Yansen 2 年前
父节点
当前提交
b7a5e58aa7

db/.back_文明创办/文明创办-backup-2023212194146.pdma.json → db/.back_文明创办/文明创办-backup-2023216160334.pdma.json 查看文件

4
   "avatar": "",
4
   "avatar": "",
5
   "version": "4.1.4",
5
   "version": "4.1.4",
6
   "createdTime": "2022-12-12 09:36:12",
6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-2-12 19:41:01",
7
+  "updatedTime": "2023-2-13 11:18:21",
8
   "dbConns": [],
8
   "dbConns": [],
9
   "profile": {
9
   "profile": {
10
     "default": {
10
     "default": {
3542
           "defName": "定位",
3542
           "defName": "定位",
3543
           "comment": "",
3543
           "comment": "",
3544
           "type": "VARCHAR",
3544
           "type": "VARCHAR",
3545
-          "len": 32,
3545
+          "len": 64,
3546
           "scale": "",
3546
           "scale": "",
3547
           "primaryKey": false,
3547
           "primaryKey": false,
3548
           "notNull": false,
3548
           "notNull": false,
6867
           "defName": "定位",
6867
           "defName": "定位",
6868
           "comment": "",
6868
           "comment": "",
6869
           "type": "VARCHAR",
6869
           "type": "VARCHAR",
6870
-          "len": 32,
6870
+          "len": 64,
6871
           "scale": "",
6871
           "scale": "",
6872
           "primaryKey": false,
6872
           "primaryKey": false,
6873
           "notNull": false,
6873
           "notNull": false,

+ 4
- 4
db/文明创办.pdma.json 查看文件

4
   "avatar": "",
4
   "avatar": "",
5
   "version": "4.1.4",
5
   "version": "4.1.4",
6
   "createdTime": "2022-12-12 09:36:12",
6
   "createdTime": "2022-12-12 09:36:12",
7
-  "updatedTime": "2023-2-12 19:41:46",
7
+  "updatedTime": "2023-2-16 16:03:34",
8
   "dbConns": [],
8
   "dbConns": [],
9
   "profile": {
9
   "profile": {
10
     "default": {
10
     "default": {
3542
           "defName": "定位",
3542
           "defName": "定位",
3543
           "comment": "",
3543
           "comment": "",
3544
           "type": "VARCHAR",
3544
           "type": "VARCHAR",
3545
-          "len": 32,
3545
+          "len": 64,
3546
           "scale": "",
3546
           "scale": "",
3547
           "primaryKey": false,
3547
           "primaryKey": false,
3548
           "notNull": false,
3548
           "notNull": false,
5219
       "fields": [
5219
       "fields": [
5220
         {
5220
         {
5221
           "defKey": "item_id",
5221
           "defKey": "item_id",
5222
-          "defName": "点位ID",
5222
+          "defName": "测评项目ID",
5223
           "comment": "",
5223
           "comment": "",
5224
           "type": "",
5224
           "type": "",
5225
           "len": 32,
5225
           "len": 32,
6867
           "defName": "定位",
6867
           "defName": "定位",
6868
           "comment": "",
6868
           "comment": "",
6869
           "type": "VARCHAR",
6869
           "type": "VARCHAR",
6870
-          "len": 32,
6870
+          "len": 64,
6871
           "scale": "",
6871
           "scale": "",
6872
           "primaryKey": false,
6872
           "primaryKey": false,
6873
           "notNull": false,
6873
           "notNull": false,

+ 8
- 1
src/main/java/com/example/civilizedcity/controller/SysUserController.java 查看文件

138
         queryWrapper.orderByDesc("create_date");
138
         queryWrapper.orderByDesc("create_date");
139
         IPage<SysUser> result = sysUserService.page(pg, queryWrapper);
139
         IPage<SysUser> result = sysUserService.page(pg, queryWrapper);
140
 
140
 
141
+        List<SysUser> list = result.getRecords();
142
+        if (null != list || list.size() > 0) {
143
+            for (SysUser sysUser : list) {
144
+                sysUser.setDutyList(sysUserDutyService.getListByUser(sysUser.getUserId()));
145
+            }
146
+        }
147
+
141
         return ResponseBean.success(result);
148
         return ResponseBean.success(result);
142
     }
149
     }
143
 
150
 
184
             }
191
             }
185
 
192
 
186
             sysUser.setUserId(origin.getUserId());
193
             sysUser.setUserId(origin.getUserId());
187
-            if (Constants.STATUS_DELETE == sysUser.getStatus()) {
194
+            if (null != sysUser.getStatus() && Constants.STATUS_DELETE == sysUser.getStatus()) {
188
                 // 如果这个人被删除了, 则重置为正常状态
195
                 // 如果这个人被删除了, 则重置为正常状态
189
                 sysUser.setStatus(Constants.STATUS_NORMAL);
196
                 sysUser.setStatus(Constants.STATUS_NORMAL);
190
             }
197
             }

+ 84
- 54
src/main/java/com/example/civilizedcity/controller/TaCheckAnswerController.java 查看文件

7
 import com.example.civilizedcity.common.Constants;
7
 import com.example.civilizedcity.common.Constants;
8
 import com.example.civilizedcity.common.ExcelUtils;
8
 import com.example.civilizedcity.common.ExcelUtils;
9
 import com.example.civilizedcity.common.ResponseBean;
9
 import com.example.civilizedcity.common.ResponseBean;
10
+
10
 import java.util.List;
11
 import java.util.List;
11
 
12
 
12
 import com.example.civilizedcity.vo.CheckLocAnswer;
13
 import com.example.civilizedcity.vo.CheckLocAnswer;
23
 
24
 
24
 /**
25
 /**
25
  * 测评作答;(ta_check_answer)表控制层
26
  * 测评作答;(ta_check_answer)表控制层
27
+ *
26
  * @author : http://njyunzhi.com
28
  * @author : http://njyunzhi.com
27
  * @date : 2022-12-13
29
  * @date : 2022-12-13
28
  */
30
  */
30
 @RestController
32
 @RestController
31
 @RequestMapping("/")
33
 @RequestMapping("/")
32
 public class TaCheckAnswerController extends BaseController {
34
 public class TaCheckAnswerController extends BaseController {
33
-    
35
+
34
     @Autowired
36
     @Autowired
35
     private TaCheckAnswerService taCheckAnswerService;
37
     private TaCheckAnswerService taCheckAnswerService;
36
-    
37
-    /** 
38
-     * 通过ID查询单条数据 
38
+
39
+    /**
40
+     * 通过ID查询单条数据
39
      *
41
      *
40
      * @param answerId 主键
42
      * @param answerId 主键
41
      * @return 实例对象
43
      * @return 实例对象
45
     public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
47
     public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
46
         return ResponseBean.success(taCheckAnswerService.getById(id));
48
         return ResponseBean.success(taCheckAnswerService.getById(id));
47
     }
49
     }
48
-    
49
-    /** 
50
-     * 分页查询
50
+
51
+    /**
52
+     * 分页查询答题详情
51
      *
53
      *
52
-     * @param pageNum 当前页码
54
+     * @param pageNum  当前页码
53
      * @param pageSize 每页条数
55
      * @param pageSize 每页条数
54
      * @return 查询结果
56
      * @return 查询结果
55
      */
57
      */
56
-    @ApiOperation("分页查询")
58
+    @ApiOperation("分页查询答题详情")
57
     @GetMapping("/taCheckAnswer")
59
     @GetMapping("/taCheckAnswer")
58
-    public ResponseBean list(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
59
-                            @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
60
-                             @ApiParam("答卷类型") @RequestParam(value ="itemType", defaultValue = "loc") String itemType,
61
-                             @ApiParam("测评ID") @RequestParam(value ="checkId", required = false) String checkId,
62
-                             @ApiParam("点位ID") @RequestParam(value ="typeId", required = false) String typeId,
63
-                             @ApiParam("社区") @RequestParam(value ="communityName", required = false) String communityName,
64
-                             @ApiParam("答卷类型") @RequestParam(value ="addr", required = false) String addr) throws Exception {
60
+    public ResponseBean list(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
61
+                             @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
62
+                             @ApiParam("答卷类型") @RequestParam(value = "itemType") String itemType,
63
+                             @ApiParam("测评ID") @RequestParam(value = "checkId") String checkId,
64
+                             @ApiParam("点位ID") @RequestParam(value = "typeId", required = false) String typeId,
65
+                             @ApiParam("社区") @RequestParam(value = "communityName", required = false) String communityName,
66
+                             @ApiParam("答卷类型") @RequestParam(value = "addr", required = false) String addr) throws Exception {
67
+
68
+        IPage<TaCheckAnswer> page = new Page<>(pageNum, pageSize);
69
+
70
+        page = taCheckAnswerService.getPageBy(page, checkId, itemType, typeId, communityName, addr);
71
+
72
+        return ResponseBean.success(page);
73
+    }
74
+
75
+
76
+    /**
77
+     * 分页查询答题详情
78
+     *
79
+     * @param pageNum  当前页码
80
+     * @param pageSize 每页条数
81
+     * @return 查询结果
82
+     */
83
+    @ApiOperation("分页查询答题详情")
84
+    @GetMapping("/taCheckAnswer/{answerId}/detail")
85
+    public ResponseBean listDetail(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
86
+                                   @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
87
+                                   @ApiParam("答案ID") @PathVariable String answerId,
88
+                                   @ApiParam("答卷类型") @RequestParam(value = "itemType", required = false) String itemType,
89
+                                   @ApiParam("测评ID") @RequestParam(value = "checkId", required = false) String checkId,
90
+                                   @ApiParam("点位ID") @RequestParam(value = "typeId", required = false) String typeId,
91
+                                   @ApiParam("社区") @RequestParam(value = "communityName", required = false) String communityName,
92
+                                   @ApiParam("答卷类型") @RequestParam(value = "addr", required = false) String addr) throws Exception {
65
 
93
 
66
         if (Constants.CHECK_OF_LOC.equals(itemType)) {
94
         if (Constants.CHECK_OF_LOC.equals(itemType)) {
67
             IPage<CheckLocAnswer> pg = new Page<>(pageNum, pageSize);
95
             IPage<CheckLocAnswer> pg = new Page<>(pageNum, pageSize);
68
-            IPage<CheckLocAnswer> result = taCheckAnswerService.getLocPageBy(pg, checkId, typeId);
96
+            IPage<CheckLocAnswer> result = taCheckAnswerService.getLocPageBy(pg, checkId, typeId, answerId);
69
             return ResponseBean.success(result);
97
             return ResponseBean.success(result);
70
         }
98
         }
71
 
99
 
72
         if (Constants.CHECK_OF_SURVEY.equals(itemType)) {
100
         if (Constants.CHECK_OF_SURVEY.equals(itemType)) {
73
             IPage<CheckSurveyAnswer> pg = new Page<>(pageNum, pageSize);
101
             IPage<CheckSurveyAnswer> pg = new Page<>(pageNum, pageSize);
74
-            IPage<CheckSurveyAnswer> result = taCheckAnswerService.getSurveyPageBy(pg, checkId, communityName, addr);
102
+            IPage<CheckSurveyAnswer> result = taCheckAnswerService.getSurveyPageBy(pg, checkId, answerId, communityName, addr);
75
             return ResponseBean.success(result);
103
             return ResponseBean.success(result);
76
         }
104
         }
77
 
105
 
78
         return ResponseBean.error("非法的答卷类型");
106
         return ResponseBean.error("非法的答卷类型");
79
     }
107
     }
80
 
108
 
81
-     /**
82
-      * 导出
83
-      *
84
-      * @return 查询结果
85
-      */
86
-     @ApiOperation("导出")
87
-     @GetMapping("/taCheckAnswer/export")
88
-     public ResponseBean export(@ApiParam("答卷类型") @RequestParam(value ="itemType", defaultValue = "loc") String itemType,
89
-                                @ApiParam("测评ID") @RequestParam(value ="checkId", required = false) String checkId,
90
-                                @ApiParam("点位ID") @RequestParam(value ="typeId", required = false) String typeId,
91
-                                @ApiParam("社区") @RequestParam(value ="communityName", required = false) String communityName,
92
-                                @ApiParam("答卷类型") @RequestParam(value ="addr", required = false) String addr,
93
-                                HttpServletResponse response) throws Exception {
94
-
95
-         if (Constants.CHECK_OF_LOC.equals(itemType)) {
96
-             List<CheckLocAnswer> result = taCheckAnswerService.getLocListBy(checkId, typeId);
97
-             ExcelUtils.flush(response, CheckLocAnswer.class, result, "实地测评答案明细");
98
-             return null;
99
-         }
100
-
101
-         if (Constants.CHECK_OF_SURVEY.equals(itemType)) {
102
-             List<CheckSurveyAnswer> result = taCheckAnswerService.getSurveyListBy(checkId, communityName, addr);
103
-             ExcelUtils.flush(response, CheckSurveyAnswer.class, result, "调查问卷答案明细");
104
-             return null;
105
-         }
106
-
107
-         return ResponseBean.error("非法的答卷类型");
108
-     }
109
-    
110
-    /** 
109
+    /**
110
+     * 导出答题详情
111
+     *
112
+     * @return 查询结果
113
+     */
114
+    @ApiOperation("导出答题详情")
115
+    @GetMapping("/taCheckAnswer/{answerId}/detail/export")
116
+    public ResponseBean exportDetail(
117
+            @ApiParam("答案ID") @PathVariable String answerId,
118
+            @ApiParam("答卷类型") @RequestParam(value = "itemType", required = false) String itemType,
119
+            @ApiParam("测评ID") @RequestParam(value = "checkId", required = false) String checkId,
120
+            @ApiParam("点位ID") @RequestParam(value = "typeId", required = false) String typeId,
121
+            @ApiParam("社区") @RequestParam(value = "communityName", required = false) String communityName,
122
+            @ApiParam("答卷类型") @RequestParam(value = "addr", required = false) String addr,
123
+            HttpServletResponse response) throws Exception {
124
+
125
+        if (Constants.CHECK_OF_LOC.equals(itemType)) {
126
+            List<CheckLocAnswer> result = taCheckAnswerService.getLocListBy(checkId, typeId, answerId);
127
+            ExcelUtils.flush(response, CheckLocAnswer.class, result, "实地测评答案明细");
128
+            return null;
129
+        }
130
+
131
+        if (Constants.CHECK_OF_SURVEY.equals(itemType)) {
132
+            List<CheckSurveyAnswer> result = taCheckAnswerService.getSurveyListBy(checkId, answerId, communityName, addr);
133
+            ExcelUtils.flush(response, CheckSurveyAnswer.class, result, "调查问卷答案明细");
134
+            return null;
135
+        }
136
+
137
+        return ResponseBean.error("非法的答卷类型");
138
+    }
139
+
140
+    /**
111
      * 新增数据
141
      * 新增数据
112
      *
142
      *
113
      * @param taCheckAnswer 实例对象
143
      * @param taCheckAnswer 实例对象
119
         taCheckAnswerService.save(taCheckAnswer);
149
         taCheckAnswerService.save(taCheckAnswer);
120
         return ResponseBean.success(taCheckAnswer);
150
         return ResponseBean.success(taCheckAnswer);
121
     }
151
     }
122
-    
123
-    /** 
152
+
153
+    /**
124
      * 更新数据
154
      * 更新数据
125
      *
155
      *
126
      * @param taCheckAnswer 实例对象
156
      * @param taCheckAnswer 实例对象
129
     @ApiOperation("更新数据")
159
     @ApiOperation("更新数据")
130
     @PutMapping("/taCheckAnswer/{id}")
160
     @PutMapping("/taCheckAnswer/{id}")
131
     public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheckAnswer taCheckAnswer,
161
     public ResponseBean edit(@ApiParam("对象实体") @RequestBody TaCheckAnswer taCheckAnswer,
132
-                            @ApiParam("对象ID") @PathVariable String id ) throws Exception {
162
+                             @ApiParam("对象ID") @PathVariable String id) throws Exception {
133
         taCheckAnswerService.updateById(taCheckAnswer);
163
         taCheckAnswerService.updateById(taCheckAnswer);
134
         return ResponseBean.success(taCheckAnswer);
164
         return ResponseBean.success(taCheckAnswer);
135
     }
165
     }
136
-    
137
-    /** 
166
+
167
+    /**
138
      * 通过主键删除数据
168
      * 通过主键删除数据
139
      *
169
      *
140
      * @param answerId 主键
170
      * @param answerId 主键
142
      */
172
      */
143
     @ApiOperation("通过主键删除数据")
173
     @ApiOperation("通过主键删除数据")
144
     @DeleteMapping("/taCheckAnswer/{id}")
174
     @DeleteMapping("/taCheckAnswer/{id}")
145
-    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
175
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) {
146
         taCheckAnswerService.removeLogicById(id);
176
         taCheckAnswerService.removeLogicById(id);
147
         return ResponseBean.success("success");
177
         return ResponseBean.success("success");
148
     }
178
     }

+ 5
- 1
src/main/java/com/example/civilizedcity/controller/TaCheckItemController.java 查看文件

79
             return ResponseBean.error("未找到测评项目");
79
             return ResponseBean.error("未找到测评项目");
80
         }
80
         }
81
 
81
 
82
+        if (Constants.CHECK_OF_SURVEY.equals(typeId)) {
83
+            SysUser sysUser = currentUser();
84
+            taCheckItem.setAnswerNum(taCheckAnswerService.getCountByUser(taCheckItem.getItemId(), sysUser.getUserId()));
85
+        }
86
+
82
         return ResponseBean.success(taCheckItem);
87
         return ResponseBean.success(taCheckItem);
83
     }
88
     }
84
 
89
 
212
     @ApiOperation("获取回答")
217
     @ApiOperation("获取回答")
213
     @GetMapping("/taCheckItem/{id}/answer")
218
     @GetMapping("/taCheckItem/{id}/answer")
214
     public ResponseBean getAnswer(@ApiParam("对象ID") @PathVariable String id) throws Exception {
219
     public ResponseBean getAnswer(@ApiParam("对象ID") @PathVariable String id) throws Exception {
215
-
216
         SysUser sysUser = currentUser();
220
         SysUser sysUser = currentUser();
217
         List<TaCheckAnswer> answerList = taCheckAnswerService.getByUser(id, sysUser.getUserId());
221
         List<TaCheckAnswer> answerList = taCheckAnswerService.getByUser(id, sysUser.getUserId());
218
         return ResponseBean.success(answerList);
222
         return ResponseBean.success(answerList);

+ 2
- 1
src/main/java/com/example/civilizedcity/controller/TaOrgIssueController.java 查看文件

71
 
71
 
72
          QueryWrapper<TaOrgIssue> queryWrapper = new QueryWrapper<>();
72
          QueryWrapper<TaOrgIssue> queryWrapper = new QueryWrapper<>();
73
          queryWrapper.eq("issue_id", issueId);
73
          queryWrapper.eq("issue_id", issueId);
74
-         queryWrapper.eq("org_id", StringUtils.isEmpty(orgId) ? sysUser.getOrgId() : orgId);
74
+         queryWrapper.eq(!Constants.ROOT_ORG.equals(sysUser.getOrgId()), "org_id", StringUtils.isEmpty(orgId) ? sysUser.getOrgId() : orgId);
75
          queryWrapper.eq("status", Constants.STATUS_NORMAL);
75
          queryWrapper.eq("status", Constants.STATUS_NORMAL);
76
+         queryWrapper.last("limit 1");
76
 
77
 
77
          TaOrgIssue taOrgIssue = taOrgIssueService.getOne(queryWrapper);
78
          TaOrgIssue taOrgIssue = taOrgIssueService.getOne(queryWrapper);
78
          if (null != taOrgIssue) {
79
          if (null != taOrgIssue) {

+ 9
- 1
src/main/java/com/example/civilizedcity/entity/TaCheckAnswer.java 查看文件

30
     @TableId(value = "answer_id", type = IdType.INPUT)
30
     @TableId(value = "answer_id", type = IdType.INPUT)
31
     private String answerId ;
31
     private String answerId ;
32
     /** 测评点位 */
32
     /** 测评点位 */
33
-    @ApiModelProperty(name = "测评点位",notes = "")
33
+    @ApiModelProperty(name = "测评项目ID",notes = "")
34
     private String itemId ;
34
     private String itemId ;
35
     /** 测评ID */
35
     /** 测评ID */
36
     @ApiModelProperty(name = "测评ID",notes = "")
36
     @ApiModelProperty(name = "测评ID",notes = "")
79
     @ApiModelProperty(name = "答案列表",notes = "")
79
     @ApiModelProperty(name = "答案列表",notes = "")
80
     private List<TaCheckAnswerItem> answerItemList ;
80
     private List<TaCheckAnswerItem> answerItemList ;
81
 
81
 
82
+     /** 点位id */
83
+     @TableField(exist = false)
84
+     @ApiModelProperty(name = "点位id",notes = "")
85
+     private String typeId ;
86
+     /** 点位名称 */
87
+     @TableField(exist = false)
88
+     @ApiModelProperty(name = "点位名称",notes = "")
89
+     private String typeName ;
82
 }
90
 }

+ 13
- 2
src/main/java/com/example/civilizedcity/mapper/TaCheckAnswerMapper.java 查看文件

31
 
31
 
32
     IPage<CheckLocAnswer> getLocPageBy(IPage<CheckLocAnswer> pg,
32
     IPage<CheckLocAnswer> getLocPageBy(IPage<CheckLocAnswer> pg,
33
                                        @Param("checkId") String checkId,
33
                                        @Param("checkId") String checkId,
34
-                                       @Param("typeId") String typeId);
34
+                                       @Param("typeId") String typeId,
35
+                                       @Param("answerId") String answerId);
35
 
36
 
36
     List<CheckLocAnswer> getLocListBy(@Param("checkId") String checkId,
37
     List<CheckLocAnswer> getLocListBy(@Param("checkId") String checkId,
37
-                                      @Param("typeId") String typeId);
38
+                                      @Param("typeId") String typeId,
39
+                                      @Param("answerId") String answerId);
38
 
40
 
39
     IPage<CheckSurveyAnswer> getSurveyPageBy(IPage<CheckSurveyAnswer> pg,
41
     IPage<CheckSurveyAnswer> getSurveyPageBy(IPage<CheckSurveyAnswer> pg,
40
                                              @Param("checkId") String checkId,
42
                                              @Param("checkId") String checkId,
43
+                                             @Param("answerId") String answerId,
41
                                              @Param("communityName") String communityName,
44
                                              @Param("communityName") String communityName,
42
                                              @Param("addr") String addr);
45
                                              @Param("addr") String addr);
43
 
46
 
44
     List<CheckSurveyAnswer> getSurveyListBy(@Param("checkId") String checkId,
47
     List<CheckSurveyAnswer> getSurveyListBy(@Param("checkId") String checkId,
48
+                                            @Param("answerId") String answerId,
45
                                             @Param("communityName") String communityName,
49
                                             @Param("communityName") String communityName,
46
                                             @Param("addr") String addr);
50
                                             @Param("addr") String addr);
51
+
52
+    IPage<TaCheckAnswer> getPageBy(IPage<TaCheckAnswer> page,
53
+                                   @Param("checkId") String checkId,
54
+                                   @Param("itemType") String itemType,
55
+                                   @Param("typeId") String typeId,
56
+                                   @Param("communityName") String communityName,
57
+                                   @Param("addr") String addr);
47
 }
58
 }

+ 6
- 5
src/main/java/com/example/civilizedcity/service/TaCheckAnswerService.java 查看文件

1
 package com.example.civilizedcity.service;
1
 package com.example.civilizedcity.service;
2
 
2
 
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
-import com.baomidou.mybatisplus.extension.service.IService;
5
 import com.example.civilizedcity.entity.TaCheckAnswer;
4
 import com.example.civilizedcity.entity.TaCheckAnswer;
6
 import com.example.civilizedcity.vo.CheckLocAnswer;
5
 import com.example.civilizedcity.vo.CheckLocAnswer;
7
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
6
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
22
 
21
 
23
     List<TaCheckAnswer> getByUser(String itemId, String userId);
22
     List<TaCheckAnswer> getByUser(String itemId, String userId);
24
 
23
 
25
-    IPage<CheckLocAnswer> getLocPageBy(IPage<CheckLocAnswer> pg, String checkId, String typeId);
24
+    IPage<CheckLocAnswer> getLocPageBy(IPage<CheckLocAnswer> pg, String checkId, String typeId, String answerId);
26
 
25
 
27
-    List<CheckLocAnswer> getLocListBy(String checkId, String typeId);
26
+    List<CheckLocAnswer> getLocListBy(String checkId, String typeId, String answerId);
28
 
27
 
29
-    IPage<CheckSurveyAnswer> getSurveyPageBy(IPage<CheckSurveyAnswer> pg, String checkId, String communityName, String addr);
28
+    IPage<CheckSurveyAnswer> getSurveyPageBy(IPage<CheckSurveyAnswer> pg, String checkId, String answerId, String communityName, String addr);
30
 
29
 
31
-    List<CheckSurveyAnswer> getSurveyListBy(String checkId, String communityName, String addr);
30
+    List<CheckSurveyAnswer> getSurveyListBy(String checkId, String answerId, String communityName, String addr);
31
+
32
+    IPage<TaCheckAnswer> getPageBy(IPage<TaCheckAnswer> page, String checkId, String itemType, String typeId, String communityName, String addr);
32
 }
33
 }

+ 13
- 9
src/main/java/com/example/civilizedcity/service/impl/TaCheckAnswerServiceImpl.java 查看文件

3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.example.civilizedcity.vo.CheckLocAnswer;
4
 import com.example.civilizedcity.vo.CheckLocAnswer;
5
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
5
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
6
-import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
6
 import org.springframework.stereotype.Service;
8
 import com.example.civilizedcity.entity.TaCheckAnswer;
7
 import com.example.civilizedcity.entity.TaCheckAnswer;
9
 import com.example.civilizedcity.mapper.TaCheckAnswerMapper;
8
 import com.example.civilizedcity.mapper.TaCheckAnswerMapper;
36
     }
35
     }
