From aa42321619fa4c4eec39d52dc0f9792aed50b50f Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期五, 15 四月 2022 12:08:05 +0800
Subject: [PATCH] QQ 开发者贡献

---
 service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java |   67 +++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 21 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 606bcde..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);
@@ -150,12 +149,18 @@
             @RequestHeader(value = "user-id", required = false) String userId,
             @RequestParam(value = "communityId", required = false) String communityId,
             @RequestParam(value = "objType", required = false) String objType,
+            @RequestParam(value = "qaType", required = false) String qaType,
+            @RequestParam(value = "qaName", required = false) String qaName,
+            @RequestParam(value = "qaId", required = false) String qaId,
             @RequestParam(value = "page") int page,
             @RequestParam(value = "row") int row) {
         QuestionAnswerDto questionAnswerDto = new QuestionAnswerDto();
         questionAnswerDto.setPage(page);
         questionAnswerDto.setRow(row);
         questionAnswerDto.setUserId(userId);
+        questionAnswerDto.setQaType(qaType);
+        questionAnswerDto.setQaName(qaName);
+        questionAnswerDto.setQaId(qaId);
         if (!StringUtil.isEmpty(objType)) {
             questionAnswerDto.setObjType(objType);
             questionAnswerDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId);
@@ -191,8 +196,6 @@
                 throw new IllegalArgumentException("鏈寘鍚�夐」");
             }
         }
-
-
         QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class);
         return saveQuestionAnswerTitleBMOImpl.save(questionAnswerTitlePo, titleValues);
     }
@@ -207,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");
@@ -222,7 +224,6 @@
                 throw new IllegalArgumentException("鏈寘鍚�夐」");
             }
         }
-
         QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class);
         return updateQuestionAnswerTitleBMOImpl.update(questionAnswerTitlePo, titleValues);
     }
@@ -241,7 +242,6 @@
 
         Assert.hasKeyAndValue(reqJson, "titleId", "titleId涓嶈兘涓虹┖");
 
-
         QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class);
         return deleteQuestionAnswerTitleBMOImpl.delete(questionAnswerTitlePo);
     }
@@ -256,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);
@@ -273,7 +281,6 @@
         } else {
             questionAnswerTitleDto.setObjIds(new String[]{storeId, communityId});
         }
-
         return getQuestionAnswerTitleBMOImpl.get(questionAnswerTitleDto);
     }
 
@@ -287,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);
     }
@@ -308,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);
     }
@@ -333,7 +334,6 @@
         Assert.hasKeyAndValue(reqJson, "communityId", "灏忓尯ID涓嶈兘涓虹┖");
 
         Assert.hasKeyAndValue(reqJson, "valueId", "valueId涓嶈兘涓虹┖");
-
 
         QuestionAnswerTitleValuePo questionAnswerTitleValuePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitleValuePo.class);
         return deleteQuestionAnswerTitleValueBMOImpl.delete(questionAnswerTitleValuePo);
@@ -360,4 +360,29 @@
         questionAnswerTitleValueDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId);
         return getQuestionAnswerTitleValueBMOImpl.get(questionAnswerTitleValueDto);
     }
+
+
+    /**
+     * 寰俊鍒犻櫎娑堟伅妯℃澘
+     *
+     * @param communityId 灏忓尯ID
+     * @return
+     * @serviceCode /questionAnswer/queryTitleValueResult
+     * @path /app/questionAnswer/queryTitleValueResult
+     */
+    @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) {
+        QuestionAnswerTitleValueDto questionAnswerTitleValueDto = new QuestionAnswerTitleValueDto();
+        questionAnswerTitleValueDto.setPage(page);
+        questionAnswerTitleValueDto.setRow(row);
+        questionAnswerTitleValueDto.setObjType(objType);
+        questionAnswerTitleValueDto.setTitleId(titleId);
+        questionAnswerTitleValueDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId);
+        return getQuestionAnswerTitleValueBMOImpl.queryQuestionAnswerTitleValueResult(questionAnswerTitleValueDto);
+    }
 }

--
Gitblit v1.8.0