Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
yang_shj 10 months ago
parent
commit
a45ff4d3c8
  1. 5
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/report/feign/IInspectReportClient.java
  2. 7
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/report/feign/InspectReportClientFallback.java
  3. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java
  4. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java
  5. 31
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TestMethodEnum.java
  6. 17
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMilesYearVO.java
  7. 26
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/vo/TicketInfoStatisticVO.java
  8. 20
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/gather/feigns/InspectReportClient.java
  9. 12
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/report/feigns/InspectReportClient.java
  10. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java
  11. 50
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java
  12. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java
  13. 37
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
  14. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainService.java
  15. 139
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  16. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainSystemMonitoringService.java
  17. 163
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java
  18. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java
  19. 71
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  20. 52
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/MonthReportController.java
  21. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/schedule/OperStationCreateMonthReport.java
  22. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IMonthReportService.java
  23. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IOperStationMonthReportService.java
  24. 43
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java
  25. 673
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java
  26. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/AccessRunReportVO.java
  27. 36
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DefectRunReportsVO.java
  28. 36
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyRunReportVO.java
  29. 41
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/FDPRunReportVO.java
  30. 31
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/RunReportVO.java
  31. 50
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/StationRunReportAllVO.java
  32. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/StationRunReportVO.java
  33. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/TimeUtils.java
  34. BIN
      hzims-service/operational/src/main/resources/template/word/stationMonthReport.docx
  35. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java
  36. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  37. 14
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  38. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceInspectionMapper.xml
  39. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java
  40. 23
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml
  41. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java
  42. 20
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml
  43. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java
  44. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java
  45. 13
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java
  46. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  47. BIN
      hzims-service/safeproduct/src/main/resources/template/会议记录表.docx
  48. BIN
      hzims-service/safeproduct/src/main/resources/template/卫生自查表.docx
  49. BIN
      hzims-service/safeproduct/src/main/resources/template/培训记录表.docx
  50. BIN
      hzims-service/safeproduct/src/main/resources/template/演练记录表.docx
  51. BIN
      hzims-service/safeproduct/src/main/resources/template/车辆检查表.docx
  52. BIN
      hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx
  53. 45
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/TicketInfoAllClient.java
  54. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java
  55. 86
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  56. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/IFirstWorkTicketService.java
  57. 41
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java
  58. 4
      hzims-service/ticket/src/test/java/com/hnac/hzims/ticket/TicketApplicationTest.java

5
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/report/feign/IInspectReportClient.java

@ -2,6 +2,8 @@ package com.hnac.hzinfo.inspect.report.feign;
import com.hnac.hzinfo.inspect.Constants;
import com.hnac.hzinfo.inspect.report.vo.AlarmRoutReportVO;
import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO;
import com.hnac.hzinfo.inspect.task.vo.TaskReportVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -16,7 +18,10 @@ import java.util.Map;
public interface IInspectReportClient {
String API_PREFIX = "/feign/report";
String GET_ALARAM_REPORT = API_PREFIX + "/getAlarmReport";
String GET_INSPECT_STATISTCS_BY_NAME = API_PREFIX + "/getInspectStatisticsByName";
@PostMapping(GET_ALARAM_REPORT)
Map<Long, AlarmRoutReportVO> getAlarmReport(@RequestParam("depts") List<Long> depts, @RequestParam("date") String date);
@PostMapping(GET_INSPECT_STATISTCS_BY_NAME)
List<TaskReportVO> getInspectStatisticsByName(@RequestParam("depts") List<Long> depts, @RequestParam("date") String startTime, @RequestParam("date") String endTime);
}

7
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/report/feign/InspectReportClientFallback.java

@ -1,9 +1,11 @@
package com.hnac.hzinfo.inspect.report.feign;
import com.hnac.hzinfo.inspect.report.vo.AlarmRoutReportVO;
import com.hnac.hzinfo.inspect.task.vo.TaskReportVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -16,4 +18,9 @@ public class InspectReportClientFallback implements IInspectReportClient{
public Map<Long, AlarmRoutReportVO> getAlarmReport(List<Long> depts, String date) {
return new HashMap<>();
}
@Override
public List<TaskReportVO> getInspectStatisticsByName(List<Long> depts, String startTime, String endTime) {
return new ArrayList<>();
}
}

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/HygienePlanEntity.java

@ -1,6 +1,7 @@
package com.hnac.hzims.safeproduct.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
@ -51,10 +52,12 @@ public class HygienePlanEntity extends BaseEntity {
@ApiModelProperty("自查计划状态")
private String hygienePlanStatus;
@TableField(exist = false)
@ExcelProperty(value = "计划开始时间", index = 3)
@ApiModelProperty("计划开始时间")
private String startTime;
@TableField(exist = false)
@ExcelProperty(value = "计划结束时间", index = 4)
@ApiModelProperty("计划结束时间")
private String endTime;

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java

@ -74,4 +74,7 @@ public class TestEntity extends BaseEntity {
@Size(max = 1000, message = "考试附件字段长度不能超过1000")
@ApiModelProperty("考试附件")
private String filePath;
@ApiModelProperty("考试方式")
private String testMethod;
}

31
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TestMethodEnum.java

@ -0,0 +1,31 @@
package com.hnac.hzims.safeproduct.enums;
/**
* 考试方式枚举类
*
* @author liwen
* @date 2024-01-25
*/
public enum TestMethodEnum {
ONLINE("ONLINE", "线上"),
OFFLINE("OFFLINE", "线下"),
MIXED("MIXED", "线上+线下");
private final String value;
private final String desc;
TestMethodEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return value;
}
public String getDesc() {
return desc;
}
}

17
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/CarMilesYearVO.java

@ -1,5 +1,6 @@
package com.hnac.hzims.safeproduct.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -14,51 +15,67 @@ import java.math.BigDecimal;
@ApiModel(value = "年度里程数据VO类")
public class CarMilesYearVO {
@ExcelProperty(value = "单位", order = 0)
@ApiModelProperty("单位")
private String unit;
@ExcelProperty(value = "品牌", order = 2)
@ApiModelProperty("品牌")
private String carBrand;
@ExcelProperty(value = "车牌号", order = 1)
@ApiModelProperty("车牌号")
private String plateNumber;
@ExcelProperty(value = "1月", order = 3)
@ApiModelProperty("1月里程数")
private BigDecimal januaryMiles;
@ExcelProperty(value = "2月", order = 4)
@ApiModelProperty("2月里程数")
private BigDecimal februaryMiles;
@ExcelProperty(value = "3月", order = 5)
@ApiModelProperty("3月里程数")
private BigDecimal marchMiles;
@ExcelProperty(value = "4月", order = 6)
@ApiModelProperty("4月里程数")
private BigDecimal aprilMiles;
@ExcelProperty(value = "5月", order = 7)
@ApiModelProperty("5月里程数")
private BigDecimal mayMiles;
@ExcelProperty(value = "6月", order = 8)
@ApiModelProperty("6月里程数")
private BigDecimal juneMiles;
@ExcelProperty(value = "7月", order = 9)
@ApiModelProperty("7月里程数")
private BigDecimal julyMiles;
@ExcelProperty(value = "8月", order = 10)
@ApiModelProperty("8月里程数")
private BigDecimal augustMiles;
@ExcelProperty(value = "9月", order = 11)
@ApiModelProperty("9月里程数")
private BigDecimal septemberMiles;
@ExcelProperty(value = "10月", order = 12)
@ApiModelProperty("10月里程数")
private BigDecimal octoberMiles;
@ExcelProperty(value = "11月", order = 13)
@ApiModelProperty("11月里程数")
private BigDecimal novemberMiles;
@ExcelProperty(value = "12月", order = 14)
@ApiModelProperty("12月里程数")
private BigDecimal decemberMiles;
@ExcelProperty(value = "合计里程/km", order = 15)
@ApiModelProperty("合计里程数")
private BigDecimal sumMiles;
}

26
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/vo/TicketInfoStatisticVO.java

