From 6d0b2b2d93eab87b246c05a2a217ab16357e5f01 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: Fri, 12 Aug 2022 14:33:52 +0800
Subject: [PATCH] 目标fix
---
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java | 59 +++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java
index 3bab61d..72b5683 100644
--- a/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java
+++ b/incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java
@@ -14,16 +14,19 @@
import com.gkhy.safePlatform.incidentManage.exception.AccidentException;
import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentReportFileReqDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentReportReqDTO;
-import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentReportDetailRespDTO;
-import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentReportFileRespDTO;
-import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentReportPageRespDTO;
+import com.gkhy.safePlatform.incidentManage.model.dto.resp.*;
import com.gkhy.safePlatform.incidentManage.query.AccidentReportQuery;
+import com.gkhy.safePlatform.incidentManage.query.AccidentReportRPCQuery;
import com.gkhy.safePlatform.incidentManage.query.db.AccidentReportDBQuery;
+import com.gkhy.safePlatform.incidentManage.query.db.AccidentReportRPCDBQuery;
import com.gkhy.safePlatform.incidentManage.service.AccidentReportService;
+import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressFileInfoService;
import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentExpressInfoService;
import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentReportFileInfoService;
import com.gkhy.safePlatform.incidentManage.service.baseService.AccidentReportInfoService;
+import com.gkhy.safePlatform.incidentManage.utils.TimeUtils;
import org.apache.dubbo.config.annotation.DubboReference;
+import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -46,6 +49,9 @@
@Autowired
private AccidentExpressInfoService accidentExpressInfoService;
+
+ @Autowired
+ private AccidentExpressFileInfoService accidentExpressFileInfoService;
@Override
@@ -105,7 +111,6 @@
accidentReportInfo.setDelFlag(false);
accidentReportInfo.setCreateUid(uid);
accidentReportInfo.setGmtCreate(nowDate);
- accidentReportInfo.setStatus(false);
accidentReportInfoService.addAccidentReport(accidentReportInfo);
//2.新增事故报告附件
if (!CollectionUtils.isEmpty(accidentReportReqDTO.getFileList())) {
@@ -136,12 +141,20 @@
throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NOT_EXIST);
} else {
BeanUtils.copyProperties(AccidentReportInfoDetailDO, AccidentReportDetailRespDTO);
- //查找对应的附件
+ //查找事故报告对应的附件
List<AccidentReportFileInfoDO> AccidentReportFileInfoDOList = accidentReportFileInfoService.selectByAccidentReportId(id);
if (!CollectionUtils.isEmpty(AccidentReportFileInfoDOList)) {
List<AccidentReportFileRespDTO> accidentReportFileRespDTOList = BeanCopyUtils.copyBeanList(AccidentReportFileInfoDOList, AccidentReportFileRespDTO.class);
AccidentReportDetailRespDTO.setFileList(accidentReportFileRespDTOList);
}
+ // 查找事故快报对应的附件
+ List<AccidentExpressFileInfoDO> AccidentExpressFileInfoDOList = accidentExpressFileInfoService.selectByAccidentExpressId(AccidentReportDetailRespDTO.getAccidentExpressId());
+ if (!CollectionUtils.isEmpty(AccidentExpressFileInfoDOList)) {
+ List<AccidentExpressFileRespDTO> accidentExpressFileRespDTOList = BeanCopyUtils.copyBeanList(AccidentExpressFileInfoDOList, AccidentExpressFileRespDTO.class);
+ AccidentReportDetailRespDTO.setExpressFileList(accidentExpressFileRespDTOList);
+ }
+
+
return new ResultVO<>(ResultCodes.OK, AccidentReportDetailRespDTO);
}
}
@@ -208,17 +221,18 @@
@Override
- public ResultVO batchDeleteAccidentReport(String ids) {
- if (StringUtils.isBlank(ids)) {
+ public ResultVO batchDeleteAccidentReport(Long[] ids) {
+ if (ids == null || ids.length==0){
throw new AccidentException(AccidentResultCodes.ACCIDENT_REPORT_NULL);
} else {
- String[] idArr = ids.split(",");
- for (String id : idArr) {
- deleteAccidentReport(Long.valueOf(id));
+
+ for (Long id : ids){
+ deleteAccidentReport(id);
}
return new ResultVO(ResultCodes.OK);
}
}
+
private void deleteAccidentReport(Long id) {
//查询是否存在
@@ -298,4 +312,29 @@
}
}
+ @Override
+ public ResultVO<List<AccidentReportCountRespDTO>> countAccidentReport(AccidentReportRPCQuery query) {
+
+ List<AccidentReportCount> list = new ArrayList<>();
+ AccidentReportRPCDBQuery dbQuery = new AccidentReportRPCDBQuery();
+ if (query.getType()==1){
+ // 月
+ int year = query.getYear();
+ int month = query.getMonth();
+ dbQuery.setStartTime(TimeUtils.getMonthFirst(year,month));
+ dbQuery.setEndTime(TimeUtils.getMonthLast(year,month));
+ list = accidentReportInfoService.selectByTimeAndType(dbQuery);
+ }
+ if (query.getType()==2){
+ // 年
+ int year = query.getYear();
+ dbQuery.setStartTime(TimeUtils.getYearFirst(year));
+ dbQuery.setEndTime(TimeUtils.getYearLast(year));
+ list = accidentReportInfoService.selectByTimeAndType(dbQuery);
+ }
+
+ List<AccidentReportCountRespDTO> accidentReportCountRespDTOList = BeanCopyUtils.copyBeanList(list,AccidentReportCountRespDTO.class);
+ return new ResultVO<>(ResultCodes.OK,accidentReportCountRespDTOList);
+ }
+
}
--
Gitblit v1.9.2