Yansen 2 년 전
부모
커밋
6bed8e7ab8

+ 6
- 2
src/main/java/com/example/civilizedcity/common/DateUtils.java 파일 보기

@@ -35,8 +35,12 @@ public class DateUtils {
35 35
     }
36 36
 
37 37
     public static String localDateTimeToString(LocalDateTime d) {
38
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
39
-        return d.format(formatter);
38
+        return toString(d, "yyyy-MM-dd HH:mm:ss");
39
+    }
40
+
41
+    public static String toString(LocalDateTime d, String formatter) {
42
+        DateTimeFormatter df = DateTimeFormatter.ofPattern(formatter);
43
+        return d.format(df);
40 44
     }
41 45
 
42 46
     public static LocalDateTime fromString(String str, String formatter) {

+ 39
- 0
src/main/java/com/example/civilizedcity/common/excel/LocalDateTimeConverter.java 파일 보기

@@ -0,0 +1,39 @@
1
+package com.example.civilizedcity.common.excel;
2
+
3
+import com.alibaba.excel.converters.Converter;
4
+import com.alibaba.excel.enums.CellDataTypeEnum;
5
+import com.alibaba.excel.metadata.GlobalConfiguration;
6
+import com.alibaba.excel.metadata.data.WriteCellData;
7
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
8
+import com.example.civilizedcity.common.DateUtils;
9
+
10
+import java.time.LocalDateTime;
11
+
12
+public class LocalDateTimeConverter implements Converter<LocalDateTime> {
13
+    @Override
14
+    public Class supportJavaTypeKey() {
15
+        return LocalDateTime.class;
16
+    }
17
+
18
+    @Override
19
+    public CellDataTypeEnum supportExcelTypeKey() {
20
+        return CellDataTypeEnum.STRING;
21
+    }
22
+
23
+    /**
24
+     * 写 Excel
25
+     * @param value
26
+     * @param contentProperty
27
+     * @param globalConfiguration
28
+     * @return
29
+     * @throws Exception
30
+     */
31
+    @Override
32
+    public WriteCellData<?> convertToExcelData(LocalDateTime value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
33
+        if (null == value) return null;
34
+
35
+        String val = DateUtils.toString(value, "yyyy-MM-dd");
36
+
37
+        return new WriteCellData<String>(val);
38
+    }
39
+}

+ 44
- 0
src/main/java/com/example/civilizedcity/common/excel/SexConverter.java 파일 보기

@@ -0,0 +1,44 @@
1
+package com.example.civilizedcity.common.excel;
2
+
3
+import com.alibaba.excel.converters.Converter;
4
+import com.alibaba.excel.enums.CellDataTypeEnum;
5
+import com.alibaba.excel.metadata.GlobalConfiguration;
6
+import com.alibaba.excel.metadata.data.WriteCellData;
7
+import com.alibaba.excel.metadata.property.ExcelContentProperty;
8
+
9
+import java.text.SimpleDateFormat;
10
+
11
+public class SexConverter implements Converter<String> {
12
+    @Override
13
+    public Class supportJavaTypeKey() {
14
+        return String.class;
15
+    }
16
+
17
+    @Override
18
+    public CellDataTypeEnum supportExcelTypeKey() {
19
+        return CellDataTypeEnum.STRING;
20
+    }
21
+
22
+    /**
23
+     * 写 Excel
24
+     * @param value
25
+     * @param contentProperty
26
+     * @param globalConfiguration
27
+     * @return
28
+     * @throws Exception
29
+     */
30
+    @Override
31
+    public WriteCellData<?> convertToExcelData(String value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
32
+        if (null == value) return null;
33
+
34
+        String val = "-";
35
+
36
+        if ("1".equals(value)) {
37
+            val = "男";
38
+        } else if ("2".equals(value)) {
39
+            val = "女";
40
+        }
41
+
42
+        return new WriteCellData<String>(val);
43
+    }
44
+}

+ 33
- 5
src/main/java/com/example/civilizedcity/controller/TaCheckAnswerController.java 파일 보기

@@ -1,6 +1,5 @@
1 1
 package com.example.civilizedcity.controller;
2 2
 
3
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 5
 import com.example.civilizedcity.common.BaseController;
@@ -10,7 +9,9 @@ import com.example.civilizedcity.common.ResponseBean;
10 9
 
11 10
 import java.util.List;
12 11
 
12
+import com.example.civilizedcity.vo.CheckLoc;
13 13
 import com.example.civilizedcity.vo.CheckLocAnswer;
14
+import com.example.civilizedcity.vo.CheckSurvey;
14 15
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
15 16
 import io.swagger.annotations.Api;
16 17
 import io.swagger.annotations.ApiOperation;
@@ -39,7 +40,7 @@ public class TaCheckAnswerController extends BaseController {
39 40
     /**
40 41
      * 通过ID查询单条数据
41 42
      *
42
-     * @param answerId 主键
43
+     * @param id 主键
43 44
      * @return 实例对象
44 45
      */
45 46
     @ApiOperation("通过ID查询单条数据")
@@ -63,16 +64,43 @@ public class TaCheckAnswerController extends BaseController {
63 64
                              @ApiParam("测评ID") @RequestParam(value = "checkId") String checkId,
64 65
                              @ApiParam("点位ID") @RequestParam(value = "typeId", required = false) String typeId,
65 66
                              @ApiParam("社区") @RequestParam(value = "communityName", required = false) String communityName,
66
-                             @ApiParam("答卷类型") @RequestParam(value = "addr", required = false) String addr) throws Exception {
67
+                             @ApiParam("答卷类型") @RequestParam(value = "addr", required = false) String addr,
68
+                             @ApiParam("答题人") @RequestParam(value = "userName", required = false) String userName) throws Exception {
67 69
 
68 70
         IPage<TaCheckAnswer> page = new Page<>(pageNum, pageSize);
69 71
 
70
-        page = taCheckAnswerService.getPageBy(page, checkId, itemType, typeId, communityName, addr);
72
+        page = taCheckAnswerService.getPageBy(page, checkId, itemType, typeId, communityName, addr, userName);
71 73
 
72 74
         return ResponseBean.success(page);
73 75
     }
74 76
 
75 77
 
78
+    /**
79
+     * 答题详情导出
80
+     *
81
+     * @return 查询结果
82
+     */
83
+    @ApiOperation("答题详情导出")
84
+    @PostMapping("/taCheckAnswer/export")
85
+    public ResponseBean export(@ApiParam("答卷类型") @RequestParam(value = "itemType") String itemType,
86
+                               @ApiParam("测评ID") @RequestParam(value = "checkId") String checkId,
87
+                               @ApiParam("点位ID") @RequestParam(value = "typeId", required = false) String typeId,
88
+                               @ApiParam("社区") @RequestParam(value = "communityName", required = false) String communityName,
89
+                               @ApiParam("答卷类型") @RequestParam(value = "addr", required = false) String addr,
90
+                               @ApiParam("答题人") @RequestParam(value = "userName", required = false) String userName,
91
+                               HttpServletResponse response) throws Exception {
92
+
93
+        if (Constants.CHECK_OF_SURVEY.equals(itemType)) {
94
+            List<CheckSurvey> list = taCheckAnswerService.getList2By(checkId, itemType, typeId, communityName, addr, userName);
95
+            ExcelUtils.flush(response, CheckSurvey.class, list, "问卷调查答卷");
96
+        } else {
97
+            List<CheckLoc> list = taCheckAnswerService.getListBy(checkId, itemType, typeId, communityName, addr, userName);
98
+            ExcelUtils.flush(response, CheckLoc.class, list, "实地测评答卷");
99
+        }
100
+
101
+        return null;
102
+    }
103
+
76 104
     /**
77 105
      * 分页查询答题详情
78 106
      *
@@ -167,7 +195,7 @@ public class TaCheckAnswerController extends BaseController {
167 195
     /**
168 196
      * 通过主键删除数据
169 197
      *
170
-     * @param answerId 主键
198
+     * @param id 主键
171 199
      * @return 是否成功
172 200
      */
173 201
     @ApiOperation("通过主键删除数据")

+ 108
- 32
src/main/java/com/example/civilizedcity/controller/TaIssueController.java 파일 보기

@@ -10,21 +10,18 @@ import com.example.civilizedcity.common.*;
10 10
 import java.time.LocalDateTime;
11 11
 import java.util.ArrayList;
12 12
 import java.util.List;
13
+import java.util.Optional;
13 14
 
14
-import com.example.civilizedcity.entity.SysUser;
15
-import com.example.civilizedcity.entity.TaAttach;
16
-import com.example.civilizedcity.entity.TaIssueProcess;
17
-import com.example.civilizedcity.service.SysUserDutyService;
18
-import com.example.civilizedcity.service.TaAttachService;
19
-import com.example.civilizedcity.service.TaIssueProcessService;
15
+import com.example.civilizedcity.entity.*;
16
+import com.example.civilizedcity.service.*;
20 17
 import io.swagger.annotations.Api;
21 18
 import io.swagger.annotations.ApiOperation;
22 19
 import io.swagger.annotations.ApiParam;
23 20
 import io.swagger.models.auth.In;
24 21
 import org.springframework.beans.factory.annotation.Autowired;
25 22
 import org.springframework.web.bind.annotation.*;
26
-import com.example.civilizedcity.entity.TaIssue;
27
-import com.example.civilizedcity.service.TaIssueService;
23
+
24
+import javax.servlet.http.HttpServletResponse;
28 25
 
29 26
 /**
30 27
  * 问题表;(ta_issue)表控制层
@@ -49,6 +46,9 @@ public class TaIssueController extends BaseController {
49 46
     @Autowired
50 47
     private SysUserDutyService sysUserDutyService;
51 48
 
49
+    @Autowired
50
+    private SysOrgService sysOrgService;
51
+
52 52
     /**
53 53
      * 通过ID查询单条数据
54 54
      *
@@ -67,31 +67,16 @@ public class TaIssueController extends BaseController {
67 67
     }
68 68
 
69 69
     /**
70
-     * 分页查询
71
-     *
72
-     * @param pageNum  当前页码
73
-     * @param pageSize 每页条数
74
-     * @return 查询结果
70
+     * 构造 查询构造器
71
+     * @param sysUser
72
+     * @param bizStatus
73
+     * @param sourceType
74
+     * @param locId
75
+     * @param mine
76
+     * @param orgId
77
+     * @return
75 78
      */
76
-    @ApiOperation("分页查询")
77
-    @GetMapping("/taIssue")
78
-    public ResponseBean list(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
79
-                             @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
80
-                             @ApiParam("问题单状态") @RequestParam(value = "bizStatus", required = false) String bizStatus,
81
-                             @ApiParam("来源") @RequestParam(value = "sourceType", required = false) String sourceType,
82
-                             @ApiParam("点位") @RequestParam(value = "locId", required = false) String locId,
83
-                             @ApiParam("我的") @RequestParam(value = "mine", defaultValue = "false") Boolean mine,
84
-                             @ApiParam("责任单位") @RequestParam(value = "orgId", required = false) String orgId) throws Exception {
85
-
86
-        SysUser sysUser = currentUser();
87
-        boolean isRooter = Constants.ROOT_ID.equals(sysUser.getUserId());
88
-
89
-        List<String> dutyList = sysUserDutyService.getListByUser(sysUser.getUserId());
90
-        if (!isRooter && (dutyList == null || dutyList.size() < 1)) {
91
-            return ResponseBean.error("暂无权限查询数据");
92
-        }
93
-
94
-        IPage<TaIssue> pg = new Page<>(pageNum, pageSize);
79
+    private QueryWrapper<TaIssue> buildQuery(SysUser sysUser, String bizStatus, String sourceType, String locId, Boolean mine, String orgId) {
95 80
         QueryWrapper<TaIssue> queryWrapper = new QueryWrapper<>();
96 81
 
97 82
         if (Constants.PROCESS_START.equals(bizStatus)) {
@@ -126,11 +111,102 @@ public class TaIssueController extends BaseController {
126 111
         queryWrapper.ne(!Constants.SOURCE_FEEDBACK.equals(sourceType), "source_type", Constants.SOURCE_FEEDBACK);
127 112
         queryWrapper.gt("status", Constants.STATUS_DELETE);
128 113
         queryWrapper.orderByDesc("create_date");
114
+
115
+        return queryWrapper;
116
+    }
117
+
118
+    /**
119
+     * 分页查询
120
+     *
121
+     * @param pageNum  当前页码
122
+     * @param pageSize 每页条数
123
+     * @return 查询结果
124
+     */
125
+    @ApiOperation("分页查询")
126
+    @GetMapping("/taIssue")
127
+    public ResponseBean list(@ApiParam("页码") @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
128
+                             @ApiParam("单页数据量") @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
129
+                             @ApiParam("问题单状态") @RequestParam(value = "bizStatus", required = false) String bizStatus,
130
+                             @ApiParam("来源") @RequestParam(value = "sourceType", required = false) String sourceType,
131
+                             @ApiParam("点位") @RequestParam(value = "locId", required = false) String locId,
132
+                             @ApiParam("我的") @RequestParam(value = "mine", defaultValue = "false") Boolean mine,
133
+                             @ApiParam("责任单位") @RequestParam(value = "orgId", required = false) String orgId) throws Exception {
134
+
135
+        SysUser sysUser = currentUser();
136
+        boolean isRooter = Constants.ROOT_ID.equals(sysUser.getUserId());
137
+
138
+        List<String> dutyList = sysUserDutyService.getListByUser(sysUser.getUserId());
139
+        if (!isRooter && (dutyList == null || dutyList.size() < 1)) {
140
+            return ResponseBean.error("暂无权限查询数据");
141
+        }
142
+
143
+        IPage<TaIssue> pg = new Page<>(pageNum, pageSize);
144
+        QueryWrapper<TaIssue> queryWrapper = buildQuery(sysUser, bizStatus, sourceType, locId, mine, orgId);
129 145
         IPage<TaIssue> result = taIssueService.page(pg, queryWrapper);
130 146
 
131 147
         return ResponseBean.success(result);
132 148
     }
133 149
 
150
+
151
+    /**
152
+     * 导出
153
+     *
154
+     * @param pageNum  当前页码
155
+     * @param pageSize 每页条数
156
+     * @return 查询结果
157
+     */
158
+    @ApiOperation("导出")
159
+    @PostMapping("/taIssue/export")
160
+    public ResponseBean export(@ApiParam("问题单状态") @RequestParam(value = "bizStatus", required = false) String bizStatus,
161
+                               @ApiParam("来源") @RequestParam(value = "sourceType", required = false) String sourceType,
162
+                               @ApiParam("点位") @RequestParam(value = "locId", required = false) String locId,
163
+                               @ApiParam("我的") @RequestParam(value = "mine", defaultValue = "false") Boolean mine,
164
+                               @ApiParam("责任单位") @RequestParam(value = "orgId", required = false) String orgId,
165
+                               HttpServletResponse response) throws Exception {
166
+
167
+        SysUser sysUser = currentUser();
168
+        boolean isRooter = Constants.ROOT_ID.equals(sysUser.getUserId());
169
+
170
+        List<String> dutyList = sysUserDutyService.getListByUser(sysUser.getUserId());
171
+        if (!isRooter && (dutyList == null || dutyList.size() < 1)) {
172
+            return ResponseBean.error("暂无权限查询数据");
173
+        }
174
+
175
+        QueryWrapper<TaIssue> queryWrapper = buildQuery(sysUser, bizStatus, sourceType, locId, mine, orgId);
176
+        List<TaIssue> list = taIssueService.list(queryWrapper);
177
+
178
+        if (null != list && list.size() > 0) {
179
+            List<SysOrg> orgList = sysOrgService.list();
180
+            for (TaIssue taIssue : list) {
181
+
182
+                // 转换机构
183
+                if (StringUtils.isNotEmpty(taIssue.getOrgId())) {
184
+                    Optional<SysOrg> sysOrg = orgList.stream().filter(x -> x.getOrgId().equals(taIssue.getOrgId())).findFirst();
185
+                    if (sysOrg.isPresent()) {
186
+                        taIssue.setOrgId(sysOrg.get().getName());
187
+                    } else {
188
+                        taIssue.setOrgId(null);
189
+                    }
190
+                }
191
+
192
+                // 转换流程状态
193
+                String processNode = taIssue.getProcessNode();
194
+                if (processNode.equals(Constants.PROCESS_START)) {
195
+                    taIssue.setProcessNode("待交办");
196
+                } else if (processNode.equals(Constants.PROCESS_END)) {
197
+                    taIssue.setProcessNode("已办结");
198
+                } else if (StringUtils.isNotEmpty(taIssue.getExpireDate()) && LocalDateTime.now().isAfter(DateUtils.day2LocalDateime(taIssue.getExpireDate()))) {
199
+                    taIssue.setProcessNode("已逾期");
200
+                } else {
201
+                    taIssue.setProcessNode("已交办");
202
+                }
203
+            }
204
+        }
205
+
206
+        ExcelUtils.flush(response, TaIssue.class, list, "问题单列表");
207
+        return null;
208
+    }
209
+
134 210
     /**
135 211
      * 新增数据
136 212
      *

+ 133
- 92
src/main/java/com/example/civilizedcity/entity/TaIssue.java 파일 보기

@@ -1,11 +1,16 @@
1 1
 package com.example.civilizedcity.entity;
2 2
 
3
+import com.alibaba.excel.annotation.ExcelIgnore;
4
+import com.alibaba.excel.annotation.ExcelProperty;
5
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
3 6
 import com.baomidou.mybatisplus.annotation.TableField;
7
+import com.example.civilizedcity.common.excel.LocalDateTimeConverter;
4 8
 import io.swagger.annotations.ApiModel;
5 9
 import io.swagger.annotations.ApiModelProperty;
6 10
 import com.baomidou.mybatisplus.annotation.IdType;
7 11
 import com.baomidou.mybatisplus.annotation.TableName;
8 12
 import com.baomidou.mybatisplus.annotation.TableId;
13
+
9 14
 import java.io.Serializable;
10 15
 import java.time.LocalDateTime;
11 16
 import java.util.Date;
@@ -15,104 +20,140 @@ import lombok.Data;
15 20
 import lombok.EqualsAndHashCode;
16 21
 import lombok.experimental.Accessors;
17 22
 
18
- /**
23
+/**
19 24
  * 问题表;
25
+ *
20 26
  * @author : http://www.chiner.pro
21 27
  * @date : 2022-12-12
22 28
  */
23 29
 @Data
24 30
 @EqualsAndHashCode(callSuper = false)
25 31
 @Accessors(chain = true)
26
-@ApiModel(value = "问题表",description = "")
32
+@ApiModel(value = "问题表", description = "")
27 33
 @TableName("ta_issue")
28
-public class TaIssue implements Serializable,Cloneable{
29
-      /** 问题ID */
30
-      @ApiModelProperty(name = "问题ID",notes = "")
31
-      @TableId(value = "issue_id", type = IdType.AUTO)
32
-      private Integer issueId ;
33
-      /** 标题 */
34
-      @ApiModelProperty(name = "标题",notes = "")
35
-      private String title ;
36
-      /** 所属分类 */
37
-      @ApiModelProperty(name = "所属分类",notes = "")
38
-      private String typeId ;
39
-      /** 分类名称 */
40
-      @ApiModelProperty(name = "分类名称",notes = "")
41
-      private String typeName ;
42
-      /** 点位ID */
43
-      @ApiModelProperty(name = "点位ID",notes = "")
44
-      private String locId ;
45
-       /** 点位名称 */
46
-       @ApiModelProperty(name = "点位名称",notes = "")
47
-       private String locName ;
48
-      /** 定位 */
49
-      @ApiModelProperty(name = "定位",notes = "")
50
-      private String location ;
51
-      /** 具体位置 */
52
-      @ApiModelProperty(name = "具体位置",notes = "")
53
-      private String addr ;
54
-      /** 问题详情 */
55
-      @ApiModelProperty(name = "问题详情",notes = "")
56
-      private String content ;
57
-      /** 流程节点 */
58
-      @ApiModelProperty(name = "流程节点",notes = "")
59
-      private String processNode ;
60
-      /** 处理状态 */
61
-      @ApiModelProperty(name = "处理状态",notes = "")
62
-      private String processStatus ;
63
-       /** 截止时间;YYYY-MM-DD */
64
-       @ApiModelProperty(name = "截止时间",notes = "YYYY-MM-DD")
65
-       private String expireDate ;
66
-     /** 办结时间 */
67
-     @ApiModelProperty(name = "办结时间",notes = "")
68
-     private LocalDateTime endDate ;
69
-      /** 交办次数 */
70
-      @ApiModelProperty(name = "交办次数",notes = "")
71
-      private Integer processNum ;
72
-      /** 责任单位 */
73
-      @ApiModelProperty(name = "责任单位",notes = "")
74
-      private String orgId ;
75
-      /** 来源类型;feedback市民上报,check模拟测评 */
76
-      @ApiModelProperty(name = "来源类型",notes = "feedback市民上报,check模拟测评")
77
-      private String sourceType ;
78
-      /** 来源ID */
79
-      @ApiModelProperty(name = "来源ID",notes = "")
80
-      private String sourceTarget ;
81
-
82
-       /** 当前申请类型 */
83
-       @ApiModelProperty(name = "当前申请类型",notes = "")
84
-       private String applyType ;
85
-       /** 当前申请ID */
86
-       @ApiModelProperty(name = "当前申请ID",notes = "")
87
-       private Integer applyId ;
88
-
89
-       /** 审核状态 */
90
-       @ApiModelProperty(name = "审核状态",notes = "")
91
-       private Integer validateStatus ;
92
-      /** 状态 */
93
-      @ApiModelProperty(name = "状态",notes = "")
94
-      private Integer status ;
95
-      /** 上报人 */
96
-      @ApiModelProperty(name = "上报人",notes = "")
97
-      private String createUser ;
98
-      /** 上报人名称 */
99
-      @ApiModelProperty(name = "上报人名称",notes = "")
100
-      private String userName ;
101
-      /** 上报人身份 */
102
-      @ApiModelProperty(name = "上报人身份",notes = "")
103
-      private String userDuty ;
104
-      /** 创建时间 */
105
-      @ApiModelProperty(name = "创建时间",notes = "")
106
-      private LocalDateTime createDate ;
107
-      /** 更新人 */
108
-      @ApiModelProperty(name = "更新人",notes = "")
109
-      private String updateUser ;
110
-      /** 更新时间 */
111
-      @ApiModelProperty(name = "更新时间",notes = "")
112
-      private LocalDateTime updateDate ;
113
-
114
-
115
-      @TableField(exist = false)
116
-       @ApiModelProperty(name = "文件列表",notes = "")
117
-      private List<TaAttach> attachList;
34
+public class TaIssue implements Serializable, Cloneable {
35
+
36
+    @ExcelIgnore
37
+    @ApiModelProperty(name = "问题ID", notes = "")
38
+    @TableId(value = "issue_id", type = IdType.AUTO)
39
+    private Integer issueId;
40
+
41
+    @ExcelIgnore
42
+    @ApiModelProperty(name = "标题", notes = "")
43
+    private String title;
44
+
45
+    @ExcelIgnore
46
+    @ApiModelProperty(name = "所属分类", notes = "")
47
+    private String typeId;
48
+
49
+    @ExcelIgnore
50
+    @ApiModelProperty(name = "分类名称", notes = "")
51
+    private String typeName;
52
+
53
+    @ExcelIgnore
54
+    @ApiModelProperty(name = "点位ID", notes = "")
55
+    private String locId;
56
+
57
+    @ColumnWidth(30)
58
+    @ExcelProperty(value = "点位", index = 1)
59
+    @ApiModelProperty(name = "点位名称", notes = "")
60
+    private String locName;
61
+
62
+    @ExcelIgnore
63
+    @ApiModelProperty(name = "定位", notes = "")
64
+    private String location;
65
+
66
+    @ColumnWidth(50)
67
+    @ExcelProperty(value = "位置", index = 2)
68
+    @ApiModelProperty(name = "具体位置", notes = "")
69
+    private String addr;
70
+
71
+    @ColumnWidth(80)
72
+    @ExcelProperty(value = "问题详情", index = 3)
73
+    @ApiModelProperty(name = "问题详情", notes = "")
74
+    private String content;
75
+
76
+    @ColumnWidth(20)
77
+    @ExcelProperty(value = "流程状态", index = 5)
78
+    @ApiModelProperty(name = "流程节点", notes = "")
79
+    private String processNode;
80
+
81
+    @ExcelIgnore
82
+    @ApiModelProperty(name = "处理状态", notes = "")
83
+    private String processStatus;
84
+
85
+    @ColumnWidth(30)
86
+    @ExcelProperty(value = "截止时间", index = 6)
87
+    @ApiModelProperty(name = "截止时间", notes = "YYYY-MM-DD")
88
+    private String expireDate;
89
+
90
+    @ExcelIgnore
91
+    @ApiModelProperty(name = "办结时间", notes = "")
92
+    private LocalDateTime endDate;
93
+
94
+    @ColumnWidth(30)
95
+    @ExcelProperty(value = "交办次数", index = 7)
96
+    @ApiModelProperty(name = "交办次数", notes = "")
97
+    private Integer processNum;
98
+    /**
99
+     * 责任单位
100
+     */
101
+    @ColumnWidth(40)
102
+    @ExcelProperty(value = "责任单位", index = 4)
103
+    @ApiModelProperty(name = "责任单位", notes = "")
104
+    private String orgId;
105
+
106
+    @ExcelIgnore
107
+    @ApiModelProperty(name = "来源类型", notes = "feedback市民上报,check模拟测评")
108
+    private String sourceType;
109
+
110
+    @ExcelIgnore
111
+    @ApiModelProperty(name = "来源ID", notes = "")
112
+    private String sourceTarget;
113
+
114
+    @ExcelIgnore
115
+    @ApiModelProperty(name = "当前申请类型", notes = "")
116
+    private String applyType;
117
+
118
+    @ExcelIgnore
119
+    @ApiModelProperty(name = "当前申请ID", notes = "")
120
+    private Integer applyId;
121
+
122
+    @ExcelIgnore
123
+    @ApiModelProperty(name = "审核状态", notes = "")
124
+    private Integer validateStatus;
125
+
126
+    @ExcelIgnore
127
+    @ApiModelProperty(name = "状态", notes = "")
128
+    private Integer status;
129
+
130
+    @ExcelIgnore
131
+    @ApiModelProperty(name = "上报人", notes = "")
132
+    private String createUser;
133
+
134
+    @ExcelIgnore
135
+    @ApiModelProperty(name = "上报人名称", notes = "")
136
+    private String userName;
137
+
138
+    @ExcelIgnore
139
+    @ApiModelProperty(name = "上报人身份", notes = "")
140
+    private String userDuty;
141
+
142
+    @ColumnWidth(30)
143
+    @ExcelProperty(value = "上报日期", index = 0, converter = LocalDateTimeConverter.class)
144
+    @ApiModelProperty(name = "创建时间", notes = "")
145
+    private LocalDateTime createDate;
146
+
147
+    @ExcelIgnore
148
+    @ApiModelProperty(name = "更新人", notes = "")
149
+    private String updateUser;
150
+
151
+    @ExcelIgnore
152
+    @ApiModelProperty(name = "更新时间", notes = "")
153
+    private LocalDateTime updateDate;
154
+
155
+    @ExcelIgnore
156
+    @TableField(exist = false)
157
+    @ApiModelProperty(name = "文件列表", notes = "")
158
+    private List<TaAttach> attachList;
118 159
 }

+ 18
- 1
src/main/java/com/example/civilizedcity/mapper/TaCheckAnswerMapper.java 파일 보기

@@ -2,7 +2,9 @@ package com.example.civilizedcity.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.example.civilizedcity.vo.CheckLoc;
5 6
 import com.example.civilizedcity.vo.CheckLocAnswer;
7
+import com.example.civilizedcity.vo.CheckSurvey;
6 8
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
7 9
 import org.apache.ibatis.annotations.Mapper;
8 10
 import org.apache.ibatis.annotations.Param;
@@ -54,5 +56,20 @@ public interface TaCheckAnswerMapper extends BaseMapper<TaCheckAnswer> {
54 56
                                    @Param("itemType") String itemType,
55 57
                                    @Param("typeId") String typeId,
56 58
                                    @Param("communityName") String communityName,
57
-                                   @Param("addr") String addr);
59
+                                   @Param("addr") String addr,
60
+                                   @Param("userName") String userName);
61
+
62
+    List<CheckLoc> getCheckListBy(@Param("checkId") String checkId,
63
+                                  @Param("itemType") String itemType,
64
+                                  @Param("typeId") String typeId,
65
+                                  @Param("communityName") String communityName,
66
+                                  @Param("addr") String addr,
67
+                                  @Param("userName") String userName);
68
+
69
+    List<CheckSurvey> getCheckList2By(@Param("checkId") String checkId,
70
+                                      @Param("itemType") String itemType,
71
+                                      @Param("typeId") String typeId,
72
+                                      @Param("communityName") String communityName,
73
+                                      @Param("addr") String addr,
74
+                                      @Param("userName") String userName);
58 75
 }

+ 7
- 1
src/main/java/com/example/civilizedcity/service/TaCheckAnswerService.java 파일 보기

@@ -2,7 +2,9 @@ package com.example.civilizedcity.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.example.civilizedcity.entity.TaCheckAnswer;
5
+import com.example.civilizedcity.vo.CheckLoc;
5 6
 import com.example.civilizedcity.vo.CheckLocAnswer;
7
+import com.example.civilizedcity.vo.CheckSurvey;
6 8
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
7 9
 
8 10
 import java.util.List;
@@ -29,5 +31,9 @@ public interface TaCheckAnswerService extends IBaseService<TaCheckAnswer> {
29 31
 
30 32
     List<CheckSurveyAnswer> getSurveyListBy(String checkId, String answerId, String communityName, String addr);
31 33
 
32
-    IPage<TaCheckAnswer> getPageBy(IPage<TaCheckAnswer> page, String checkId, String itemType, String typeId, String communityName, String addr);
34
+    IPage<TaCheckAnswer> getPageBy(IPage<TaCheckAnswer> page, String checkId, String itemType, String typeId, String communityName, String addr, String userName);
35
+
36
+    List<CheckLoc> getListBy(String checkId, String itemType, String typeId, String communityName, String addr, String userName);
37
+
38
+    List<CheckSurvey> getList2By(String checkId, String itemType, String typeId, String communityName, String addr, String userName);
33 39
 }

+ 14
- 2
src/main/java/com/example/civilizedcity/service/impl/TaCheckAnswerServiceImpl.java 파일 보기

@@ -1,7 +1,9 @@
1 1
 package com.example.civilizedcity.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.example.civilizedcity.vo.CheckLoc;
4 5
 import com.example.civilizedcity.vo.CheckLocAnswer;
6
+import com.example.civilizedcity.vo.CheckSurvey;
5 7
 import com.example.civilizedcity.vo.CheckSurveyAnswer;
6 8
 import org.springframework.stereotype.Service;
7 9
 import com.example.civilizedcity.entity.TaCheckAnswer;
@@ -55,7 +57,17 @@ public class TaCheckAnswerServiceImpl extends BaseServiceImpl<TaCheckAnswerMappe
55 57
     }
56 58
 
57 59
     @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);
60
+    public IPage<TaCheckAnswer> getPageBy(IPage<TaCheckAnswer> page, String checkId, String itemType, String typeId, String communityName, String addr, String userName) {
61
+        return baseMapper.getPageBy(page, checkId, itemType, typeId, communityName, addr, userName);
62
+    }
63
+
64
+    @Override
65
+    public List<CheckLoc> getListBy(String checkId, String itemType, String typeId, String communityName, String addr, String userName) {
66
+        return baseMapper.getCheckListBy(checkId, itemType, typeId, communityName, addr, userName);
67
+    }
68
+
69
+    @Override
70
+    public List<CheckSurvey> getList2By(String checkId, String itemType, String typeId, String communityName, String addr, String userName) {
71
+        return baseMapper.getCheckList2By(checkId, itemType, typeId, communityName, addr, userName);
60 72
     }
61 73
 }

+ 18
- 20
src/main/java/com/example/civilizedcity/service/impl/TaCheckItemServiceImpl.java 파일 보기

@@ -107,25 +107,28 @@ public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, T
107 107
         }