@ -20,7 +20,8 @@ public class TicketInfoStatisticVO implements Serializable {
private static final long serialVersionUID = -8870464581684939369L;
@ApiModelProperty("日期")
private String dateTime;
@ApiModelProperty("序号")
private Integer index;
@ApiModelProperty("本月票据合格率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double ticketInfoProportion;
@ -29,23 +30,26 @@ public class TicketInfoStatisticVO implements Serializable {
private String ticketInfoType;
@ApiModelProperty("开票数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoNumber;
// @JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoNumber=0;
@ApiModelProperty("本月完成开票数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoCompleteNum;
// @JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoCompleteNum=0;
@ApiModelProperty("本月未完成开票数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoStartNum;
// @JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoStartNum=0;
@ApiModelProperty("本月延期开票数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoDelayNum;
// @JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoDelayNum=0;
@ApiModelProperty("工作票合格数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoQualifiedNum;
// @JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoQualifiedNum=0;
@ApiModelProperty("废票数")
// @JsonSerialize(nullsUsing = NullSerializer.class)
private Integer ticketInfoInvalidatedNum=0;
}

20
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/gather/feigns/InspectReportClient.java

@ -1,20 +0,0 @@
package com.hnac.hzinfo.inspect.gather.feigns;
import com.hnac.hzinfo.inspect.report.feign.IInspectReportClient;
import com.hnac.hzinfo.inspect.report.service.InspectReportService;
import com.hnac.hzinfo.inspect.report.vo.AlarmRoutReportVO;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
public class InspectReportClient implements IInspectReportClient {
@Autowired
private InspectReportService inspectReportService;
@Override
public Map<Long, AlarmRoutReportVO> getAlarmReport(List<Long> depts, String date) {
return inspectReportService.getAlarnReport(date,depts);
}
}

12
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/report/feigns/InspectReportClient.java

@ -3,6 +3,8 @@ package com.hnac.hzinfo.inspect.report.feigns;
import com.hnac.hzinfo.inspect.report.feign.IInspectReportClient;
import com.hnac.hzinfo.inspect.report.service.InspectReportService;
import com.hnac.hzinfo.inspect.report.vo.AlarmRoutReportVO;
import com.hnac.hzinfo.inspect.task.service.ITaskService;
import com.hnac.hzinfo.inspect.task.vo.TaskReportVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@ -15,10 +17,18 @@ public class InspectReportClient implements IInspectReportClient {
@Autowired
private InspectReportService inspectReportService;
@Autowired
private ITaskService taskService;
@PostMapping(GET_ALARAM_REPORT)
@Override
public Map<Long, AlarmRoutReportVO> getAlarmReport(List<Long> depts, String date) {
return inspectReportService.getAlarnReport(date,depts);
}
@PostMapping(GET_INSPECT_STATISTCS_BY_NAME)
@Override
public List<TaskReportVO> getInspectStatisticsByName(List<Long> depts, String startTime, String endTime) {
List<TaskReportVO> inspectTaskReport = taskService.getInspectTaskReport(startTime, endTime, depts);
return inspectTaskReport;
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessTaskService.java

@ -8,6 +8,7 @@ import com.hnac.hzims.operational.access.vo.AccessTaskExportVo;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.access.vo.RepairBillVO;
import com.hnac.hzims.operational.report.vo.AccessReportVO;
import com.hnac.hzims.operational.report.vo.AccessRunReportVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzims.vo.VoteChartVo;
import org.springblade.core.mp.base.BaseService;
@ -48,6 +49,7 @@ public interface IOperAccessTaskService extends BaseService<OperAccessTaskEntity
List<AccessReportVO> getAccessTaskByDisposer(LocalDate startDate, LocalDate endDate, List<Long> deptIdList);
List<AccessReportVO> getAccessTaskByDisposer(Map<String,Object> params);
List<AccessRunReportVO> getAccessTaskByName(Map<String,Object> params);
List<Map<String,Object>> getAccessConclusion(Map<String,Object> params);

50
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/OperAccessTaskServiceImpl.java

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.message.enums.PushStatEnum;
import com.hnac.hzims.message.fegin.IMessagePushClient;
import com.hnac.hzims.message.req.PushExtrasReq;
import com.hnac.hzims.operational.OperationalConstants;
@ -36,6 +37,7 @@ import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper;
import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService;
import com.hnac.hzims.operational.report.vo.AccessReportVO;
import com.hnac.hzims.operational.report.vo.AccessRunReportVO;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.feign.IDangerSourceClient;
import com.hnac.hzims.spare.entity.SpRecordEntity;
@ -59,6 +61,7 @@ import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.utils.FlowUtil;
import org.springblade.flow.core.utils.TaskUtil;
import org.springblade.flow.core.vo.ComleteTask;
import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
@ -302,6 +305,53 @@ public class OperAccessTaskServiceImpl extends BaseServiceImpl<OperAccessTaskMap
}
@Override
public List<AccessRunReportVO> getAccessTaskByName(Map<String, Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>) params.get("deptId");
List<OperAccessTaskEntity> operAccessTaskEntityList = this.list(new LambdaQueryWrapper<OperAccessTaskEntity>() {{
ge(OperAccessTaskEntity::getPlanStartTime, startDate);
le(OperAccessTaskEntity::getPlanStartTime, endDate);
in(OperAccessTaskEntity::getCreateDept, deptIdList);
}});
List<AccessRunReportVO> res =new ArrayList<>();
if(CollectionUtil.isNotEmpty(operAccessTaskEntityList)) {
for (int i = 0; i < operAccessTaskEntityList.size(); i++) {
OperAccessTaskEntity operAccessTaskEntity= operAccessTaskEntityList.get(i);
AccessRunReportVO accessReportVO = new AccessRunReportVO();
accessReportVO.setIndex(i+1);
accessReportVO.setUserName(operAccessTaskEntity.getHandlerName());
accessReportVO.setMaintenanceItem(operAccessTaskEntity.getName());
switch (operAccessTaskEntity.getStatus()) {
case AccessConstants.ACCESS_TASK_STATUS_0:
accessReportVO.setCompleteSituation("未开始");
break;
case AccessConstants.ACCESS_TASK_STATUS_1:
accessReportVO.setCompleteSituation("进行中");
break;
case AccessConstants.ACCESS_TASK_STATUS_2:
accessReportVO.setCompleteSituation("待审核");
break;
case AccessConstants.ACCESS_TASK_STATUS_3:
accessReportVO.setCompleteSituation("审核未通过");
break;
case AccessConstants.ACCESS_TASK_STATUS_4:
accessReportVO.setCompleteSituation("已完成");
break;
case AccessConstants.ACCESS_TASK_STATUS_5:
accessReportVO.setCompleteSituation("未完成");
break;
default:
accessReportVO.setCompleteSituation("未开始");
break;
}
res.add(accessReportVO);
}
}
return res;
}
@Override
public List<Map<String, Object>> getAccessConclusion(Map<String, Object> params) {
return mapper.getAccessConclusion(params);
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java

@ -7,6 +7,7 @@ import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.OperDefectVO;
import com.hnac.hzims.operational.report.vo.DefectReportsVO;
import com.hnac.hzims.operational.report.vo.DefectRunReportsVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
@ -69,6 +70,8 @@ public interface IOperDefectService extends BaseService<OperDefectEntity> {
List<DefectReportsVO> getFaultByFaultCode(Map<String,Object> params);
List<DefectRunReportsVO> getDefectByName(Map<String,Object> params);
List<Map<String,Object>> getDefectConclusion(Map<String,Object> params);
/**

37
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java

@ -21,8 +21,11 @@ import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper;
import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.vo.OperDefectVO;
import com.hnac.hzims.operational.defect.wrapper.OperDefectWrapper;
import com.hnac.hzims.operational.duty.entity.ImsDutyEmergencyEntity;
import com.hnac.hzims.operational.report.vo.DefectReportsVO;
import com.hnac.hzims.operational.report.vo.DefectRunReportsVO;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.spare.entity.WtSpManagementEntity;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import lombok.AllArgsConstructor;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
@ -354,6 +357,40 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
}
@Override
public List<DefectRunReportsVO> getDefectByName(Map<String, Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>) params.get("deptId");
List<DefectRunReportsVO> res=new ArrayList<>();
List<OperPhenomenonEntity> operPhenomenonEntities = operPhenomenonMapper.selectList(
Wrappers.<OperPhenomenonEntity>query().lambda()
.ge(OperPhenomenonEntity::getCreateTime, startDate)
.le(OperPhenomenonEntity::getCreateTime, endDate)
.in(OperPhenomenonEntity::getCreateDept, deptIdList)
.eq(OperPhenomenonEntity::getIsDeleted, 0)
.eq(OperPhenomenonEntity::getIsDefect, 1));
if (CollectionUtil.isNotEmpty(operPhenomenonEntities)){
for (int i = 0; i < operPhenomenonEntities.size(); i++) {
DefectRunReportsVO reportsVO=new DefectRunReportsVO();
OperPhenomenonEntity operPhenomenonEntity = operPhenomenonEntities.get(i);
reportsVO.setIndex(i+1);
reportsVO.setFinder(operPhenomenonEntity.getFinderName());
reportsVO.setFinderTime(DateUtil.formatDateTime(operPhenomenonEntity.getFindTime()));
reportsVO.setDescription(operPhenomenonEntity.getDescripiton());
if ("1".equals(operPhenomenonEntity.getHandleStatus())) {
reportsVO.setHandleTime(DateUtil.formatDateTime(operPhenomenonEntity.getActStartTime()));
reportsVO.setHandleSituation(operPhenomenonEntity.getDisposeDesc());
}else {
reportsVO.setHandleSituation("未处理");
}
res.add(reportsVO);
}
}
return res;
}
@Override
public List<Map<String, Object>> getDefectConclusion(Map<String, Object> params) {
return operDefectMapper.getDefectConclusion(params);
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyMainService.java

@ -6,6 +6,7 @@ import com.hnac.hzims.operational.duty.entity.ImsDutyRecEntity;
import com.hnac.hzims.operational.duty.vo.*;
import com.hnac.hzims.operational.main.vo.DutyPersonalReportVO;
import com.hnac.hzims.operational.report.vo.DutyReportVO;
import com.hnac.hzims.operational.report.vo.DutyRunReportVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
@ -80,8 +81,8 @@ public interface IImsDutyMainService extends BaseService<ImsDutyMainEntity> {
*/
List<DutyReportVO> getDutyMainStatisticsByClassId(LocalDate startDate, LocalDate endDate, List<Long> deptIdList);
List<DutyReportVO> getDutyMainStatisticsByClassId(Map<String, Object> params);
// List<DutyReportVO> getDutyMainStatisticsByClassId(Map<String, Object> params);
List<DutyRunReportVO> getDutyMainRunReport(Map<String, Object> params);
List<Map<String, Object>> getDutyConclusion(Map<String, Object> params);
DutyPersonalReportVO getPersonalDutyMain(Map<String, Object> params);

139
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -19,6 +19,7 @@ import com.hnac.hzims.operational.duty.service.*;
import com.hnac.hzims.operational.duty.vo.*;
import com.hnac.hzims.operational.main.vo.DutyPersonalReportVO;
import com.hnac.hzims.operational.report.vo.DutyReportVO;
import com.hnac.hzims.operational.report.vo.DutyRunReportVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.log.exception.ServiceException;
@ -44,6 +45,7 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -1022,12 +1024,143 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
return dutyReportVOList;
}
private void getDutyRunReportByPerson(LocalDate startDate, LocalDate endDate, List<Long> deptIdList, List<ImsDutyMainEntity> imsDutyMainEntityList, List<DutyRunReportVO> dutyReportVOList,AtomicInteger index) {
//无班组的值班数据:
List<ImsDutyMainEntity> personDutyMainEntity = imsDutyMainEntityList.stream().filter(o -> ObjectUtil.isEmpty(o.getDutyGroupId())).collect(Collectors.toList());
//获取班组名
if (ObjectUtil.isNotEmpty(personDutyMainEntity)) {
DutyRunReportVO dutyReportVO = new DutyRunReportVO();
dutyReportVO.setGroupName("灵活排班");
dutyReportVO.setIndex(index.get());
dutyReportVO.setDutyNum(personDutyMainEntity.size());
//获取值班ID
List<Long> dutyIdList = personDutyMainEntity.stream().map(ImsDutyMainEntity::getId).collect(Collectors.toList());
dutyReportVO.setDutyList(dutyIdList.stream().map(s->String.valueOf(s)).collect(Collectors.toList()));
//发现问题数量
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
ge(OperPhenomenonEntity::getCreateTime, startDate);
le(OperPhenomenonEntity::getCreateTime, endDate);
in(OperPhenomenonEntity::getCreateDept, deptIdList);
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.ZB.getStatus());
eq(OperPhenomenonEntity::getIsDeleted, 0);
}});
dutyReportVO.setFindProblemNum(operPhenomenonEntityList.size());
//获取交接班异常记录
List<ImsDutyRecEntity> imsDutyRecEntityList = imsDutyRecMapper.selectList(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
in(ImsDutyRecEntity::getDutyId, dutyIdList);
}});
//延迟交接班
List<ImsDutyRecEntity> delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() == 1).collect(Collectors.toList());
//异常交接班
List<ImsDutyRecEntity> exceptionList = imsDutyRecEntityList.stream().filter(rec -> DutyRecStatus.ANOMALY.getVal().equals(rec.getStatus())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(delayList)) {
dutyReportVO.setDelayChangeShifts(delayList.size());
List<String> delayIdsList = delayList.stream().map(ImsDutyRecEntity::getDutyId).map(s -> String.valueOf(s)).collect(Collectors.toList());
dutyReportVO.setDelayChangeList(delayIdsList);
}
if (CollectionUtil.isNotEmpty(exceptionList)) {
dutyReportVO.setExceptionChangeShifts(exceptionList.size());
List<String> exceptionIdsList = exceptionList.stream().map(ImsDutyRecEntity::getDutyId).map(s -> String.valueOf(s)).collect(Collectors.toList());
dutyReportVO.setExceptionChangeList(exceptionIdsList);
}
dutyReportVOList.add(dutyReportVO);
}
}
private void getDutyRunReportByGroup(LocalDate startDate, LocalDate endDate, List<Long> deptIdList, List<ImsDutyMainEntity> imsDutyMainEntityList, List<DutyRunReportVO> dutyReportVOList,AtomicInteger index) {
//按班组组合值班记录
Map<Long, List<ImsDutyMainEntity>> listByGroup = imsDutyMainEntityList.stream().filter(o -> ObjectUtil.isNotEmpty(o.getDutyGroupId())).collect(Collectors.groupingBy(ImsDutyMainEntity::getDutyGroupId));
listByGroup.forEach((k, v) -> {
//获取班组名
ImsDutyGroupEntity imsDutyGroupEntity = dutyGroupMapper.selectById(k);
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity)) {
DutyRunReportVO dutyReportVO = new DutyRunReportVO();
dutyReportVO.setIndex(index.get());
index.getAndIncrement();
dutyReportVO.setGroupName(imsDutyGroupEntity.getGroupName());
User user = UserCache.getUser(imsDutyGroupEntity.getManagerId());
if (ObjectUtil.isNotEmpty(user)){
dutyReportVO.setManagerName(user.getName());
}
dutyReportVO.setDutyNum(v.size());
//获取值班ID
List<Long> dutyIdList = v.stream().map(ImsDutyMainEntity::getId).collect(Collectors.toList());
dutyReportVO.setDutyList(dutyIdList.stream().map(s->String.valueOf(s)).collect(Collectors.toList()));
//发现问题数量
List<ImsDutyGroupPEntity> imsDutyGroupPEntities = imsDutyGroupPMapper.selectByGroupId(k);
List<Long> person = imsDutyGroupPEntities.stream().map(s -> s.getPersonId()).collect(Collectors.toList());
List<OperPhenomenonEntity> operPhenomenonEntityList = operPhenomenonMapper.selectList(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
ge(OperPhenomenonEntity::getCreateTime, startDate);
le(OperPhenomenonEntity::getCreateTime, endDate);
in(OperPhenomenonEntity::getCreateDept, deptIdList);
in(OperPhenomenonEntity::getFinder,person);
eq(OperPhenomenonEntity::getSourceCode, DefectConstant.DefectSourceEnum.ZB.getStatus());
eq(OperPhenomenonEntity::getIsDeleted, 0);
}});
dutyReportVO.setFindProblemNum(operPhenomenonEntityList.size());
//获取交接班异常记录
List<ImsDutyRecEntity> imsDutyRecEntityList = imsDutyRecMapper.selectList(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
in(ImsDutyRecEntity::getDutyId, dutyIdList);
}});
//延迟交接班
List<ImsDutyRecEntity> delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() == 1).collect(Collectors.toList());
//异常交接班
List<ImsDutyRecEntity> exceptionList = imsDutyRecEntityList.stream().filter(rec -> DutyRecStatus.ANOMALY.getVal().equals(rec.getStatus())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(delayList)) {
dutyReportVO.setDelayChangeShifts(delayList.size());
List<String> delayIdsList = delayList.stream().map(ImsDutyRecEntity::getDutyId).map(s -> String.valueOf(s)).collect(Collectors.toList());
dutyReportVO.setDelayChangeList(delayIdsList);
}
if (CollectionUtil.isNotEmpty(exceptionList)) {
dutyReportVO.setExceptionChangeShifts(exceptionList.size());
List<String> exceptionIdsList = exceptionList.stream().map(ImsDutyRecEntity::getDutyId).map(s -> String.valueOf(s)).collect(Collectors.toList());
dutyReportVO.setExceptionChangeList(exceptionIdsList);
}
dutyReportVOList.add(dutyReportVO);
}
});
}
@Override
public List<DutyReportVO> getDutyMainStatisticsByClassId(Map<String, Object> params) {
public List<DutyRunReportVO> getDutyMainRunReport(Map<String, Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptId = (List<Long>) params.get("deptId");
return getDutyMainStatisticsByClassId(startDate, endDate, deptId);
List<Long> deptIdList = (List<Long>) params.get("deptId");
List<DutyRunReportVO> dutyReportVOList = new ArrayList<>();
//获取当月值班记录
List<ImsDutyMainEntity> imsDutyMainEntityList = this.baseMapper.selectList(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
ge(ImsDutyMainEntity::getDutyDate, startDate);
le(ImsDutyMainEntity::getDutyDate, endDate);
in(ImsDutyMainEntity::getCreateDept, deptIdList);
ne(ImsDutyMainEntity::getStatus, -1);
eq(ImsDutyMainEntity::getIsDeleted, 0);
}});
AtomicInteger index= new AtomicInteger(1);
if(CollectionUtil.isNotEmpty(imsDutyMainEntityList)) {
//带班组的值班数据
this.getDutyRunReportByGroup(startDate, endDate, deptIdList, imsDutyMainEntityList, dutyReportVOList,index);
//灵活排班的值班数据
this.getDutyRunReportByPerson(startDate, endDate, deptIdList, imsDutyMainEntityList, dutyReportVOList,index);
}
DutyRunReportVO dutyReportVO = new DutyRunReportVO();
dutyReportVO.setGroupName("合计");
if (CollectionUtil.isNotEmpty(dutyReportVOList)){
dutyReportVO.setDutyNum(dutyReportVOList.stream().mapToInt(DutyRunReportVO::getDutyNum).sum());
dutyReportVO.setFindProblemNum(dutyReportVOList.stream().mapToInt(DutyRunReportVO::getFindProblemNum).sum());
dutyReportVO.setDelayChangeShifts(dutyReportVOList.stream().mapToInt(DutyRunReportVO::getDelayChangeShifts).sum());
dutyReportVO.setExceptionChangeShifts(dutyReportVOList.stream().mapToInt(DutyRunReportVO::getExceptionChangeShifts).sum());
}else {
dutyReportVO.setDutyNum(0);
dutyReportVO.setFindProblemNum(0);
dutyReportVO.setDelayChangeShifts(0);
dutyReportVO.setExceptionChangeShifts(0);
}
return dutyReportVOList;
}
@Override

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IMainSystemMonitoringService.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.main.service;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.report.vo.StationReportVO;
import com.hnac.hzims.operational.report.vo.StationRunReportVO;
import com.hnac.hzims.operational.station.entity.StationEntity;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept;
@ -66,7 +67,8 @@ public interface IMainSystemMonitoringService {
List<StationReportVO> getElectricSituation(String month, String stationId);
List<StationRunReportVO> getElectricSituationV2(String yearAndMonth, String code);
void getElectricSituationByRedis(String month, List<StationRunReportVO> reportVOS, List<StationEntity> stationEntityList);
InDustryVo getUserDataScopeHomePage(String businessType,String stationType,String deptIds,String refTerminal);
List<StationEntity> classifyUserDataScopeType(String deptIds, String stationType,List<String> types,boolean bool);
@ -87,4 +89,5 @@ public interface IMainSystemMonitoringService {
List<EminfoAndEmParamVo> getEmInfoList();
}

163
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java

@ -24,8 +24,10 @@ import com.hnac.hzims.operational.main.service.IMainWorkBenchService;
import com.hnac.hzims.operational.main.service.IUnitRunningTimeService;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.report.vo.StationReportVO;
import com.hnac.hzims.operational.report.vo.StationRunReportVO;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.util.TimeUtils;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
@ -50,6 +52,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDate;
@ -1340,7 +1343,167 @@ public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringSer
}
}
private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data";
/**
* 获取部门站点发电量情况
* @param month 2024-01 月份
*/
@Override
public void getElectricSituationByRedis(String month,List<StationRunReportVO> reportVOS, List<StationEntity> stationEntityList) {
String[] yearMon = month.split("-");
Integer year = Integer.valueOf(yearMon[0]);
Integer mon = Integer.valueOf(yearMon[1]);
List<String> listByYear = TimeUtils.getListByYearMon(year, mon);
String currentMon = TimeUtils.getMon(year, mon);
Integer count=0;
Map<Long, Map<String, Float>> powerMapThree = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
for (Map.Entry<Long, Map<String, Float>> deviceMap : powerMapThree.entrySet()) {
for (StationEntity stationEntity : stationEntityList) {
if (stationEntity.getId().equals(deviceMap.getKey())) {
StationRunReportVO stationReportVO = new StationRunReportVO();
count++;
stationReportVO.setIndex(count);
stationReportVO.setStationName(stationEntity.getName());
//当前机构近三年的数据
Map<String, Float> value = deviceMap.getValue();
//当月发电量
BigDecimal powerMon = value.entrySet().stream().filter(s -> currentMon.equals(s.getKey())).map(s -> BigDecimal.valueOf(s.getValue()).setScale(1,BigDecimal.ROUND_UP)).reduce(BigDecimal.ZERO, BigDecimal::add);
stationReportVO.setFinishPowerMon(powerMon.toString());
//获取计划月发电量
R<Float> planPowerMonR = planGenertionClient.planGenerationMonthCount(stationEntity.getCode(), month);
double planPowerMon =0;
if (planPowerMonR.isSuccess()&&ObjectUtil.isNotEmpty(planPowerMonR.getData())) {
planPowerMon = planPowerMonR.getData().doubleValue();
}
stationReportVO.setPowerMonPlan(planPowerMon);
//当年发电量
BigDecimal powerYear = value.entrySet().stream().filter(s -> listByYear.contains(s.getKey())).map(s -> BigDecimal.valueOf(s.getValue()).setScale(1,BigDecimal.ROUND_UP)).reduce(BigDecimal.ZERO, BigDecimal::add);
stationReportVO.setFinishPowerYear(powerYear.toString());
//获取计划年发电量
Double planPowerYear = planGenertionClient.getPlanPowerYear(Arrays.asList(stationEntity.getId().toString()), yearMon[0]);
stationReportVO.setPowerYearPlan(planPowerYear);
if (ObjectUtil.isNotEmpty(stationReportVO.getPowerMonPlan())
&&ObjectUtil.isNotEmpty(stationReportVO.getFinishPowerMon())
&&new BigDecimal(stationReportVO.getPowerMonPlan()).compareTo(BigDecimal.ZERO)!=0){
BigDecimal monRate = new BigDecimal(stationReportVO.getFinishPowerMon()).multiply(new BigDecimal(100))
.divide(new BigDecimal(stationReportVO.getPowerMonPlan()), 2, BigDecimal.ROUND_UP);
stationReportVO.setPowerMonRate(monRate.doubleValue()+"%");
}else {
stationReportVO.setPowerMonRate(new Double(0)+"%");
}
if (ObjectUtil.isNotEmpty(stationReportVO.getFinishPowerYear())
&&ObjectUtil.isNotEmpty(stationReportVO.getPowerYearPlan())
&&new BigDecimal(stationReportVO.getPowerYearPlan()).compareTo(BigDecimal.ZERO)!=0){
BigDecimal yearRate = new BigDecimal(stationReportVO.getFinishPowerYear()).multiply(new BigDecimal(100))
.divide(new BigDecimal(stationReportVO.getPowerYearPlan()), 2, BigDecimal.ROUND_UP);
stationReportVO.setPowerYearRate(yearRate.doubleValue()+"%");
}else {
stationReportVO.setPowerYearRate(new Double(0)+"%");
}
reportVOS.add(stationReportVO);
}
}
}
}
@Override
public List<StationRunReportVO> getElectricSituationV2(String month, String stationId) {
String year = month.split("-")[0];
List<StationRunReportVO> stationReportVOList = new ArrayList<>();
DateTimeFormatter df = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME);
StationRunReportVO stationReportVO = new StationRunReportVO();
//获取对应的发电量
StationEntity stationEntity = stationService.getStationByCode(stationId);
stationReportVO.setStationName(stationEntity.getName());
AtomicReference<Float> powerCount = new AtomicReference<>((float) 0L);
AtomicReference<Float> powerCountYear = new AtomicReference<>((float) 0L);
//获取站点所属部门下的设备列表
List<String> emCodes = emInfoClient.getEmCodeByDeptIdAndHomePage(stationEntity.getRefDept()).getData();
if (CollectionUtil.isNotEmpty(emCodes)) {
List<String> emCodeList = analyseInstanceClient.getListAnalyseCode(emCodes).getData();
if (CollectionUtil.isNotEmpty(emCodeList)) {
List<EmInfoEntity> data = emInfoClient.getEmInfoByEmCodes(emCodeList).getData();
for (EmInfoEntity emInfoEntity : data) {
int ct = 0;
int pt = 0;
R<EmParamEntity> EmParamEntityCT = emParamClient.getParamByEmId(emInfoEntity.getId(), "ct");
if (EmParamEntityCT.isSuccess() && ObjectUtil.isNotEmpty(EmParamEntityCT.getData())
&& StringUtil.isNotBlank(EmParamEntityCT.getData().getParamValue())) {
ct = Integer.valueOf(EmParamEntityCT.getData().getParamValue());
}
R<EmParamEntity> EmParamEntityPT = emParamClient.getParamByEmId(emInfoEntity.getId(), "pt");
if (EmParamEntityPT.isSuccess() && ObjectUtil.isNotEmpty(EmParamEntityPT.getData())
&& StringUtil.isNotBlank(EmParamEntityPT.getData().getParamValue())) {
pt = Integer.valueOf(EmParamEntityPT.getData().getParamValue());
}
//TODO
int rideCount = ct * pt;
MainVo vo = new MainVo();
MainVo yearVo = new MainVo();
R<EmParamEntity> paramByEmId = emParamClient.getParamByEmId(emInfoEntity.getId(), EquipmentConstants.MainEnum.INSTALLED_CAPACITY.getVal());
if (paramByEmId.isSuccess()) {
if (ObjectUtil.isNotEmpty(paramByEmId.getData())) {
vo.setInstalledCapacity(paramByEmId.getData().getParamValue());
}
}
//循环所有机组
//根据设备编号 标识 获取 发电量、有功功率数据
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
po.setDeviceCode(emInfoEntity.getNumber());
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);//填充 null
analyzeDataConditionPO.setSignages(GENERATE_SIGNAGE);
analyzeDataConditionPO.setAccessRules(EquipmentConstants.AccessRulesEnum.DIFF_CYCLE.getType());//取数规则 0=(整点值/最早值)、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值) 6=最新值
analyzeDataConditionPO.setTimeInterval(1);//间隔
//月发电量
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(month + "-01 00:00:00", df));
DateTimeFormatter fmt = DateTimeFormatter.ISO_LOCAL_DATE;
LocalDate localDateMonth = LocalDate.parse(month + "-01");
String endDateTime = fmt.format(localDateMonth.with(TemporalAdjusters.lastDayOfMonth())) + " 23:59:59";
analyzeDataConditionPO.setEndTime(LocalDateTime.parse(endDateTime, df));
setValueGenerateCount(analyzeDataConditionPO, signboardConditions, po, rideCount, vo, EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(), true);
//年发电量
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(year + "-01-01 00:00:00", df));
setValueGenerateCount(analyzeDataConditionPO, signboardConditions, po, rideCount, vo, EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(), true);
powerCount.updateAndGet(v -> new Float(v + vo.getMonthGenerateCount()));
powerCountYear.updateAndGet(v -> new Float(v + yearVo.getYearGenerateCount()));
log.info("------------月发电量:[{}]--------", vo.getMonthGenerateCount());
}
}
}
Double finishPowerMon = new BigDecimal(powerCount.get()).doubleValue();
stationReportVO.setFinishPowerMon(finishPowerMon.toString());
Double finishPowerYear = new BigDecimal(powerCountYear.get()).doubleValue();
stationReportVO.setFinishPowerYear(finishPowerYear.toString());
//当年的计划发电量
Double planPowerYear = planGenertionClient.getPlanPowerYear(Arrays.asList(stationId), year);
stationReportVO.setPowerYearPlan(planPowerYear);
//当月的计划发电量
R<Float> planPowerMonR = planGenertionClient.planGenerationMonthCount(stationId, month);
Double planPowerMon = planPowerMonR.getData().doubleValue();
stationReportVO.setPowerMonPlan(planPowerMon);
if (ObjectUtil.isNotEmpty(stationReportVO.getPowerMonPlan())
&&ObjectUtil.isNotEmpty(stationReportVO.getFinishPowerMon())
&&new BigDecimal(stationReportVO.getPowerMonPlan()).compareTo(BigDecimal.ZERO)!=0){
BigDecimal monRate = new BigDecimal(stationReportVO.getFinishPowerMon()).multiply(new BigDecimal(100))
.divide(new BigDecimal(stationReportVO.getPowerMonPlan()), 2, BigDecimal.ROUND_UP);
stationReportVO.setPowerMonRate(monRate.doubleValue()+"%");
}else {
stationReportVO.setPowerMonRate(new Double(0)+"%");
}
if (ObjectUtil.isNotEmpty(stationReportVO.getFinishPowerYear())
&&ObjectUtil.isNotEmpty(stationReportVO.getPowerYearPlan())
&&new BigDecimal(stationReportVO.getPowerYearPlan()).compareTo(BigDecimal.ZERO)!=0){
BigDecimal yearRate = new BigDecimal(stationReportVO.getFinishPowerYear()).multiply(new BigDecimal(100))
.divide(new BigDecimal(stationReportVO.getPowerYearPlan()), 2, BigDecimal.ROUND_UP);
stationReportVO.setPowerYearRate(yearRate.doubleValue()+"%");
}else {
stationReportVO.setPowerYearRate(new Double(0)+"%");
}
stationReportVOList.add(stationReportVO);
return stationReportVOList;
}
/**
* 获取部门站点发电量情况
*

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java

@ -8,6 +8,7 @@ import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.vo.MaintenanceExportVO;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.operational.report.vo.MaintenanceReportVO;
import com.hnac.hzims.operational.report.vo.RunReportVO;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
@ -48,6 +49,7 @@ public interface IOperMaintenanceTaskService extends BaseService<OperMaintenance
List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(LocalDate startDate,LocalDate endDate,List<Long> deptIdList);
List<MaintenanceReportVO> getMaintenanceStatisticsByDisposer(Map<String,Object> params);
List<RunReportVO> getMaintenanceStatisticsByName(Map<String,Object> params);
List<Map<String,Object>> getMaintenanceConclusion(Map<String,Object> params);

71
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java

@ -24,6 +24,7 @@ import com.hnac.hzims.operational.maintenance.vo.MaintenanceExportVO;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.operational.maintenance.wrapper.OperMaintenanceTaskWrapper;
import com.hnac.hzims.operational.report.vo.MaintenanceReportVO;
import com.hnac.hzims.operational.report.vo.RunReportVO;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.feign.IDangerSourceClient;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
@ -61,6 +62,7 @@ import java.text.DecimalFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@ -245,6 +247,75 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
}
@Override
public List<RunReportVO> getMaintenanceStatisticsByName(Map<String, Object> params) {
LocalDate startDate = LocalDate.parse(params.get("startDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
LocalDate endDate = LocalDate.parse(params.get("endDate").toString(), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
List<Long> deptIdList = (List<Long>) params.get("deptId");
List<RunReportVO> maintenanceReportVOList = new ArrayList<>();
//查询当月日常维护任务
List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList = this.baseMapper.selectList(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{
ge(OperMaintenanceTaskEntity::getDisposeTime, startDate);
le(OperMaintenanceTaskEntity::getDisposeTime, endDate);
in(OperMaintenanceTaskEntity::getCreateDept, deptIdList);
eq(OperMaintenanceTaskEntity::getIsDeleted, 0);
}});
AtomicInteger index= new AtomicInteger(1);
//按执行人分组
if (CollectionUtil.isNotEmpty(operMaintenanceTaskEntityList)) {
Map<String, List<OperMaintenanceTaskEntity>> map = operMaintenanceTaskEntityList.stream().filter(o -> StringUtils.isNotBlank(o.getDisposer())).collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getDisposer));
map.forEach((k, v) -> {
RunReportVO maintenanceReportVO = new RunReportVO();
maintenanceReportVO.setIndex(index.get());
//获取执行人名字
List<Long> userIdList = Arrays.asList(k.split(",")).stream().map(o -> Long.parseLong(o)).collect(Collectors.toList());
String userName = userIdList.stream().map(userId -> {
User user = UserCache.getUser(userId);
return Optional.ofNullable(user).map(User::getName).orElse("");
}).collect(Collectors.joining(","));
maintenanceReportVO.setUserName(userName);
this.fillRunReport(v, maintenanceReportVO);
maintenanceReportVOList.add(maintenanceReportVO);
index.getAndIncrement();
});
//合计
List<OperMaintenanceTaskEntity> maintenanceTaskEntityList = operMaintenanceTaskEntityList.stream().filter(o -> StringUtils.isNotBlank(o.getDisposer())).collect(Collectors.toList());
RunReportVO maintenanceReportVO = new RunReportVO();
maintenanceReportVO.setUserName("合计");
this.fillRunReport(maintenanceTaskEntityList, maintenanceReportVO);
maintenanceReportVOList.add(maintenanceReportVO);
}
return maintenanceReportVOList;
}
private static void fillRunReport(List<OperMaintenanceTaskEntity> v, RunReportVO maintenanceReportVO) {
//已完成任务
List<OperMaintenanceTaskEntity> finishTask = v.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList());
Map<String, List<OperMaintenanceTaskEntity>> finishTaskGroupByType = finishTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode));
AtomicReference<String> finishSituation = new AtomicReference<>("");
finishTaskGroupByType.forEach((TypeCode, TypeList) -> {
try {
finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n"));
} catch (NullPointerException e) {
e.printStackTrace();
}
});
maintenanceReportVO.setCompleteNum(finishTask.size());
maintenanceReportVO.setCompleteList(finishTask.stream().map(s->String.valueOf(s.getId())).collect(Collectors.toList()));
//未完成任务
List<OperMaintenanceTaskEntity> immatureTask = v.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 != o.getStatus()).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(immatureTask)){
Map<String, List<OperMaintenanceTaskEntity>> immatureTaskTaskGroupByType = immatureTask.stream().collect(Collectors.groupingBy(OperMaintenanceTaskEntity::getTypeCode));
// AtomicReference<String> immatureTaskSituation = new AtomicReference<>("");
immatureTaskTaskGroupByType.forEach((TypeCode, TypeList) -> {
finishSituation.set(finishSituation.get().concat(DictCache.getValue(DictConstant.MAINTENANCE_TYPE_CODE, TypeCode)).concat(":").concat(TypeList.size() + "").concat("\r\n"));
});
maintenanceReportVO.setIncompleteNum(immatureTask.size());
maintenanceReportVO.setIncompleteList(immatureTask.stream().map(s->String.valueOf(s.getId())).collect(Collectors.toList()));
maintenanceReportVO.setRemark(finishSituation.get());
}
}
@Override
public List<Map<String, Object>> getMaintenanceConclusion(Map<String, Object> params) {
return operMaintenanceTaskMapper.getMaintenanceConclusion(params);
}

52
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/MonthReportController.java

@ -13,6 +13,7 @@ import com.hnac.hzims.operational.report.schedule.OperStationCreateMonthReport;
import com.hnac.hzims.operational.report.service.IMonthReportService;
import com.hnac.hzims.operational.report.service.IOperPersonalMonthReportService;
import com.hnac.hzims.operational.report.service.IOperStationMonthReportService;
import com.hnac.hzims.operational.report.vo.StationRunReportAllVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.objects.annotations.Getter;
@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.time.LocalDate;
@ -66,38 +68,44 @@ public class MonthReportController {
@OperationAnnotation(moduleName = "生产月报",
title = "统计月报(对内 对外)",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "根据站点编码获取站点月报")
public R<StationReportAllVO> getStationMonthReportByStationCode(@RequestParam("deptId") Long deptId,@RequestParam("month") String month) throws Exception {
public R<StationRunReportAllVO> getStationMonthReportByStationCode(@RequestParam("deptId") Long deptId,@RequestParam("month") String month) throws Exception {
// LocalDate startDate = DateUtil.getFirstDayByYearMonth(month);
// LocalDate endDate = DateUtil.getLastDayByYearMonth(month);
// return R.data(taskMonthService.getStationMonthReport(startDate,endDate,deptId.toString()));
StationReportAllVO stationReportAllVO = monthReportService.getStationMonthReportByStationCode(deptId,month);
StationRunReportAllVO stationReportAllVO = monthReportService.getStationMonthReportByStationCode(deptId,month);
return R.data(stationReportAllVO);
}
@ApiLog
@GetMapping("/getPersonalMonthReport")
@ApiOperation(value = "获取当前登录人个人月报",notes = "获取当前登录人个人月报")
@ApiOperationSupport(order = 2)
@OperationAnnotation(moduleName = "生产月报",title = "统计月报-个人",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "获取当前登录人个人月报")
public R<PersonalMonthReportVO> getPersonalMonthReport(@RequestParam("month") String month) throws Exception {
PersonalMonthReportVO personalMonthReportVO = monthReportService.getPersonalMonthReport(month);
return R.data(personalMonthReportVO);
}
//
// @ApiLog
// @GetMapping("/getPersonalMonthReport")
// @ApiOperation(value = "获取当前登录人个人月报",notes = "获取当前登录人个人月报")
// @ApiOperationSupport(order = 2)
// @OperationAnnotation(moduleName = "生产月报",title = "统计月报-个人",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
// action = "获取当前登录人个人月报")
// public R<PersonalMonthReportVO> getPersonalMonthReport(@RequestParam("month") String month) throws Exception {
// PersonalMonthReportVO personalMonthReportVO = monthReportService.getPersonalMonthReport(month);
// return R.data(personalMonthReportVO);
// }
@GetMapping("/exportStationMonthReport")
@ApiOperation(value = "导出站点月报",notes = "导出站点月报")
@ApiOperationSupport(order = 3)
public void exportStationMonthReport(@RequestParam("month") String month,@RequestParam("stationCode") String stationCode,@RequestParam("type") String type) throws UnsupportedEncodingException {
operStationMonthReportService.exportStationMonthReport(month,stationCode,type);
}
@GetMapping("/exportPersonalMonthReport")
@ApiOperation(value = "导出个人月报",notes = "导出个人月报")
@ApiOperationSupport(order = 4)
public void exportPersonalMonthReport(@RequestParam("month") String month){
operPersonalMonthReportService.exportPersonalMonthReport(month);
public void exportStationMonthReport(HttpServletResponse response, @RequestParam("deptId") Long deptId, @RequestParam("month") String month) throws Exception {
StationRunReportAllVO stationReportAllVO = monthReportService.getStationMonthReportByStationCode(deptId,month);
operStationMonthReportService.exportStationMonthReport(response, stationReportAllVO,deptId);
}
// @GetMapping("/exportStationMonthReport")
// @ApiOperation(value = "导出站点月报",notes = "导出站点月报")
// @ApiOperationSupport(order = 3)
// public void exportStationMonthReport(@RequestParam("month") String month,@RequestParam("stationCode") String stationCode,@RequestParam("type") String type) throws UnsupportedEncodingException {
// operStationMonthReportService.exportStationMonthReport(month,stationCode,type);
// }
// @GetMapping("/exportPersonalMonthReport")
// @ApiOperation(value = "导出个人月报",notes = "导出个人月报")
// @ApiOperationSupport(order = 4)
// public void exportPersonalMonthReport(@RequestParam("month") String month){
// operPersonalMonthReportService.exportPersonalMonthReport(month);
// }
@GetMapping("/getStationMonthReport")
@ApiOperation(value = "按机构获取月报测试",notes = "按机构获取月报测试")

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/schedule/OperStationCreateMonthReport.java

@ -9,6 +9,7 @@ import com.hnac.hzims.operational.report.entity.OperMonthReportEntity;
import com.hnac.hzims.operational.report.service.IMonthReportService;
import com.hnac.hzims.operational.report.service.IOperStationMonthReportService;
import com.hnac.hzims.operational.report.utils.ObjectHelper;
import com.hnac.hzims.operational.report.vo.StationRunReportAllVO;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.xxl.job.core.biz.model.ReturnT;
@ -63,9 +64,7 @@ public class OperStationCreateMonthReport {
}});
if(CollectionUtil.isEmpty(operMonthReportEntityList)){
//按站点生成各电站运维月报
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
singleThreadExecutor.execute(() -> {
StationReportAllVO stationReportAllVO = operStationMonthReportService.getStationMonthReport(yearAndMonth, deptVO);
StationRunReportAllVO stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(yearAndMonth, deptVO);
if(ObjectUtil.isNotEmpty(stationReportAllVO)){
OperMonthReportEntity operMonthReportEntity = new OperMonthReportEntity();
operMonthReportEntity.setMonth(yearAndMonth);
@ -79,8 +78,6 @@ public class OperStationCreateMonthReport {
e.printStackTrace();
}
}
});
singleThreadExecutor.shutdown();
}
else{
log.info("该月{}已生成月报",deptVO.getDeptName());

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IMonthReportService.java

@ -3,6 +3,7 @@ package com.hnac.hzims.operational.report.service;
import com.hnac.hzims.operational.report.vo.PersonalMonthReportVO;
import com.hnac.hzims.operational.report.vo.StationReportAllVO;
import com.hnac.hzims.operational.report.entity.OperMonthReportEntity;
import com.hnac.hzims.operational.report.vo.StationRunReportAllVO;
import org.springblade.core.mp.base.BaseService;
public interface IMonthReportService extends BaseService<OperMonthReportEntity> {
@ -13,7 +14,7 @@ public interface IMonthReportService extends BaseService<OperMonthReportEntity>
* @return
* @throws Exception
*/
StationReportAllVO getStationMonthReportByStationCode(Long deptId, String month) throws Exception;
StationRunReportAllVO getStationMonthReportByStationCode(Long deptId, String month) throws Exception;
/**
* 查询个人月报
@ -21,5 +22,5 @@ public interface IMonthReportService extends BaseService<OperMonthReportEntity>
* @return
* @throws Exception
*/
PersonalMonthReportVO getPersonalMonthReport(String month) throws Exception;
// PersonalMonthReportVO getPersonalMonthReport(String month) throws Exception;
}

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IOperStationMonthReportService.java