37
 
36
 
38
     @Override
37
     @Override
39
-    public IPage<CheckLocAnswer> getLocPageBy(IPage<CheckLocAnswer> pg, String checkId, String typeId) {
40
-        return baseMapper.getLocPageBy(pg, checkId, typeId);
38
+    public IPage<CheckLocAnswer> getLocPageBy(IPage<CheckLocAnswer> pg, String checkId, String typeId, String answerId) {
39
+        return baseMapper.getLocPageBy(pg, checkId, typeId, answerId);
41
     }
40
     }
42
 
41
 
43
     @Override
42
     @Override
44
-    public List<CheckLocAnswer> getLocListBy(String checkId, String typeId) {
45
-        return baseMapper.getLocListBy(checkId, typeId);
43
+    public List<CheckLocAnswer> getLocListBy(String checkId, String typeId, String answerId) {
44
+        return baseMapper.getLocListBy(checkId, typeId, answerId);
46
     }
45
     }
47
 
46
 
48
     @Override
47
     @Override
49
-    public IPage<CheckSurveyAnswer> getSurveyPageBy(IPage<CheckSurveyAnswer> pg, String checkId, String communityName, String addr) {
50
-        return baseMapper.getSurveyPageBy(pg, checkId, communityName, addr);
48
+    public IPage<CheckSurveyAnswer> getSurveyPageBy(IPage<CheckSurveyAnswer> pg, String checkId, String answerId, String communityName, String addr) {
49
+        return baseMapper.getSurveyPageBy(pg, checkId, answerId, communityName, addr);
51
     }
50
     }