108 108
 
109 109
         if (Constants.CHECK_OF_LOC.equals(taCheckItem.getItemType())) {
110
-            // 实地调查, 需要计算当前这份试卷的
110
+            // 实地调查, 需要计算当前这份试卷的
111 111
             double positiveScore = scores[0];
112 112
             double negativeScore = scores[1];
113 113
 
114 114
             // 每份试卷的得分 = 总分 / 份数
115 115
             double maxScore = taCheckItem.getFullScore()  / taCheckItem.getNum();
116
-            double totalScore = negativeScore + positiveScore;
117
-//            double totalScore = maxScore + negativeScore + positiveScore;
116
+            double score = negativeScore + positiveScore;
118 117
 //
119
-//            if (0 > totalScore) {
120
-//                // 如果扣分项太多
121
-//                totalScore = 0.0;
122
-//            }
123
-            if (totalScore > maxScore) {
124
-                // 如果得分超过总分
125
-                totalScore = maxScore;
118
+            if (score > 0) {
119
+                // 没有扣分就是满分
120
+                score = maxScore;
121
+            } else {
122
+                // 有扣分项, 总分 - 扣分
123
+                score = maxScore + score;
124
+            }
125
+
126
+            // 如果得分超过总分
127
+            if (score > maxScore) {
128
+                score = maxScore;
126 129
             }
127 130
 
128
-            taCheckAnswer.setScore(totalScore);
131
+            taCheckAnswer.setScore(score);
129 132
             taCheckAnswerMapper.insert(taCheckAnswer);
130 133
         }
131 134
     }
