|
|
@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.hnac.hzims.common.utils.DateUtil; |
|
|
|
import com.hnac.hzims.common.utils.DateUtil; |
|
|
|
|
|
|
|
import com.hnac.hzims.fdp.dto.FDPFaultTableDTO; |
|
|
|
import com.hnac.hzims.fdp.dto.StatisticStatusDTO; |
|
|
|
import com.hnac.hzims.fdp.dto.StatisticStatusDTO; |
|
|
|
|
|
|
|
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity; |
|
|
|
import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient; |
|
|
|
import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient; |
|
|
|
import com.hnac.hzims.fdp.vo.StatisticStatusVO; |
|
|
|
import com.hnac.hzims.fdp.vo.StatisticStatusVO; |
|
|
|
import com.hnac.hzims.operational.access.service.IOperAccessTaskService; |
|
|
|
import com.hnac.hzims.operational.access.service.IOperAccessTaskService; |
|
|
@ -17,6 +19,7 @@ import com.hnac.hzims.operational.duty.service.IImsDutyMainService; |
|
|
|
import com.hnac.hzims.operational.main.common.ExcelData; |
|
|
|
import com.hnac.hzims.operational.main.common.ExcelData; |
|
|
|
import com.hnac.hzims.operational.main.enums.ColumnEnum; |
|
|
|
import com.hnac.hzims.operational.main.enums.ColumnEnum; |
|
|
|
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; |
|
|
|
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; |
|
|
|
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; |
|
|
|
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; |
|
|
|
import com.hnac.hzims.operational.report.service.IOperStationMonthReportService; |
|
|
|
import com.hnac.hzims.operational.report.service.IOperStationMonthReportService; |
|
|
|
import com.hnac.hzims.operational.report.vo.*; |
|
|
|
import com.hnac.hzims.operational.report.vo.*; |
|
|
@ -457,32 +460,38 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
pool.execute(() -> { |
|
|
|
pool.execute(() -> { |
|
|
|
List<FDPRunReportVO> list=new ArrayList<>(); |
|
|
|
List<FDPRunReportVO> list=new ArrayList<>(); |
|
|
|
if (CollectionUtil.isNotEmpty(stationEntityList)) { |
|
|
|
if (CollectionUtil.isNotEmpty(stationEntityList)) { |
|
|
|
StbAnalysisDTO param = new StbAnalysisDTO(); |
|
|
|
FDPFaultTableDTO fdpFaultTableDTO = new FDPFaultTableDTO(); |
|
|
|
param.setStartTime(LocalDateTime.parse(fmt.format(startDate)+" 00:00:00", org.springblade.core.tool.utils.DateUtil.DATETIME_FORMATTER)); |
|
|
|
List<String> stationIds = stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList()); |
|
|
|
param.setEndTime(LocalDateTime.parse(fmt.format(endDate)+" 23:59:59", org.springblade.core.tool.utils.DateUtil.DATETIME_FORMATTER)); |
|
|
|
String[] stationIdArray = new String[stationIds.size()]; |
|
|
|
// param.setStartTime(startDate.atStartOfDay());
|
|
|
|
stationIds.toArray(stationIdArray); |
|
|
|
// param.setEndTime(endDate.at());
|
|
|
|
fdpFaultTableDTO.setStationIds(stationIdArray); |
|
|
|
List<String> collect = stationEntityList.stream().filter(s -> ObjectUtil.isNotEmpty(s.getCode())).map(StationEntity::getCode).collect(Collectors.toList()); |
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
|
|
param.setStations(Arrays.asList("902100000026")); |
|
|
|
fdpFaultTableDTO.setCreateTimeLeft(formatter.format(LocalDateTime.of(startDate, LocalTime.MIN))); |
|
|
|
// param.setPageSize(10);
|
|
|
|
fdpFaultTableDTO.setCreateTimeRight(formatter.format(LocalDateTime.of(endDate, LocalTime.MAX))); |
|
|
|
// param.setPage(0);
|
|
|
|
fdpFaultTableDTO.setPageSize(-1); |
|
|
|
param.setNeedPage(false); |
|
|
|
fdpFaultTableDTO.setPageIndex(-1); |
|
|
|
Result<HzPage<StbAnalysisVO>> result = soeDataClient.pageStbAnalysis(param); |
|
|
|
fdpFaultTableDTO.setSource("auto"); |
|
|
|
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData().getRecords())){ |
|
|
|
fdpFaultTableDTO.setOrderBy("CREATE_TIME"); |
|
|
|
List<StbAnalysisVO> data = result.getData().getRecords(); |
|
|
|
int index=1; |
|
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
|
List<FdpFaultHistoryDataEntity> historyData = diagnoseClient.getHistoryData(fdpFaultTableDTO); |
|
|
|
StbAnalysisVO stbAnalysisVO = data.get(i); |
|
|
|
if (CollectionUtil.isNotEmpty(historyData)) { |
|
|
|
|
|
|
|
Map<String, List<FdpFaultHistoryDataEntity>> listMap = historyData.stream().collect(Collectors.groupingBy(FdpFaultHistoryDataEntity::getFaultId)); |
|
|
|
|
|
|
|
for (Map.Entry<String, List<FdpFaultHistoryDataEntity>> stringListEntry : listMap.entrySet()) { |
|
|
|
FDPRunReportVO fdpRunReportVO=new FDPRunReportVO(); |
|
|
|
FDPRunReportVO fdpRunReportVO=new FDPRunReportVO(); |
|
|
|
fdpRunReportVO.setIndex(i+1); |
|
|
|
List<FdpFaultHistoryDataEntity> fdpFaultHistoryDataEntities = stringListEntry.getValue(); |
|
|
|
fdpRunReportVO.setLastBeginTime(stbAnalysisVO.getTs()); |
|
|
|
FdpFaultHistoryDataEntity fdpFaultHistoryDataEntity = fdpFaultHistoryDataEntities.get(fdpFaultHistoryDataEntities.size() - 1); |
|
|
|
fdpRunReportVO.setContent(stbAnalysisVO.getContent()); |
|
|
|
fdpRunReportVO.setIndex(index); |
|
|
|
fdpRunReportVO.setType(stbAnalysisVO.getFtype()); |
|
|
|
fdpRunReportVO.setLastBeginTime(fdpFaultHistoryDataEntity.getCreateTime()); |
|
|
|
Long count = data.stream().filter(s -> stbAnalysisVO.equals(s.getFaultid())).count(); |
|
|
|
fdpRunReportVO.setType("智能预警"); |
|
|
|
fdpRunReportVO.setNum(count.toString()); |
|
|
|
fdpRunReportVO.setContent(fdpFaultHistoryDataEntity.getName()); |
|
|
|
fdpRunReportVO.setReason(stbAnalysisVO.getFinfo()); |
|
|
|
fdpRunReportVO.setNum(String.valueOf(fdpFaultHistoryDataEntities.size())); |
|
|
|
|
|
|
|
fdpRunReportVO.setReason(fdpFaultHistoryDataEntity.getDiagReason()); |
|
|
|
|
|
|
|
fdpRunReportVO.setAdvise(fdpFaultHistoryDataEntity.getDiagSolution()); |
|
|
|
list.add(fdpRunReportVO); |
|
|
|
list.add(fdpRunReportVO); |
|
|
|
|
|
|
|
index++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
stationReportAllVo.setFdpRunReportVOList(list); |
|
|
|
} |
|
|
|
} |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -498,12 +507,13 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
this.getStationReportConclusionV2(stationReportAllVo, params); |
|
|
|
this.getStationReportConclusionV2(stationReportAllVo, params); |
|
|
|
return stationReportAllVo; |
|
|
|
return stationReportAllVo; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 导出统计月报 |
|
|
|
* 导出统计月报 |
|
|
|
* |
|
|
|
* @param response |
|
|
|
* @param month 月份 |
|
|
|
* @param stationReportAllVO |
|
|
|
* @param stationCode 站点编码 |
|
|
|
* @param deptId |
|
|
|
* @param type 导出类型 |
|
|
|
* @throws Exception |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void exportStationMonthReport(HttpServletResponse response, StationRunReportAllVO stationReportAllVO,Long deptId) throws Exception { |
|
|
|
public void exportStationMonthReport(HttpServletResponse response, StationRunReportAllVO stationReportAllVO,Long deptId) throws Exception { |
|
|
@ -540,6 +550,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
private HashMap<String, Object> getHashMap(StationRunReportAllVO stationReportAllVO, Long deptId) throws IllegalAccessException { |
|
|
|
private HashMap<String, Object> getHashMap(StationRunReportAllVO stationReportAllVO, Long deptId) throws IllegalAccessException { |
|
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
|
map.put("deptName", stationReportAllVO.getStationName()); |
|
|
|
map.put("deptName", stationReportAllVO.getStationName()); |
|
|
|
|
|
|
|
map.put("yearMon", stationReportAllVO.getYearMonth()); |
|
|
|
List<User> userListByRoleAlias = userClient.relationUserListByRoleAlias("200000", deptId, PROJECT_MANAGER).getData(); |
|
|
|
List<User> userListByRoleAlias = userClient.relationUserListByRoleAlias("200000", deptId, PROJECT_MANAGER).getData(); |
|
|
|
if (CollectionUtil.isNotEmpty(userListByRoleAlias)){ |
|
|
|
if (CollectionUtil.isNotEmpty(userListByRoleAlias)){ |
|
|
|
User user = userListByRoleAlias.get(0); |
|
|
|
User user = userListByRoleAlias.get(0); |
|
|
@ -1162,8 +1173,8 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
//巡检任务统计
|
|
|
|
//巡检任务统计
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVo.getInspectReportVOList())) { |
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVo.getInspectReportVOList())) { |
|
|
|
List<RunReportVO> inspectReportVOList = stationReportAllVo.getInspectReportVOList(); |
|
|
|
List<RunReportVO> inspectReportVOList = stationReportAllVo.getInspectReportVOList(); |
|
|
|
int completeInspectTaskNum = inspectReportVOList.stream().filter(vo -> Func.isNotEmpty(vo.getCompleteNum())).mapToInt(RunReportVO::getCompleteNum).sum(); |
|
|
|
int completeInspectTaskNum =inspectReportVOList.stream().filter(vo ->"合计".equals(vo.getUserName())).mapToInt(RunReportVO::getCompleteNum).sum(); |
|
|
|
int incompleteInspectTaskNum = inspectReportVOList.stream().filter(vo -> Func.isNotEmpty(vo.getIncompleteNum())).mapToInt(RunReportVO::getIncompleteNum).sum(); |
|
|
|
int incompleteInspectTaskNum =inspectReportVOList.stream().filter(vo ->"合计".equals(vo.getUserName())).mapToInt(RunReportVO::getIncompleteNum).sum(); |
|
|
|
if (completeInspectTaskNum == 0 && incompleteInspectTaskNum == 0) { |
|
|
|
if (completeInspectTaskNum == 0 && incompleteInspectTaskNum == 0) { |
|
|
|
conclusion.append("3、无巡检任务;\r\n"); |
|
|
|
conclusion.append("3、无巡检任务;\r\n"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -1208,9 +1219,10 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
} |
|
|
|
} |
|
|
|
// 两票
|
|
|
|
// 两票
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVo.getTicketInfoStatisticVOList())) { |
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVo.getTicketInfoStatisticVOList())) { |
|
|
|
int sum = stationReportAllVo.getTicketInfoStatisticVOList().stream().mapToInt(TicketInfoStatisticVO::getTicketInfoNumber).sum(); |
|
|
|
int sum = stationReportAllVo.getTicketInfoStatisticVOList().stream().filter(s->"合计".equals(s.getTicketInfoType())).mapToInt(TicketInfoStatisticVO::getTicketInfoNumber).sum(); |
|
|
|
int qualifiedNum = stationReportAllVo.getTicketInfoStatisticVOList().stream().mapToInt(TicketInfoStatisticVO::getTicketInfoQualifiedNum).sum(); |
|
|
|
int qualifiedNum = stationReportAllVo.getTicketInfoStatisticVOList().stream().filter(s->"合计".equals(s.getTicketInfoType())).mapToInt(TicketInfoStatisticVO::getTicketInfoQualifiedNum).sum(); |
|
|
|
double ticketInfoProportion = new BigDecimal(qualifiedNum / (double) sum * 100).setScale(2, RoundingMode.HALF_DOWN).doubleValue(); |
|
|
|
// double ticketInfoProportion = new BigDecimal(qualifiedNum ).divide(sum,2, RoundingMode.HALF_DOWN).doubleValue();
|
|
|
|
|
|
|
|
double ticketInfoProportion = new BigDecimal(qualifiedNum ).divide(new BigDecimal(sum*100),2, RoundingMode.HALF_DOWN).doubleValue(); |
|
|
|
String phenomenonConclusion = "5、本月开票%s张,合格率%s;"; |
|
|
|
String phenomenonConclusion = "5、本月开票%s张,合格率%s;"; |
|
|
|
conclusion.append(String.format(phenomenonConclusion,sum,ticketInfoProportion)).append(";\r\n"); |
|
|
|
conclusion.append(String.format(phenomenonConclusion,sum,ticketInfoProportion)).append(";\r\n"); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|