52
 
51
 
53
     @Override
52
     @Override
54
-    public List<CheckSurveyAnswer> getSurveyListBy(String checkId, String communityName, String addr) {
55
-        return baseMapper.getSurveyListBy(checkId, communityName, addr);
53
+    public List<CheckSurveyAnswer> getSurveyListBy(String checkId, String answerId, String communityName, String addr) {
54
+        return baseMapper.getSurveyListBy(checkId, answerId, communityName, addr);
55
+    }
56
+
57
+    @Override
58
+    public IPage<TaCheckAnswer> getPageBy(IPage<TaCheckAnswer> page, String checkId, String itemType, String typeId, String communityName, String addr) {
59
+        return baseMapper.getPageBy(page, checkId, itemType, typeId, communityName, addr);
56
     }
60
     }
57
 }
61
 }

+ 14
- 2
src/main/java/com/example/civilizedcity/service/impl/TaCheckItemServiceImpl.java 查看文件

145
         double negativeScore = 0.0; // 扣分
145
         double negativeScore = 0.0; // 扣分
146
         double positiveScore = 0.0; // 得分
146
         double positiveScore = 0.0; // 得分
147
         for(TaCheckAnswerItem item : answerItemList) {
147
         for(TaCheckAnswerItem item : answerItemList) {
148
+            boolean mustCreateIssue = false;
148
             // 找到对应的题目
149
             // 找到对应的题目
149
             TaCheckItemQu qu = getQu(quList, item.getQuId());
150
             TaCheckItemQu qu = getQu(quList, item.getQuId());
150
             // 如果是选择题, 对应的答案
151
             // 如果是选择题, 对应的答案
185
             if (score > 0) {
186
             if (score > 0) {
186
                 positiveScore += score;
187
                 positiveScore += score;
187
             } else {
188
             } else {
188
-                negativeScore += score;
189
+//                negativeScore += score;
190
+
191
+                // 扣分项
192
+                if (sign < 0) {
193
+                    mustCreateIssue = true;
194
+                    score = qu.getMaxScore() - score;
195
+                    if (score < 0) {
196
+                        score = 0;
197
+                    }
198
+
199
+                    positiveScore += score;
200
+                }
189
             }
201
             }
190
 
202
 
191
             // 保存附件
203
             // 保存附件
202
             }
214
             }