@ -1,8 +1,11 @@
package com.hnac.hzims.operational.report.service;
import com.hnac.hzims.operational.report.vo.StationReportAllVO;
import com.hnac.hzims.operational.report.vo.StationRunReportAllVO;
import org.springblade.system.vo.DeptVO;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
public interface IOperStationMonthReportService {
@ -12,11 +15,15 @@ public interface IOperStationMonthReportService {
* @return
*/
StationReportAllVO getStationMonthReport(String yearAndMonth, DeptVO deptVO);
/**
* 获取电站月报
* @param yearAndMonth
* @return
*/
StationRunReportAllVO getStationMonthReportV2(String yearAndMonth, DeptVO deptVO);
/**
* 导出站点月报
* @param month
* @param type
*/
void exportStationMonthReport(String month,String stationCode,String type);
// void exportStationMonthReport(String month,String stationCode,String type);
void exportStationMonthReport(HttpServletResponse response, StationRunReportAllVO stationReportAllVO,Long deptId) throws Exception;
}

43
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java

@ -9,6 +9,7 @@ import com.hnac.hzims.operational.report.entity.OperMonthReportEntity;
import com.hnac.hzims.operational.report.mapper.MonthReportMapper;
import com.hnac.hzims.operational.report.service.IMonthReportService;
import com.hnac.hzims.operational.report.utils.ObjectHelper;
import com.hnac.hzims.operational.report.vo.StationRunReportAllVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -33,12 +34,12 @@ public class MonthReportServiceImpl extends BaseServiceImpl<MonthReportMapper, O
private final ISysClient sysClient;
@Override
public StationReportAllVO getStationMonthReportByStationCode(Long deptId, String month) throws Exception {
StationReportAllVO stationReportAllVO = new StationReportAllVO();
public StationRunReportAllVO getStationMonthReportByStationCode(Long deptId, String month) throws Exception {
StationRunReportAllVO stationReportAllVO = new StationRunReportAllVO();
Dept dept = sysClient.getDept(deptId).getData();
//当月查询实时数据
if(month.equals(YearMonth.now().toString())){
stationReportAllVO = operStationMonthReportService.getStationMonthReport(month, BeanUtil.copy(dept, DeptVO.class));
stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
}
//历史查询定时任务生成的数据
else{
@ -48,26 +49,26 @@ public class MonthReportServiceImpl extends BaseServiceImpl<MonthReportMapper, O
orderByDesc(OperMonthReportEntity::getObject);
last("limit 1;");
}});
stationReportAllVO = ObjectUtil.isNotEmpty(operMonthReportEntity) ? (StationReportAllVO) ObjectHelper.byte2obj(operMonthReportEntity.getObject())
: operStationMonthReportService.getStationMonthReport(month, BeanUtil.copy(dept, DeptVO.class));
stationReportAllVO = ObjectUtil.isNotEmpty(operMonthReportEntity) ? (StationRunReportAllVO) ObjectHelper.byte2obj(operMonthReportEntity.getObject())
: operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
}
return stationReportAllVO;
}
@Override
public PersonalMonthReportVO getPersonalMonthReport(String month) throws Exception {
PersonalMonthReportVO personalMonthReportVO = new PersonalMonthReportVO();
BladeUser user = AuthUtil.getUser();
if(month.equals(YearMonth.now().toString())){
personalMonthReportVO = operPersonalMonthReportService.getPersonalMonthReport(month,user.getUserId());
}
else{
OperMonthReportEntity operMonthReportEntity = this.getOne(new LambdaQueryWrapper<OperMonthReportEntity>(){{
eq(OperMonthReportEntity::getMonth,month);
eq(OperMonthReportEntity::getUserId,user.getUserId());
}});
personalMonthReportVO = ObjectUtil.isNotEmpty(operMonthReportEntity) ? (PersonalMonthReportVO) ObjectHelper.byte2obj(operMonthReportEntity.getObject()) : null;
}
return personalMonthReportVO;
}
// @Override
// public PersonalMonthReportVO getPersonalMonthReport(String month) throws Exception {
// PersonalMonthReportVO personalMonthReportVO = new PersonalMonthReportVO();
// BladeUser user = AuthUtil.getUser();
// if(month.equals(YearMonth.now().toString())){
// personalMonthReportVO = operPersonalMonthReportService.getPersonalMonthReport(month,user.getUserId());
// }
// else{
// OperMonthReportEntity operMonthReportEntity = this.getOne(new LambdaQueryWrapper<OperMonthReportEntity>(){{
// eq(OperMonthReportEntity::getMonth,month);
// eq(OperMonthReportEntity::getUserId,user.getUserId());
// }});
// personalMonthReportVO = ObjectUtil.isNotEmpty(operMonthReportEntity) ? (PersonalMonthReportVO) ObjectHelper.byte2obj(operMonthReportEntity.getObject()) : null;
// }
// return personalMonthReportVO;
// }
}

