Explorar el Código

优化添加问卷代码

java110 hace 5 años
padre
commit
8fe2b84ff9

+ 1 - 0
java110-bean/src/main/java/com/java110/dto/questionAnswer/QuestionAnswerDto.java

@@ -16,6 +16,7 @@ import java.util.Date;
 public class QuestionAnswerDto extends PageDto implements Serializable {
 
     public static final String QA_TYPE_COMMUNITY = "3306";//小区
+    public static final String QA_TYPE_STORE = "3307";//商户ID
 
     private String qaName;
     private String qaType;

+ 35 - 43
java110-generator/src/main/resources/web/template_1.json

@@ -1,88 +1,80 @@
 {
-  "templateName": "房屋装修",
+  "templateName": "问卷信息",
   "directories": "property",
-  "templateCode": "roomRenovation",
-  "templateKey": "rId",
-  "templateKeyName": "装修ID",
-  "searchCode": "rId",
-  "searchName": "装修ID",
+  "templateCode": "questionAnswer",
+  "templateKey": "qaId",
+  "templateKeyName": "问卷ID",
+  "searchCode": "qaId",
+  "searchName": "问卷ID",
   "conditions": [
     {
-      "name": "房屋名称",
-      "inputType": "input",
-      "code": "roomName",
+      "name": "问卷类型",
+      "inputType": "select",
+      "selectValue": "1001,2002,3003,4004",
+      "selectValueName": "业主问卷,员工自评,业主投票,员工投票",
+      "code": "qaType",
       "whereCondition": "equal"
     },
     {
-      "name": "联系人",
+      "name": "问卷名称",
       "inputType": "input",
-      "code": "personName",
+      "code": "qaName",
       "whereCondition": "equal"
     },
     {
-      "name": "联系电话",
+      "name": "问卷ID",
       "inputType": "input",
-      "code": "personTel",
+      "code": "qaId",
       "whereCondition": "equal"
     }
   ],
   "columns": [
     {
-      "code": "roomName",
-      "cnCode": "房屋",
-      "desc": "必填,请填写房屋",
+      "code": "qaType",
+      "cnCode": "问卷类型",
+      "desc": "必填,请选择问卷类型",
       "required": true,
       "hasDefaultValue": false,
-      "inputType": "input",
-      "limit": "maxLength",
-      "limitParam": "64",
-      "limitErrInfo": "房屋格式错误",
+      "inputType": "select",
+      "selectValue": "1001,2002,3003,4004",
+      "selectValueName": "业主问卷,员工自评,业主投票,员工投票",
+      "limit": "num",
+      "limitParam": "",
+      "limitErrInfo": "问卷类型格式错误",
       "show": true
     },
     {
-      "code": "personName",
-      "cnCode": "联系人",
-      "desc": "必填,请填写联系人",
+      "code": "qaName",
+      "cnCode": "问卷名称",
+      "desc": "必填,请填写问卷名称",
       "required": true,
       "hasDefaultValue": false,
       "inputType": "input",
       "limit": "maxLength",
-      "limitParam": "64",
-      "limitErrInfo": "联系人格式错误",
-      "show": true
-    },
-    {
-      "code": "personTel",
-      "cnCode": "联系电话",
-      "desc": "选填,请填写联系电话",
-      "required": true,
-      "hasDefaultValue": false,
-      "inputType": "input",
-      "limit": "num",
-      "limitParam": "",
-      "limitErrInfo": "联系电话错误",
+      "limitParam": "256",
+      "limitErrInfo": "问卷名称太长",
       "show": true
     },
     {
       "code": "startTime",
-      "cnCode": "装修时间",
-      "desc": "选填,请选择装修时间",
+      "cnCode": "开始时间",
+      "desc": "选填,请填写开始时间",
       "required": true,
       "hasDefaultValue": false,
       "inputType": "input",
-      "limit": "date",
+      "limit": "datetime",
       "limitParam": "",
-      "limitErrInfo": "装修时间错误",
+      "limitErrInfo": "开始时间错误",
       "show": true
     },
     {
       "code": "endTime",
       "cnCode": "结束时间",
-      "desc": "填,请选择结束时间",
+      "desc": "填,请选择结束时间",
       "required": true,
       "hasDefaultValue": false,
       "inputType": "input",
-      "limit": "date",
+      "limit": "datetime",
       "limitParam": "",
       "limitErrInfo": "结束时间错误",
       "show": true

+ 19 - 10
service-user/src/main/java/com/java110/user/api/QuestionAnswerApi.java

@@ -70,7 +70,8 @@ public class QuestionAnswerApi {
      * @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 @@ public class QuestionAnswerApi {
         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 class QuestionAnswerApi {
     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 @@ public class QuestionAnswerApi {
 
     /**
      * 微信保存消息模板
-     * @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 @@ public class QuestionAnswerApi {
 
     /**
      * 微信修改消息模板
-     * @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 @@ public class QuestionAnswerApi {
 
     /**
      * 微信删除消息模板
-     * @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 @@ public class QuestionAnswerApi {
 
     /**
      * 微信删除消息模板
-     * @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,