203
 
215
 
204
             // 如果得分小于0, 说明是扣分项, 生成问题单
216
             // 如果得分小于0, 说明是扣分项, 生成问题单
205
-            if (score < 0 && Constants.CHECK_OF_LOC.equals(taCheckItem.getItemType())) {
217
+            if (mustCreateIssue && Constants.CHECK_OF_LOC.equals(taCheckItem.getItemType())) {
206
                 createNewIssue(sysUser, taCheckItem, qu, standAn, taCheckAnswer, item);
218
                 createNewIssue(sysUser, taCheckItem, qu, standAn, taCheckAnswer, item);
207
             }
219
             }
208
         }
220
         }

+ 7
- 6
src/main/java/com/example/civilizedcity/service/impl/TaCheckServiceImpl.java 查看文件

127
                     double ratio = maxStandScore / qu.getMaxScore();
127
                     double ratio = maxStandScore / qu.getMaxScore();
128
 
128
 
129
                     // 当前得分
129
                     // 当前得分
130
-                    double s = Math.abs(answerItem.getScore()) > qu.getMaxScore() ?  qu.getMaxScore() : answerItem.getScore();
131
-                    if (answerItem.getScore() < 0) {
132
-                        // 在与最大值的比较过程中, 最大值是正数, 有可能改变得分的符号
133
-                        // 所以此处要纠正过来
134
-                        s = 0 - Math.abs(s);
135
-                    }
130
+                    double s = answerItem.getScore();
131
+//                    double s = Math.abs(answerItem.getScore()) > qu.getMaxScore() ?  qu.getMaxScore() : answerItem.getScore();
132
+//                    if (answerItem.getScore() < 0) {
133
+//                        // 在与最大值的比较过程中, 最大值是正数, 有可能改变得分的符号
134
+//                        // 所以此处要纠正过来
135
+//                        s = 0 - Math.abs(s);
136
+//                    }
136
 