@@ -159,22 +162,17 @@ public class TaCheckItemServiceImpl extends BaseServiceImpl<TaCheckItemMapper, T
159 162
                 // 如果是填空题, 用户填的应该是数字, 没填就是 0
160 163
                 Double an = StringUtils.isEmpty(item.getAnswer()) ? 0.0 : Double.parseDouble(item.getAnswer());
161 164
                 score = an * qu.getAnScore();
162
-                if (score > qu.getMaxScore()) {
163
-                    score = qu.getMaxScore();
164
-                }
165
-
166
-                score *= sign;
167 165
             } else if (Constants.QU_OF_RADIO.equals(qu.getQuType())) {
168 166
                 // 如果是选择题, 找到对应的答案
169 167
                 standAn = taCheckItemAnMapper.getOneBy(qu.getQuId(), item.getAnswerCode());
170 168
 
171 169
                 score = standAn.getScore();
172
-                if (score > qu.getMaxScore()) {
173
-                    score = qu.getMaxScore();
174
-                }
170
+            }
175 171
 
176
-                score *= sign;
172
+            if (score > qu.getMaxScore()) {
173
+                score = qu.getMaxScore();
177 174
             }
175
+            score *= sign;
178 176
 
179 177
             item.setItemId(StringUtils.uuid());
