From 8fe2b84ff985cf8dd8566e7ecbe9157c5ba9b769 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期五, 05 二月 2021 17:45:55 +0800
Subject: [PATCH] 优化添加问卷代码

---
 service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 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 f77c464..92801e3 100644
--- a/service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java
+++ b/service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java
@@ -70,7 +70,8 @@
      * @path /app/questionAnswer/saveQuestionAnswer
      */
     @RequestMapping(value = "/saveQuestionAnswer", method = RequestMethod.POST)
-    public ResponseEntity<String> saveQuestionAnswer(@RequestBody JSONObject reqJson) {
+    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");
@@ -78,6 +79,10 @@
         Assert.hasKeyAndValue(reqJson, "endTime", "璇锋眰鎶ユ枃涓湭鍖呭惈endTime");
         Assert.hasKeyAndValue(reqJson, "objType", "璇锋眰鎶ユ枃涓湭鍖呭惈objType");
 
+        if (QuestionAnswerDto.QA_TYPE_STORE.equals(reqJson.getString("objType"))) {
+            reqJson.put("objId", storeId);
+        }
+        Assert.hasKeyAndValue(reqJson, "objId", "璇锋眰鎶ユ枃涓湭鍖呭惈objId");
 
         QuestionAnswerPo questionAnswerPo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerPo.class);
         return saveQuestionAnswerBMOImpl.save(questionAnswerPo);
@@ -137,7 +142,7 @@
     public ResponseEntity<String> queryQuestionAnswer(
             @RequestHeader(value = "store-id") String storeId,
             @RequestParam(value = "communityId", required = false) String communityId,
-            @RequestParam(value = "objType") String objType,
+            @RequestParam(value = "objType", required = false) String objType,
             @RequestParam(value = "page") int page,
             @RequestParam(value = "row") int row) {
         QuestionAnswerDto questionAnswerDto = new QuestionAnswerDto();
@@ -236,10 +241,11 @@
 
     /**
      * 寰俊淇濆瓨娑堟伅妯℃澘
-     * @serviceCode /questionAnswer/saveQuestionAnswerTitleValue
-     * @path /app/questionAnswer/saveQuestionAnswerTitleValue
+     *
      * @param reqJson
      * @return
+     * @serviceCode /questionAnswer/saveQuestionAnswerTitleValue
+     * @path /app/questionAnswer/saveQuestionAnswerTitleValue
      */
     @RequestMapping(value = "/saveQuestionAnswerTitleValue", method = RequestMethod.POST)
     public ResponseEntity<String> saveQuestionAnswerTitleValue(@RequestBody JSONObject reqJson) {
@@ -256,10 +262,11 @@
 
     /**
      * 寰俊淇敼娑堟伅妯℃澘
-     * @serviceCode /questionAnswer/updateQuestionAnswerTitleValue
-     * @path /app/questionAnswer/updateQuestionAnswerTitleValue
+     *
      * @param reqJson
      * @return
+     * @serviceCode /questionAnswer/updateQuestionAnswerTitleValue
+     * @path /app/questionAnswer/updateQuestionAnswerTitleValue
      */
     @RequestMapping(value = "/updateQuestionAnswerTitleValue", method = RequestMethod.POST)
     public ResponseEntity<String> updateQuestionAnswerTitleValue(@RequestBody JSONObject reqJson) {
@@ -277,10 +284,11 @@
 
     /**
      * 寰俊鍒犻櫎娑堟伅妯℃澘
-     * @serviceCode /questionAnswer/deleteQuestionAnswerTitleValue
-     * @path /app/questionAnswer/deleteQuestionAnswerTitleValue
+     *
      * @param reqJson
      * @return
+     * @serviceCode /questionAnswer/deleteQuestionAnswerTitleValue
+     * @path /app/questionAnswer/deleteQuestionAnswerTitleValue
      */
     @RequestMapping(value = "/deleteQuestionAnswerTitleValue", method = RequestMethod.POST)
     public ResponseEntity<String> deleteQuestionAnswerTitleValue(@RequestBody JSONObject reqJson) {
@@ -295,10 +303,11 @@
 
     /**
      * 寰俊鍒犻櫎娑堟伅妯℃澘
-     * @serviceCode /questionAnswer/queryQuestionAnswerTitleValue
-     * @path /app/questionAnswer/queryQuestionAnswerTitleValue
+     *
      * @param communityId 灏忓尯ID
      * @return
+     * @serviceCode /questionAnswer/queryQuestionAnswerTitleValue
+     * @path /app/questionAnswer/queryQuestionAnswerTitleValue
      */
     @RequestMapping(value = "/queryQuestionAnswerTitleValue", method = RequestMethod.GET)
     public ResponseEntity<String> queryQuestionAnswerTitleValue(@RequestHeader(value = "store-id") String storeId,

--
Gitblit v1.8.0