137
 
137
                     // 分值
138
                     // 分值
138
                     quScore += s * ratio;
139
                     quScore += s * ratio;

+ 16
- 0
src/main/java/com/example/civilizedcity/service/impl/TaIssueApplyServiceImpl.java 查看文件

143
         taIssueMapper.updateById(taIssue);
143
         taIssueMapper.updateById(taIssue);
144
         taOrgIssueMapper.updateById(taOrgIssue);
144
         taOrgIssueMapper.updateById(taOrgIssue);
145
 
145
 
146
+        // 再次生成流程记录,
147
+        createProcessByIssue(taIssue, sysUser);
148
+
146
 //        // 如果是用户随手拍
149
 //        // 如果是用户随手拍
147
 //        if (Constants.SOURCE_FEEDBACK.equals(taIssue.getSourceType())) {
150
 //        if (Constants.SOURCE_FEEDBACK.equals(taIssue.getSourceType())) {
148
 //            // 如果是销单了
151
 //            // 如果是销单了
153
         applicationEventPublisher.publishEvent(new MessagEvent(this, origin));
156
         applicationEventPublisher.publishEvent(new MessagEvent(this, origin));
154
     }
157
     }
155
 
158
 
159
+    private void createProcessByIssue(TaIssue taIssue, SysUser sysUser) {
160
+        TaIssueProcess taIssueProcess = new TaIssueProcess();
161
+        taIssueProcess.setIssueId(taIssue.getIssueId());
162
+        taIssueProcess.setOrgId(taIssue.getOrgId());
163
+        taIssueProcess.setProcessNode(taIssue.getProcessNode());
164
+        taIssueProcess.setProcessStatus(taIssue.getProcessStatus());
165
+        taIssueProcess.setProcessResult(null);
166
+        taIssueProcess.setCreateUser(sysUser.getUserId());
167
+        taIssueProcess.setCreateDate(LocalDateTime.now());
168
+        taIssueProcess.setStatus(Constants.STATUS_NORMAL);
169
+        taIssueProcessMapper.insert(taIssueProcess);
170
+    }
171
+
156
     // 问题单审核
