From 6bf8b48e9d689ab90864bc2ee0e6ebeae3a4c1fa Mon Sep 17 00:00:00 2001
From: xiaogang <905166056@qq.com>
Date: 星期四, 04 八月 2022 10:06:47 +0800
Subject: [PATCH] 1.优化报表缴费明细统计问题2、优化调查问卷投票问题3、优化投诉咨询问题3、优化业主新增用户联系地址4、增加定时任务根据身份证号自动更新年龄5、优化缴费清单

---
 service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java |  118 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 88 insertions(+), 30 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
old mode 100644
new mode 100755
index 83b4465..ca35d93
--- a/service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java
+++ b/service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java
@@ -1,5 +1,6 @@
 package com.java110.user.api;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.dto.questionAnswer.QuestionAnswerDto;
 import com.java110.dto.questionAnswerTitle.QuestionAnswerTitleDto;
@@ -24,8 +25,12 @@
 import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 @RestController
 @RequestMapping(value = "/questionAnswer")
@@ -33,8 +38,10 @@
 
     @Autowired
     private ISaveQuestionAnswerBMO saveQuestionAnswerBMOImpl;
+
     @Autowired
     private IUpdateQuestionAnswerBMO updateQuestionAnswerBMOImpl;
+
     @Autowired
     private IDeleteQuestionAnswerBMO deleteQuestionAnswerBMOImpl;
 
@@ -43,8 +50,10 @@
 
     @Autowired
     private ISaveQuestionAnswerTitleBMO saveQuestionAnswerTitleBMOImpl;
+
     @Autowired
     private IUpdateQuestionAnswerTitleBMO updateQuestionAnswerTitleBMOImpl;
+
     @Autowired
     private IDeleteQuestionAnswerTitleBMO deleteQuestionAnswerTitleBMOImpl;
 
@@ -53,14 +62,15 @@
 
     @Autowired
     private ISaveQuestionAnswerTitleValueBMO saveQuestionAnswerTitleValueBMOImpl;
+
     @Autowired
     private IUpdateQuestionAnswerTitleValueBMO updateQuestionAnswerTitleValueBMOImpl;
+
     @Autowired
     private IDeleteQuestionAnswerTitleValueBMO deleteQuestionAnswerTitleValueBMOImpl;
 
     @Autowired
     private IGetQuestionAnswerTitleValueBMO getQuestionAnswerTitleValueBMOImpl;
-
 
     /**
      * 寰俊淇濆瓨娑堟伅妯℃澘
@@ -73,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");
@@ -99,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);
     }
@@ -125,7 +131,6 @@
 
         Assert.hasKeyAndValue(reqJson, "qaId", "qaId涓嶈兘涓虹┖");
 
-
         QuestionAnswerPo questionAnswerPo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerPo.class);
         return deleteQuestionAnswerBMOImpl.delete(questionAnswerPo);
     }
@@ -139,15 +144,22 @@
      * @path /app/questionAnswer/queryQuestionAnswer
      */
     @RequestMapping(value = "/queryQuestionAnswer", method = RequestMethod.GET)
-    public ResponseEntity<String> queryQuestionAnswer(
-            @RequestHeader(value = "store-id",required = false) String storeId,
-            @RequestParam(value = "communityId", required = false) String communityId,
-            @RequestParam(value = "objType", required = false) String objType,
-            @RequestParam(value = "page") int page,
-            @RequestParam(value = "row") int row) {
+    public ResponseEntity<String> queryQuestionAnswer(@RequestHeader(value = "store-id", required = false) String storeId,
+                                                      @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);
@@ -171,12 +183,20 @@
         Assert.hasKeyAndValue(reqJson, "qaId", "璇锋眰鎶ユ枃涓湭鍖呭惈qaId");
         Assert.hasKeyAndValue(reqJson, "qaTitle", "璇锋眰鎶ユ枃涓湭鍖呭惈qaTitle");
         Assert.hasKeyAndValue(reqJson, "titleType", "璇锋眰鎶ユ枃涓湭鍖呭惈titleType");
+        Assert.hasKeyAndValue(reqJson, "objId", "璇锋眰鎶ユ枃涓湭鍖呭惈objId");
         Assert.hasKeyAndValue(reqJson, "objType", "璇锋眰鎶ユ枃涓湭鍖呭惈objType");
         Assert.hasKeyAndValue(reqJson, "seq", "璇锋眰鎶ユ枃涓湭鍖呭惈seq");
 
+        JSONArray titleValues = null;
+        if (!QuestionAnswerTitleDto.TITLE_TYPE_QUESTIONS.equals(reqJson.getString("titleType"))) {
+            titleValues = reqJson.getJSONArray("titleValues");
 
+            if (titleValues.size() < 1) {
+                throw new IllegalArgumentException("鏈寘鍚�夐」");
+            }
+        }
         QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class);
