|
@@ -34,6 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -59,7 +60,7 @@ public class DemFireStatisticsServiceImpl extends AbstractCrudService<DemFireSta
|
|
|
private DemFireLabelAttributeService demFireLabelAttributeService;
|
|
|
|
|
|
@Override
|
|
|
- public CommonPage<Object> fireAccidentStatistic(String fireNumber, Integer labelId, Integer typeId, Integer id, Integer pageNum, Integer pageSize) {
|
|
|
+ public CommonPage<Object> fireAccidentStatistic(String fireNumber, Integer labelId, Integer classifyId, Integer id, Integer pageNum, Integer pageSize) {
|
|
|
Integer type1 = 0;
|
|
|
Integer type2 = 0;
|
|
|
Integer type3 = 0;
|
|
@@ -72,19 +73,19 @@ public class DemFireStatisticsServiceImpl extends AbstractCrudService<DemFireSta
|
|
|
if (list1.size() > 0) {
|
|
|
switch (list1.get(0).getAttribute()) {
|
|
|
case "typeName1":
|
|
|
- type1 = typeId;
|
|
|
+ type1 = classifyId;
|
|
|
break;
|
|
|
case "typeName2":
|
|
|
- type2 = typeId;
|
|
|
+ type2 = classifyId;
|
|
|
break;
|
|
|
case "typeName3":
|
|
|
- type3 = typeId;
|
|
|
+ type3 = classifyId;
|
|
|
break;
|
|
|
case "typeName4":
|
|
|
- type4 = typeId;
|
|
|
+ type4 = classifyId;
|
|
|
break;
|
|
|
case "typeName5":
|
|
|
- type5 = typeId;
|
|
|
+ type5 = classifyId;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -100,7 +101,7 @@ public class DemFireStatisticsServiceImpl extends AbstractCrudService<DemFireSta
|
|
|
.eq(type1 != null && type1 != 0, DemFireStatistics::getTypeId1, type1)
|
|
|
.eq(type2 != null && type2 != 0, DemFireStatistics::getTypeId2, type2)
|
|
|
.eq(type3 != null && type3 != 0, DemFireStatistics::getTypeId3, type3)
|
|
|
- .eq(type4 != null && type4 != 0, DemFireStatistics::getTypeId5, type4)
|
|
|
+ .eq(type4 != null && type4 != 0, DemFireStatistics::getTypeId4, type4)
|
|
|
.eq(type5 != null && type5 != 0, DemFireStatistics::getTypeId5, type5)
|
|
|
.eq(id != null & id != 0, DemFireStatistics::getId, id)
|
|
|
.orderByDesc(DemFireStatistics::getId);
|
|
@@ -177,6 +178,93 @@ public class DemFireStatisticsServiceImpl extends AbstractCrudService<DemFireSta
|
|
|
return new CommonPage<>(list, page.getTotal(), pageSize, pageNum);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<DemFireStatisticsExportVO> fireAccidentStatisticExport(String fireNumber, Integer labelId, Integer classifyId){
|
|
|
+ List<DemFireStatisticsExportVO> list = new ArrayList<>();
|
|
|
+
|
|
|
+ Integer type1 = 0;
|
|
|
+ Integer type2 = 0;
|
|
|
+ Integer type3 = 0;
|
|
|
+ Integer type4 = 0;
|
|
|
+ Integer type5 = 0;
|
|
|
+ if (labelId != null && labelId != 0) {
|
|
|
+ LambdaQueryWrapper<DemFireLabelAttribute> queryWrapper1 = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper1.eq(DemFireLabelAttribute::getLabelId, labelId);
|
|
|
+ List<DemFireLabelAttribute> list1 = demFireLabelAttributeService.list(queryWrapper1);
|
|
|
+ if (list1.size() > 0) {
|
|
|
+ switch (list1.get(0).getAttribute()) {
|
|
|
+ case "typeName1":
|
|
|
+ type1 = classifyId;
|
|
|
+ break;
|
|
|
+ case "typeName2":
|
|
|
+ type2 = classifyId;
|
|
|
+ break;
|
|
|
+ case "typeName3":
|
|
|
+ type3 = classifyId;
|
|
|
+ break;
|
|
|
+ case "typeName4":
|
|
|
+ type4 = classifyId;
|
|
|
+ break;
|
|
|
+ case "typeName5":
|
|
|
+ type5 = classifyId;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<DemFireStatistics> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(DemFireStatistics::getBurnedArea, DemFireStatistics::getDirectPropertyLoss, DemFireStatistics::getVictimNumber,
|
|
|
+ DemFireStatistics::getInjuredNumber, DemFireStatistics::getDeathToll, DemFireStatistics::getFileCase, DemFireStatistics::getFireGrade,
|
|
|
+ DemFireStatistics::getSubordinateDetachment, DemFireStatistics::getAdministrativeDivision, DemFireStatistics::getFireNumber,
|
|
|
+ DemFireStatistics::getFireAddress, DemFireStatistics::getFireTime, DemFireStatistics::getId, DemFireStatistics::getTypeId1,
|
|
|
+ DemFireStatistics::getTypeId2, DemFireStatistics::getTypeId3, DemFireStatistics::getTypeId4, DemFireStatistics::getTypeId5)
|
|
|
+ .like(StringUtils.isNotBlank(fireNumber), DemFireStatistics::getFireNumber, fireNumber)
|
|
|
+ .eq(type1 != null && type1 != 0, DemFireStatistics::getTypeId1, type1)
|
|
|
+ .eq(type2 != null && type2 != 0, DemFireStatistics::getTypeId2, type2)
|
|
|
+ .eq(type3 != null && type3 != 0, DemFireStatistics::getTypeId3, type3)
|
|
|
+ .eq(type4 != null && type4 != 0, DemFireStatistics::getTypeId4, type4)
|
|
|
+ .eq(type5 != null && type5 != 0, DemFireStatistics::getTypeId5, type5)
|
|
|
+ .orderByDesc(DemFireStatistics::getId);
|
|
|
+ List<DemFireStatistics> fireStatisticsList = this.list(queryWrapper);
|
|
|
+ if(CollectionUtils.isNotEmpty(fireStatisticsList)){
|
|
|
+ List<String> fireNumberList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < fireStatisticsList.size(); i++) {
|
|
|
+ fireNumberList.add(fireStatisticsList.get(i).getFireNumber());
|
|
|
+ }
|
|
|
+ List<DemFireStatisticsAttach> demFireStatisticsAttaches = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(fireNumberList)) {
|
|
|
+ demFireStatisticsAttaches = demFireStatisticsAttachService.fireAccidentStatistic(fireNumberList);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<DemFileLabel> demFileLabels = demFileLabelService.demFileLabelList(null, null, null);
|
|
|
+ for (int i = 0; i < fireStatisticsList.size(); i++) {
|
|
|
+ DemFireStatisticsExportVO demFireStatisticsExportVO = new DemFireStatisticsExportVO();
|
|
|
+ demFireStatisticsExportVO.setFireNumber(fireStatisticsList.get(i).getFireNumber());
|
|
|
+ demFireStatisticsExportVO.setFireAddress(fireStatisticsList.get(i).getFireAddress());
|
|
|
+ demFireStatisticsExportVO.setFireTime((fireStatisticsList.get(i).getFireTime()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
+ demFireStatisticsExportVO.setFireCause(null);
|
|
|
+ demFireStatisticsExportVO.setFireSite(null);
|
|
|
+ for (int j = 0; j < demFireStatisticsAttaches.size(); j++) {
|
|
|
+ if (fireStatisticsList.get(i).getFireNumber().equals(demFireStatisticsAttaches.get(j).getFireNumber())) {
|
|
|
+ demFireStatisticsExportVO.setFireCause(demFireStatisticsAttaches.get(j).getFireCauseType1());
|
|
|
+ demFireStatisticsExportVO.setFireSite(demFireStatisticsAttaches.get(j).getFireSiteType1());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ demFireStatisticsExportVO.setDirectPropertyLoss(fireStatisticsList.get(i).getDirectPropertyLoss());
|
|
|
+ demFireStatisticsExportVO.setBurnedArea(fireStatisticsList.get(i).getBurnedArea());
|
|
|
+ demFireStatisticsExportVO.setVictimNumber(fireStatisticsList.get(i).getVictimNumber());
|
|
|
+ demFireStatisticsExportVO.setInjuredNumber(fireStatisticsList.get(i).getInjuredNumber());
|
|
|
+ demFireStatisticsExportVO.setDeathToll(fireStatisticsList.get(i).getDeathToll());
|
|
|
+ demFireStatisticsExportVO.setFileCase(fireStatisticsList.get(i).getFileCase());
|
|
|
+ demFireStatisticsExportVO.setFireGrade(fireStatisticsList.get(i).getFireGrade());
|
|
|
+ demFireStatisticsExportVO.setSubordinateDetachment(fireStatisticsList.get(i).getSubordinateDetachment());
|
|
|
+ demFireStatisticsExportVO.setAdministrativeDivision(fireStatisticsList.get(i).getAdministrativeDivision());
|
|
|
+ list.add(demFireStatisticsExportVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public void addLabel(DemFileLabel demFileLabel) {
|