180 178
             item.setAnswerId(taCheckAnswer.getAnswerId());

+ 7
- 4
src/main/java/com/example/civilizedcity/service/impl/TaCheckServiceImpl.java 파일 보기

@@ -65,22 +65,25 @@ public class TaCheckServiceImpl extends BaseServiceImpl<TaCheckMapper, TaCheck>
65 65
         for (TaCheckItem checkItem : checkItemList) {
66 66
             Double score = taCheckAnswerMapper.sumScore(checkItem.getItemId(), checkItem.getNum());
67 67
             double s = null == score ? 0.0 : score;
68
-            checkItem.setScore(s);
69
-            taCheckItemMapper.updateById(checkItem);
68
+
69
+            double maxScore = checkItem.getFullScore() / checkItem.getNum();
70 70
 
71 71
             // 如果得到正分, 说明试卷得了满分
72 72
             if (s > 0) {
73
-                s = checkItem.getFullScore();
73
+                s = maxScore;
74 74
             }
75 75
 
76 76
             // 如果产生扣分项
77 77
             if (s < 0) {
78
-                s = checkItem.getFullScore() + s;
78
+                s = maxScore + s;
79 79
                 if (s < 0) {
80 80
                     s = 0;
81 81
                 }
82 82
             }
83 83
 
84
+            checkItem.setScore(s);
85
+            taCheckItemMapper.updateById(checkItem);
86
+
84 87
             totalScore += s;
85 88
         }
