From 5d167ea6e943dd1574e0e6ed70ff25b8d4830f61 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期四, 16 六月 2022 11:47:49 +0800
Subject: [PATCH] 优化代码

---
 service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java |   46 ++++++++++++++++++++--------------------------
 1 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java b/service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java
index 3a05e1f..062a700 100755
--- a/service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java
+++ b/service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java
@@ -32,15 +32,16 @@
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-
 @RestController
 @RequestMapping(value = "/questionAnswer")
 public class QuestionAnswerApi {
 
     @Autowired
     private ISaveQuestionAnswerBMO saveQuestionAnswerBMOImpl;
+
     @Autowired
     private IUpdateQuestionAnswerBMO updateQuestionAnswerBMOImpl;
+
     @Autowired
     private IDeleteQuestionAnswerBMO deleteQuestionAnswerBMOImpl;
 
@@ -49,8 +50,10 @@
 
     @Autowired
     private ISaveQuestionAnswerTitleBMO saveQuestionAnswerTitleBMOImpl;
+
     @Autowired
     private IUpdateQuestionAnswerTitleBMO updateQuestionAnswerTitleBMOImpl;
+
     @Autowired
     private IDeleteQuestionAnswerTitleBMO deleteQuestionAnswerTitleBMOImpl;
 
@@ -59,14 +62,15 @@
 
     @Autowired
     private ISaveQuestionAnswerTitleValueBMO saveQuestionAnswerTitleValueBMOImpl;
+
     @Autowired
     private IUpdateQuestionAnswerTitleValueBMO updateQuestionAnswerTitleValueBMOImpl;
+
     @Autowired
     private IDeleteQuestionAnswerTitleValueBMO deleteQuestionAnswerTitleValueBMOImpl;
 
     @Autowired
     private IGetQuestionAnswerTitleValueBMO getQuestionAnswerTitleValueBMOImpl;
-
 
     /**
      * 寰俊淇濆瓨娑堟伅妯℃澘
@@ -79,7 +83,6 @@
     @RequestMapping(value = "/saveQuestionAnswer", method = RequestMethod.POST)
     public ResponseEntity<String> saveQuestionAnswer(@RequestHeader(value = "store-id", required = false) String storeId,
                                                      @RequestBody JSONObject reqJson) {
-
         Assert.hasKeyAndValue(reqJson, "qaType", "璇锋眰鎶ユ枃涓湭鍖呭惈qaType");
         Assert.hasKeyAndValue(reqJson, "qaName", "璇锋眰鎶ユ枃涓湭鍖呭惈qaName");
         Assert.hasKeyAndValue(reqJson, "startTime", "璇锋眰鎶ユ枃涓湭鍖呭惈startTime");
@@ -105,14 +108,11 @@
      */
     @RequestMapping(value = "/updateQuestionAnswer", method = RequestMethod.POST)
     public ResponseEntity<String> updateQuestionAnswer(@RequestBody JSONObject reqJson) {
-
         Assert.hasKeyAndValue(reqJson, "qaType", "璇锋眰鎶ユ枃涓湭鍖呭惈qaType");
         Assert.hasKeyAndValue(reqJson, "qaName", "璇锋眰鎶ユ枃涓湭鍖呭惈qaName");
         Assert.hasKeyAndValue(reqJson, "startTime", "璇锋眰鎶ユ枃涓湭鍖呭惈startTime");
         Assert.hasKeyAndValue(reqJson, "endTime", "璇锋眰鎶ユ枃涓湭鍖呭惈endTime");
         Assert.hasKeyAndValue(reqJson, "qaId", "qaId涓嶈兘涓虹┖");
-
-
         QuestionAnswerPo questionAnswerPo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerPo.class);
         return updateQuestionAnswerBMOImpl.update(questionAnswerPo);
     }
@@ -130,7 +130,6 @@
         Assert.hasKeyAndValue(reqJson, "communityId", "灏忓尯ID涓嶈兘涓虹┖");
 
         Assert.hasKeyAndValue(reqJson, "qaId", "qaId涓嶈兘涓虹┖");
-
 
         QuestionAnswerPo questionAnswerPo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerPo.class);
         return deleteQuestionAnswerBMOImpl.delete(questionAnswerPo);
@@ -197,8 +196,6 @@
                 throw new IllegalArgumentException("鏈寘鍚�夐」");
             }
         }
-
-
         QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class);
         return saveQuestionAnswerTitleBMOImpl.save(questionAnswerTitlePo, titleValues);
     }
@@ -213,7 +210,6 @@
      */
     @RequestMapping(value = "/updateQuestionAnswerTitle", method = RequestMethod.POST)
     public ResponseEntity<String> updateQuestionAnswerTitle(@RequestBody JSONObject reqJson) {
-
 //        Assert.hasKeyAndValue(reqJson, "qaId", "璇锋眰鎶ユ枃涓湭鍖呭惈qaId");
         Assert.hasKeyAndValue(reqJson, "qaTitle", "璇锋眰鎶ユ枃涓湭鍖呭惈qaTitle");
         Assert.hasKeyAndValue(reqJson, "titleType", "璇锋眰鎶ユ枃涓湭鍖呭惈titleType");
@@ -228,7 +224,6 @@
                 throw new IllegalArgumentException("鏈寘鍚�夐」");
             }
         }
-
         QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class);
         return updateQuestionAnswerTitleBMOImpl.update(questionAnswerTitlePo, titleValues);
     }
@@ -247,7 +242,6 @@
 
         Assert.hasKeyAndValue(reqJson, "titleId", "titleId涓嶈兘涓虹┖");
 
-
         QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class);
         return deleteQuestionAnswerTitleBMOImpl.delete(questionAnswerTitlePo);
     }