172
     // 问题单审核
157
     public void verifyIssue(TaIssueApply taIssueApply, TaIssue taIssue, TaOrgIssue taOrgIssue) throws Exception {
173
     public void verifyIssue(TaIssueApply taIssueApply, TaIssue taIssue, TaOrgIssue taOrgIssue) throws Exception {
158
         taIssue.setProcessNode(Constants.PROCESS_ASSIGNED);
174
         taIssue.setProcessNode(Constants.PROCESS_ASSIGNED);

+ 4
- 0
src/main/java/com/example/civilizedcity/vo/CheckLocAnswer.java 查看文件

67
     @ExcelProperty(value = "作答时间", index = 6)
67
     @ExcelProperty(value = "作答时间", index = 6)
68
     @ApiModelProperty("作答时间")
68
     @ApiModelProperty("作答时间")
69
     private LocalDateTime createDate;
69
     private LocalDateTime createDate;
70
+
71
+    @ExcelIgnore
72
+    @ApiModelProperty("得分")
73
+    private Float score;
70
 }
74
 }

+ 6
- 2
src/main/java/com/example/civilizedcity/vo/CheckSurveyAnswer.java 查看文件

65
     private LocalDateTime createDate;
65
     private LocalDateTime createDate;
66
 
66
 
67
     @ColumnWidth(30)