86 89
 

+ 44
- 0
src/main/java/com/example/civilizedcity/vo/CheckLoc.java 파일 보기

@@ -0,0 +1,44 @@
1
+package com.example.civilizedcity.vo;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import com.example.civilizedcity.common.excel.LocalDateTimeConverter;
6
+import io.swagger.annotations.ApiModel;
7
+import io.swagger.annotations.ApiModelProperty;
8
+import lombok.Data;
9
+
10
+import java.time.LocalDateTime;
11
+
12
+@Data
13
+@ApiModel("实地测评答案")
14
+public class CheckLoc {
15
+    @ColumnWidth(20)
16
+    @ExcelProperty(value = "点位名称", index = 2)
17
+    @ApiModelProperty("点位名称")
18
+    private String typeName;
19
+
20
+    @ColumnWidth(30)
21
+    @ExcelProperty(value = "测评名称", index = 0)
22
+    @ApiModelProperty("测评名称")
23
+    private String checkTitle;
24
+
25
+    @ColumnWidth(60)
26
+    @ExcelProperty(value = "详细地址", index = 3)
27
+    @ApiModelProperty("详细地址")
28
+    private String addr;
29
+
30
+    @ColumnWidth(20)
31
+    @ExcelProperty(value = "答题人", index = 4)
32
+    @ApiModelProperty("作答人")
33
+    private String userName;
34
+
35
+    @ColumnWidth(30)
36
+    @ExcelProperty(value = "答题时间", index = 1, converter = LocalDateTimeConverter.class)
37
+    @ApiModelProperty("作答时间")
38
+    private LocalDateTime createDate;
39
+
40
+    @ColumnWidth(30)
41
+    @ExcelProperty(value = "得分", index = 5)
42
+    @ApiModelProperty("得分")
43
+    private Float score;
44
+}