@@ -262,16 +256,24 @@
      */
     @RequestMapping(value = "/queryQuestionAnswerTitle", method = RequestMethod.GET)
     public ResponseEntity<String> queryQuestionAnswerTitle(@RequestHeader(value = "store-id", required = false) String storeId,
-                                                          // @RequestHeader(value = "user-id", required = false) String userId,
+                                                           // @RequestHeader(value = "user-id", required = false) String userId,
+                                                           @RequestParam(value = "titleType", required = false) String titleType,
+                                                           @RequestParam(value = "qaTitle", required = false) String qaTitle,
+                                                           @RequestParam(value = "titleId", required = false) String titleId,
                                                            @RequestParam(value = "communityId", required = false) String communityId,
                                                            @RequestParam(value = "objType") String objType,
                                                            @RequestParam(value = "qaId") String qaId,
+                                                           @RequestParam(value = "objId") String objId,
                                                            @RequestParam(value = "page") int page,
                                                            @RequestParam(value = "row") int row) {
         QuestionAnswerTitleDto questionAnswerTitleDto = new QuestionAnswerTitleDto();
+        questionAnswerTitleDto.setTitleType(titleType);
+        questionAnswerTitleDto.setQaTitle(qaTitle);
+        questionAnswerTitleDto.setTitleId(titleId);
         questionAnswerTitleDto.setPage(page);
         questionAnswerTitleDto.setRow(row);
         questionAnswerTitleDto.setQaId(qaId);
+        questionAnswerTitleDto.setObjId(objId);
         //questionAnswerTitleDto.setUserId(userId);
         if (!StringUtil.isEmpty(objType)) {
             questionAnswerTitleDto.setObjType(objType);
@@ -279,7 +281,6 @@
         } else {
             questionAnswerTitleDto.setObjIds(new String[]{storeId, communityId});
         }
-
         return getQuestionAnswerTitleBMOImpl.get(questionAnswerTitleDto);
     }
 
@@ -293,13 +294,10 @@
      */
     @RequestMapping(value = "/saveQuestionAnswerTitleValue", method = RequestMethod.POST)
     public ResponseEntity<String> saveQuestionAnswerTitleValue(@RequestBody JSONObject reqJson) {
-
         Assert.hasKeyAndValue(reqJson, "titleId", "璇锋眰鎶ユ枃涓湭鍖呭惈titleId");
         Assert.hasKeyAndValue(reqJson, "qaValue", "璇锋眰鎶ユ枃涓湭鍖呭惈qaValue");
         Assert.hasKeyAndValue(reqJson, "objType", "璇锋眰鎶ユ枃涓湭鍖呭惈objType");
         Assert.hasKeyAndValue(reqJson, "seq", "璇锋眰鎶ユ枃涓湭鍖呭惈seq");
-
-
         QuestionAnswerTitleValuePo questionAnswerTitleValuePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitleValuePo.class);
         return saveQuestionAnswerTitleValueBMOImpl.save(questionAnswerTitleValuePo);
     }
@@ -314,14 +312,11 @@
      */
     @RequestMapping(value = "/updateQuestionAnswerTitleValue", method = RequestMethod.POST)
     public ResponseEntity<String> updateQuestionAnswerTitleValue(@RequestBody JSONObject reqJson) {
-
         Assert.hasKeyAndValue(reqJson, "titleId", "璇锋眰鎶ユ枃涓湭鍖呭惈titleId");
         Assert.hasKeyAndValue(reqJson, "qaValue", "璇锋眰鎶ユ枃涓湭鍖呭惈qaValue");
         Assert.hasKeyAndValue(reqJson, "objType", "璇锋眰鎶ユ枃涓湭鍖呭惈objType");
         Assert.hasKeyAndValue(reqJson, "seq", "璇锋眰鎶ユ枃涓湭鍖呭惈seq");
         Assert.hasKeyAndValue(reqJson, "valueId", "valueId涓嶈兘涓虹┖");
-
-
         QuestionAnswerTitleValuePo questionAnswerTitleValuePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitleValuePo.class);
         return updateQuestionAnswerTitleValueBMOImpl.update(questionAnswerTitleValuePo);
     }
@@ -339,7 +334,6 @@
         Assert.hasKeyAndValue(reqJson, "communityId", "灏忓尯ID涓嶈兘涓虹┖");
 
         Assert.hasKeyAndValue(reqJson, "valueId", "valueId涓嶈兘涓虹┖");
-
 
         QuestionAnswerTitleValuePo questionAnswerTitleValuePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitleValuePo.class);
         return deleteQuestionAnswerTitleValueBMOImpl.delete(questionAnswerTitleValuePo);
@@ -378,11 +372,11 @@
      */
     @RequestMapping(value = "/queryTitleValueResult", method = RequestMethod.GET)
     public ResponseEntity<String> queryTitleValueResult(@RequestHeader(value = "store-id") String storeId,
-                                                                @RequestParam(value = "communityId", required = false) String communityId,
-                                                                @RequestParam(value = "objType") String objType,
-                                                                @RequestParam(value = "titleId",required = false) String titleId,
-                                                                @RequestParam(value = "page") int page,
-                                                                @RequestParam(value = "row") int row) {
+                                                        @RequestParam(value = "communityId", required = false) String communityId,
+                                                        @RequestParam(value = "objType") String objType,
+                                                        @RequestParam(value = "titleId", required = false) String titleId,
+                                                        @RequestParam(value = "page") int page,
+                                                        @RequestParam(value = "row") int row) {
         QuestionAnswerTitleValueDto questionAnswerTitleValueDto = new QuestionAnswerTitleValueDto();
         questionAnswerTitleValueDto.setPage(page);
         questionAnswerTitleValueDto.setRow(row);

--
Gitblit v1.8.0