67
     @ColumnWidth(30)
68
-    @ExcelProperty(value = "受访者年龄段", index = 7)
69
-    @ApiModelProperty("受访者年龄段")
68
+    @ExcelProperty(value = "受访者性别", index = 7)
69
+    @ApiModelProperty("受访者性别")
70
     private String sex;
70
     private String sex;
71
 
71
 
72
     @ColumnWidth(30)
72
     @ColumnWidth(30)
73
     @ExcelProperty(value = "受访者年龄段", index = 8)
73
     @ExcelProperty(value = "受访者年龄段", index = 8)
74
     @ApiModelProperty("受访者年龄段")
74
     @ApiModelProperty("受访者年龄段")
75
     private String age;
75
     private String age;
76
+
77
+    @ExcelIgnore
78
+    @ApiModelProperty("得分")
79
+    private Float score;
76
 }
80
 }

+ 34
- 0
src/main/resources/mapper/TaCheckAnswerMapper.xml 查看文件

58
         SELECT
58
         SELECT
59
             t.item_id AS answer_item_id,
59
             t.item_id AS answer_item_id,
60
             t.answer_id,
60
             t.answer_id,
61
+            t.score,
61
             m.item_id AS check_item_id,
62
             m.item_id AS check_item_id,
62
             m.type_id,