+ 56
- 0
src/main/java/com/example/civilizedcity/vo/CheckSurvey.java 파일 보기

@@ -0,0 +1,56 @@
1
+package com.example.civilizedcity.vo;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import com.example.civilizedcity.common.excel.LocalDateTimeConverter;
6
+import com.example.civilizedcity.common.excel.SexConverter;
7
+import io.swagger.annotations.ApiModel;
8
+import io.swagger.annotations.ApiModelProperty;
9
+import lombok.Data;
10
+
11
+import java.time.LocalDateTime;
12
+
13
+@Data
14
+@ApiModel("调查问卷答案")
15
+public class CheckSurvey {
16
+
17
+    @ColumnWidth(30)
18
+    @ExcelProperty(value = "社区名称", index = 2)
19
+    @ApiModelProperty("社区名称")
20
+    private String communityName;
21
+
22
+    @ColumnWidth(30)
23
+    @ExcelProperty(value = "小区名称", index = 3)
24
+    @ApiModelProperty("小区名称")
25
+    private String addr;
26
+
27
+    @ColumnWidth(30)
28
+    @ExcelProperty(value = "测评名称", index = 0)
29
+    @ApiModelProperty("测评名称")
30
+    private String checkTitle;
31
+
32
+    @ColumnWidth(20)
33
+    @ExcelProperty(value = "答题人", index = 4)
34
+    @ApiModelProperty("作答人")
35
+    private String userName;
36
+
37
+    @ColumnWidth(30)
38
+    @ExcelProperty(value = "答题时间", index = 1, converter = LocalDateTimeConverter.class)
39
+    @ApiModelProperty("答题时间")
40
+    private LocalDateTime createDate;
41
+
42
+    @ColumnWidth(30)
43
+    @ExcelProperty(value = "受访者性别", index = 5, converter = SexConverter.class)
44
+    @ApiModelProperty("受访者性别")
45
+    private String sex;
46
+
47
+    @ColumnWidth(30)
48
+    @ExcelProperty(value = "受访者年龄段", index = 6)
49
+    @ApiModelProperty("受访者年龄段")
50
+    private String age;
51
+
52
+    @ColumnWidth(30)
53
+    @ExcelProperty(value = "得分", index = 7)
54
+    @ApiModelProperty("得分")
55
+    private Float score;
56
+}

