ソースを参照

优化评价管理

zhangxin 2 ヶ月 前
コミット
6fe72855ba

+ 10 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/controller/my/AppEvaluateController.java

@@ -13,7 +13,9 @@ import org.jeecg.modules.app.dto.PageDTO;
 import org.jeecg.modules.app.dto.evaluate.AddEvaluateDTO;
 import org.jeecg.modules.app.dto.evaluate.FindEvaluateDTO;
 import org.jeecg.modules.system.app.dto.evaluate.FindEvaluateResponseDTO;
+import org.jeecg.modules.system.app.entity.AppOrder;
 import org.jeecg.modules.system.app.entity.Evaluate;
+import org.jeecg.modules.system.app.service.IAppOrderService;
 import org.jeecg.modules.system.app.service.IEvaluateService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +35,8 @@ public class AppEvaluateController {
 
     @Autowired
     private IEvaluateService evaluateService;
+    @Autowired
+    private IAppOrderService iAppOrderService;
 
 
     /**
@@ -52,12 +56,18 @@ public class AppEvaluateController {
     @Operation(summary = "提交评价")
     public Result<String> submitFeedback(@RequestBody AddEvaluateDTO addEvaluateDTO) {
         //缺少订单校验逻辑 需要校验订单并且
+        AppOrder appOrder = iAppOrderService.getById(addEvaluateDTO.getOrderId());
+        if (appOrder==null){
+            return Result.error("提交评价失败,未查询到订单");
+        }
         Evaluate evaluate = new Evaluate();
         LoginUser principal = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         BeanUtils.copyProperties(addEvaluateDTO, evaluate);
         evaluate.setId(UuidUtils.getUUID());
         evaluate.setUserId(principal.getId());
         evaluate.setCreateTime(new Date());
+        evaluate.setDeptId(appOrder.getTenantId());
+        evaluate.setOrgCode(appOrder.getOrgCode());
         boolean save = evaluateService.save(evaluate);
         if (!save) {
             return Result.error("提交评价失败,请联系管理员");

+ 4 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/dto/evaluate/AddEvaluateDTO.java

@@ -25,7 +25,7 @@ public class AddEvaluateDTO {
     private String deptId;
     /**场地/地点*/
     @Schema(description = "场地/地点")
-    private Integer siteId;
+    private String siteId;
     /**用户*/
     @Schema(description = "用户")
     private String userId;
@@ -50,6 +50,8 @@ public class AddEvaluateDTO {
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @Schema(description = "创建时间;创建时间")
     private Date createTime;
-
+    /**是否匿名 0-匿名 1-不匿名*/
+    @Schema(description = "是否匿名 0-匿名 1-不匿名")
+    private Integer  isAnonymous;
 
 }

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/app/vo/stadium/StadiumConcertsVO.java

@@ -26,7 +26,7 @@ public class StadiumConcertsVO {
     @Schema(description = "日期加星期")
     private String weekDayAndDate;
     @Schema(description = "日期")
-    @JsonFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern = "yyyy-MM-dd")
     private Date weekDayDate;
 //    /**当天场次总数*/

+ 4 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/dto/evaluate/FindEvaluateResponseDTO.java

@@ -86,4 +86,8 @@ public class FindEvaluateResponseDTO {
     @Schema(description = "图片列表集合")
     private List<String> imageList;
 
+    /**是否匿名 0-匿名 1-不匿名*/
+    @Schema(description = "是否匿名 0-匿名 1-不匿名")
+    private Integer  isAnonymous;
+
 }

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/entity/Evaluate.java

@@ -44,7 +44,7 @@ public class Evaluate implements Serializable {
 	/**场地/地点*/
 	@Excel(name = "场地/地点", width = 15)
     @Schema(description = "场地/地点")
-    private Integer siteId;
+    private String siteId;
 	/**用户*/
 	@Excel(name = "用户", width = 15)
     @Schema(description = "用户")

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/mapper/xml/EvaluateMapper.xml

@@ -4,7 +4,7 @@
 
     <select id="findPage" resultType="org.jeecg.modules.system.app.dto.evaluate.FindEvaluateResponseDTO">
         select ne.id,
-            ne.score,ne.evaluate_content,su.avatar,ne.images,ne.check_status,ne.reply_status,ne.reply_content,ne.reply_time,ne.type,ne.create_time,sd.depart_name,ns.address,su.username,su.phone
+            ne.score,ne.evaluate_content,su.avatar,ne.images,ne.check_status,ne.reply_status,ne.reply_content,ne.reply_time,ne.type,ne.create_time,sd.depart_name,ns.address,su.username,su.phone,ne.is_anonymous
         from nm_evaluate ne
         left join  sys_depart sd on  ne.dept_id = sd.id
         LEFT JOIN nm_site ns on  ne.site_id =ns.id

+ 8 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/service/impl/EvaluateServiceImpl.java

@@ -11,10 +11,10 @@ import org.jeecg.modules.system.app.entity.Evaluate;
 import org.jeecg.modules.system.app.mapper.AppCoursesMapper;
 import org.jeecg.modules.system.app.mapper.EvaluateMapper;
 import org.jeecg.modules.system.app.service.IEvaluateService;
+import org.jeecg.modules.system.app.utils.StringMasker;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -34,6 +34,8 @@ public class EvaluateServiceImpl extends ServiceImpl<EvaluateMapper, Evaluate> i
     private AppCoursesMapper appCoursesMapper;
 
 
+
+
     @Override
     public IPage<FindEvaluateResponseDTO> findPage(Integer pageNo, Integer pageSize, FindEvaluateRequestDTO findEvaluateRequestDTO) {
         Page<FindEvaluateResponseDTO> page = new Page<FindEvaluateResponseDTO>(pageNo, pageSize);
@@ -46,6 +48,11 @@ public class EvaluateServiceImpl extends ServiceImpl<EvaluateMapper, Evaluate> i
                 }else {
                     strings.add(record.getImages());
                 }
+                if (record.getIsAnonymous()!=null&&record.getIsAnonymous()==0){
+                    String username = record.getUsername();
+                    String mask = StringMasker.mask(username);
+                    record.setUsername(mask);
+                }
                 record.setImageList(strings);
             }
         }

+ 35 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/app/utils/StringMasker.java

@@ -0,0 +1,35 @@
+package org.jeecg.modules.system.app.utils;
+
+import java.util.Objects;
+
+public class StringMasker {
+    private static final char MASK_CHAR = '*';
+
+    /**
+     * 掩码处理字符串(保留首字符,其余替换为*)
+     * @param input 原始字符串
+     * @return 掩码后的字符串(null返回null,空字符串返回空串)
+     */
+    public static String mask(String input) {
+        // 防御性空值处理
+        if (Objects.isNull(input) || input.isEmpty()) {
+            return input;
+        }
+
+        // 单字符快速返回
+        if (input.length() == 1) {
+            return input;
+        }
+
+        // 确定处理长度(最多处理前5个字符)
+        int processLength = Math.min(input.length(), 5);
+        char[] chars = new char[processLength];
+        // 设置第一个字符
+        chars[0] = input.charAt(0);
+        // 掩码后续字符(最多到第5个)
+        for (int i = 1; i < processLength; i++) {
+            chars[i] = MASK_CHAR;
+        }
+        return new String(chars);
+    }
+}