Yansen 2 years ago
parent
commit
b7a5e58aa7

db/.back_文明创办/文明创办-backup-2023212194146.pdma.json → db/.back_文明创办/文明创办-backup-2023216160334.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.4",
6 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 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -3542,7 +3542,7 @@
3542 3542
           "defName": "定位",
3543 3543
           "comment": "",
3544 3544
           "type": "VARCHAR",
3545
-          "len": 32,
3545
+          "len": 64,
3546 3546
           "scale": "",
3547 3547
           "primaryKey": false,
3548 3548
           "notNull": false,
@@ -6867,7 +6867,7 @@
6867 6867
           "defName": "定位",
6868 6868
           "comment": "",
6869 6869
           "type": "VARCHAR",
6870
-          "len": 32,
6870
+          "len": 64,
6871 6871
           "scale": "",
6872 6872
           "primaryKey": false,
6873 6873
           "notNull": false,

+ 4
- 4
db/文明创办.pdma.json View File

@@ -4,7 +4,7 @@
4 4
   "avatar": "",
5 5
   "version": "4.1.4",
6 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 8
   "dbConns": [],
9 9
   "profile": {
10 10
     "default": {
@@ -3542,7 +3542,7 @@
3542 3542
           "defName": "定位",
3543 3543
           "comment": "",
3544 3544
           "type": "VARCHAR",
3545
-          "len": 32,
3545
+          "len": 64,
3546 3546
           "scale": "",
3547 3547
           "primaryKey": false,
3548 3548
           "notNull": false,
@@ -5219,7 +5219,7 @@
5219 5219
       "fields": [
5220 5220
         {
5221 5221
           "defKey": "item_id",
5222
-          "defName": "点位ID",
5222
+          "defName": "测评项目ID",
5223 5223
           "comment": "",
5224 5224
           "type": "",
5225 5225
           "len": 32,
@@ -6867,7 +6867,7 @@
6867 6867
           "defName": "定位",
6868 6868
           "comment": "",
6869 6869
           "type": "VARCHAR",
6870
-          "len": 32,
6870
+          "len": 64,
6871 6871
           "scale": "",
6872 6872
           "primaryKey": false,
6873 6873
           "notNull": false,

+ 8
- 1
src/main/java/com/example/civilizedcity/controller/SysUserController.java View File

@@ -138,6 +138,13 @@ public class SysUserController extends BaseController {
138 138
         queryWrapper.orderByDesc("create_date");
139 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 148
         return ResponseBean.success(result);
142 149
     }
143 150
 
@@ -184,7 +191,7 @@ public class SysUserController extends BaseController {
184 191
             }
185 192
 
186 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 196
                 sysUser.setStatus(Constants.STATUS_NORMAL);
190 197
             }

+ 84
- 54
src/main/java/com/example/civilizedcity/controller/TaCheckAnswerController.java View File

@@ -7,6 +7,7 @@ import com.example.civilizedcity.common.BaseController;
7 7
 import com.example.civilizedcity.common.Constants;
8 8
 import com.example.civilizedcity.common.ExcelUtils;
9 9
 import com.example.civilizedcity.common.ResponseBean;
10
+
10 11
 import java.util.List;
11 12
 
12 13
 import com.example.civilizedcity.vo.CheckLocAnswer;
@@ -23,6 +24,7 @@ import javax.servlet.http.HttpServletResponse;
23 24
 
24 25
 /**
25 26
  * 测评作答;(ta_check_answer)表控制层
27
+ *
26 28
  * @author : http://njyunzhi.com
27 29
  * @date : 2022-12-13
28 30
  */
@@ -30,12 +32,12 @@ import javax.servlet.http.HttpServletResponse;
30 32
 @RestController
31 33
 @RequestMapping("/")
32 34
 public class TaCheckAnswerController extends BaseController {
33
-    
35
+
34 36
     @Autowired
35 37
     private TaCheckAnswerService taCheckAnswerService;
36
-    
37
-    /** 
38
-     * 通过ID查询单条数据 
38
+
39
+    /**
40
+     * 通过ID查询单条数据
39 41
      *
40 42
      * @param answerId 主键
41 43
      * @return 实例对象
@@ -45,69 +47,97 @@ public class TaCheckAnswerController extends BaseController {
45 47
     public ResponseBean queryById(@ApiParam("对象ID") @PathVariable String id) throws Exception {
46 48
         return ResponseBean.success(taCheckAnswerService.getById(id));
47 49
     }
48
-    
49
-    /** 
50
-     * 分页查询
50
+
51
+    /**
52
+     * 分页查询答题详情
51 53
      *
52
-     * @param pageNum 当前页码
54
+     * @param pageNum  当前页码
53 55
      * @param pageSize 每页条数
54 56
      * @return 查询结果
55 57
      */
56
-    @ApiOperation("分页查询")
58
+    @ApiOperation("分页查询答题详情")
57 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 94
         if (Constants.CHECK_OF_LOC.equals(itemType)) {
67 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 97
             return ResponseBean.success(result);
70 98
         }
71 99
 
72 100
         if (Constants.CHECK_OF_SURVEY.equals(itemType)) {
73 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 103
             return ResponseBean.success(result);
76 104
         }
77 105
 
78 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 143
      * @param taCheckAnswer 实例对象
@@ -119,8 +149,8 @@ public class TaCheckAnswerController extends BaseController {
119 149
         taCheckAnswerService.save(taCheckAnswer);
120 150
         return ResponseBean.success(taCheckAnswer);
121 151
     }
122
-    
123
-    /** 
152
+
153
+    /**
124 154
      * 更新数据
125 155
      *
126 156
      * @param taCheckAnswer 实例对象
@@ -129,12 +159,12 @@ public class TaCheckAnswerController extends BaseController {
129 159
     @ApiOperation("更新数据")
130 160
     @PutMapping("/taCheckAnswer/{id}")
131 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 163
         taCheckAnswerService.updateById(taCheckAnswer);
134 164
         return ResponseBean.success(taCheckAnswer);
135 165
     }
136
-    
137
-    /** 
166
+
167
+    /**
138 168
      * 通过主键删除数据
139 169
      *
140 170
      * @param answerId 主键
@@ -142,7 +172,7 @@ public class TaCheckAnswerController extends BaseController {
142 172
      */
143 173
     @ApiOperation("通过主键删除数据")
144 174
     @DeleteMapping("/taCheckAnswer/{id}")
145
-    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id){
175
+    public ResponseBean deleteById(@ApiParam("对象ID") @PathVariable String id) {
146 176
         taCheckAnswerService.removeLogicById(id);
147 177
         return ResponseBean.success("success");
148 178
     }

+ 5
- 1
src/main/java/com/example/civilizedcity/controller/TaCheckItemController.java View File

@@ -79,6 +79,11 @@ public class TaCheckItemController extends BaseController {
79 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 87
         return ResponseBean.success(taCheckItem);
83 88
     }
84 89
 
@@ -212,7 +217,6 @@ public class TaCheckItemController extends BaseController {
212 217
     @ApiOperation("获取回答")
213 218
     @GetMapping("/taCheckItem/{id}/answer")
214 219
     public ResponseBean getAnswer(@ApiParam("对象ID") @PathVariable String id) throws Exception {
215
-
216 220
         SysUser sysUser = currentUser();
217 221
         List<TaCheckAnswer> answerList = taCheckAnswerService.getByUser(id, sysUser.getUserId());
218 222
         return ResponseBean.success(answerList);

+ 2
- 1
src/main/java/com/example/civilizedcity/controller/TaOrgIssueController.java View File

@@ -71,8 +71,9 @@ public class TaOrgIssueController extends BaseController {
71 71
 
72 72
          QueryWrapper<TaOrgIssue> queryWrapper = new QueryWrapper<>();
73 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 75
          queryWrapper.eq("status", Constants.STATUS_NORMAL);
76
+         queryWrapper.last("limit 1");
76 77
 
77 78
          TaOrgIssue taOrgIssue = taOrgIssueService.getOne(queryWrapper);
78 79
          if (null != taOrgIssue) {

+ 9
- 1
src/main/java/com/example/civilizedcity/entity/TaCheckAnswer.java View File

@@ -30,7 +30,7 @@ public class TaCheckAnswer implements Serializable,Cloneable{
30 30
     @TableId(value = "answer_id", type = IdType.INPUT)
31 31
     private String answerId ;
32 32
     /** 测评点位 */
33
-    @ApiModelProperty(name = "测评点位",notes = "")
33
+    @ApiModelProperty(name = "测评项目ID",notes = "")
34 34
     private String itemId ;
35 35
     /** 测评ID */
36 36
     @ApiModelProperty(name = "测评ID",notes = "")
@@ -79,4 +79,12 @@ public class TaCheckAnswer implements Serializable,Cloneable{
79 79
     @ApiModelProperty(name = "答案列表",notes = "")
80 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 View File

@@ -31,17 +31,28 @@ public interface TaCheckAnswerMapper extends BaseMapper<TaCheckAnswer> {
31 31
 
32 32
     IPage<CheckLocAnswer> getLocPageBy(IPage<CheckLocAnswer> pg,
33 33
                                        @Param("checkId") String checkId,
34
-                                       @Param("typeId") String typeId);
34
+                                       @Param("typeId") String typeId,
35
+                                       @Param("answerId") String answerId);
35 36
 
36 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 41
     IPage<CheckSurveyAnswer> getSurveyPageBy(IPage<CheckSurveyAnswer> pg,
40 42
                                              @Param("checkId") String checkId,
43
+                                             @Param("answerId") String answerId,
41 44
                                              @Param("communityName") String communityName,
42 45
                                              @Param("addr") String addr);
43 46
 
44 47
     List<CheckSurveyAnswer> getSurveyListBy(@Param("checkId") String checkId,
48
+                                            @Param("answerId") String answerId,
45 49
                                             @Param("communityName") String communityName,
46 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 View File

@@ -1,7 +1,6 @@
1 1
 package com.example.civilizedcity.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
-import com.baomidou.mybatisplus.extension.service.IService;
5 4
 import com.example.civilizedcity.entity.TaCheckAnswer;
6 5
 import com.example.civilizedcity.vo.CheckLocAnswer;
7 6
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
@@ -22,11 +21,13 @@ public interface TaCheckAnswerService extends IBaseService<TaCheckAnswer> {
22 21
 
23 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 View File

@@ -3,7 +3,6 @@ package com.example.civilizedcity.service.impl;
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.example.civilizedcity.vo.CheckLocAnswer;
5 5
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
6
-import org.springframework.beans.factory.annotation.Autowired;
7 6
 import org.springframework.stereotype.Service;
8 7
 import com.example.civilizedcity.entity.TaCheckAnswer;
9 8
 import com.example.civilizedcity.mapper.TaCheckAnswerMapper;
@@ -36,22 +35,27 @@ public class TaCheckAnswerServiceImpl extends BaseServiceImpl<TaCheckAnswerMappe
36 35
     }
37 36
 
38 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 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 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 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 View File

@@ -145,6 +145,7 @@ public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, T
145 145
         double negativeScore = 0.0; // 扣分
146 146
         double positiveScore = 0.0; // 得分
147 147
         for(TaCheckAnswerItem item : answerItemList) {
148
+            boolean mustCreateIssue = false;
148 149
             // 找到对应的题目
149 150
             TaCheckItemQu qu = getQu(quList, item.getQuId());
150 151
             // 如果是选择题, 对应的答案
@@ -185,7 +186,18 @@ public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, T
185 186
             if (score > 0) {
186 187
                 positiveScore += score;
187 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,7 +214,7 @@ public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, T
202 214
             }
203 215
 
204 216
             // 如果得分小于0, 说明是扣分项, 生成问题单
205
-            if (score < 0 && Constants.CHECK_OF_LOC.equals(taCheckItem.getItemType())) {
217
+            if (mustCreateIssue && Constants.CHECK_OF_LOC.equals(taCheckItem.getItemType())) {
206 218
                 createNewIssue(sysUser, taCheckItem, qu, standAn, taCheckAnswer, item);
207 219
             }
208 220
         }

+ 7
- 6
src/main/java/com/example/civilizedcity/service/impl/TaCheckServiceImpl.java View File

@@ -127,12 +127,13 @@ public class TaCheckServiceImpl extends BaseServiceImpl<TaCheckMapper, TaCheck>
127 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 139
                     quScore += s * ratio;

+ 16
- 0
src/main/java/com/example/civilizedcity/service/impl/TaIssueApplyServiceImpl.java View File

@@ -143,6 +143,9 @@ public class TaIssueApplyServiceImpl extends BaseServiceImpl<TaIssueApplyMapper,
143 143
         taIssueMapper.updateById(taIssue);
144 144
         taOrgIssueMapper.updateById(taOrgIssue);
145 145
 
146
+        // 再次生成流程记录,
147
+        createProcessByIssue(taIssue, sysUser);
148
+
146 149
 //        // 如果是用户随手拍
147 150
 //        if (Constants.SOURCE_FEEDBACK.equals(taIssue.getSourceType())) {
148 151
 //            // 如果是销单了
@@ -153,6 +156,19 @@ public class TaIssueApplyServiceImpl extends BaseServiceImpl<TaIssueApplyMapper,
153 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 173
     public void verifyIssue(TaIssueApply taIssueApply, TaIssue taIssue, TaOrgIssue taOrgIssue) throws Exception {
158 174
         taIssue.setProcessNode(Constants.PROCESS_ASSIGNED);

+ 4
- 0
src/main/java/com/example/civilizedcity/vo/CheckLocAnswer.java View File

@@ -67,4 +67,8 @@ public class CheckLocAnswer {
67 67
     @ExcelProperty(value = "作答时间", index = 6)
68 68
     @ApiModelProperty("作答时间")
69 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 View File

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

+ 34
- 0
src/main/resources/mapper/TaCheckAnswerMapper.xml View File

@@ -58,6 +58,7 @@
58 58
         SELECT
59 59
             t.item_id AS answer_item_id,
60 60
             t.answer_id,
61
+            t.score,
61 62
             m.item_id AS check_item_id,
62 63
             m.type_id,
63 64
             m.`name` AS type_name,
@@ -79,6 +80,9 @@
79 80
         WHERE
80 81
             m.item_type = 'loc'
81 82
             AND t.`status` = 1
83
+        <if test="answerId != null and answerId != ''">
84
+            AND t.answer_id = #{answerId}
85
+        </if>
82 86
             <if test="checkId != null and checkId != ''">
83 87
                 AND n.check_id = #{checkId}
84 88
             </if>
@@ -100,6 +104,7 @@
100 104
         SELECT
101 105
             t.item_id AS answer_item_id,
102 106
             t.answer_id,
107
+            t.score,
103 108
             m.item_id AS check_item_id,
104 109
             n.check_id,
105 110
             n.title AS check_title,
@@ -122,6 +127,9 @@
122 127
         WHERE
123 128
             m.item_type = 'survey'
124 129
           AND t.`status` = 1
130
+        <if test="answerId != null and answerId != ''">
131
+            AND t.answer_id = #{answerId}
132
+        </if>
125 133
         <if test="checkId != null and checkId != ''">
126 134
             AND n.check_id = #{checkId}
127 135
         </if>
@@ -141,4 +149,30 @@
141 149
     <select id="getSurveyListBy" resultType="com.example.civilizedcity.vo.CheckSurveyAnswer">
142 150
         <include refid="getSurveyAnswers"></include>
143 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 178
 </mapper>