TRX 1 سال پیش
والد
کامیت
05e9fd139e

+ 2 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/quest/QuestInfoParam.java

@@ -21,4 +21,6 @@ public class QuestInfoParam {
 
     private Object data;
 
+    private String uuid;
+
 }

+ 1 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/quest/QuestInfoDao.java

@@ -18,4 +18,5 @@ public interface QuestInfoDao extends MongoDao<QuestInfo>, QuestInfoDaoExtend {
 
     QuestInfo findTopById(String id);
 
+    QuestInfo findTopByUuid(String uuid);
 }

+ 1 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/quest/QuestInfo.java

@@ -25,4 +25,5 @@ public class QuestInfo extends SuperMain {
     @Schema(description = "问题及答案")
     private Object data;
 
+    private String uuid;
 }

+ 8 - 3
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/quest/QuestService.java

@@ -41,6 +41,12 @@ public class QuestService {
     private QuestInfoDao questInfoDao;
 
     public ResultContent saveInfo(QuestInfoParam param) {
+        if (StringUtils.isNotEmpty(param.getUuid())) {
+            QuestInfo temp = questInfoDao.findTopByUuid(param.getUuid());
+            if (ObjectUtils.isNotEmpty(temp)) {
+                return ResultContent.buildFail("不能重复提交哦");
+            }
+        }
         QuestInfo entity = new QuestInfo();
         BeanUtils.copyProperties(param, entity);
         questInfoDao.save(entity);
@@ -135,7 +141,7 @@ public class QuestService {
                                     if (tempMap.containsKey("supplementary")) {
                                         if (StringUtils.isNotEmpty(value)) {
                                             value += "  补充: " + tempMap.get("supplementary").toString();
-                                        }else {
+                                        } else {
                                             value += tempMap.get("supplementary").toString();
                                         }
                                     }
@@ -162,8 +168,7 @@ public class QuestService {
         execlParam.setDatas(maps);
         List<CommonExeclTd> tds = new ArrayList<>();
         for (QuestTitleModel titleModel : titles) {
-            tds.add(CommonExeclTd.build(titleModel.getQuestion(),
-                    titleModel.getQuestionId(), 8));
+            tds.add(CommonExeclTd.build(titleModel.getQuestion(), titleModel.getQuestionId(), 8));
         }
         tds.add(CommonExeclTd.build("时间", "timeStr"));
         execlParam.setTds(tds);