673
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java

@ -1,5 +1,6 @@
package com.hnac.hzims.operational.report.service.impl;
import cn.afterturn.easypoi.word.WordExportUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.service.IStationService;
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.fegin.ITicketInfoAllClient;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
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.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.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
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.logger.BladeLogger;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*;
import org.springblade.system.entity.Dept;
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.springframework.core.io.ClassPathResource;
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.ServletRequestAttributes;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
@ -63,15 +76,20 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
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
@Slf4j
@RequiredArgsConstructor
public class OperStationMonthReportServiceImpl implements IOperStationMonthReportService {
private final IImsDutyMainService iImsDutyMainService;
private final IOperMaintenanceTaskService operMaintenanceTaskService;
private final IInspectReportClient inspectReportClient;
private final IOperDefectService operDefectService;
private final IOperAccessTaskService operAccessTaskService;
private final IMainSystemMonitoringService mainSystemMonitoringService;
@ -80,18 +98,28 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
private final IInspectRobotTaskClient inspectRobotTaskClient;
private final IFdpDiagnoseClient diagnoseClient;
private final ISysClient sysClient;
private final IUserClient userClient;
private final IInspectTaskReportClient taskReportClient;
private final ITicketInfoAllClient ticketInfoAllClient;
private final BladeLogger logger;
private final SoeDataClient soeDataClient;
/**统计月报线程数量**/
/**
* 统计月报线程数量
**/
private static final int POOL_QUANTITY = 8;
/**通过线程池异步获取月报各模块内容 主要分为八块内容**/
/**
* 通过线程池异步获取月报各模块内容 主要分为八块内容
**/
private static ExecutorService pool = Executors.newFixedThreadPool(POOL_QUANTITY);
/**统计月报-电站-对内**/
/**
* 统计月报-电站-对内
**/
private static final String STATION_REPORT_INSIDE = "2";
/**统计月报-电站-对外**/
/**
* 统计月报-电站-对外
**/
private static final String STATION_REPORT_OUTSIDE = "1";
@Override
@ -124,7 +152,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
//监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY);
long startMillis = System.currentTimeMillis();
//电站发电情况
pool.execute(() -> {
try {
@ -134,19 +162,21 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
powerList.addAll(stationReportVOList);
});
stationReportAllVo.setStationReportVOList(powerList);
}
finally {
} finally {
countDownLatch.countDown();
log.info("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms");
System.out.printf("电站发电耗时:"+(System.currentTimeMillis()-startMillis)+"ms");
}
});
//值班情况
pool.execute(() -> {
try {
List<DutyReportVO> dutyReportVOList = iImsDutyMainService.getDutyMainStatisticsByClassId(params);
stationReportAllVo.setDutyReportVOList(dutyReportVOList);
}
finally {
// List<DutyReportVO> dutyReportVOList = iImsDutyMainService.getDutyMainStatisticsByClassId(params);
// stationReportAllVo.setDutyReportVOList(dutyReportVOList);
} finally {
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 {
List<MaintenanceReportVO> maintenanceList = operMaintenanceTaskService.getMaintenanceStatisticsByDisposer(params);
stationReportAllVo.setMaintenanceReportVOList(maintenanceList);
}
finally {
} finally {
countDownLatch.countDown();
log.info("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms");
System.out.printf("日常维护:"+(System.currentTimeMillis()-startMillis)+"ms");
}
});
//检修
pool.execute(() -> {
try {
List<AccessReportVO> accessList = operAccessTaskService.getAccessTaskByDisposer(params);
stationReportAllVo.setAccessReportVOList(accessList);
}
finally {
// 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");
}
});
//缺陷
@ -174,35 +206,38 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
try {
List<DefectReportsVO> defectList = operDefectService.getFaultByFaultCode(params);
stationReportAllVo.setDefectReportsVOList(defectList);
}
finally {
} 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 ticketStatisticDTO = new TicketStatisticDTO();
ticketStatisticDTO.setStartDate(fmt.format(startDate));
ticketStatisticDTO.setEndDate(fmt.format(endDate));
ticketStatisticDTO.setDeptIds(deptIds);
List<TicketInfoStatisticVO> ticketVOS = ticketInfoAllClient.getTicketReportStatistic(ticketStatisticDTO);
stationReportAllVo.setTicketInfoStatisticVOList(ticketVOS);
}
finally {
} finally {
countDownLatch.countDown();
log.info("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms");
System.out.printf("两票统计:"+(System.currentTimeMillis()-startMillis)+"ms");
}
});
//巡检
pool.execute(() -> {
try {
List<TaskReportVO> taskReportVOS = taskReportClient.getInspectTaskReport(params);
this.fillInspectProblem(startDate,endDate,deptIdList,taskReportVOS);
this.fillInspectProblem(startDate, endDate, deptIdList, taskReportVOS);
stationReportAllVo.setInspectReportVOList(taskReportVOS);
}
finally {
} finally {
countDownLatch.countDown();
log.info("巡检:"+(System.currentTimeMillis()-startMillis)+"ms");
System.out.printf("巡检:"+(System.currentTimeMillis()-startMillis)+"ms");
}
});
//智能诊断
@ -262,102 +297,433 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
this.getStationReportConclusion(stationReportAllVo, params);
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 stationCode 站点编码
* @param type 导出类型
*/
@Override
public void exportStationMonthReport(String month, String stationCode, String type) {
DeptVO deptVO = BeanUtil.copy(sysClient.getDept(Long.parseLong(stationCode)).getData(), DeptVO.class);
StationReportAllVO stationReportAllVO = this.getStationMonthReport(month, deptVO);
Assert.isTrue(ObjectUtil.isNotEmpty(stationReportAllVO),()->{
public void exportStationMonthReport(HttpServletResponse response, StationRunReportAllVO stationReportAllVO,Long deptId) throws Exception {
Assert.isTrue(ObjectUtil.isNotEmpty(stationReportAllVO), () -> {
throw new ServiceException("电站统计月报查询为空");
});
ExcelData ed = new ExcelData();
XSSFWorkbook readWb = ed.getWb();
XSSFSheet readSheet = null;
HashMap<String, Object> map = getHashMap(stationReportAllVO, deptId);
ClassPathResource classPathResource = new ClassPathResource("files/运维月度报表内容设计0708.xlsx");
InputStream inputStream = null;
XSSFWorkbook wb = null;
XWPFDocument xwpfDocument = WordExportUtil.exportWord07("template/word/stationMonthReport.docx", map);
// 下载导出
String filename = stationReportAllVO.getYearMonth()+stationReportAllVO.getStationName()+"月报";
// 设置头信息
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-excel");
ServletOutputStream outputStream = null;
try {
inputStream = classPathResource.getInputStream();
wb = new XSSFWorkbook(inputStream);
//设置xlsx格式
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) {
e.printStackTrace();
}
Assert.isTrue(ObjectUtil.isNotEmpty(inputStream) && ObjectUtil.isNotEmpty(wb),()->{
throw new ServiceException("站点统计月报excel模板读取失败");
});
}
if(STATION_REPORT_OUTSIDE.equals(type)) {
readSheet = readWb.getSheet("站长月度报告-对外");
readWb.setSheetHidden(1, true);
readWb.setSheetHidden(2, true);
private HashMap<String, Object> getHashMap(StationRunReportAllVO stationReportAllVO, Long deptId) throws IllegalAccessException {
HashMap<String, Object> map = new HashMap<>();
map.put("deptName", stationReportAllVO.getStationName());
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("站长月度报告-对内");
readWb.setSheetHidden(0, true);
readWb.setSheetHidden(2, true);
//电站发电情况
if (CollectionUtil.isNotEmpty(stationReportAllVO.getStationReportVOList())) {
ArrayList<HashMap<String, Object>> list = new ArrayList<>();
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);
// 下载导出
RequestAttributes requestAttributes = RequestContextHolder.currentRequestAttributes();
HttpServletResponse response = ((ServletRequestAttributes) requestAttributes).getResponse();
String fileName = "(" + month + ")站长月度报告";
try {
ExcelUtil.exportExcel(readWb,response,fileName);
} catch (IOException e) {
e.printStackTrace();
private static void fillMapByClass(Object object, ArrayList<HashMap<String, Object>> list) throws IllegalAccessException {
Class<?> clazz = object.getClass();
HashMap<String, Object> temp=new HashMap<>();
for (Field field : clazz.getDeclaredFields()) {
field.setAccessible(true);
String fieldName = field.getName();
Object value = field.get(object);
temp.put(fieldName, value);
}
list.add(temp);
}
/**
* 填充统计月报
*
* @param sheet excel sheet
* @param stationReportAllVO 月报对象
* @param type
*/
private void fillReport(XSSFSheet sheet, StationReportAllVO stationReportAllVO, String type) {
logger.info("hzims:operational:station:report",JSON.toJSONString(stationReportAllVO));
logger.info("hzims:operational:station:report", JSON.toJSONString(stationReportAllVO));
//当前行数
int currentRowNum = 0;
//填充标题
XSSFCell cell_0_0 = sheet.getRow(currentRowNum).getCell(0);
String title = String.format(cell_0_0.getStringCellValue(),stationReportAllVO.getStationName(),stationReportAllVO.getYearMonth());
String title = String.format(cell_0_0.getStringCellValue(), stationReportAllVO.getStationName(), stationReportAllVO.getYearMonth());
cell_0_0.setCellValue(title);
//电站发电情况
currentRowNum = currentRowNum+2;
currentRowNum = this.fillPowerGeneration(stationReportAllVO.getStationReportVOList(),currentRowNum,sheet,type);
currentRowNum = currentRowNum + 2;
currentRowNum = this.fillPowerGeneration(stationReportAllVO.getStationReportVOList(), currentRowNum, sheet, type);
//值班情况
currentRowNum = currentRowNum+3;
currentRowNum = this.fillDuty(stationReportAllVO.getDutyReportVOList(),currentRowNum,sheet,type);
currentRowNum = currentRowNum + 3;
currentRowNum = this.fillDuty(stationReportAllVO.getDutyReportVOList(), currentRowNum, sheet, type);
//日常维护
currentRowNum = currentRowNum+2;
currentRowNum = this.fillMaintenance(stationReportAllVO.getMaintenanceReportVOList(),currentRowNum,sheet,type);
currentRowNum = currentRowNum + 2;
currentRowNum = this.fillMaintenance(stationReportAllVO.getMaintenanceReportVOList(), currentRowNum, sheet, type);
//巡检
currentRowNum = currentRowNum+2;
currentRowNum = this.fillInspect(stationReportAllVO.getInspectReportVOList(),currentRowNum,sheet,type);
currentRowNum = currentRowNum + 2;
currentRowNum = this.fillInspect(stationReportAllVO.getInspectReportVOList(), currentRowNum, sheet, type);
//检修
currentRowNum = currentRowNum+2;
currentRowNum = this.fillAccess(stationReportAllVO.getAccessReportVOList(),currentRowNum,sheet,type);
currentRowNum = currentRowNum + 2;
currentRowNum = this.fillAccess(stationReportAllVO.getAccessReportVOList(), currentRowNum, sheet, type);
//缺陷
currentRowNum = currentRowNum+2;
currentRowNum = this.fillDefect(stationReportAllVO.getDefectReportsVOList(),currentRowNum,sheet,type);
currentRowNum = currentRowNum + 2;
currentRowNum = this.fillDefect(stationReportAllVO.getDefectReportsVOList(), currentRowNum, sheet, type);
//两票
currentRowNum = currentRowNum+2;
currentRowNum = this.fillTicket(stationReportAllVO.getTicketInfoStatisticVOList(),currentRowNum,sheet,type);
currentRowNum = currentRowNum + 2;
currentRowNum = this.fillTicket(stationReportAllVO.getTicketInfoStatisticVOList(), currentRowNum, sheet, type);
//智能诊断
currentRowNum = currentRowNum+1;
currentRowNum = this.fillDiagnosis(stationReportAllVO.getDiagnoseConclusion(),currentRowNum,sheet,type);
currentRowNum = currentRowNum + 1;
currentRowNum = this.fillDiagnosis(stationReportAllVO.getDiagnoseConclusion(), currentRowNum, sheet, type);
//小结
currentRowNum = this.fillConclusion(stationReportAllVO,currentRowNum,sheet,type);
currentRowNum = this.fillConclusion(stationReportAllVO, currentRowNum, sheet, type);
//处理建议合并单元格
//this.mergeSuggestion(currentRowNum+2,sheet,type);
}
@ -365,11 +731,10 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
private void mergeSuggestion(int currentRowNum, XSSFSheet sheet, String type) {
final int OUTSIDE_COLUMN_NUM = 4;
final int INSIDE_COLUMN_NUM = 5;
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);
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);
sheet.addMergedRegion(cellRangeAddress);
}
@ -378,13 +743,13 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
private int fillConclusion(StationReportAllVO stationReportAllVO, int currentRowNum, XSSFSheet sheet, String type) {
final int OUTSIDE_COLUMN_NUM = 4;
final int INSIDE_COLUMN_NUM = 5;
sheet.shiftRows(currentRowNum+1, sheet.getLastRowNum(), 1,true,false);
sheet.createRow(currentRowNum+1);
sheet.shiftRows(currentRowNum + 1, sheet.getLastRowNum(), 1, true, false);
sheet.createRow(currentRowNum + 1);
XSSFRow row = sheet.getRow(currentRowNum + 1);
row.setHeight((short) 2400);
XSSFRow lastRow = sheet.getRow(currentRowNum);
if(STATION_REPORT_OUTSIDE.equals(type)) {
IntStream.iterate(0,col_index->col_index+1).limit(OUTSIDE_COLUMN_NUM+1).forEachOrdered(col_index->{
if (STATION_REPORT_OUTSIDE.equals(type)) {
IntStream.iterate(0, col_index -> col_index + 1).limit(OUTSIDE_COLUMN_NUM + 1).forEachOrdered(col_index -> {
row.createCell(col_index);
XSSFCellStyle cellStyle = lastRow.getCell(col_index).getCellStyle();
cellStyle.setAlignment(HorizontalAlignment.LEFT);
@ -392,55 +757,53 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
row.getCell(col_index).setCellStyle(cellStyle);
});
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);
row.getCell(0).setCellValue(stationReportAllVO.getStationOutsideConclusion());
}
else if(STATION_REPORT_INSIDE.equals(type)) {
IntStream.iterate(0,col_index->col_index+1).limit(INSIDE_COLUMN_NUM+1).forEachOrdered(col_index->{
} else if (STATION_REPORT_INSIDE.equals(type)) {
IntStream.iterate(0, col_index -> col_index + 1).limit(INSIDE_COLUMN_NUM + 1).forEachOrdered(col_index -> {
row.createCell(col_index);
XSSFCellStyle cellStyle = lastRow.getCell(col_index).getCellStyle();
cellStyle.setWrapText(true);
cellStyle.setAlignment(HorizontalAlignment.LEFT);
row.getCell(col_index).setCellStyle(cellStyle);
});
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum+1, (short) currentRowNum+1, (short) 0, (short) INSIDE_COLUMN_NUM);
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum + 1, (short) currentRowNum + 1, (short) 0, (short) INSIDE_COLUMN_NUM);
sheet.addMergedRegion(cellRangeAddress);
row.getCell(0).setCellValue(stationReportAllVO.getStationInsideConclusion());
}
return currentRowNum+1;
return currentRowNum + 1;
}
private int fillDiagnosis(String diagnoseConclusion, int currentRowNum, XSSFSheet sheet, String type) {
final int OUTSIDE_COLUMN_NUM = 4;
final int INSIDE_COLUMN_NUM = 5;
sheet.shiftRows(currentRowNum+1, sheet.getLastRowNum(), 1,true,false);
sheet.createRow(currentRowNum+1);
sheet.shiftRows(currentRowNum + 1, sheet.getLastRowNum(), 1, true, false);
sheet.createRow(currentRowNum + 1);
XSSFRow row = sheet.getRow(currentRowNum + 1);
row.setHeight((short) 800);
XSSFRow lastRow = sheet.getRow(currentRowNum-1);
if(STATION_REPORT_OUTSIDE.equals(type)) {
IntStream.iterate(0,col_index->col_index+1).limit(OUTSIDE_COLUMN_NUM+1).forEachOrdered(col_index->{
XSSFRow lastRow = sheet.getRow(currentRowNum - 1);
if (STATION_REPORT_OUTSIDE.equals(type)) {
IntStream.iterate(0, col_index -> col_index + 1).limit(OUTSIDE_COLUMN_NUM + 1).forEachOrdered(col_index -> {
row.createCell(col_index);
XSSFCellStyle cellStyle = lastRow.getCell(col_index).getCellStyle();
cellStyle.setWrapText(true);
row.getCell(col_index).setCellStyle(cellStyle);
});
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);
}
else if(STATION_REPORT_INSIDE.equals(type)) {
IntStream.iterate(0,col_index->col_index+1).limit(INSIDE_COLUMN_NUM+1).forEachOrdered(col_index->{
} else if (STATION_REPORT_INSIDE.equals(type)) {
IntStream.iterate(0, col_index -> col_index + 1).limit(INSIDE_COLUMN_NUM + 1).forEachOrdered(col_index -> {
row.createCell(col_index);
XSSFCellStyle cellStyle = lastRow.getCell(col_index).getCellStyle();
cellStyle.setWrapText(true);
row.getCell(col_index).setCellStyle(cellStyle);
});
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum+1, (short) currentRowNum+1, (short) 0, (short) INSIDE_COLUMN_NUM);
CellRangeAddress cellRangeAddress = new CellRangeAddress((short) currentRowNum + 1, (short) currentRowNum + 1, (short) 0, (short) INSIDE_COLUMN_NUM);
sheet.addMergedRegion(cellRangeAddress);
}
row.getCell(0).setCellValue(diagnoseConclusion);
return currentRowNum+1;
return currentRowNum + 1;
}
private int fillTicket(List<TicketInfoStatisticVO> ticketInfoStatisticVOList, int currentRowNum, XSSFSheet sheet, String type) {
@ -747,4 +1110,112 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
stationReportAllVo.setStationInsideConclusion(conclusion.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());
}
}

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/AccessRunReportVO.java

@ -0,0 +1,32 @@
package com.hnac.hzims.operational.report.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class AccessRunReportVO implements Serializable {
private static final long serialVersionUID = -6752409583963294512L;
private Integer index;
@ApiModelProperty("人员ID")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long userId;
@ApiModelProperty("姓名")
private String userName;
@ApiModelProperty("检修项目")
private String maintenanceItem;
@ApiModelProperty("完成情况")
private String completeSituation;
@ApiModelProperty("备注")
private String remark;
}

36
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DefectRunReportsVO.java

@ -0,0 +1,36 @@
package com.hnac.hzims.operational.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class DefectRunReportsVO implements Serializable {
private static final long serialVersionUID = 4172942990070215282L;
private Integer index;
@ApiModelProperty("缺陷名称")
private String faultName;
@ApiModelProperty("缺陷等级")
private String seriousSituation;
@ApiModelProperty("发现人")
private String finder;
@ApiModelProperty("发现时间")
private String finderTime;
@ApiModelProperty("缺陷描述")
private String description;
@ApiModelProperty("处理时间")
private String handleTime;
@ApiModelProperty("处理情况")
private String handleSituation;
}

36
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyRunReportVO.java

@ -0,0 +1,36 @@
package com.hnac.hzims.operational.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class DutyRunReportVO implements Serializable {
private static final long serialVersionUID = 3273581622730234931L;
private Integer index;
@ApiModelProperty("班组名称")
private String groupName;
@ApiModelProperty("值长")
private String managerName;
@ApiModelProperty("值班次数")
private Integer dutyNum=0;
@ApiModelProperty("值班")
private List<String> dutyList;
@ApiModelProperty("发现问题数量")
private Integer findProblemNum=0;
@ApiModelProperty("发现问题数量")
private List<String> findProblemList;
@ApiModelProperty("延迟交接班")
private Integer delayChangeShifts=0;
@ApiModelProperty("延迟交接班")
private List<String> delayChangeList;
@ApiModelProperty("异常交接班")
private Integer exceptionChangeShifts=0;
@ApiModelProperty("异常交接班")
private List<String> exceptionChangeList;
}

41
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/FDPRunReportVO.java

@ -0,0 +1,41 @@
package com.hnac.hzims.operational.report.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class FDPRunReportVO implements Serializable {
private static final long serialVersionUID = -4198449565005940501L;
private Integer index;
@ApiModelProperty("最近出现告警时间")
@JSONField(name = "LASTBEGINTIME")
private String lastBeginTime;
@ApiModelProperty("告警内容")
private String content;
@ApiModelProperty("告警类型")
private String type;
@ApiModelProperty("告警次数")
private String num;
@ApiModelProperty("初步分析原因")
@JSONField(name = "ORD")
private String reason;
@ApiModelProperty("建议处置方式")
@JSONField(name = "INFO")
private String advise;
}

31
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/RunReportVO.java

@ -0,0 +1,31 @@
package com.hnac.hzims.operational.report.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class RunReportVO implements Serializable {
private static final long serialVersionUID = -4198449565005940501L;
private Integer index;
@ApiModelProperty("人员ID")
private String userId;
@ApiModelProperty("姓名")
private String userName;
@ApiModelProperty("完成次数")
private Integer completeNum;
@ApiModelProperty("完成任务数量")
private List<String> completeList;
@ApiModelProperty("未完成次数")
private Integer incompleteNum;
@ApiModelProperty("完成任务数量")
private List<String> incompleteList;
@ApiModelProperty("备注")
private String remark;
}

50
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/StationRunReportAllVO.java

@ -0,0 +1,50 @@
package com.hnac.hzims.operational.report.vo;
import com.hnac.hzims.fdp.vo.StatisticStatusVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import com.hnac.hzinfo.inspect.task.vo.TaskReportVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
@Data
public class StationRunReportAllVO implements Serializable {
private static final long serialVersionUID = -3173423342834166988L;
@ApiModelProperty("月报统计月份")
private String yearMonth;
@ApiModelProperty("电站名称")
private String stationName;
@ApiModelProperty("电站发电情况")
private List<StationRunReportVO> stationReportVOList;
@ApiModelProperty("值班")
private List<DutyRunReportVO> dutyReportVOList;
@ApiModelProperty("日常维护")
private List<RunReportVO> maintenanceReportVOList;
@ApiModelProperty("巡检")
private List<RunReportVO> inspectReportVOList;
@ApiModelProperty("检修")
private List<AccessRunReportVO> accessReportVOList;
@ApiModelProperty("缺陷")
private List<DefectRunReportsVO> defectReportsVOList;
@ApiModelProperty("两票")
private List<TicketInfoStatisticVO> ticketInfoStatisticVOList;
@ApiModelProperty("智能诊断")
private List<FDPRunReportVO> fdpRunReportVOList;
@ApiModelProperty("建议")
private String suggestion;
}

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/StationRunReportVO.java

@ -0,0 +1,32 @@
package com.hnac.hzims.operational.report.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class StationRunReportVO implements Serializable {
private static final long serialVersionUID = -8957498837980526029L;
@ApiModelProperty("序号")
private Integer index;
@ApiModelProperty(value = "电站名称")
private String stationName;
@ApiModelProperty(value = "月计划发电量")
private Double powerMonPlan;
@ApiModelProperty(value = "实发电量")
private String finishPowerMon;
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty(value = "月度完成率")
private String powerMonRate;
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty(value = "年度计划")
private Double powerYearPlan;
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty(value = "已完成")
private String finishPowerYear;
@ApiModelProperty(value = "年度完成率")
private String powerYearRate;
}

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/TimeUtils.java

@ -127,6 +127,21 @@ public class TimeUtils {
}
return monthList;
}
public static List<String> getListByYearMon(Integer year,Integer mon) {
List<String> monthList=new ArrayList<>();
for (int i = 0; i <mon; i++) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, Integer.valueOf(year));
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, i);
calendar.set(Calendar.DAY_OF_MONTH, 1);
String monTime = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE);
monthList.add(monTime);
}
return monthList;
}
public static String getMon(Integer year,Integer month) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();

BIN
hzims-service/operational/src/main/resources/template/word/stationMonthReport.docx

Binary file not shown.

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java

@ -110,8 +110,8 @@ public class ConferenceController extends BladeController {
@GetMapping("/recordPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "conferencePlanId", value = "会议计划id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "actualStartTime", value = "计划开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "actualEndTime", value = "计划结束时间", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "actualStartTime", value = "开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "actualEndTime", value = "结束时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "会议记录分页")
@ApiOperationSupport(order = 10)

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java

@ -113,8 +113,8 @@ public class RehearsalController extends BladeController {
@GetMapping("/rehearsalRecordPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "rehearsalPlanId", value = "演练计划id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "actualStartTime", value = "计划开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "actualEndTime", value = "计划结束时间", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "actualStartTime", value = "开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "actualEndTime", value = "结束时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "演练记录分页")
@ApiOperationSupport(order = 10)

14
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java

@ -124,13 +124,14 @@ public class TrainController extends BladeController {
@GetMapping("/trainRecordPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "startTime", value = "计划开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "endTime", value = "计划结束时间", dataType = "query", paramType = "string")
})
@ApiOperation(value = "培训记录分页")
@ApiOperationSupport(order = 10)
public R<IPage<TrainRecordEntity>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TrainRecordEntity> page = trainRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(
param, TrainRecordEntity.class).lambda().orderByDesc(TrainRecordEntity::getCreateTime));
IPage<TrainRecordEntity> page = trainRecordService.trainRecordPage(param, query);
return R.data(page);
}
@ -173,13 +174,14 @@ public class TrainController extends BladeController {
@GetMapping("/testPage")
@ApiImplicitParams({
@ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "trainRecordId", value = "培训记录id", dataType = "query", paramType = "string")
@ApiImplicitParam(name = "trainRecordId", value = "培训记录id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "testName", value = "考试名称", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string")
})
@ApiOperation(value = "考试记录分页")
@ApiOperationSupport(order = 16)
public R<IPage<TestEntity>> testPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TestEntity> page = testService.page(Condition.getPage(query), Condition.getQueryWrapper(param, TestEntity.class)
.lambda().orderByDesc(TestEntity::getCreateTime));
IPage<TestEntity> page = testService.testPage(param, query);
return R.data(page);
}

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/SpecialDeviceInspectionMapper.xml

@ -13,10 +13,10 @@
AND device_id = #{param.deviceId}
</if>
<if test="param.startTime != null and param.startTime != ''">
AND inspectionTime >= #{param.startTime}
AND inspection_time >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND inspectionTime &lt;= #{param.endTime}
AND inspection_time &lt;= #{param.endTime}
</if>
ORDER BY
create_time DESC

10
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java

@ -1,11 +1,13 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.dto.TestDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 考试记录Mapper类
@ -22,4 +24,12 @@ public interface TestMapper extends BaseMapper<TestEntity> {
* @return 考试记录名称列表
*/
List<TestDTO> getTestNameList(String trainPlanId);
/**
* 考试记录分页
* @param param 入参
* @param page 分页类
* @return 考试记录数据
*/
IPage<TestEntity> testPage(IPage<TestEntity> page, Map<String, Object> param);
}

23
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml

@ -15,4 +15,27 @@
ORDER BY
create_time DESC
</select>
<select id="testPage" resultType="com.hnac.hzims.safeproduct.entity.TestEntity">
SELECT
*
FROM
hzims_test
WHERE
is_deleted = 0
<if test="param.trainPlanId != null and param.trainPlanId != ''">
AND train_plan_id = #{param.trainPlanId}
</if>
<if test="param.trainRecordId != null and param.trainRecordId != ''">
AND train_record_id = #{param.trainRecordId}
</if>
<if test="param.testName != null and param.testName != ''">
AND test_name like concat('%', #{param.testName}, '%)'
</if>
<if test="param.unit != null and param.unit != ''">
AND test_name like concat('%', #{param.unit}, '%)'
</if>
ORDER BY
create_time DESC
</select>
</mapper>

10
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java

@ -1,12 +1,14 @@
package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 培训记录Mapper类
@ -30,4 +32,12 @@ public interface TrainRecordMapper extends BaseMapper<TrainRecordEntity> {
* @return 培训记录表VO类
*/
TrainRecordDetailVO getTrainRecordDetailById(Long id);
/**
* 培训记录分页
* @param param 入参
* @param page 分页类
* @return 培训记录数据
*/
IPage<TrainRecordEntity> trainRecordPage(IPage<TrainRecordEntity> page, Map<String, Object> param);
}

20
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml

@ -27,4 +27,24 @@
t1.is_deleted = 0
AND t1.id = #{id}
</select>
<select id="trainRecordPage" resultType="com.hnac.hzims.safeproduct.entity.TrainRecordEntity">
SELECT
*
FROM
hzims_train_record
WHERE
is_deleted = 0
<if test="param.trainPlanId != null and param.trainPlanId != ''">
AND train_plan_id = #{param.trainPlanId}
</if>
<if test="param.startTime != null and param.startTime != ''">
AND actual_start_time >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND actual_end_time &lt;= #{param.endTime}
</if>
ORDER BY
create_time DESC
</select>
</mapper>

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java

@ -1,11 +1,14 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.TestDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
/**
* 考试记录服务类
@ -63,4 +66,12 @@ public interface ITestService extends IService<TestEntity> {
* @return true-成功false-失败
*/
boolean updateTest(TestEntity testEntity);
/**
* 考试记录分页
* @param param 入参
* @param query 分页类
* @return 考试记录数据
*/
IPage<TestEntity> testPage(Map<String, Object> param, Query query);
}

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java

@ -1,12 +1,15 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import org.springblade.core.mp.support.Query;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 培训记录服务类
@ -64,4 +67,12 @@ public interface ITrainRecordService extends IService<TrainRecordEntity> {
* @return 培训记录表VO类
*/
TrainRecordDetailVO getTrainRecordDetailById(Long id);
/**
* 培训记录分页
* @param param 入参
* @param query 分页类
* @return 培训记录数据
*/
IPage<TrainRecordEntity> trainRecordPage(Map<String, Object> param, Query query);
}

13
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java

@ -3,6 +3,8 @@ package com.hnac.hzims.safeproduct.service.impl;
import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.dto.TestDTO;
@ -14,6 +16,7 @@ import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper;
import com.hnac.hzims.safeproduct.service.ITestScoreService;
import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -23,6 +26,7 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -175,6 +179,15 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
}
/**
* 考试记录分页
*/
@Override
public IPage<TestEntity> testPage(Map<String, Object> param, Query query) {
IPage<TestEntity> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.testPage(page, param);
}
/**
* 获取成绩列表
* @param testEntity 考试记录实体类
* @param person 参考人员

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java

@ -4,6 +4,8 @@ import cn.afterturn.easypoi.entity.ImageEntity;
import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
@ -18,6 +20,7 @@ import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import org.springblade.core.mp.support.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -180,6 +183,15 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
}
/**
* 培训记录分页
*/
@Override
public IPage<TrainRecordEntity> trainRecordPage(Map<String, Object> param, Query query) {
IPage<TrainRecordEntity> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.trainRecordPage(page, param);
}
/**
* 查询是否存在同月编号
* @param currentMonth 当月
* @return 存在则返回上一编号否则返回null

BIN
hzims-service/safeproduct/src/main/resources/template/会议记录表.docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/卫生自查表.docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/培训记录表.docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/演练记录表.docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/车辆检查表.docx

Binary file not shown.

BIN
hzims-service/safeproduct/src/main/resources/template/车辆维保记录单.docx

Binary file not shown.

45
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/allTicket/fegin/TicketInfoAllClient.java

@ -12,13 +12,16 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -41,19 +44,53 @@ public class TicketInfoAllClient implements ITicketInfoAllClient {
@Override
@PostMapping("/getTicketReportStatistic")
public List<TicketInfoStatisticVO> getTicketReportStatistic(@RequestBody TicketStatisticDTO ticketStatisticDTO) {
List<TicketInfoStatisticVO> workTicketStatistic = new ArrayList<>();
String startDate = ticketStatisticDTO.getStartDate();
String endDate = ticketStatisticDTO.getEndDate();
String deptIds = ticketStatisticDTO.getDeptIds();
Assert.isTrue(StringUtil.isNoneBlank(deptIds),()->{
Assert.isTrue(StringUtil.isNoneBlank(deptIds), () -> {
throw new ServiceException("站点统计月报工作票查询机构ID不能为空");
});
List<Long> deptIdList = Arrays.stream(deptIds.split(",")).map(Long::parseLong).collect(Collectors.toList());
// 统计工作票
TicketInfoStatisticVO workTicketStatistic = firstWorkTicketService.workTicketReportStatistic(startDate, endDate, deptIdList);
workTicketStatistic = firstWorkTicketService.workTicketReportStatistic(startDate, endDate, deptIdList);
// 统计操作票
TicketInfoStatisticVO operateTicketStatistic = standardTicketInfoService.operateTicketReportStatistic(startDate,endDate,deptIdList);
List<TicketInfoStatisticVO> operateTicketStatistic = standardTicketInfoService.operateTicketReportStatistic(startDate, endDate, deptIdList);
if (CollectionUtil.isNotEmpty(operateTicketStatistic)) {
workTicketStatistic.addAll(operateTicketStatistic);
//TODO 统计应急抢修单
return Lists.newArrayList(workTicketStatistic,operateTicketStatistic);
}
if (CollectionUtil.isNotEmpty(workTicketStatistic)){
AtomicInteger index = new AtomicInteger(1);
workTicketStatistic = workTicketStatistic.stream().map(s -> {
s.setIndex(index.get());
index.getAndIncrement();
return s;
}).collect(Collectors.toList());
TicketInfoStatisticVO ticketInfoStatisticVO=new TicketInfoStatisticVO();
ticketInfoStatisticVO.setTicketInfoType("合计");
int sum = workTicketStatistic.stream().mapToInt(TicketInfoStatisticVO::getTicketInfoNumber).sum();
int CompleteNum = workTicketStatistic.stream().mapToInt(TicketInfoStatisticVO::getTicketInfoCompleteNum).sum();
int InvalidatedNum = workTicketStatistic.stream().mapToInt(TicketInfoStatisticVO::getTicketInfoInvalidatedNum).sum();
int QualifiedNum = workTicketStatistic.stream().mapToInt(TicketInfoStatisticVO::getTicketInfoQualifiedNum).sum();
Double Proportion = new BigDecimal(QualifiedNum).divide(new BigDecimal(sum),2,BigDecimal.ROUND_UP).doubleValue();
ticketInfoStatisticVO.setTicketInfoNumber(sum);
ticketInfoStatisticVO.setTicketInfoCompleteNum(CompleteNum);
ticketInfoStatisticVO.setTicketInfoInvalidatedNum(InvalidatedNum);
ticketInfoStatisticVO.setTicketInfoQualifiedNum(QualifiedNum);
ticketInfoStatisticVO.setTicketInfoProportion(Proportion);
workTicketStatistic.add(ticketInfoStatisticVO);
}else {
TicketInfoStatisticVO ticketInfoStatisticVO=new TicketInfoStatisticVO();
ticketInfoStatisticVO.setTicketInfoType("合计");
ticketInfoStatisticVO.setTicketInfoNumber(0);
ticketInfoStatisticVO.setTicketInfoCompleteNum(0);
ticketInfoStatisticVO.setTicketInfoInvalidatedNum(0);
ticketInfoStatisticVO.setTicketInfoQualifiedNum(0);
ticketInfoStatisticVO.setTicketInfoProportion(0.0);
workTicketStatistic.add(ticketInfoStatisticVO);
}
return workTicketStatistic;
}
@Override

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java

@ -94,7 +94,7 @@ public interface IStandardTicketInfoService extends BaseService<StandardTicketIn
* @param deptIdList 机构ID列表
* @return
*/
TicketInfoStatisticVO operateTicketReportStatistic(String startDate, String endDate, List<Long> deptIdList);
List<TicketInfoStatisticVO> operateTicketReportStatistic(String startDate, String endDate, List<Long> deptIdList);
/**
* 获取首页区域当月操作票/工作票

86
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

@ -38,6 +38,7 @@ import com.hnac.hzims.ticket.utils.PdfUtils;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketReportStatisticVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -681,20 +682,33 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
* @return
*/
@Override
public TicketInfoStatisticVO operateTicketReportStatistic(String startDate, String endDate, List<Long> deptIdList) {
TicketInfoStatisticVO result = new TicketInfoStatisticVO();
result.setTicketInfoType("操作票");
public List<TicketInfoStatisticVO> operateTicketReportStatistic(String startDate, String endDate, List<Long> deptIdList) {
List<TicketInfoStatisticVO> res = new ArrayList<>();
List<OperateTicketStatisticVO> operateTicketReportStatistic = this.baseMapper.getOperateTicketReportStatistic(startDate, endDate, deptIdList);
Map<String, List<OperateTicketStatisticVO>> operateTicket = operateTicketReportStatistic.stream().filter(o -> ObjectUtil.isNotEmpty(o.getTicketType()))
.collect(Collectors.groupingBy(OperateTicketStatisticVO::getTicketType));
if (CollectionUtil.isNotEmpty(operateTicketReportStatistic)) {
for (Map.Entry<String, List<OperateTicketStatisticVO>> typeOperateTicket : operateTicket.entrySet()) {
String type = TicketConstants.TicketTypeNameEnum.getTicketNameByType(typeOperateTicket.getKey());
//已完成数量
int ticketInfoCompleteNum = operateTicketReportStatistic.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()).size();
//合格数量
int ticketInfoQualifiedNum = operateTicketReportStatistic.stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && 1 == ticket.getEvaluation().intValue()).collect(Collectors.toList()).size();
//废票数量
int ticketInfoInvalidatedNum = operateTicketReportStatistic.stream().filter(item -> "作废".equals(item.getFlowTaskName())).collect(Collectors.toList()).size();
//计算合格率
double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double) operateTicketReportStatistic.size() * 100).setScale(2, RoundingMode.HALF_DOWN).doubleValue();
result = TicketInfoStatisticVO.builder().ticketInfoType("操作票").ticketInfoNumber(operateTicketReportStatistic.size()).ticketInfoCompleteNum(ticketInfoCompleteNum).ticketInfoQualifiedNum(ticketInfoQualifiedNum).ticketInfoStartNum(operateTicketReportStatistic.size() - ticketInfoCompleteNum).ticketInfoProportion(ticketInfoProportion).build();
TicketInfoStatisticVO ticketInfoStatisticVO = TicketInfoStatisticVO.builder().ticketInfoType(type)
.ticketInfoNumber(operateTicketReportStatistic.size())
.ticketInfoCompleteNum(ticketInfoCompleteNum)
.ticketInfoQualifiedNum(ticketInfoQualifiedNum)
.ticketInfoInvalidatedNum(ticketInfoInvalidatedNum)
.ticketInfoStartNum(operateTicketReportStatistic.size() - ticketInfoCompleteNum)
.ticketInfoProportion(ticketInfoProportion).build();
res.add(ticketInfoStatisticVO);
}
return result;
}
return res;
}
@ -788,16 +802,17 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/**
* 操作票-关联数据
*
* @param page
* @param business
* @return
*/
@Override
public IPage<StandardTicketInfoVO> operate(IPage<StandardTicketInfoEntity> page,OperateVo business) {
public IPage<StandardTicketInfoVO> operate(IPage<StandardTicketInfoEntity> page, OperateVo business) {
QueryWrapper<StandardTicketInfoEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.ge(Func.isNotEmpty(business.getStartTime()), "oper.create_time", business.getStartTime());
queryWrapper.le(Func.isNotEmpty(business.getEndTime()), "oper.create_time", business.getEndTime());
queryWrapper.in(Func.isNotEmpty(business.getDeptIds()), "oper.create_dept",Func.toLongList(",",business.getDeptIds()));
queryWrapper.in(Func.isNotEmpty(business.getDeptIds()), "oper.create_dept", Func.toLongList(",", business.getDeptIds()));
queryWrapper.like(Func.isNotEmpty(business.getCode()), "oper.code", business.getCode());
queryWrapper.eq(Func.isNotEmpty(business.getTicketType()), "oper.ticket_type", business.getTicketType());
queryWrapper.eq(Func.isNotEmpty(business.getStatus()), "eva.status", business.getStatus());
@ -816,8 +831,8 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
queryWrapper.eq(StandardTicketInfoEntity::getFlowTaskName, entity.getFlowTaskName());
}
List<StandardTicketInfoEntity> standardTicketInfoEntities = super.baseMapper.selectList(queryWrapper);
List<StandardTicketExportVO> list=new ArrayList<>();
if (CollectionUtils.isNotEmpty(standardTicketInfoEntities)){
List<StandardTicketExportVO> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(standardTicketInfoEntities)) {
List<StandardTicketExportVO> standardTicketInfoVOS = standardTicketInfoEntities.parallelStream().map(standardTicketInfoEntity -> {
StandardTicketExportVO exportVO = new StandardTicketExportVO();
try {
@ -853,22 +868,23 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
exportVO.setEndTime(Optional.ofNullable(DateUtil.format(standardTicketInfoEntity.getEndTime(), TicketConstants.TICKET_DATE_PATTERN)).orElse(""));
exportVO.setIsEvaluate("未评价");
if (ObjectUtils.isNotEmpty(standardTicketInfoEntity.getIsEvaluate())) {
if (1==standardTicketInfoEntity.getIsEvaluate() ) {
if (1 == standardTicketInfoEntity.getIsEvaluate()) {
TicketInfoEvaluateEntity evaluateEntity = ticketInfoEvaluateService.getOne(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
eq(TicketInfoEvaluateEntity::getTicketId, standardTicketInfoEntity.getId());
}}.last(" limit 1"));
if ( ObjectUtil.isNotEmpty(evaluateEntity)) {
if (ObjectUtil.isNotEmpty(evaluateEntity)) {
exportVO.setIsEvaluate(evaluateEntity.getStatus() == 1 ? "合格" : "不合格");
}
}
}}catch (Exception e){
log.error("转换失败----》"+e.toString()+standardTicketInfoEntity.toString());
System.out.println("转换失败----》"+e.toString()+standardTicketInfoEntity.toString());
}
} catch (Exception e) {
log.error("转换失败----》" + e.toString() + standardTicketInfoEntity.toString());
System.out.println("转换失败----》" + e.toString() + standardTicketInfoEntity.toString());
}
return exportVO;
}).collect(Collectors.toList());
return standardTicketInfoVOS;
}else {
} else {
return list;
}
}
@ -876,8 +892,8 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
@Override
public void exportOperateTicket(HttpServletResponse response, Long ticketId) {
StandardTicketInfoVO detail = this.detail(ticketId).getData();
Map<String,Object> params = com.hnac.hzims.ticket.utils.ObjectUtils.obj2Map(detail);
params.put("measureMapList",this.convert(detail.getStandardTicketMeasureVOList()));
Map<String, Object> params = com.hnac.hzims.ticket.utils.ObjectUtils.obj2Map(detail);
params.put("measureMapList", this.convert(detail.getStandardTicketMeasureVOList()));
XWPFDocument xwpfDocument = null;
String fileName = "template/电气操作票.docx";
try {
@ -885,15 +901,15 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
} catch (Exception e) {
e.printStackTrace();
}
String wordPath = this.getFileSavePath() + detail.getTitle() +".docx";
String wordPath = this.getFileSavePath() + detail.getTitle() + ".docx";
try {
this.exportTicketWord(Lists.newArrayList(xwpfDocument),wordPath);
this.exportTicketWord(Lists.newArrayList(xwpfDocument), wordPath);
} catch (IOException e) {
throw new RuntimeException(e);
}
String pdfPath = this.getFileSavePath() + detail.getTitle() +".pdf";
AsposeUtil.wordToPdf(wordPath,pdfPath);
PdfUtils.readPdf(response,pdfPath);
String pdfPath = this.getFileSavePath() + detail.getTitle() + ".pdf";
AsposeUtil.wordToPdf(wordPath, pdfPath);
PdfUtils.readPdf(response, pdfPath);
}
private void exportTicketWord(List<XWPFDocument> documents, String savePath) throws IOException {
@ -902,39 +918,35 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
for (XWPFDocument document : documents) {
document.write(out);
}
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
finally {
} finally {
out.close();
}
}
private String getFileSavePath() {
String os = System.getProperty("os.name").toLowerCase();
if("linux".equals(os)) {
if ("linux".equals(os)) {
return pdfSavePath;
}
else {
} else {
return "E://template/";
}
}
private List<Map> convert (List<? extends Object> list) {
if(CollectionUtil.isNotEmpty(list)) {
private List<Map> convert(List<? extends Object> list) {
if (CollectionUtil.isNotEmpty(list)) {
return IntStream.iterate(0, index -> index + 1).limit(list.size() > 25 ? list.size() : 25).mapToObj(index -> {
if(index <= list.size() - 1) {
if (index <= list.size() - 1) {
Map result = com.hnac.hzims.ticket.utils.ObjectUtils.obj2Map(list.get(index));
result.put("index",index + 1);
result.put("status",TicketConstants.MATTER_FINISH_STATUS == result.get("status") ? "√" : null);
result.put("index", index + 1);
result.put("status", TicketConstants.MATTER_FINISH_STATUS == result.get("status") ? "√" : null);
return result;
}
else {
} else {
return new HashMap();
}
}).collect(Collectors.toList());
}
return IntStream.iterate(0,index -> index + 1).limit(4).mapToObj(index -> new HashMap()).collect(Collectors.toList());
return IntStream.iterate(0, index -> index + 1).limit(4).mapToObj(index -> new HashMap()).collect(Collectors.toList());
}
}

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/IFirstWorkTicketService.java

@ -133,5 +133,5 @@ public interface IFirstWorkTicketService extends ITwoTicketService<WorkTicketInf
* @param deptIdList 机构ID列表
* @return
*/
TicketInfoStatisticVO workTicketReportStatistic(String startDate, String endDate, List<Long> deptIdList);
List<TicketInfoStatisticVO> workTicketReportStatistic(String startDate, String endDate, List<Long> deptIdList);
}

41
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java

@ -1073,38 +1073,57 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMa
* @return
*/
@Override
public TicketInfoStatisticVO workTicketReportStatistic(String startDate, String endDate, List<Long> deptIdList) {
TicketInfoStatisticVO workTicketStatistic = new TicketInfoStatisticVO();
workTicketStatistic.setTicketInfoType("工作票");
public List<TicketInfoStatisticVO> workTicketReportStatistic(String startDate, String endDate, List<Long> deptIdList) {
List<TicketInfoStatisticVO> res = new ArrayList<>();
// 统计工作票
List<WorkTicketReportStatisticVO> workTicketReportStatistic = this.baseMapper.getWorkTicketReportStatistic(startDate, endDate, deptIdList);
Map<String, List<WorkTicketReportStatisticVO>> workTicketMap = workTicketReportStatistic.stream().filter(o -> ObjectUtil.isNotEmpty(o.getType()))
.collect(Collectors.groupingBy(WorkTicketReportStatisticVO::getType));
if(CollectionUtil.isNotEmpty(workTicketReportStatistic)) {
for (Map.Entry<String, List<WorkTicketReportStatisticVO>> typeWorkTicket : workTicketMap.entrySet()) {
String ticketInfoType="";
switch (typeWorkTicket.getKey()){
case "6":
ticketInfoType="第一种工作票";
break;
case "7":
ticketInfoType="第二种工作票";
break;
case "8":
ticketInfoType="机械工作票";
break;
}
// 工作票完成数量
int ticketInfoCompleteNum = workTicketReportStatistic.stream().filter(item -> "结束".equals(item.getFlowTaskName()))
int ticketInfoCompleteNum = typeWorkTicket.getValue().stream().filter(item -> "结束".equals(item.getFlowTaskName()))
.collect(Collectors.toList()).size();
// 工作票未完成数量
int ticketInfoStartNum = workTicketReportStatistic.size() - ticketInfoCompleteNum;
int ticketInfoStartNum = typeWorkTicket.getValue().size() - ticketInfoCompleteNum;
// 延期数量统计
int ticketInfoDelayNum = workTicketReportStatistic.stream().filter(item -> "延期".equals(item.getInput()))
int ticketInfoDelayNum = typeWorkTicket.getValue().stream().filter(item -> "延期".equals(item.getInput()))
.collect(Collectors.toList()).size();
// 废票数量统计
int invalidatedNum = typeWorkTicket.getValue().stream().filter(item -> "废票".equals(item.getFlowTaskName()))
.collect(Collectors.toList()).size();
// 合格数量统计
int ticketInfoQualifiedNum = workTicketReportStatistic.stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && ticket.getEvaluation().intValue() == 1)
int ticketInfoQualifiedNum = typeWorkTicket.getValue().stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && ticket.getEvaluation().intValue() == 1)
.collect(Collectors.toList()).size();
//计算合格率
Double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double) workTicketReportStatistic.size() *100)
.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue();
workTicketStatistic = TicketInfoStatisticVO.builder()
.ticketInfoType("工作票")
TicketInfoStatisticVO workTicketStatistic = TicketInfoStatisticVO.builder()
.ticketInfoType(ticketInfoType)
.ticketInfoNumber(workTicketReportStatistic.size())
.ticketInfoCompleteNum(ticketInfoCompleteNum)
.ticketInfoStartNum(ticketInfoStartNum)
.ticketInfoDelayNum(ticketInfoDelayNum)
.ticketInfoInvalidatedNum(invalidatedNum)
.ticketInfoQualifiedNum(ticketInfoQualifiedNum)
.ticketInfoProportion(ticketInfoProportion)
.build();
res.add(workTicketStatistic);
}
}
return workTicketStatistic;
return res;
}
/**

4
hzims-service/ticket/src/test/java/com/hnac/hzims/ticket/TicketApplicationTest.java

@ -81,8 +81,8 @@ public class TicketApplicationTest {
String startDate = "2022-07-01";
String endDate = "2022-07-31";
List<Long> deptIdList = Lists.newArrayList(2000000109L);
TicketInfoStatisticVO ticketInfoStatisticVO = firstWorkTicketService.workTicketReportStatistic(startDate, endDate, deptIdList);
log.info("{}",JSON.toJSONString(ticketInfoStatisticVO));
// TicketInfoStatisticVO ticketInfoStatisticVO = firstWorkTicketService.workTicketReportStatistic(startDate, endDate, deptIdList);
// log.info("{}",JSON.toJSONString(ticketInfoStatisticVO));
}

Loading…
Cancel
Save