+ 31
- 16
src/main/resources/mapper/TaCheckAnswerMapper.xml 파일 보기

@@ -149,30 +149,45 @@
149 149
     <select id="getSurveyListBy" resultType="com.example.civilizedcity.vo.CheckSurveyAnswer">
150 150
         <include refid="getSurveyAnswers"></include>
151 151
     </select>
152
-    <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaCheckAnswer">
152
+
153
+    <sql id="getCheckList">
153 154
         SELECT
154 155
             t.*,
155 156
             s.type_id,
156
-            s.`name` as type_name
157
+            s.`name` as type_name,
158
+            m.title as check_title
157 159
         FROM
158 160
             ta_check_answer t
159
-                INNER JOIN ta_check_item s ON t.item_id = s.item_id
161
+            INNER JOIN ta_check_item s ON t.item_id = s.item_id
162
+            INNER JOIN ta_check m ON t.check_id = m.check_id
160 163
         WHERE
161 164
             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
165
+            <if test="itemType != null and itemType != ''">
166
+                AND s.item_type = #{itemType}
167
+            </if>
168
+            <if test="typeId != null and typeId != ''">
169
+                AND s.type_id = #{typeId}
170
+            </if>
171
+            <if test="communityName != null and communityName != ''">
172
+                AND t.community_name LIKE CONCAT( #{communityName}, '%' )
173
+            </if>
174
+            <if test="addr != null and addr != ''">
175
+                AND t.addr LIKE CONCAT( #{addr}, '%' )
176
+            </if>
177
+            <if test="userName != null and userName != ''">
178
+                AND t.user_name LIKE CONCAT('%', #{userName}, '%' )
179
+            </if>
180
+            AND t.`status` &gt; - 1
175 181
         ORDER BY
176 182
             t.create_date DESC
183
+    </sql>
184
+    <select id="getPageBy" resultType="com.example.civilizedcity.entity.TaCheckAnswer">
185
+        <include refid="getCheckList"></include>
186
+    </select>
187
+    <select id="getCheckListBy" resultType="com.example.civilizedcity.vo.CheckLoc">
188
+        <include refid="getCheckList"></include>
189
+    </select>
190
+    <select id="getCheckList2By" resultType="com.example.civilizedcity.vo.CheckSurvey">
191
+        <include refid="getCheckList"></include>
177 192
     </select>
178 193
 </mapper>