|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.hnac.hzims.operational.report.service.impl; |
|
|
|
package com.hnac.hzims.operational.report.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.afterturn.easypoi.word.WordExportUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
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; |
|
|
@ -22,23 +23,33 @@ import com.hnac.hzims.operational.report.vo.*; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
import com.hnac.hzims.operational.util.ExcelUtil; |
|
|
|
import com.hnac.hzims.operational.util.ExcelUtil; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.util.WordUtils; |
|
|
|
import com.hnac.hzims.ticket.allTicket.dto.TicketStatisticDTO; |
|
|
|
import com.hnac.hzims.ticket.allTicket.dto.TicketStatisticDTO; |
|
|
|
import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient; |
|
|
|
import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient; |
|
|
|
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; |
|
|
|
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; |
|
|
|
import com.hnac.hzinfo.inspect.ai.feign.IInspectRobotTaskClient; |
|
|
|
import com.hnac.hzinfo.inspect.ai.feign.IInspectRobotTaskClient; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.inspect.report.feign.IInspectReportClient; |
|
|
|
import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient; |
|
|
|
import com.hnac.hzinfo.inspect.task.feign.IInspectTaskReportClient; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.TaskReportVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.TaskReportVO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.HzPage; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.core.response.Result; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.v5.soe.SoeDataClient; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.v5.soe.dto.StbAnalysisDTO; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.v5.soe.vo.StbAnalysisVO; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.poi.ss.usermodel.HorizontalAlignment; |
|
|
|
import org.apache.poi.ss.usermodel.HorizontalAlignment; |
|
|
|
import org.apache.poi.ss.util.CellRangeAddress; |
|
|
|
import org.apache.poi.ss.util.CellRangeAddress; |
|
|
|
import org.apache.poi.xssf.usermodel.*; |
|
|
|
import org.apache.poi.xssf.usermodel.*; |
|
|
|
|
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.logger.BladeLogger; |
|
|
|
import org.springblade.core.log.logger.BladeLogger; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springblade.system.vo.DeptVO; |
|
|
|
import org.springblade.system.vo.DeptVO; |
|
|
|
import org.springframework.core.io.ClassPathResource; |
|
|
|
import org.springframework.core.io.ClassPathResource; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -47,12 +58,14 @@ import org.springframework.web.context.request.RequestAttributes; |
|
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.math.RoundingMode; |
|
|
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalTime; |
|
|
|
import java.time.LocalTime; |
|
|
@ -63,15 +76,20 @@ import java.util.concurrent.CountDownLatch; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.IntStream; |
|
|
|
import java.util.stream.IntStream; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static com.hnac.hzims.operational.main.constant.MainConstants.PROJECT_MANAGER; |
|
|
|
|
|
|
|
import static org.springblade.core.tool.utils.DateUtil.DATETIME_FORMATTER; |
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class OperStationMonthReportServiceImpl implements IOperStationMonthReportService { |
|
|
|
public class OperStationMonthReportServiceImpl implements IOperStationMonthReportService { |
|
|
|
private final IImsDutyMainService iImsDutyMainService; |
|
|
|
private final IImsDutyMainService iImsDutyMainService; |
|
|
|
private final IOperMaintenanceTaskService operMaintenanceTaskService; |
|
|
|
private final IOperMaintenanceTaskService operMaintenanceTaskService; |
|
|
|
|
|
|
|
private final IInspectReportClient inspectReportClient; |
|
|
|
private final IOperDefectService operDefectService; |
|
|
|
private final IOperDefectService operDefectService; |
|
|
|
private final IOperAccessTaskService operAccessTaskService; |
|
|
|
private final IOperAccessTaskService operAccessTaskService; |
|
|
|
private final IMainSystemMonitoringService mainSystemMonitoringService; |
|
|
|
private final IMainSystemMonitoringService mainSystemMonitoringService; |
|
|
@ -80,18 +98,28 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
private final IInspectRobotTaskClient inspectRobotTaskClient; |
|
|
|
private final IInspectRobotTaskClient inspectRobotTaskClient; |
|
|
|
private final IFdpDiagnoseClient diagnoseClient; |
|
|
|
private final IFdpDiagnoseClient diagnoseClient; |
|
|
|
private final ISysClient sysClient; |
|
|
|
private final ISysClient sysClient; |
|
|
|
|
|
|
|
private final IUserClient userClient; |
|
|
|
private final IInspectTaskReportClient taskReportClient; |
|
|
|
private final IInspectTaskReportClient taskReportClient; |
|
|
|
private final ITicketInfoAllClient ticketInfoAllClient; |
|
|
|
private final ITicketInfoAllClient ticketInfoAllClient; |
|
|
|
private final BladeLogger logger; |
|
|
|
private final BladeLogger logger; |
|
|
|
|
|
|
|
private final SoeDataClient soeDataClient; |
|
|
|
|
|
|
|
|
|
|
|
/**统计月报线程数量**/ |
|
|
|
/** |
|
|
|
|
|
|
|
* 统计月报线程数量 |
|
|
|
|
|
|
|
**/ |
|
|
|
private static final int POOL_QUANTITY = 8; |
|
|
|
private static final int POOL_QUANTITY = 8; |
|
|
|
/**通过线程池异步获取月报各模块内容 主要分为八块内容**/ |
|
|
|
/** |
|
|
|
|
|
|
|
* 通过线程池异步获取月报各模块内容 主要分为八块内容 |
|
|
|
|
|
|
|
**/ |
|
|
|
private static ExecutorService pool = Executors.newFixedThreadPool(POOL_QUANTITY); |
|
|
|
private static ExecutorService pool = Executors.newFixedThreadPool(POOL_QUANTITY); |
|
|
|
|
|
|
|
|
|
|
|
/**统计月报-电站-对内**/ |
|
|
|
/** |
|
|
|
|
|
|
|
* 统计月报-电站-对内 |
|
|
|
|
|
|
|
**/ |
|
|
|
private static final String STATION_REPORT_INSIDE = "2"; |
|
|
|
private static final String STATION_REPORT_INSIDE = "2"; |
|
|
|
/**统计月报-电站-对外**/ |
|
|
|
/** |
|
|
|
|
|
|
|
* 统计月报-电站-对外 |
|
|
|
|
|
|
|
**/ |
|
|
|
private static final String STATION_REPORT_OUTSIDE = "1"; |
|
|
|
private static final String STATION_REPORT_OUTSIDE = "1"; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -124,7 +152,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
|
|
|
|
|
|
|
|
//监控线程执行完后返回结果
|
|
|
|
//监控线程执行完后返回结果
|
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY); |
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY); |
|
|
|
|
|
|
|
long startMillis = System.currentTimeMillis(); |
|
|
|
//电站发电情况
|
|
|
|
//电站发电情况
|
|
|
|
pool.execute(() -> { |
|
|
|
pool.execute(() -> { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -134,19 +162,21 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
powerList.addAll(stationReportVOList); |
|
|
|
powerList.addAll(stationReportVOList); |
|
|
|
}); |
|
|
|
}); |
|
|
|
stationReportAllVo.setStationReportVOList(powerList); |
|
|
|
stationReportAllVo.setStationReportVOList(powerList); |
|
|
|
} |
|
|
|
} finally { |
|
|
|
finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
//值班情况
|
|
|
|
//值班情况
|
|
|
|
pool.execute(() -> { |
|
|
|
pool.execute(() -> { |
|
|
|
try { |
|
|
|
try { |
|
|
|
List<DutyReportVO> dutyReportVOList = iImsDutyMainService.getDutyMainStatisticsByClassId(params); |
|
|
|
// List<DutyReportVO> dutyReportVOList = iImsDutyMainService.getDutyMainStatisticsByClassId(params);
|
|
|
|
stationReportAllVo.setDutyReportVOList(dutyReportVOList); |
|
|
|
// stationReportAllVo.setDutyReportVOList(dutyReportVOList);
|
|
|
|
} |
|
|
|
} finally { |
|
|
|
finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("值班情况耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("值班情况耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
//日常维护
|
|
|
|
//日常维护
|
|
|
@ -154,19 +184,21 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
try { |
|
|
|
try { |
|
|
|
List<MaintenanceReportVO> maintenanceList = operMaintenanceTaskService.getMaintenanceStatisticsByDisposer(params); |
|
|
|
List<MaintenanceReportVO> maintenanceList = operMaintenanceTaskService.getMaintenanceStatisticsByDisposer(params); |
|
|
|
stationReportAllVo.setMaintenanceReportVOList(maintenanceList); |
|
|
|
stationReportAllVo.setMaintenanceReportVOList(maintenanceList); |
|
|
|
} |
|
|
|
} finally { |
|
|
|
finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
//检修
|
|
|
|
//检修
|
|
|
|
pool.execute(() -> { |
|
|
|
pool.execute(() -> { |
|
|
|
try { |
|
|
|
try { |
|
|
|
List<AccessReportVO> accessList = operAccessTaskService.getAccessTaskByDisposer(params); |
|
|
|
// List<AccessRunReportVO> accessList = operAccessTaskService.getAccessTaskByName(params);
|
|
|
|
stationReportAllVo.setAccessReportVOList(accessList); |
|
|
|
// stationReportAllVo.setAccessReportVOList(accessList);
|
|
|
|
} |
|
|
|
} finally { |
|
|
|
finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("检修:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("检修:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
//缺陷
|
|
|
|
//缺陷
|
|
|
@ -174,9 +206,10 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
try { |
|
|
|
try { |
|
|
|
List<DefectReportsVO> defectList = operDefectService.getFaultByFaultCode(params); |
|
|
|
List<DefectReportsVO> defectList = operDefectService.getFaultByFaultCode(params); |
|
|
|
stationReportAllVo.setDefectReportsVOList(defectList); |
|
|
|
stationReportAllVo.setDefectReportsVOList(defectList); |
|
|
|
} |
|
|
|
} finally { |
|
|
|
finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("缺陷:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("缺陷:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
//两票统计
|
|
|
|
//两票统计
|
|
|
@ -189,9 +222,10 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
ticketStatisticDTO.setDeptIds(deptIds); |
|
|
|
ticketStatisticDTO.setDeptIds(deptIds); |
|
|
|
List<TicketInfoStatisticVO> ticketVOS = ticketInfoAllClient.getTicketReportStatistic(ticketStatisticDTO); |
|
|
|
List<TicketInfoStatisticVO> ticketVOS = ticketInfoAllClient.getTicketReportStatistic(ticketStatisticDTO); |
|
|
|
stationReportAllVo.setTicketInfoStatisticVOList(ticketVOS); |
|
|
|
stationReportAllVo.setTicketInfoStatisticVOList(ticketVOS); |
|
|
|
} |
|
|
|
} finally { |
|
|
|
finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
//巡检
|
|
|
|
//巡检
|
|
|
@ -200,9 +234,10 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
List<TaskReportVO> taskReportVOS = taskReportClient.getInspectTaskReport(params); |
|
|
|
List<TaskReportVO> taskReportVOS = taskReportClient.getInspectTaskReport(params); |
|
|
|
this.fillInspectProblem(startDate, endDate, deptIdList, taskReportVOS); |
|
|
|
this.fillInspectProblem(startDate, endDate, deptIdList, taskReportVOS); |
|
|
|
stationReportAllVo.setInspectReportVOList(taskReportVOS); |
|
|
|
stationReportAllVo.setInspectReportVOList(taskReportVOS); |
|
|
|
} |
|
|
|
} finally { |
|
|
|
finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("巡检:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("巡检:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
//智能诊断
|
|
|
|
//智能诊断
|
|
|
@ -262,64 +297,395 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
this.getStationReportConclusion(stationReportAllVo, params); |
|
|
|
this.getStationReportConclusion(stationReportAllVo, params); |
|
|
|
return stationReportAllVo; |
|
|
|
return stationReportAllVo; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public StationRunReportAllVO getStationMonthReportV2(String yearAndMonth, DeptVO deptVO) { |
|
|
|
|
|
|
|
StationRunReportAllVO stationReportAllVo = new StationRunReportAllVO(); |
|
|
|
|
|
|
|
stationReportAllVo.setStationName(deptVO.getDeptName()); |
|
|
|
|
|
|
|
stationReportAllVo.setYearMonth(YearMonth.parse(yearAndMonth).format(DateTimeFormatter.ofPattern("yyyy年MM月"))); |
|
|
|
|
|
|
|
//处理请求参数
|
|
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
|
|
|
|
//使用预定义实例来转换
|
|
|
|
|
|
|
|
DateTimeFormatter fmt = DateTimeFormatter.ISO_LOCAL_DATE; |
|
|
|
|
|
|
|
LocalDate startDate = DateUtil.getFirstDayByYearMonth(yearAndMonth); |
|
|
|
|
|
|
|
LocalDate endDate = DateUtil.getLastDayByYearMonth(yearAndMonth); |
|
|
|
|
|
|
|
params.put("startDate", fmt.format(startDate)); |
|
|
|
|
|
|
|
params.put("endDate", fmt.format(endDate)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Long> deptIdList = new ArrayList<>(); |
|
|
|
|
|
|
|
deptIdList.add(deptVO.getId()); |
|
|
|
|
|
|
|
//获取下属机构
|
|
|
|
|
|
|
|
R<List<Dept>> childDeptListR = sysClient.getDeptChild(deptVO.getId()); |
|
|
|
|
|
|
|
if (childDeptListR.isSuccess() && CollectionUtil.isNotEmpty(childDeptListR.getData())) { |
|
|
|
|
|
|
|
deptIdList.addAll(childDeptListR.getData().stream().map(Dept::getId).collect(Collectors.toList())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
params.put("deptId", deptIdList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取机构及子机构下的站点
|
|
|
|
|
|
|
|
List<StationEntity> stationEntityList = stationService.list(new LambdaQueryWrapper<StationEntity>() {{ |
|
|
|
|
|
|
|
in(StationEntity::getRefDept, deptIdList); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//监控线程执行完后返回结果
|
|
|
|
|
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY); |
|
|
|
|
|
|
|
long startMillis = System.currentTimeMillis(); |
|
|
|
|
|
|
|
//电站发电情况
|
|
|
|
|
|
|
|
pool.execute(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
List<StationRunReportVO> reportVOS = new ArrayList<>(); |
|
|
|
|
|
|
|
String[] yearMon = yearAndMonth.split("-"); |
|
|
|
|
|
|
|
Integer year = Integer.valueOf(yearMon[0]); |
|
|
|
|
|
|
|
Calendar calendar=Calendar.getInstance(); |
|
|
|
|
|
|
|
Integer currentYear = calendar.get(Calendar.YEAR); |
|
|
|
|
|
|
|
if (year>currentYear-3) { |
|
|
|
|
|
|
|
mainSystemMonitoringService.getElectricSituationByRedis(yearAndMonth, reportVOS, stationEntityList); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
stationEntityList.forEach(stationEntity -> { |
|
|
|
|
|
|
|
List<StationRunReportVO> stationReportVOList = mainSystemMonitoringService.getElectricSituationV2(yearAndMonth, stationEntity.getCode()); |
|
|
|
|
|
|
|
reportVOS.addAll(stationReportVOList); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
stationReportAllVo.setStationReportVOList(reportVOS); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
|
|
|
log.error("", e); |
|
|
|
|
|
|
|
System.out.println(e); |
|
|
|
|
|
|
|
}finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
//值班情况
|
|
|
|
|
|
|
|
pool.execute(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
List<DutyRunReportVO> dutyReportVOList = iImsDutyMainService.getDutyMainRunReport(params); |
|
|
|
|
|
|
|
stationReportAllVo.setDutyReportVOList(dutyReportVOList); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("值班情况耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("值班情况耗时:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
//日常维护
|
|
|
|
|
|
|
|
pool.execute(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
List<RunReportVO> maintenanceList = operMaintenanceTaskService.getMaintenanceStatisticsByName(params); |
|
|
|
|
|
|
|
stationReportAllVo.setMaintenanceReportVOList(maintenanceList); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
//巡检
|
|
|
|
|
|
|
|
pool.execute(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
List<RunReportVO> reportVOS=new ArrayList<>(); |
|
|
|
|
|
|
|
List<TaskReportVO> inspectStatisticsByName = inspectReportClient.getInspectStatisticsByName(deptIdList, fmt.format(startDate), fmt.format(endDate)); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(inspectStatisticsByName)) { |
|
|
|
|
|
|
|
for (int i = 0; i < inspectStatisticsByName.size(); i++) { |
|
|
|
|
|
|
|
TaskReportVO taskReportVO = inspectStatisticsByName.get(i); |
|
|
|
|
|
|
|
RunReportVO runReportVO = new RunReportVO(); |
|
|
|
|
|
|
|
runReportVO.setIndex(i+1); |
|
|
|
|
|
|
|
runReportVO.setUserName(taskReportVO.getUserName()); |
|
|
|
|
|
|
|
runReportVO.setCompleteNum(taskReportVO.getCompleteNum()); |
|
|
|
|
|
|
|
runReportVO.setIncompleteNum(taskReportVO.getIncompleteNum()); |
|
|
|
|
|
|
|
runReportVO.setRemark(taskReportVO.getCompleteSituation() + "" + taskReportVO.getIncompleteSituation()); |
|
|
|
|
|
|
|
reportVOS.add(runReportVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
int complete = inspectStatisticsByName.stream().mapToInt(TaskReportVO::getCompleteNum).sum(); |
|
|
|
|
|
|
|
int inComplete = inspectStatisticsByName.stream().mapToInt(TaskReportVO::getIncompleteNum).sum(); |
|
|
|
|
|
|
|
RunReportVO runReportVO = new RunReportVO(); |
|
|
|
|
|
|
|
runReportVO.setUserName("合计"); |
|
|
|
|
|
|
|
runReportVO.setCompleteNum(complete); |
|
|
|
|
|
|
|
runReportVO.setIncompleteNum(inComplete); |
|
|
|
|
|
|
|
reportVOS.add(runReportVO); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
RunReportVO runReportVO = new RunReportVO(); |
|
|
|
|
|
|
|
runReportVO.setUserName("合计"); |
|
|
|
|
|
|
|
runReportVO.setCompleteNum(0); |
|
|
|
|
|
|
|
runReportVO.setIncompleteNum(0); |
|
|
|
|
|
|
|
reportVOS.add(runReportVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
stationReportAllVo.setInspectReportVOList(reportVOS); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
//检修
|
|
|
|
|
|
|
|
pool.execute(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
List<AccessRunReportVO> accessList = operAccessTaskService.getAccessTaskByName(params); |
|
|
|
|
|
|
|
stationReportAllVo.setAccessReportVOList(accessList); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("检修:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("检修:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
//缺陷
|
|
|
|
|
|
|
|
pool.execute(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
List<DefectRunReportsVO> defectList = operDefectService.getDefectByName(params); |
|
|
|
|
|
|
|
stationReportAllVo.setDefectReportsVOList(defectList); |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("缺陷:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("缺陷:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
//两票统计
|
|
|
|
|
|
|
|
pool.execute(() -> { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
String deptIds = deptIdList.stream().map(deptId -> deptId.toString()).collect(Collectors.joining(",")); |
|
|
|
|
|
|
|
TicketStatisticDTO ticketStatisticDTO = new TicketStatisticDTO(); |
|
|
|
|
|
|
|
ticketStatisticDTO.setStartDate(fmt.format(startDate)); |
|
|
|
|
|
|
|
ticketStatisticDTO.setEndDate(fmt.format(endDate)); |
|
|
|
|
|
|
|
ticketStatisticDTO.setDeptIds(deptIds); |
|
|
|
|
|
|
|
List<TicketInfoStatisticVO> ticketVOS = ticketInfoAllClient.getTicketReportStatistic(ticketStatisticDTO); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(ticketVOS)){ |
|
|
|
|
|
|
|
stationReportAllVo.setTicketInfoStatisticVOList(ticketVOS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} finally { |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
log.info("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
System.out.printf("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
//智能诊断
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
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.add(fdpRunReportVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
//所有模板数据获取完成后释放锁
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
countDownLatch.await(); |
|
|
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
logger.error(e.getMessage(), e.toString()); |
|
|
|
|
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//小结
|
|
|
|
|
|
|
|
this.getStationReportConclusionV2(stationReportAllVo, params); |
|
|
|
|
|
|
|
return stationReportAllVo; |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 导出统计月报 |
|
|
|
* 导出统计月报 |
|
|
|
|
|
|
|
* |
|
|
|
* @param month 月份 |
|
|
|
* @param month 月份 |
|
|
|
* @param stationCode 站点编码 |
|
|
|
* @param stationCode 站点编码 |
|
|
|
* @param type 导出类型 |
|
|
|
* @param type 导出类型 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void exportStationMonthReport(String month, String stationCode, String type) { |
|
|
|
public void exportStationMonthReport(HttpServletResponse response, StationRunReportAllVO stationReportAllVO,Long deptId) throws Exception { |
|
|
|
DeptVO deptVO = BeanUtil.copy(sysClient.getDept(Long.parseLong(stationCode)).getData(), DeptVO.class); |
|
|
|
|
|
|
|
StationReportAllVO stationReportAllVO = this.getStationMonthReport(month, deptVO); |
|
|
|
|
|
|
|
Assert.isTrue(ObjectUtil.isNotEmpty(stationReportAllVO), () -> { |
|
|
|
Assert.isTrue(ObjectUtil.isNotEmpty(stationReportAllVO), () -> { |
|
|
|
throw new ServiceException("电站统计月报查询为空"); |
|
|
|
throw new ServiceException("电站统计月报查询为空"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
ExcelData ed = new ExcelData(); |
|
|
|
HashMap<String, Object> map = getHashMap(stationReportAllVO, deptId); |
|
|
|
XSSFWorkbook readWb = ed.getWb(); |
|
|
|
|
|
|
|
XSSFSheet readSheet = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClassPathResource classPathResource = new ClassPathResource("files/运维月度报表内容设计0708.xlsx"); |
|
|
|
|
|
|
|
InputStream inputStream = null; |
|
|
|
XWPFDocument xwpfDocument = WordExportUtil.exportWord07("template/word/stationMonthReport.docx", map); |
|
|
|
XSSFWorkbook wb = null; |
|
|
|
// 下载导出
|
|
|
|
|
|
|
|
String filename = stationReportAllVO.getYearMonth()+stationReportAllVO.getStationName()+"月报"; |
|
|
|
|
|
|
|
// 设置头信息
|
|
|
|
|
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
|
|
|
|
response.setContentType("application/vnd.ms-excel"); |
|
|
|
|
|
|
|
ServletOutputStream outputStream = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
inputStream = classPathResource.getInputStream(); |
|
|
|
//设置xlsx格式
|
|
|
|
wb = new XSSFWorkbook(inputStream); |
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename + ".docx", "UTF-8")); |
|
|
|
|
|
|
|
//创建一个输出流
|
|
|
|
|
|
|
|
outputStream = response.getOutputStream(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//写入数据
|
|
|
|
|
|
|
|
xwpfDocument.write(outputStream); |
|
|
|
|
|
|
|
// 关闭
|
|
|
|
|
|
|
|
outputStream.close(); |
|
|
|
|
|
|
|
xwpfDocument.close(); |
|
|
|
} catch (IOException e) { |
|
|
|
} catch (IOException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
Assert.isTrue(ObjectUtil.isNotEmpty(inputStream) && ObjectUtil.isNotEmpty(wb),()->{ |
|
|
|
} |
|
|
|
throw new ServiceException("站点统计月报excel模板读取失败"); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(STATION_REPORT_OUTSIDE.equals(type)) { |
|
|
|
private HashMap<String, Object> getHashMap(StationRunReportAllVO stationReportAllVO, Long deptId) throws IllegalAccessException { |
|
|
|
readSheet = readWb.getSheet("站长月度报告-对外"); |
|
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
|
readWb.setSheetHidden(1, true); |
|
|
|
map.put("deptName", stationReportAllVO.getStationName()); |
|
|
|
readWb.setSheetHidden(2, true); |
|
|
|
List<User> userListByRoleAlias = userClient.relationUserListByRoleAlias("200000", deptId, PROJECT_MANAGER).getData(); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(userListByRoleAlias)){ |
|
|
|
|
|
|
|
User user = userListByRoleAlias.get(0); |
|
|
|
|
|
|
|
map.put("manager", user.getName()); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
map.put("manager",""); |
|
|
|
} |
|
|
|
} |
|
|
|
else if(STATION_REPORT_INSIDE.equals(type)) { |
|
|
|
//电站发电情况
|
|
|
|
readSheet = readWb.getSheet("站长月度报告-对内"); |
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVO.getStationReportVOList())) { |
|
|
|
readWb.setSheetHidden(0, true); |
|
|
|
ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
|
|
|
readWb.setSheetHidden(2, true); |
|
|
|
List<StationRunReportVO> stationReportVOList = stationReportAllVO.getStationReportVOList(); |
|
|
|
|
|
|
|
for (StationRunReportVO stationRunReportVO : stationReportVOList) { |
|
|
|
|
|
|
|
fillMapByClass(stationRunReportVO, list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("stationReportVOList", list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//值班情况
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVO.getDutyReportVOList())) { |
|
|
|
|
|
|
|
ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
|
|
|
|
|
|
|
List<DutyRunReportVO> dutyReportVOList = stationReportAllVO.getDutyReportVOList(); |
|
|
|
|
|
|
|
for (DutyRunReportVO dutyRunReportVO : dutyReportVOList) { |
|
|
|
|
|
|
|
if ("合计".equals(dutyRunReportVO.getGroupName())){ |
|
|
|
|
|
|
|
ArrayList<HashMap<String, String>> sumList = new ArrayList<>(); |
|
|
|
|
|
|
|
HashMap<String, String> temp=new HashMap<>(); |
|
|
|
|
|
|
|
temp.put("groupName",dutyRunReportVO.getGroupName()); |
|
|
|
|
|
|
|
temp.put("dutyNum",dutyRunReportVO.getDutyNum().toString()); |
|
|
|
|
|
|
|
temp.put("findProblemNum",dutyRunReportVO.getFindProblemNum().toString()); |
|
|
|
|
|
|
|
temp.put("delayChangeShifts",dutyRunReportVO.getDelayChangeShifts().toString()); |
|
|
|
|
|
|
|
temp.put("exceptionChangeShifts",dutyRunReportVO.getExceptionChangeShifts().toString()); |
|
|
|
|
|
|
|
sumList.add(temp); |
|
|
|
|
|
|
|
map.put("dutyReportSum", sumList); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fillMapByClass(dutyRunReportVO,list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("dutyReportVOList", list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//日常维护
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVO.getMaintenanceReportVOList())) { |
|
|
|
|
|
|
|
ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
|
|
|
|
|
|
|
List<RunReportVO> maintenanceReportVOList = stationReportAllVO.getMaintenanceReportVOList(); |
|
|
|
|
|
|
|
for (RunReportVO maintenanceReport : maintenanceReportVOList) { |
|
|
|
|
|
|
|
if ("合计".equals(maintenanceReport.getUserName())){ |
|
|
|
|
|
|
|
ArrayList<HashMap<String, String>> sumList = new ArrayList<>(); |
|
|
|
|
|
|
|
HashMap<String, String> temp=new HashMap<>(); |
|
|
|
|
|
|
|
temp.put("userName",maintenanceReport.getUserName()); |
|
|
|
|
|
|
|
temp.put("completeNum",maintenanceReport.getCompleteNum().toString()); |
|
|
|
|
|
|
|
temp.put("incompleteNum",maintenanceReport.getIncompleteNum().toString()); |
|
|
|
|
|
|
|
temp.put("remark",maintenanceReport.getRemark().toString()); |
|
|
|
|
|
|
|
sumList.add(temp); |
|
|
|
|
|
|
|
map.put("maintenanceSum", sumList); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fillMapByClass(maintenanceReport,list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("maintenanceReportVOList", list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//巡检
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVO.getInspectReportVOList())) { |
|
|
|
|
|
|
|
ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
|
|
|
|
|
|
|
List<RunReportVO> inspectReportVOList = stationReportAllVO.getInspectReportVOList(); |
|
|
|
|
|
|
|
for (RunReportVO inspectReport : inspectReportVOList) { |
|
|
|
|
|
|
|
if ("合计".equals(inspectReport.getUserName())){ |
|
|
|
|
|
|
|
ArrayList<HashMap<String, String>> sumList = new ArrayList<>(); |
|
|
|
|
|
|
|
HashMap<String, String> temp=new HashMap<>(); |
|
|
|
|
|
|
|
temp.put("userName",inspectReport.getUserName()); |
|
|
|
|
|
|
|
temp.put("completeNum",inspectReport.getCompleteNum().toString()); |
|
|
|
|
|
|
|
temp.put("incompleteNum",inspectReport.getIncompleteNum().toString()); |
|
|
|
|
|
|
|
temp.put("remark",""); |
|
|
|
|
|
|
|
sumList.add(temp); |
|
|
|
|
|
|
|
map.put("inspectReportSum", sumList); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fillMapByClass(inspectReportVOList,list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("inspectReportVOList", list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//检修
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVO.getAccessReportVOList())) { |
|
|
|
|
|
|
|
ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
|
|
|
|
|
|
|
List<AccessRunReportVO> accessReportVOList = stationReportAllVO.getAccessReportVOList(); |
|
|
|
|
|
|
|
for (AccessRunReportVO accessRunReportVO : accessReportVOList) { |
|
|
|
|
|
|
|
fillMapByClass(accessRunReportVO, list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("accessReportVOList", list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//缺陷
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVO.getDefectReportsVOList())) { |
|
|
|
|
|
|
|
ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
|
|
|
|
|
|
|
List<DefectRunReportsVO> defectReportsVOList = stationReportAllVO.getDefectReportsVOList(); |
|
|
|
|
|
|
|
for (DefectRunReportsVO defectRunReportsVO : defectReportsVOList) { |
|
|
|
|
|
|
|
fillMapByClass(defectRunReportsVO, list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("defectReportsVOList", list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//两票
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVO.getTicketInfoStatisticVOList())) { |
|
|
|
|
|
|
|
ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
|
|
|
|
|
|
|
List<TicketInfoStatisticVO> ticketInfoStatisticVOList = stationReportAllVO.getTicketInfoStatisticVOList(); |
|
|
|
|
|
|
|
for (TicketInfoStatisticVO ticketInfoStatisticVO : ticketInfoStatisticVOList) { |
|
|
|
|
|
|
|
if (!"合计".equals(ticketInfoStatisticVO.getTicketInfoType())){ |
|
|
|
|
|
|
|
fillMapByClass(ticketInfoStatisticVO, list); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ArrayList<HashMap<String, String>> sumList = new ArrayList<>(); |
|
|
|
|
|
|
|
HashMap<String, String> temp=new HashMap<>(); |
|
|
|
|
|
|
|
temp.put("ticketInfoType",ticketInfoStatisticVO.getTicketInfoType()); |
|
|
|
|
|
|
|
temp.put("ticketInfoNumber",ticketInfoStatisticVO.getTicketInfoNumber().toString()); |
|
|
|
|
|
|
|
temp.put("ticketInfoCompleteNum",ticketInfoStatisticVO.getTicketInfoCompleteNum().toString()); |
|
|
|
|
|
|
|
temp.put("ticketInfoInvalidatedNum",ticketInfoStatisticVO.getTicketInfoInvalidatedNum().toString()); |
|
|
|
|
|
|
|
temp.put("ticketInfoQualifiedNum",ticketInfoStatisticVO.getTicketInfoQualifiedNum().toString()); |
|
|
|
|
|
|
|
temp.put("ticketInfoProportion",ticketInfoStatisticVO.getTicketInfoProportion().toString()); |
|
|
|
|
|
|
|
sumList.add(temp); |
|
|
|
|
|
|
|
map.put("ticketInfoSum", sumList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("ticketInfoStatisticVOList", list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//智能诊断
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVO.getFdpRunReportVOList())) { |
|
|
|
|
|
|
|
ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
|
|
|
|
|
|
|
List<FDPRunReportVO> fdpRunReportVOList = stationReportAllVO.getFdpRunReportVOList(); |
|
|
|
|
|
|
|
for (FDPRunReportVO fdpRunReportVO : fdpRunReportVOList) { |
|
|
|
|
|
|
|
fillMapByClass(fdpRunReportVO, list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put("fdpRunReportVOList", list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//总结
|
|
|
|
|
|
|
|
map.put("suggestion", stationReportAllVO.getSuggestion()); |
|
|
|
|
|
|
|
return map; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fillReport(readSheet,stationReportAllVO,type); |
|
|
|
private static void fillMapByClass(Object object, ArrayList<HashMap<String, Object>> list) throws IllegalAccessException { |
|
|
|
|
|
|
|
Class<?> clazz = object.getClass(); |
|
|
|
// 下载导出
|
|
|
|
HashMap<String, Object> temp=new HashMap<>(); |
|
|
|
RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes(); |
|
|
|
for (Field field : clazz.getDeclaredFields()) { |
|
|
|
HttpServletResponse response = ((ServletRequestAttributes) requestAttributes).getResponse(); |
|
|
|
field.setAccessible(true); |
|
|
|
String fileName = "(" + month + ")站长月度报告"; |
|
|
|
String fieldName = field.getName(); |
|
|
|
try { |
|
|
|
Object value = field.get(object); |
|
|
|
ExcelUtil.exportExcel(readWb,response,fileName); |
|
|
|
temp.put(fieldName, value); |
|
|
|
} catch (IOException e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
list.add(temp); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 填充统计月报 |
|
|
|
* 填充统计月报 |
|
|
|
|
|
|
|
* |
|
|
|
* @param sheet excel sheet |
|
|
|
* @param sheet excel sheet |
|
|
|
* @param stationReportAllVO 月报对象 |
|
|
|
* @param stationReportAllVO 月报对象 |
|
|
|
* @param type |
|
|
|
* @param type |
|
|
@ -368,8 +734,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
if (STATION_REPORT_OUTSIDE.equals(type)) { |
|
|
|
if (STATION_REPORT_OUTSIDE.equals(type)) { |
|
|
|
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum, (short) currentRowNum, (short) 0, (short) OUTSIDE_COLUMN_NUM); |
|
|
|
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum, (short) currentRowNum, (short) 0, (short) OUTSIDE_COLUMN_NUM); |
|
|
|
sheet.addMergedRegion(cellRangeAddress); |
|
|
|
sheet.addMergedRegion(cellRangeAddress); |
|
|
|
} |
|
|
|
} else if (STATION_REPORT_INSIDE.equals(type)) { |
|
|
|
else if(STATION_REPORT_INSIDE.equals(type)) { |
|
|
|
|
|
|
|
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum, (short) currentRowNum, (short) 0, (short) INSIDE_COLUMN_NUM); |
|
|
|
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum, (short) currentRowNum, (short) 0, (short) INSIDE_COLUMN_NUM); |
|
|
|
sheet.addMergedRegion(cellRangeAddress); |
|
|
|
sheet.addMergedRegion(cellRangeAddress); |
|
|
|
} |
|
|
|
} |
|
|
@ -395,8 +760,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum + 1, (short) currentRowNum + 1, (short) 0, (short) OUTSIDE_COLUMN_NUM); |
|
|
|
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum + 1, (short) currentRowNum + 1, (short) 0, (short) OUTSIDE_COLUMN_NUM); |
|
|
|
sheet.addMergedRegion(cellRangeAddress); |
|
|
|
sheet.addMergedRegion(cellRangeAddress); |
|
|
|
row.getCell(0).setCellValue(stationReportAllVO.getStationOutsideConclusion()); |
|
|
|
row.getCell(0).setCellValue(stationReportAllVO.getStationOutsideConclusion()); |
|
|
|
} |
|
|
|
} else if (STATION_REPORT_INSIDE.equals(type)) { |
|
|
|
else if(STATION_REPORT_INSIDE.equals(type)) { |
|
|
|
|
|
|
|
IntStream.iterate(0, col_index -> col_index + 1).limit(INSIDE_COLUMN_NUM + 1).forEachOrdered(col_index -> { |
|
|
|
IntStream.iterate(0, col_index -> col_index + 1).limit(INSIDE_COLUMN_NUM + 1).forEachOrdered(col_index -> { |
|
|
|
row.createCell(col_index); |
|
|
|
row.createCell(col_index); |
|
|
|
XSSFCellStyle cellStyle = lastRow.getCell(col_index).getCellStyle(); |
|
|
|
XSSFCellStyle cellStyle = lastRow.getCell(col_index).getCellStyle(); |
|
|
@ -428,8 +792,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
}); |
|
|
|
}); |
|
|
|
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum + 1, (short) currentRowNum + 1, (short) 0, (short) OUTSIDE_COLUMN_NUM); |
|
|
|
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum + 1, (short) currentRowNum + 1, (short) 0, (short) OUTSIDE_COLUMN_NUM); |
|
|
|
sheet.addMergedRegion(cellRangeAddress); |
|
|
|
sheet.addMergedRegion(cellRangeAddress); |
|
|
|
} |
|
|
|
} else if (STATION_REPORT_INSIDE.equals(type)) { |
|
|
|
else if(STATION_REPORT_INSIDE.equals(type)) { |
|
|
|
|
|
|
|
IntStream.iterate(0, col_index -> col_index + 1).limit(INSIDE_COLUMN_NUM + 1).forEachOrdered(col_index -> { |
|
|
|
IntStream.iterate(0, col_index -> col_index + 1).limit(INSIDE_COLUMN_NUM + 1).forEachOrdered(col_index -> { |
|
|
|
row.createCell(col_index); |
|
|
|
row.createCell(col_index); |
|
|
|
XSSFCellStyle cellStyle = lastRow.getCell(col_index).getCellStyle(); |
|
|
|
XSSFCellStyle cellStyle = lastRow.getCell(col_index).getCellStyle(); |
|
|
@ -747,4 +1110,112 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor |
|
|
|
stationReportAllVo.setStationInsideConclusion(conclusion.toString()); |
|
|
|
stationReportAllVo.setStationInsideConclusion(conclusion.toString()); |
|
|
|
stationReportAllVo.setStationOutsideConclusion(outsideConclusion.toString()); |
|
|
|
stationReportAllVo.setStationOutsideConclusion(outsideConclusion.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 完善站点月报小结 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param stationReportAllVo |
|
|
|
|
|
|
|
* @param params |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void getStationReportConclusionV2(StationRunReportAllVO stationReportAllVo, Map<String, Object> params) { |
|
|
|
|
|
|
|
//值班小结
|
|
|
|
|
|
|
|
List<Map<String, Object>> dutyConclusion = iImsDutyMainService.getDutyConclusion(params); |
|
|
|
|
|
|
|
//机器人巡检小结
|
|
|
|
|
|
|
|
Map<String, Object> robotConclusion = inspectRobotTaskClient.getRobotConclusion(params); |
|
|
|
|
|
|
|
StringBuffer conclusion = new StringBuffer("本月电站工作小结:\r\n"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//完善值班小结
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVo.getDutyReportVOList())) { |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(dutyConclusion) || dutyConclusion.size() == 0) { |
|
|
|
|
|
|
|
conclusion.append("1、本月无值班任务;\r\n"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//对内值班小结
|
|
|
|
|
|
|
|
conclusion.append("1、值班") |
|
|
|
|
|
|
|
.append(dutyConclusion.get(0).get(ColumnEnum.duty_conclusion_date_col.getColumnName())) |
|
|
|
|
|
|
|
.append("天,正常交接班") |
|
|
|
|
|
|
|
.append(dutyConclusion.get(0).get(ColumnEnum.duty_conclusion_intime_col.getColumnName())) |
|
|
|
|
|
|
|
.append("次,延迟交接班") |
|
|
|
|
|
|
|
.append(dutyConclusion.get(0).get(ColumnEnum.duty_conclusion_delay_col.getColumnName())) |
|
|
|
|
|
|
|
.append("次;\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
conclusion.append("1、本月无值班任务;\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//日常维护任务统计
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVo.getMaintenanceReportVOList())) { |
|
|
|
|
|
|
|
List<RunReportVO> maintenanceReportVOList = stationReportAllVo.getMaintenanceReportVOList(); |
|
|
|
|
|
|
|
int completeTaskNum = maintenanceReportVOList.stream().filter(vo -> Func.isNotEmpty(vo.getCompleteNum())).mapToInt(RunReportVO::getCompleteNum).sum(); |
|
|
|
|
|
|
|
int incompleteTaskNum = maintenanceReportVOList.stream().filter(vo -> Func.isNotEmpty(vo.getIncompleteNum())).mapToInt(RunReportVO::getIncompleteNum).sum(); |
|
|
|
|
|
|
|
if (completeTaskNum == 0 && incompleteTaskNum == 0) { |
|
|
|
|
|
|
|
conclusion.append("2、无日常维护任务;\r\n"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//对内日常维护小结
|
|
|
|
|
|
|
|
String maintenanceTaskConclusion = "2、%s个日常维护任务,已执行%s个任务,完成率%s%%"; |
|
|
|
|
|
|
|
Double completeRate = new BigDecimal(completeTaskNum / (double) (completeTaskNum + incompleteTaskNum) * 100) |
|
|
|
|
|
|
|
.setScale(2, RoundingMode.HALF_UP).doubleValue(); |
|
|
|
|
|
|
|
conclusion.append(String.format(maintenanceTaskConclusion, (completeTaskNum + incompleteTaskNum), completeTaskNum, completeRate)).append(";\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
conclusion.append("2、无日常维护任务;\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//巡检任务统计
|
|
|
|
|
|
|
|
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(); |
|
|
|
|
|
|
|
if (completeInspectTaskNum == 0 && incompleteInspectTaskNum == 0) { |
|
|
|
|
|
|
|
conclusion.append("3、无巡检任务;\r\n"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String inspectTaskConclusion = "3、%s个巡检任务,已执行%s个巡检任务。"; |
|
|
|
|
|
|
|
conclusion.append(String.format(inspectTaskConclusion, (completeInspectTaskNum + incompleteInspectTaskNum), completeInspectTaskNum)).append(";\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
conclusion.append("3、无巡检任务;\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//检修任务统计
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVo.getAccessReportVOList())) { |
|
|
|
|
|
|
|
List<AccessRunReportVO> accessReportVOList = stationReportAllVo.getAccessReportVOList(); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(accessReportVOList)) { |
|
|
|
|
|
|
|
conclusion.append("4、无检修任务;\r\n"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
String accessTaskConclusion = "4、执行%s个检修任务"; |
|
|
|
|
|
|
|
conclusion.append(String.format(accessTaskConclusion, accessReportVOList.size())).append(";\r\n"); |
|
|
|
|
|
|
|
} } else { |
|
|
|
|
|
|
|
conclusion.append("4、无检修任务;\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 现象统计
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(stationReportAllVo.getDefectReportsVOList())) { |
|
|
|
|
|
|
|
String phenomenonConclusion = "5、本月发现%s个缺陷"; |
|
|
|
|
|
|
|
conclusion.append(String.format(phenomenonConclusion,stationReportAllVo.getDefectReportsVOList().size())).append(";\r\n"); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
conclusion.append("5、本月未发现缺陷;\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//机器人巡检小结
|
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(robotConclusion) || ObjectUtil.isEmpty(robotConclusion.get("ROBOT_TASK_HOURS"))) { |
|
|
|
|
|
|
|
conclusion.append("6、本月无机器人巡检任务;\n"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
conclusion.append("6、本月机器人巡检").append(robotConclusion.get("ROBOT_TASK_HOURS")).append("小时") |
|
|
|
|
|
|
|
.append(Optional.ofNullable(robotConclusion.get("ROBOT_TASK_NUM")).map(o -> { |
|
|
|
|
|
|
|
return ",执行".concat(o.toString().concat("个巡检任务")); |
|
|
|
|
|
|
|
}).orElse("")) |
|
|
|
|
|
|
|
.append(Optional.ofNullable(robotConclusion.get("ROBOT_TASK_COMPLETE")).map(o -> { |
|
|
|
|
|
|
|
return ",有".concat(o.toString()).concat("个任务运行正常"); |
|
|
|
|
|
|
|
}).orElse("")) |
|
|
|
|
|
|
|
.append(Optional.ofNullable(robotConclusion.get("ROBOT_TASK_INCOMPLETE")).map(o -> { |
|
|
|
|
|
|
|
return ",有".concat(o.toString()).concat("任务未执行;\r\n"); |
|
|
|
|
|
|
|
}).orElse(";\r\n")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 两票
|
|
|
|
|
|
|
|
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(); |
|
|
|
|
|
|
|
String phenomenonConclusion = "5、本月开票%s张,合格率%s;"; |
|
|
|
|
|
|
|
conclusion.append(String.format(phenomenonConclusion,sum,ticketInfoProportion)).append(";\r\n"); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
conclusion.append("5、本月未开票;\r\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
stationReportAllVo.setSuggestion(conclusion.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|