63
             m.type_id,
63
             m.`name` AS type_name,
64
             m.`name` AS type_name,
79
         WHERE
80
         WHERE
80
             m.item_type = 'loc'
81
             m.item_type = 'loc'
81
             AND t.`status` = 1
82
             AND t.`status` = 1
83
+        <if test="answerId != null and answerId != ''">
84
+            AND t.answer_id = #{answerId}
85
+        </if>
82
             <if test="checkId != null and checkId != ''">
86
             <if test="checkId != null and checkId != ''">
83
                 AND n.check_id = #{checkId}
87
                 AND n.check_id = #{checkId}
84
             </if>
88
             </if>
100
         SELECT
104
         SELECT
101
             t.item_id AS answer_item_id,
105
             t.item_id AS answer_item_id,
102
             t.answer_id,
106
             t.answer_id,
107
+            t.score,
103
             m.item_id AS check_item_id,
108
             m.item_id AS check_item_id,
104
             n.check_id,
109
             n.check_id,
105
             n.title AS check_title,
110
             n.title AS check_title,
122
         WHERE
127
         WHERE
123
             m.item_type = 'survey'
128
             m.item_type = 'survey'
124
           AND t.`status` = 1
129
           AND t.`status` = 1
130
+        <if test="answerId != null and answerId != ''">
131
+            AND t.answer_id = #{answerId}
132
+        </if>
125
         <if test="checkId != null and checkId != ''">
133
         <if test="checkId != null and checkId != ''">
126
             AND n.check_id = #{checkId}
134
             AND n.check_id = #{checkId}
127
         </if>
135
         </if>
141
     <select id="getSurveyListBy" resultType="com.example.civilizedcity.vo.CheckSurveyAnswer">
149
     <select id="getSurveyListBy" resultType="com.example.civilizedcity.vo.CheckSurveyAnswer">
142
         <include refid="getSurveyAnswers"></include>
150
         <include refid="getSurveyAnswers"></include>
143
     </select>
151
     </select>
152
+    <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaCheckAnswer">
153
+        SELECT
154
+            t.*,
155
+            s.type_id,
156
+            s.`name` as type_name
157
+        FROM
158
+            ta_check_answer t
159
+                INNER JOIN ta_check_item s ON t.item_id = s.item_id
160
+        WHERE
161
+            t.check_id = #{checkId}
162
+          <if test="itemType != null and itemType != ''">
163
+              AND s.item_type = #{itemType}
164
+          </if>
165
+        <if test="typeId != null and typeId != ''">
166
+            AND s.type_id = #{typeId}
167
+        </if>
168
+          <if test="communityName != null and communityName != ''">
169
+              AND t.community_name LIKE CONCAT( #{communityName}, '%' )
170
+          </if>
171
+          <if test="addr != null and addr != ''">
172
+              AND t.addr LIKE CONCAT( #{addr}, '%' )
173
+          </if>
174
+          AND t.`status` &gt; - 1
175
+        ORDER BY
176
+            t.create_date DESC
177
+    </select>
144
 </mapper>
178
 </mapper>