-        return saveQuestionAnswerTitleBMOImpl.save(questionAnswerTitlePo);
+        return saveQuestionAnswerTitleBMOImpl.save(questionAnswerTitlePo, titleValues);
     }
 
     /**
@@ -189,17 +209,22 @@
      */
     @RequestMapping(value = "/updateQuestionAnswerTitle", method = RequestMethod.POST)
     public ResponseEntity<String> updateQuestionAnswerTitle(@RequestBody JSONObject reqJson) {
-
-        Assert.hasKeyAndValue(reqJson, "qaId", "璇锋眰鎶ユ枃涓湭鍖呭惈qaId");
+//        Assert.hasKeyAndValue(reqJson, "qaId", "璇锋眰鎶ユ枃涓湭鍖呭惈qaId");
         Assert.hasKeyAndValue(reqJson, "qaTitle", "璇锋眰鎶ユ枃涓湭鍖呭惈qaTitle");
         Assert.hasKeyAndValue(reqJson, "titleType", "璇锋眰鎶ユ枃涓湭鍖呭惈titleType");
         Assert.hasKeyAndValue(reqJson, "objType", "璇锋眰鎶ユ枃涓湭鍖呭惈objType");
         Assert.hasKeyAndValue(reqJson, "seq", "璇锋眰鎶ユ枃涓湭鍖呭惈seq");
         Assert.hasKeyAndValue(reqJson, "titleId", "titleId涓嶈兘涓虹┖");
+        JSONArray titleValues = null;
+        if (!QuestionAnswerTitleDto.TITLE_TYPE_QUESTIONS.equals(reqJson.getString("titleType"))) {
+            titleValues = reqJson.getJSONArray("titleValues");
 
-
+            if (titleValues.size() < 1) {
+                throw new IllegalArgumentException("鏈寘鍚�夐」");
+            }
+        }
         QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class);
-        return updateQuestionAnswerTitleBMOImpl.update(questionAnswerTitlePo);
+        return updateQuestionAnswerTitleBMOImpl.update(questionAnswerTitlePo, titleValues);
     }
 
     /**
@@ -216,7 +241,6 @@
 
         Assert.hasKeyAndValue(reqJson, "titleId", "titleId涓嶈兘涓虹┖");
 
-
         QuestionAnswerTitlePo questionAnswerTitlePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitlePo.class);
         return deleteQuestionAnswerTitleBMOImpl.delete(questionAnswerTitlePo);
     }
@@ -230,16 +254,32 @@
      * @path /app/questionAnswer/queryQuestionAnswerTitle
      */
     @RequestMapping(value = "/queryQuestionAnswerTitle", method = RequestMethod.GET)
-    public ResponseEntity<String> queryQuestionAnswerTitle(@RequestHeader(value = "store-id") String storeId,
+    public ResponseEntity<String> queryQuestionAnswerTitle(@RequestHeader(value = "store-id", required = false) String storeId,
+                                                           // @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.setObjType(objType);
-        questionAnswerTitleDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId);
+        questionAnswerTitleDto.setQaId(qaId);
+        questionAnswerTitleDto.setObjId(objId);
+        //questionAnswerTitleDto.setUserId(userId);
+        if (!StringUtil.isEmpty(objType)) {
+            questionAnswerTitleDto.setObjType(objType);
+            questionAnswerTitleDto.setObjId(QuestionAnswerDto.QA_TYPE_COMMUNITY.equals(objType) ? communityId : storeId);
+        } else {
+            questionAnswerTitleDto.setObjIds(new String[]{storeId, communityId});
+        }
         return getQuestionAnswerTitleBMOImpl.get(questionAnswerTitleDto);
     }
 
@@ -253,13 +293,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);
     }
@@ -274,14 +311,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);
     }
@@ -299,7 +333,6 @@
         Assert.hasKeyAndValue(reqJson, "communityId", "灏忓尯ID涓嶈兘涓虹┖");
 
         Assert.hasKeyAndValue(reqJson, "valueId", "valueId涓嶈兘涓虹┖");
-
 
         QuestionAnswerTitleValuePo questionAnswerTitleValuePo = BeanConvertUtil.covertBean(reqJson, QuestionAnswerTitleValuePo.class);
         return deleteQuestionAnswerTitleValueBMOImpl.delete(questionAnswerTitleValuePo);
@@ -326,4 +359,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