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