Showing
8 changed files
with
105 additions
and
11 deletions
... | ... | @@ -2,6 +2,7 @@ package com.ash.controller; |
2 | 2 | |
3 | 3 | import com.alibaba.excel.EasyExcel; |
4 | 4 | import com.alibaba.excel.exception.ExcelDataConvertException; |
5 | +import com.ash.base.AshErrorCode; | |
5 | 6 | import com.ash.base.BaseController; |
6 | 7 | import com.ash.base.JsonResult; |
7 | 8 | import com.ash.base.OptionStatus; |
... | ... | @@ -79,6 +80,34 @@ public class CaseController extends BaseController { |
79 | 80 | } |
80 | 81 | } |
81 | 82 | |
83 | + @PostMapping("/detail") | |
84 | + public JsonResult detail(@RequestBody Case data) { | |
85 | + try { | |
86 | + Case caseInfo = caseService.load(data.getId()); | |
87 | + Map<String, CaseAnalysis> analysisMap = caseAnalysisService.listByCaseId(Collections.singletonList(caseInfo.getId())); | |
88 | + caseInfo.setAnalysis(analysisMap.get(caseInfo.getId())); | |
89 | + return new JsonResult(true, OptionStatus.OPT_SUCCESS.getName(), caseInfo); | |
90 | + } catch (Exception ex) { | |
91 | + ex.printStackTrace(); | |
92 | + log.error(ex.getMessage()); | |
93 | + return JsonResult.error(OptionStatus.OPT_ERROR.getName()); | |
94 | + } | |
95 | + } | |
96 | + | |
97 | + @PostMapping("/getNextUnReviewId") | |
98 | + public JsonResult getNextUnReviewId(@RequestBody Case data) { | |
99 | + try { | |
100 | + List<String> dataList = caseService.listUnReview(data.getExceptIds()); | |
101 | + if (CollectionUtils.isEmpty(dataList)) { | |
102 | + return new JsonResult(false, AshErrorCode.NEXT_DATA_EMPTY.getText(), null); | |
103 | + } | |
104 | + return new JsonResult(true, OptionStatus.OPT_SUCCESS.getName(), dataList.get(0)); | |
105 | + } catch (Exception ex) { | |
106 | + ex.printStackTrace(); | |
107 | + log.error(ex.getMessage()); | |
108 | + return JsonResult.error(OptionStatus.OPT_ERROR.getName()); | |
109 | + } | |
110 | + } | |
82 | 111 | |
83 | 112 | @GetMapping(value = "/importTempDownload") |
84 | 113 | public void myExcelDownload(HttpServletResponse response) throws IOException { |
... | ... | @@ -172,7 +201,7 @@ public class CaseController extends BaseController { |
172 | 201 | CaseExportExcelData ed = new CaseExportExcelData(); |
173 | 202 | BeanUtils.copyProperties(e, ed); |
174 | 203 | CaseAnalysis analysis = e.getAnalysis(); |
175 | - if(analysis!=null){ | |
204 | + if (analysis != null) { | |
176 | 205 | ed.setArea(analysis.getArea()); |
177 | 206 | ed.setCounty(analysis.getCounty()); |
178 | 207 | ed.setTotalAmount(analysis.getTotalAmount()); | ... | ... |
... | ... | @@ -2,9 +2,7 @@ package com.ash.controller; |
2 | 2 | |
3 | 3 | import com.alibaba.excel.EasyExcel; |
4 | 4 | import com.alibaba.excel.exception.ExcelDataConvertException; |
5 | -import com.ash.base.BaseController; | |
6 | -import com.ash.base.JsonResult; | |
7 | -import com.ash.base.OptionStatus; | |
5 | +import com.ash.base.*; | |
8 | 6 | import com.ash.base.excelOpt.ExcelErrorMessage; |
9 | 7 | import com.ash.entity.Case; |
10 | 8 | import com.ash.entity.FileData; |
... | ... | @@ -89,6 +87,35 @@ public class WarningInstanceController extends BaseController { |
89 | 87 | } |
90 | 88 | } |
91 | 89 | |
90 | + @PostMapping("/detail") | |
91 | + public JsonResult detail(@RequestBody WarningInstance warningInstance) { | |
92 | + try { | |
93 | + WarningInstance data = warningInstanceService.load(warningInstance.getId()); | |
94 | + Map<String, WarningInstanceAnalysis> wiMap = warningInstanceAnalysisService.listByWiId(Collections.singletonList(data.getId())); | |
95 | + data.setAnalysis(wiMap.get(data.getId())); | |
96 | + return new JsonResult(true, OptionStatus.OPT_SUCCESS.getName(), data); | |
97 | + } catch (Exception ex) { | |
98 | + ex.printStackTrace(); | |
99 | + log.error(ex.getMessage()); | |
100 | + return JsonResult.error(OptionStatus.OPT_ERROR.getName()); | |
101 | + } | |
102 | + } | |
103 | + | |
104 | + @PostMapping("/getNextUnReviewId") | |
105 | + public JsonResult getNextUnReviewId(@RequestBody WarningInstance warningInstance) { | |
106 | + try { | |
107 | + List<String> dataList = warningInstanceService.listUnReview(warningInstance.getExceptIds()); | |
108 | + if (CollectionUtils.isEmpty(dataList)) { | |
109 | + return new JsonResult(false, AshErrorCode.NEXT_DATA_EMPTY.getText(), null); | |
110 | + } | |
111 | + return new JsonResult(true, OptionStatus.OPT_SUCCESS.getName(), dataList.get(0)); | |
112 | + } catch (Exception ex) { | |
113 | + ex.printStackTrace(); | |
114 | + log.error(ex.getMessage()); | |
115 | + return JsonResult.error(OptionStatus.OPT_ERROR.getName()); | |
116 | + } | |
117 | + } | |
118 | + | |
92 | 119 | @GetMapping(value = "/importTempDownload") |
93 | 120 | public void myExcelDownload(HttpServletResponse response) throws IOException { |
94 | 121 | List<WarningInstanceExcelData> list = new ArrayList<>(); | ... | ... |
... | ... | @@ -12,6 +12,7 @@ import lombok.Data; |
12 | 12 | |
13 | 13 | import javax.persistence.Transient; |
14 | 14 | import java.util.Date; |
15 | +import java.util.List; | |
15 | 16 | |
16 | 17 | @Data |
17 | 18 | @TableName(value = "t_ash_case") |
... | ... | @@ -91,4 +92,7 @@ public class Case extends BaseModel { |
91 | 92 | |
92 | 93 | @Transient |
93 | 94 | private transient Integer age; |
95 | + | |
96 | + @Transient | |
97 | + private transient List<String> exceptIds; | |
94 | 98 | } | ... | ... |
... | ... | @@ -12,6 +12,7 @@ import lombok.Data; |
12 | 12 | |
13 | 13 | import javax.persistence.Transient; |
14 | 14 | import java.util.Date; |
15 | +import java.util.List; | |
15 | 16 | |
16 | 17 | @Data |
17 | 18 | @TableName(value = "t_ash_warning_instance") |
... | ... | @@ -155,4 +156,7 @@ public class WarningInstance extends BaseModel { |
155 | 156 | |
156 | 157 | @Transient |
157 | 158 | private transient WarningInstanceAnalysis analysis; |
159 | + | |
160 | + @Transient | |
161 | + private transient List<String> exceptIds; | |
158 | 162 | } | ... | ... |
... | ... | @@ -9,10 +9,7 @@ import com.ash.base.excelOpt.ExcelErrorMessage; |
9 | 9 | import com.ash.entity.Case; |
10 | 10 | import com.ash.entity.CaseAnalysis; |
11 | 11 | import com.ash.entity.dao.CaseMapper; |
12 | -import com.ash.enums.AnalysisStatusEnum; | |
13 | -import com.ash.enums.CaseVictimAgeRangeEnum; | |
14 | -import com.ash.enums.ConformStatusEnum; | |
15 | -import com.ash.enums.LossRangeEnum; | |
12 | +import com.ash.enums.*; | |
16 | 13 | import com.ash.excelData.CaseExcelData; |
17 | 14 | import com.ash.listener.CaseExcelListener; |
18 | 15 | import com.ash.util.*; |
... | ... | @@ -146,6 +143,22 @@ public class CaseService { |
146 | 143 | return caseMapper.selectList(queryWrapper); |
147 | 144 | } |
148 | 145 | |
146 | + | |
147 | + public List<String> listUnReview(List<String> exceptIds) { | |
148 | + QueryWrapper<Case> queryWrapper = new QueryWrapper<>(); | |
149 | + LambdaQueryWrapper<Case> lambda = queryWrapper.lambda(); | |
150 | + lambda.select(Case::getId); | |
151 | + lambda.ne(Case::getReviewStatus, ReviewStatusEnum.UNAUDITED); | |
152 | + if (!CollectionUtils.isEmpty(exceptIds)) { | |
153 | + lambda.notIn(Case::getId, exceptIds); | |
154 | + } | |
155 | + lambda.last("limit 1"); | |
156 | + lambda.orderByDesc(BaseModel::getCreateTime).orderByDesc(Case::getId); | |
157 | + List<Case> warningInstances = caseMapper.selectList(queryWrapper); | |
158 | + return Optional.ofNullable(warningInstances).map(all -> all.stream() | |
159 | + .map(Case::getId).collect(Collectors.toList())).orElse(new ArrayList<>()); | |
160 | + } | |
161 | + | |
149 | 162 | public Page<Case> pageByCondition(Case params, Page<Case> page) { |
150 | 163 | QueryWrapper<Case> queryWrapper = getCondition(params); |
151 | 164 | return caseMapper.selectPage(page, queryWrapper); |
... | ... | @@ -645,7 +658,7 @@ public class CaseService { |
645 | 658 | } |
646 | 659 | } |
647 | 660 | |
648 | - lambda.orderByDesc(BaseModel::getCreateTime, Case::getCode, Case::getId); | |
661 | + lambda.orderByDesc(BaseModel::getCreateTime).orderByDesc(Case::getCode).orderByDesc(Case::getId); | |
649 | 662 | |
650 | 663 | return queryWrapper; |
651 | 664 | } | ... | ... |
... | ... | @@ -57,7 +57,7 @@ public class WarningInstanceAnalysisService { |
57 | 57 | throw new AshException(AshErrorCode.DATA_NOT_EXIST); |
58 | 58 | } |
59 | 59 | |
60 | - int result = warningInstanceAnalysisMapper.updateById(data); | |
60 | + warningInstanceAnalysisMapper.updateById(data); | |
61 | 61 | } |
62 | 62 | |
63 | 63 | public Map<String, WarningInstanceAnalysis> listByWiId(List<String> wiIds) { | ... | ... |
... | ... | @@ -12,6 +12,7 @@ import com.ash.entity.WarningInstanceAnalysis; |
12 | 12 | import com.ash.entity.dao.WarningInstanceMapper; |
13 | 13 | import com.ash.enums.AnalysisStatusEnum; |
14 | 14 | import com.ash.enums.ConformStatusEnum; |
15 | +import com.ash.enums.ReviewStatusEnum; | |
15 | 16 | import com.ash.excelData.WarningInstanceExcelData; |
16 | 17 | import com.ash.listener.WarningInstanceExcelListener; |
17 | 18 | import com.ash.util.*; |
... | ... | @@ -128,6 +129,21 @@ public class WarningInstanceService { |
128 | 129 | return warningInstanceMapper.selectList(queryWrapper); |
129 | 130 | } |
130 | 131 | |
132 | + public List<String> listUnReview(List<String> exceptIds) { | |
133 | + QueryWrapper<WarningInstance> queryWrapper = new QueryWrapper<>(); | |
134 | + LambdaQueryWrapper<WarningInstance> lambda = queryWrapper.lambda(); | |
135 | + lambda.select(WarningInstance::getId); | |
136 | + lambda.ne(WarningInstance::getReviewStatus, ReviewStatusEnum.UNAUDITED); | |
137 | + if (!CollectionUtils.isEmpty(exceptIds)) { | |
138 | + lambda.notIn(WarningInstance::getId, exceptIds); | |
139 | + } | |
140 | + lambda.last("limit 1"); | |
141 | + lambda.orderByDesc(BaseModel::getCreateTime).orderByDesc(WarningInstance::getId); | |
142 | + List<WarningInstance> warningInstances = warningInstanceMapper.selectList(queryWrapper); | |
143 | + return Optional.ofNullable(warningInstances).map(all -> all.stream() | |
144 | + .map(WarningInstance::getId).collect(Collectors.toList())).orElse(new ArrayList<>()); | |
145 | + } | |
146 | + | |
131 | 147 | |
132 | 148 | public Page<WarningInstance> pageByCondition(WarningInstance params, Page<WarningInstance> page) { |
133 | 149 | QueryWrapper<WarningInstance> queryWrapper = getCondition(params); |
... | ... | @@ -368,7 +384,7 @@ public class WarningInstanceService { |
368 | 384 | } |
369 | 385 | } |
370 | 386 | |
371 | - lambda.orderByDesc(BaseModel::getCreateTime, WarningInstance::getCode, WarningInstance::getId); | |
387 | + lambda.orderByDesc(BaseModel::getCreateTime).orderByDesc(WarningInstance::getCode).orderByDesc(WarningInstance::getId); | |
372 | 388 | return queryWrapper; |
373 | 389 | } |
374 | 390 | ... | ... |