|
@@ -1,5 +1,10 @@
|
|
|
package com.chelvc.cloud.admin.controller;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import javax.validation.constraints.Min;
|
|
|
+
|
|
|
import com.chelvc.cloud.vehicle.api.dto.GoodsAssessDto;
|
|
|
import com.chelvc.cloud.vehicle.api.param.AssessModifyParam;
|
|
|
import com.chelvc.cloud.vehicle.api.param.AssessQueryParam;
|
|
@@ -8,9 +13,7 @@ import com.chelvc.cloud.vehicle.api.service.AssessService;
|
|
|
import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
import com.chelvc.framework.base.context.SessionContextHolder;
|
|
|
import com.chelvc.framework.redis.config.RedisConfigurer;
|
|
|
-import com.fasterxml.jackson.databind.util.JSONPObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import net.minidev.json.JSONObject;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -20,13 +23,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
-import javax.validation.constraints.Min;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
/**
|
|
|
* 评价管理
|
|
|
+ *
|
|
|
* @author valley
|
|
|
* @date 2024/01/26 00:08
|
|
|
**/
|
|
@@ -34,10 +33,9 @@ import java.util.Map;
|
|
|
@Validated
|
|
|
@RestController
|
|
|
@ResponseWrapping
|
|
|
-@PreAuthorize("isScope('EMPLOYEE')")
|
|
|
public class AssessController {
|
|
|
|
|
|
- private static final String DEFAULT_MSG= "亲爱的顾客,感谢您认可我们的服务,我们会努力做的更好,祝您生活愉快!";
|
|
|
+ private static final String DEFAULT_MSG = "亲爱的顾客,感谢您认可我们的服务,我们会努力做的更好,祝您生活愉快!";
|
|
|
@Autowired
|
|
|
private RedisConfigurer redis;
|
|
|
@DubboReference
|
|
@@ -47,18 +45,18 @@ public class AssessController {
|
|
|
* @return 获取默认评价内容
|
|
|
*/
|
|
|
@GetMapping("assess/getDefaultMsg")
|
|
|
- public String getDefaultAssessMsg(){
|
|
|
- Long userId = SessionContextHolder.getSession().getId();
|
|
|
- Object obj = redis.redisTemplate().opsForValue().get("assess:defaultAssess " + userId);
|
|
|
- return obj == null ? DEFAULT_MSG : obj.toString();
|
|
|
+ public String getDefaultAssessMsg() {
|
|
|
+ Long userId = SessionContextHolder.getSession().getId();
|
|
|
+ Object obj = redis.redisTemplate().opsForValue().get("assess:defaultAssess " + userId);
|
|
|
+ return obj == null ? DEFAULT_MSG : obj.toString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @param msg 评价内容
|
|
|
- * 修改默认评价
|
|
|
+ * 修改默认评价
|
|
|
*/
|
|
|
@PostMapping("assess/saveDefaultMsg")
|
|
|
- public void getDefaultAssessMsg(String msg){
|
|
|
+ public void getDefaultAssessMsg(String msg) {
|
|
|
Long userId = SessionContextHolder.getSession().getId();
|
|
|
redis.redisTemplate().opsForValue().set("assess:defaultAssess " + userId, msg);
|
|
|
}
|
|
@@ -67,14 +65,15 @@ public class AssessController {
|
|
|
* 针对订单发布评价
|
|
|
*/
|
|
|
@PostMapping("assess/add")
|
|
|
- public Long addAssess(@RequestBody AssessModifyParam param){
|
|
|
+ public Long addAssess(@RequestBody AssessModifyParam param) {
|
|
|
return assessService.add(param);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 评价查询
|
|
|
*/
|
|
|
@GetMapping("assess/query")
|
|
|
- public List<GoodsAssessDto> addAssess(@RequestBody AssessQueryParam param){
|
|
|
+ public List<GoodsAssessDto> addAssess(@RequestBody AssessQueryParam param) {
|
|
|
return assessService.query(param);
|
|
|
}
|
|
|
|
|
@@ -82,7 +81,7 @@ public class AssessController {
|
|
|
* 评价回复
|
|
|
*/
|
|
|
@PostMapping("assess/recover/add")
|
|
|
- public Long addAssessRecover(@RequestBody AssessRecoverModifyParam param){
|
|
|
+ public Long addAssessRecover(@RequestBody AssessRecoverModifyParam param) {
|
|
|
return assessService.addAssessRecover(param);
|
|
|
}
|
|
|
|
|
@@ -90,7 +89,7 @@ public class AssessController {
|
|
|
* 90天评价所有商品得分计算
|
|
|
*/
|
|
|
@PostMapping("assess/computeAvgScore")
|
|
|
- public void addAssessRecover(){
|
|
|
+ public void addAssessRecover() {
|
|
|
assessService.computeAvgScore();
|
|
|
}
|
|
|
|
|
@@ -98,7 +97,7 @@ public class AssessController {
|
|
|
* 获取商品分数,包含总平均分、各周期平均分
|
|
|
*/
|
|
|
@GetMapping("goodsScore")
|
|
|
- public Map<String, BigDecimal> getGoodsScore(@Min(value = 0, message = "商品id必须大于0") Long goodsId){
|
|
|
+ public Map<String, BigDecimal> getGoodsScore(@Min(value = 0, message = "商品id必须大于0") Long goodsId) {
|
|
|
return assessService.getGoodsScore(goodsId);
|
|
|
}
|
|
|
}
|