Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
a002e34bc4
  1. 10
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/constants/AlarmConstants.java
  2. 2
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmEntity.java
  3. 16
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperAppearanceEntity.java
  4. 38
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java
  5. 50
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java
  6. 47
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java
  7. 9
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsVO.java
  8. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectVO.java
  9. 14
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperPhenomenonVO.java
  10. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java
  11. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/TicketChartCell.java
  12. 26
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensParamVo.java
  13. 29
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensVo.java
  14. 29
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensYearParamVo.java
  15. 22
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensYearVo.java
  16. 3
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java
  17. 60
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java
  18. 70
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java
  19. 63
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSessionManager.java
  20. 33
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketConfig.java
  21. 13
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketPool.java
  22. 49
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java
  23. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DealDutyRecFlowServiceImpl.java
  24. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java
  25. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java
  26. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java
  27. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java
  28. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java
  29. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java
  30. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulTaskServiceImpl.java
  31. 40
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java
  32. 6
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java
  33. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java
  34. 3
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java
  35. 121
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java
  36. 8
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  37. 7
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/station/impl/StationAttributeServiceImpl.java
  38. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/station/impl/StationServiceImpl.java
  39. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java
  40. 23
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  41. 37
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectStatisticsServiceImpl.java
  42. 48
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java
  43. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java
  44. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java
  45. 30
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  46. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java
  47. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java
  48. 91
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  49. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  50. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  51. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java
  52. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/controller/MaintenanceController.java
  53. 52
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java
  54. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java
  55. 119
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java
  56. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  57. 22
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/TimeUtils.java
  58. 127
      hzims-service/operational/src/main/resources/log/logback-dev.xml
  59. 127
      hzims-service/operational/src/main/resources/log/logback-prod.xml
  60. 127
      hzims-service/operational/src/main/resources/log/logback-test.xml
  61. BIN
      hzims-service/operational/src/main/resources/template/waterMonReport.docx
  62. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/impl/TicketMatterGroupServiceImpl.java
  63. 41
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/CensController.java
  64. 4
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java
  65. 18
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/CensService.java
  66. 180
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/CensServiceImpl.java
  67. 13
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  68. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java

10
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/constants/AlarmConstants.java

@ -28,19 +28,21 @@ public interface AlarmConstants {
Integer IS_WX_MESSAGE = 8;
// 告警来源 : 0- HZ3000告警 1 -等级告警 2 -条件告警 3-FDP智能预警 4-视频预警
// 告警来源 : 0- HZ3000告警 1 -等级告警 2 -条件告警 3-FDP智能预警 4-视频预警 5-开关机告警
Integer HZ3000_ALARM = 0;
Integer LEVEL_ALARM = 1;
Integer CONDITION_ALARM = 2;
Integer EARLY_WARNING = 3;
Integer VIDEO_WARNING = 4;
List<Integer> ALARAM_SOURCE = Arrays.asList(HZ3000_ALARM,LEVEL_ALARM,CONDITION_ALARM,EARLY_WARNING);
Integer START_STOP_WARNING = 5;
List<Integer> ALARAM_SOURCE = Arrays.asList(HZ3000_ALARM,LEVEL_ALARM,CONDITION_ALARM,EARLY_WARNING,VIDEO_WARNING,START_STOP_WARNING);
// 子类告警
// HZ3000告警 : 2-告警 3-故障 5-遥测越限 13-通讯中断 14-数据异常
// 等级告警 : 21-一级告警 22-二级告警 23-三级告警
// 智能预警 : 30-智能预警
// 条件告警 : 40-条件告警
// 开关机告警 : 50-开机告警 51-关机告警
Integer WARNING = 2;
Integer FAULT = 3;
Integer OFFSIDE = 5;
@ -53,5 +55,9 @@ public interface AlarmConstants {
List<Integer> LEVEL_ALARAM = Arrays.asList(ONE_LEVEL,TWO_LEVEL,THREE_LEVEL);
Integer EARLY = 30;
Integer CONDITION = 40;
Integer VIDEO = 50;
Integer START = 60;
Integer STOP = 61;
List<Integer> START_STOP_ALARAM = Arrays.asList(START,STOP);
String VIDEO_SCHEDULED_TASK= "VideoScheduledTask";
}

2
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmEntity.java

@ -37,7 +37,7 @@ public class AlarmEntity extends TenantEntity {
@ApiModelProperty(value = "告警ID")
private String alarmId;
@ApiModelProperty(value = "告警类型 :0- HZ3000告警 1 -等级告警 2 -条件告警 3-FDP智能预警")
@ApiModelProperty(value = "告警类型 :0- HZ3000告警 1 -等级告警 2 -条件告警 3-FDP智能预警 4-视频预警 5-开关机告警")
private Integer alarmSource;
@ApiModelProperty(value = "告警子类")

16
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperAppearanceEntity.java

@ -50,6 +50,12 @@ public class OperAppearanceEntity extends TenantEntity {
@ApiModelProperty(value = "问题发现人")
private Long finder;
/**
* 问题发现人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "问题发现人")
private String finderName;
/**
* 问题类型
*
*/
@ -104,6 +110,12 @@ public class OperAppearanceEntity extends TenantEntity {
@ApiModelProperty(value = "甄别人")
private Long discriminator;
/**
* 甄别人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "甄别人")
private String discriminatorName;
/**
* 甄别时间
*/
@DateTimeFormat(
@ -151,4 +163,8 @@ public class OperAppearanceEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty(value = "已有缺陷编码")
private String existDefectId;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("机构名称")
private String deptName;
}

38
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java

@ -103,12 +103,6 @@ public class OperDefectEntity extends TenantEntity {
@ApiModelProperty(value = "缺陷创建时间-结束时间")
private String endTime;
// 20230612弃用该字段,无地方引用
// @TableField(exist = false)
// @ApiModelProperty(value = "机构编号集合")
// private List<Long> deptIds;
/**
* 区域Id
*/
@ -128,12 +122,22 @@ public class OperDefectEntity extends TenantEntity {
@ApiModelProperty(value = "消缺处理人")
private String planHandler;
/**
* 消缺处理人
*/
@ApiModelProperty(value = "消缺处理人")
private String planHandlerName;
/**
* 检修任务处理人
*/
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty(value = "检修任务处理人")
private Long handler;
/**
* 检修任务处理人
*/
@ApiModelProperty(value = "检修任务处理人")
private String handlerName;
/**
* 发现人
*/
@ -141,6 +145,11 @@ public class OperDefectEntity extends TenantEntity {
@ApiModelProperty(value = "发现人")
private Long finder;
/**
* 发现人
*/
@ApiModelProperty(value = "发现人")
private String finderName;
/**
* 缺陷等级
*/
@JsonSerialize(nullsUsing = NullSerializer.class)
@ -184,6 +193,12 @@ public class OperDefectEntity extends TenantEntity {
@ApiModelProperty(value = "定论人")
private Long conclusionPeople;
/**
* 定论人
*/
@ApiModelProperty(value = "定论人")
private String conclusionPeopleName;
/**
* 定论时间
*/
@DateTimeFormat(
@ -218,6 +233,11 @@ public class OperDefectEntity extends TenantEntity {
@ApiModelProperty("操作票负责人")
private Long principal;
/**
* 操作票负责人
*/
@ApiModelProperty(value = "操作票负责人")
private String principalName;
/**
* 手填值班负责人
*/
@ApiModelProperty(value = "手填操作票负责人")
@ -232,5 +252,9 @@ public class OperDefectEntity extends TenantEntity {
*/
@ApiModelProperty(value = "处理任务Id")
private Long handleTaskId;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("机构名称")
private String deptName;
}

50
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectStatisticsEntity.java

@ -60,6 +60,13 @@ public class OperDefectStatisticsEntity extends TenantEntity {
@QueryField(condition = SqlCondition.EQUAL)
@ApiModelProperty(value = "缺陷发现人")
private Long finder;
/**
* 缺陷发现人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "缺陷发现人")
private String finderName;
/**
* 缺陷类型
*/
@ -112,6 +119,12 @@ public class OperDefectStatisticsEntity extends TenantEntity {
@ApiModelProperty(value = "甄别人")
private Long discriminator;
/**
* 甄别人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "甄别人")
private String discriminatorName;
/**
* 甄别时间
*/
@DateTimeFormat(
@ -135,6 +148,12 @@ public class OperDefectStatisticsEntity extends TenantEntity {
@ApiModelProperty(value = "检修任务处理人")
private Long handler;
/**
* 检修任务处理人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "检修任务处理人")
private String handlerName;
/**
* 计划工时
*/
@JsonSerialize(nullsUsing = NullSerializer.class)
@ -170,6 +189,12 @@ public class OperDefectStatisticsEntity extends TenantEntity {
@ApiModelProperty(value = "处理人")
private Long disposer;
/**
* 处理人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "处理人")
private String disposerName;
/**
* 处理描述
*/
@ApiModelProperty(value = "处理描述")
@ -215,6 +240,12 @@ public class OperDefectStatisticsEntity extends TenantEntity {
@ApiModelProperty(value = "定论人")
private Long conclusionPeople;
/**
* 定论人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "定论人")
private String conclusionPeopleName;
/**
* 定论时间
*/
@DateTimeFormat(
@ -238,6 +269,12 @@ public class OperDefectStatisticsEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty(value = "消缺处理人")
private String planHandler;
/**
* 消缺处理人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "消缺处理人")
private String planHandlerName;
/**
* 是否入库
@ -288,6 +325,12 @@ public class OperDefectStatisticsEntity extends TenantEntity {
@ApiModelProperty("操作票负责人")
private Long principal;
/**
* 操作票负责人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "操作票负责人")
private String principalName;
/**
* 手填值班负责人
*/
@ApiModelProperty(value = "手填操作票负责人")
@ -313,4 +356,11 @@ public class OperDefectStatisticsEntity extends TenantEntity {
*/
@ApiModelProperty(value = "处理任务Id")
private Long handleTaskId;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("机构名称")
private String deptName;
}

47
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperPhenomenonEntity.java

@ -61,6 +61,12 @@ public class OperPhenomenonEntity extends TenantEntity {
@ApiModelProperty(value = "问题发现人")
private Long finder;
/**
* 问题发现人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "问题发现人")
private String finderName;
/**
* 问题类型0-设备和1-非设备
*
*/
@ -141,6 +147,12 @@ public class OperPhenomenonEntity extends TenantEntity {
@ApiModelProperty(value = "甄别人")
private Long discriminator;
/**
* 甄别人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "甄别人")
private String discriminatorName;
/**
* 甄别时间
*/
@DateTimeFormat(
@ -197,6 +209,12 @@ public class OperPhenomenonEntity extends TenantEntity {
@JsonSerialize(nullsUsing = NullSerializer.class)
@ApiModelProperty(value = "决策处理方案人,决策缺陷处理方案,key 必须是 handleProgramme")
private Long handleProgramme;
/**
* 决策处理方案人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "决策处理方案人")
private String handleProgrammeName;
/**
* 决策处理方案类型
@ -217,6 +235,13 @@ public class OperPhenomenonEntity extends TenantEntity {
@ApiModelProperty(value = "检修任务处理人")
private Long handler;
/**
* 检修任务处理人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "检修任务处理人")
private String handlerName;
/**
* 处理状态已处理1未处理0默认0
*/
@QueryField(condition = SqlCondition.EQUAL)
@ -262,6 +287,12 @@ public class OperPhenomenonEntity extends TenantEntity {
@ApiModelProperty(value = "定论人")
private Long conclusionPeople;
/**
* 定论人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "定论人")
private String conclusionPeopleName;
/**
* 定论状态已定论1未定论0默认0
*/
@QueryField(condition = SqlCondition.EQUAL)
@ -291,6 +322,11 @@ public class OperPhenomenonEntity extends TenantEntity {
@ApiModelProperty(value = "消缺处理人")
private String planHandler;
/**
* 消缺处理人
*/
@ApiModelProperty(value = "消缺处理人")
private String planHandlerName;
/**
* 实际开始时间
*/
@DateTimeFormat(
@ -378,6 +414,12 @@ public class OperPhenomenonEntity extends TenantEntity {
@ApiModelProperty("操作票负责人")
private Long principal;
/**
* 操作票负责人
*/
@QueryField(condition = SqlCondition.LIKE)
@ApiModelProperty(value = "操作票负责人")
private String principalName;
/**
* 手填操作票负责人
*/
@ApiModelProperty(value = "手填操作票负责人")
@ -396,4 +438,9 @@ public class OperPhenomenonEntity extends TenantEntity {
@TableField(exist = false)
@ApiModelProperty(value = "处理人")
private String flowHandler;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("机构名称")
private String deptName;
}

9
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectStatisticsVO.java

@ -21,15 +21,10 @@ public class OperDefectStatisticsVO extends OperDefectStatisticsEntity {
private static final long serialVersionUID = 8239436726489738763L;
@ApiModelProperty(value = "问题发现人名称")
private String finderName;
@ApiModelProperty(value = "现象Ids")
private List<String> defectCodeList;
@ApiModelProperty(value = "甄别人名称")
private String discriminatorName;
@ApiModelProperty(value = "处理人名称,处理工作流的第一个处理人")
private String handlerName;
@ApiModelProperty(value = "消缺处理人名称")
private String planHandlerName;
@ -37,8 +32,6 @@ public class OperDefectStatisticsVO extends OperDefectStatisticsEntity {
@ApiModelProperty(value = "两票工作负责人名称")
private String principalName;
@ApiModelProperty(value = "定论人名称")
private String conclusionPeopleName;
@ApiModelProperty("创建人名称")
private String createUserName;

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperDefectVO.java

@ -24,8 +24,7 @@ public class OperDefectVO extends OperDefectEntity {
private static final long serialVersionUID = 330945650534291157L;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("修改人名称")
private String updateUserName;

14
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/vo/OperPhenomenonVO.java

@ -21,20 +21,6 @@ public class OperPhenomenonVO extends OperPhenomenonEntity {
private static final long serialVersionUID = -8661188316092509183L;
@ApiModelProperty(value = "发现人")
private String finderName;
@ApiModelProperty(value = "甄别人名称")
private String discriminatorName;
@ApiModelProperty(value = "处理人名称,处理工作流的第一个处理人")
private String handlerName;
@ApiModelProperty(value = "定论人名称")
private String conclusionPeopleName;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("修改人名称")
private String updateUserName;

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/MainConstants.java

@ -68,6 +68,9 @@ public interface MainConstants {
// 集中监控数据处理
String CENTRALIZED_MONITORING = "centralizedMonitoring";
// 开停机告警
String START_STOP_ALARM = "startStopAlarm";
// realId获取
String REAL_ID_DATA = "realIdData";

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/TicketChartCell.java

@ -17,10 +17,14 @@ public class TicketChartCell {
private String ticketName;
@ApiModelProperty(value = "本月数量")
private int ticketMon;
@ApiModelProperty(value = "本月合格数量")
private int ticketMonPassCount;
@ApiModelProperty(value = "本月合格率")
private double ticketMonPerc;
@ApiModelProperty(value = "本年数量")
private int ticketYear;
@ApiModelProperty(value = "本年合格数量")
private int ticketYearPassCount;
@ApiModelProperty(value = "本年合格率")
private double ticketYeaPercr;
}

26
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensParamVo.java

@ -0,0 +1,26 @@
package com.hnac.hzims.ticket.standardTicket.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class CensParamVo {
@ApiModelProperty("机构Id")
private Long deptId;
@ApiModelProperty("开始时间 : yyyy-MM-dd HH:mm:ss")
private String startTime;
@ApiModelProperty("结束时间: yyyy-MM-dd HH:mm:ss")
private String endTime;
@ApiModelProperty("状态 : 0-全部 1-完成")
private Integer state;
@ApiModelProperty("结束")
private String flowTaskName;
}

29
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensVo.java

@ -0,0 +1,29 @@
package com.hnac.hzims.ticket.standardTicket.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class CensVo {
@ApiModelProperty("机构ID")
private Long deptId;
@ApiModelProperty("机构名称")
private String deptName;
@ApiModelProperty("月份")
private Integer mon;
@ApiModelProperty("工作票数量")
private Long workCount;
@ApiModelProperty("操作票数量")
private Long operateCount;
@ApiModelProperty("工作任务数量")
private Long workTaskCount;
}

29
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensYearParamVo.java

@ -0,0 +1,29 @@
package com.hnac.hzims.ticket.standardTicket.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class CensYearParamVo {
@ApiModelProperty("机构Id")
private Long deptId;
@ApiModelProperty("年度 : yyyy")
private String year;
@ApiModelProperty("状态 : 0-全部 1-完成")
private Integer state;
@ApiModelProperty("流程描述")
private String flowTaskName;
@ApiModelProperty("开始时间 : yyyy-MM-dd HH:mm:ss")
private String startTime;
@ApiModelProperty("结束时间: yyyy-MM-dd HH:mm:ss")
private String endTime;
}

22
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/standardTicket/vo/CensYearVo.java

@ -0,0 +1,22 @@
package com.hnac.hzims.ticket.standardTicket.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
public class CensYearVo {
@ApiModelProperty("机构ID")
private Long deptId;
@ApiModelProperty("机构名称")
private String deptName;
@ApiModelProperty("统计数量")
private List<CensVo> censs;
}

3
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.alarm.entity.AlarmEntity;
import com.hnac.hzims.alarm.vo.AlarmCountVo;
import org.springblade.core.mp.base.BaseService;
import org.springframework.web.socket.TextMessage;
import java.util.List;
@ -17,4 +18,6 @@ public interface AlarmService extends BaseService<AlarmEntity> {
List<AlarmCountVo> counts(AlarmEntity alarm);
List<AlarmEntity> broadcast(String startTime, String endTime);
TextMessage majorAlarm(List<Long> depts);
}

60
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java

@ -1,7 +1,9 @@
package com.hnac.hzims.alarm.show.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.config.service.AlarmConfigService;
import com.hnac.hzims.alarm.constants.AlarmConstants;
import com.hnac.hzims.alarm.entity.AlarmEntity;
@ -23,10 +25,9 @@ import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.web.socket.TextMessage;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -64,6 +65,7 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
QueryWrapper wrapper = new QueryWrapper<>();
wrapper.orderByDesc("CREATE_TIME");
wrapper.eq("IS_RIGHT_TABULATION",0);
wrapper.eq("STATUS",0);
wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
if(!StringUtil.isEmpty(alarm.getStationId())){
wrapper.eq("STATION_ID",alarm.getStationId());
@ -114,6 +116,7 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
// 参数过滤 :站点、告警来源、告警子类
QueryWrapper wrapper = new QueryWrapper<>();
wrapper.eq("IS_RIGHT_TABULATION",0);
wrapper.eq("STATUS",0);
wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
if(!StringUtil.isEmpty(alarm.getStationId())){
wrapper.eq("STATION_ID",alarm.getStationId());
@ -165,7 +168,34 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
return this.list(wrapper);
}
/**
* 弹框告警
* @param depts
* @return
*/
@Override
public TextMessage majorAlarm(List<Long> depts) {
// 站点查询
List<StationEntity> stations = this.stations();
if(CollectionUtil.isEmpty(stations)){
return null;
}
List<String> effectives = stations.stream().filter(station->depts.contains(station.getRefDept())).map(StationEntity::getCode).collect(Collectors.toList());
if(CollectionUtil.isEmpty(effectives)){
return null;
}
List<AlarmEntity> alarms = this.list(Wrappers.<AlarmEntity>lambdaQuery()
.in(AlarmEntity::getStationId,effectives)
.in(AlarmEntity::getAlarmType, Arrays.asList(AlarmConstants.FAULT,AlarmConstants.EARLY))
.eq(AlarmEntity::getIsShowAlert,0)
.eq(AlarmEntity::getStatus,0)
//.ge(AlarmEntity::getAlarmType, DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00")
);
if(CollectionUtil.isEmpty(alarms)){
return null;
}
return new TextMessage(JSONObject.toJSONString(alarms.stream().sorted(Comparator.comparing(AlarmEntity::getAlarmTime).reversed()).collect(Collectors.toList())));
}
/**
@ -219,6 +249,28 @@ public class AlarmServiceImpl extends BaseServiceImpl<AlarmMapper, AlarmEntity>
count.setCount((long) collect.size());
}
return Collections.singletonList(count);
// 视频告警
}else if(AlarmConstants.VIDEO_WARNING.equals(source)){
ChildAlarmCountVo count = new ChildAlarmCountVo();
count.setType(AlarmConstants.VIDEO);
if(CollectionUtil.isEmpty(collect)){
count.setCount(0L);
}else{
count.setCount((long) collect.size());
}
return Collections.singletonList(count);
// 开关机告警
}else if(AlarmConstants.START_STOP_WARNING.equals(source)){
return AlarmConstants.START_STOP_ALARAM.stream().map(type->{
ChildAlarmCountVo count = new ChildAlarmCountVo();
count.setType(type);
if(CollectionUtil.isEmpty(collect)){
count.setCount(0L);
}else{
count.setCount(collect.stream().filter(o->o.getAlarmType().equals(type)).count());
}
return count;
}).collect(Collectors.toList());
}
return new ArrayList<>();
}

70
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmHandler.java

@ -0,0 +1,70 @@
package com.hnac.hzims.alarm.ws.alart;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.alarm.show.service.AlarmService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.io.IOException;
import java.util.List;
/**
* @author ysj
*/
@Slf4j
public class AlarmHandler extends TextWebSocketHandler {
@Autowired
private AlarmService alarmService;
@Override
public void afterConnectionEstablished(WebSocketSession session) {
String[] split = session.getUri().toString().split("/");
String uid = split[split.length - 1];
AlarmSessionManager.add(uid, session);
session.getAttributes().put("userId", uid);
log.info("sessionId: " + session.getId());
log.info("session connection successful!");
AlarmSocketPool.pool.put(session.getId(), this);
}
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
AlarmSessionManager.removeAndClose(session.getId());
AlarmSocketPool.pool.remove(session.getId());
log.info("sessionId: " + session.getId());
log.info("uri: " + session.getUri());
log.info("session closed successful!");
}
@Override
public void handleTransportError(WebSocketSession session, Throwable exception) {
AlarmSessionManager.removeAndClose(session.getId());
AlarmSocketPool.pool.remove(session.getId());
}
@Override
protected void handleTextMessage(WebSocketSession session, TextMessage textMessage) throws IOException {
String userId = (String) session.getAttributes().get("userId");
String message = textMessage.getPayload();
if(StringUtil.isBlank(message)){
return;
}
List<Long> depts = JSONObject.parseArray(message,Long.class);
if(CollectionUtil.isEmpty(depts)){
return;
}
TextMessage sendMessage = alarmService.majorAlarm(depts);
if(ObjectUtil.isEmpty(sendMessage)){
return;
}
session.sendMessage(sendMessage);
}
}

63
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSessionManager.java

@ -0,0 +1,63 @@
package com.hnac.hzims.alarm.ws.alart;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.socket.WebSocketSession;
import java.io.IOException;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author ysj
*/
@Slf4j
public class AlarmSessionManager {
/**
* ws会话池
*/
public static ConcurrentHashMap<String, WebSocketSession> SESSION_POOL = new ConcurrentHashMap<>();
/**
* 添加会话
*
* @param uid 标记
* @param session 会话对象
*/
public static void add(String uid, WebSocketSession session) {
if (SESSION_POOL.containsKey(uid)) {
AlarmSessionManager.removeAndClose(uid);
}
SESSION_POOL.put(uid, session);
log.info("添加 WebSocketSession 会话成功,uid=" + uid);
}
/**
* 获取 ws 会话
*
* @param uid
*/
public static WebSocketSession get(String uid) {
return SESSION_POOL.get(uid);
}
/**
* 移除 ws 会话并关闭会话
*
* @param uid
*/
public static void removeAndClose(String uid) {
WebSocketSession session = SESSION_POOL.get(uid);
if (session != null) {
try {
//关闭连接
session.close();
} catch (IOException ex) {
throw new RuntimeException("关闭ws会话失败!", ex);
}
}
SESSION_POOL.remove(uid);
}
}

33
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketConfig.java

@ -0,0 +1,33 @@
package com.hnac.hzims.alarm.ws.alart;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* @author ysj
*/
@Configuration
@EnableWebSocket
public class AlarmSocketConfig implements WebSocketConfigurer{
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
// 集中监控弹框处理器
registry.addHandler(monitorHandler(), "/alarm/alart/{uid}").setAllowedOrigins("*");
}
@Bean
public WebSocketHandler monitorHandler() {
return new AlarmHandler();
}
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}

13
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/ws/alart/AlarmSocketPool.java

@ -0,0 +1,13 @@
package com.hnac.hzims.alarm.ws.alart;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author ysj
*/
public class AlarmSocketPool {
public static Map<String, AlarmHandler> pool = new ConcurrentHashMap<>();
}

49
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java

@ -45,7 +45,7 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
//记录操作日志
WorkflowOperationLog regularWorkflowOperationLog = new WorkflowOperationLog();
BeanUtils.copyProperties(response,regularWorkflowOperationLog);
BeanUtils.copyProperties(response, regularWorkflowOperationLog);
if (ObjectUtils.isNotEmpty(regularWorkflowOperationLog)) {
regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables()));
regularWorkflowOperationLog.setTakeId(response.getTaskId());
@ -53,40 +53,29 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
regularWorkflowOperationLog.setIsOperationLog(true);
regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId());
log.info("正在记录操作日志WorkflowOperationLog.... :{}", regularWorkflowOperationLog);
workflowOperationLogService.save(regularWorkflowOperationLog);
}
try {
WorkflowQueue ticker = new WorkflowQueue();
ticker.setProcessDefinitionKey(taskDefinitionKey);
//判断执行具体的实现类
ProcessService processService =
ticketServiceList.stream().filter(item -> item.isWorkflowProcess(ticker)).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(processService)) {
//执行业务方法
try {
processService.calculate(response);
} catch (Exception e) {
e.printStackTrace();
//todo 业务出错误 做补偿
log.error("业务出错,StandardWorkTicketConsumer: {}", e.getMessage());
log.error("业务出错,StandardWorkTicketConsumer: {} ", response);
regularWorkflowOperationLog.setIsOperationLog(false);//调用消费方抛出异常
WorkflowQueue ticker = new WorkflowQueue();
ticker.setProcessDefinitionKey(taskDefinitionKey);
//判断执行具体的实现类
ProcessService processService =
ticketServiceList.stream().filter(item -> item.isWorkflowProcess(ticker)).findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(processService)) {
//执行业务方法
try {
processService.calculate(response);
} catch (Exception e) {
e.printStackTrace();
//todo 业务出错误 做补偿
log.error("业务出错,StandardWorkTicketConsumer: {}", e.getMessage());
log.error("业务出错,StandardWorkTicketConsumer: {} ", response);
WorkflowOperationLog workflowOperationLog = new WorkflowOperationLog();
BeanUtils.copyProperties(response,workflowOperationLog);
if (ObjectUtils.isNotEmpty(workflowOperationLog)) {
regularWorkflowOperationLog.setVariables(JSON.toJSONString(response.getVariables()));
regularWorkflowOperationLog.setTakeId(response.getTaskId());
regularWorkflowOperationLog.setTakeName(response.getTaskName());
regularWorkflowOperationLog.setIsOperationLog(false);
regularWorkflowOperationLog.setProcessInstanceKey(response.getProcessInstanceId());
log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog);
workflowOperationLogService.save(workflowOperationLog);
}
}
} finally {
workflowOperationLogService.save(regularWorkflowOperationLog);
}
}
}

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DealDutyRecFlowServiceImpl.java

@ -57,9 +57,12 @@ public class DealDutyRecFlowServiceImpl extends ProcessAbstractService {
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
log.info("交接班v4消费流程执行中,param"+response);
R dealtDutyRecFlow = iDutyRecClient.dealDutyRecFlow(response);
if (!dealtDutyRecFlow.isSuccess()){
log.error("消费交接班失败"+response);
throw new ServiceException("执行交接班v4失败");
}
log.info("交接班v4消费流程结束,param"+response);
}
}

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java

@ -58,10 +58,12 @@ public class DefectProcessServiceImpl extends ProcessAbstractService {
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
log.info("消缺工作流程消费开始---param",response);
R defect = defectClient.saveDefect(response);
if (!defect.isSuccess()) {
log.error("消缺工作流程消费调取对应业务报错---param",response);
throw new ServiceException("消缺工作流程出现异常呢");
}
log.info("消缺工作消费流程结束---param",response);
}
}

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java

@ -61,10 +61,12 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService {
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
log.info("水力机械工作票消费流程开始---param",response);
Boolean pending = ticketProcessService.findPending(response);
if (!pending) {
log.error("水力机械工作票消费调用报错---param",response);
throw new ServiceException("水力机械工作票流程出现异常呢");
}
log.info("水力机械工作票消费流程结束---param",response);
}
}

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MaintenanceProcessServiceImpl.java

@ -58,9 +58,12 @@ public class MaintenanceProcessServiceImpl extends ProcessAbstractService {
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
log.info("日常维护消费开始---param",response);
Boolean pending = maintenanceFeignClient.findPending(response);
if (!pending) {
log.error("日常维护消费报错---param",response);
throw new ServiceException("日常维护业务流程出错呢");
}
log.info("日常维护消费结束---param",response);
}
}

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OneTicketProcessServiceImpl.java

@ -66,10 +66,12 @@ public class OneTicketProcessServiceImpl extends ProcessAbstractService {
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
log.info("工作票消费调用开始---param",response);
Boolean pending = ticketProcessService.findPending(response);
if (!pending) {
log.error("工作票消费调用异常---param",response);
throw new ServiceException("工作票流程出现异常呢");
}
log.info("工作票消费调用结束---param",response);
}
}

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java

@ -62,9 +62,12 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService {
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
log.info("操作票流程消费调用fein接口开始---param",response);
Boolean pending = operationTicketFeignClient.findPending(response);
if (!pending) {
log.info("操作票流程调用fein接口异常---param",response);
throw new ServiceException("操作票流程出现异常呢");
}
log.info("操作票流程消费调用fein接口结束---param",response);
}
}

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulPlanServiceImpl.java

@ -46,9 +46,12 @@ public class OverhaulPlanServiceImpl extends ProcessAbstractService {
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
log.info("检修计划调用fein消费开始---param",response);
R defect = accessPlanV4Client.listener(response);
if (!defect.isSuccess()) {
log.error("检修计划调用fein异常---param",response);
throw new ServiceException("检修计划业务执行异常!");
}
log.info("检修计划调用fein结束---param",response);
}
}

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OverhaulTaskServiceImpl.java

@ -47,10 +47,12 @@ public class OverhaulTaskServiceImpl extends ProcessAbstractService {
*/
@Override
public void calculate(ProcessWorkFlowResponse response) {
log.info("检修计划调用fein接口消费开始---param",response);
R defect = accessTaskV4Client.listener(response);
if (!defect.isSuccess()) {
log.error("检修计划调用fein接口消费异常---param",response);
throw new ServiceException("检修任务业务执行异常!");
}
log.info("检修计划调用fein接口消费结束---param",response);
}
}

40
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/AlarmScheduledTask.java

@ -0,0 +1,40 @@
package com.hnac.hzims.scheduled.scheduled;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.xxl.job.core.biz.model.ReturnT;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 告警定时任务
* @author ysj
*/
@Slf4j
@Component
public class AlarmScheduledTask {
@Autowired
private AlarmQueryService service;
/**
* 开停机告警
* @return ReturnT<String>
*/
//@XxlJob(START_STOP_ALARM)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> startStopAlarm() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
service.startStopAlarm(param);
return new ReturnT<>("SUCCESS");
}
}

6
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java

@ -42,8 +42,10 @@ public class MonitorScheduledTask {
* 实时数据刷新
* @return ReturnT<String>
*/
@XxlJob(REAL_TIME_DATA)
public ReturnT<String> loadRealData(String param) {
//@XxlJob(REAL_TIME_DATA)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadRealData() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/RealTargetScheduledTask.java

@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Arrays;
@ -45,8 +46,10 @@ public class RealTargetScheduledTask {
/**
* 水电站-机组实时加载
*/
@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
public ReturnT<String> loadHydropowerReal(String param) {
//@XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerReal() {
String param = "";
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}

3
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/AlarmQueryService.java

@ -10,6 +10,9 @@ import java.util.List;
*/
public interface AlarmQueryService extends BaseService<AlarmEntity> {
// 开停机告警
void startStopAlarm(String param);
List<String> bells(List<String> codes);
List<String> aborts(List<String> codes);

121
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/alarm/impl/AlarmQueryServiceImpl.java

@ -1,18 +1,25 @@
package com.hnac.hzims.scheduled.service.alarm.impl;
import cn.hutool.core.stream.CollectorUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.alarm.constants.AlarmConstants;
import com.hnac.hzims.alarm.entity.AlarmEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.mapper.alarm.AlarmQueryMapper;
import com.hnac.hzims.scheduled.service.alarm.AlarmQueryService;
import com.hnac.hzims.scheduled.service.operation.station.StationService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.*;
@ -27,6 +34,118 @@ import java.util.stream.Collectors;
@DS("alarm")
public class AlarmQueryServiceImpl extends BaseServiceImpl<AlarmQueryMapper, AlarmEntity> implements AlarmQueryService {
private final StationService stationService;
private final RedisTemplate redisTemplate;
private final static String start_stop_cache_final = "hzims:operation:start:stop:key";
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key";
/**
* 开停机告警
* @param param
*/
@Override
public void startStopAlarm(String param) {
// 获取站点开关机状态
Map<String,Integer> startStopMap = (HashMap<String, Integer>) redisTemplate.opsForValue().get(start_stop_cache_final);;
// 查询接入水电站点
List<StationEntity> stations = stationService.list(new LambdaQueryWrapper<StationEntity>()
.eq(StationEntity::getDataOrigin,0)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 获取站点设备实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
if(CollectionUtil.isEmpty(reals)){
return;
}
Map<String,Integer> refresh = new HashMap<>();
// 实时设备遍历
reals.forEach(real->{
// 过滤站点
List<StationEntity> list = stations.stream().filter(item -> item.getRefDept().equals(real.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return;
}
// 确定站点
StationEntity station = list.get(0);
// 数据初始化记录
if(CollectionUtil.isEmpty(startStopMap)){
if(Math.abs(real.getActivePower()) > 0){
refresh.put(real.getDeviceCode(),1);
}else{
refresh.put(real.getDeviceCode(),0);
}
return;
}
// 比对开机状态
if(Math.abs(real.getActivePower()) > 0){
if(startStopMap.get(real.getDeviceCode()) == 0){
refresh.put(real.getDeviceCode(),1);
// 记录开机告警
this.saveStartStopAlarm(station,real,1);
}else{
refresh.put(real.getDeviceCode(),0);
}
}else{
if(startStopMap.get(real.getDeviceCode()) == 1){
refresh.put(real.getDeviceCode(),0);
// 记录关机告警
this.saveStartStopAlarm(station,real,0);
}else{
refresh.put(real.getDeviceCode(),1);
}
}
});
redisTemplate.opsForValue().set(start_stop_cache_final,refresh);
}
/**
* 保存站点设备开关机告警
* @param station
* @param real
* @param state
*/
private void saveStartStopAlarm(StationEntity station, HydropowerUnitRealVo real, int state) {
AlarmEntity alarm = new AlarmEntity();
alarm.setStationId(station.getCode());
alarm.setStationName(station.getName());
alarm.setDeviceCode(real.getDeviceCode());
alarm.setDeviceName(real.getDeviceName());
alarm.setAlarmId(station.getCode() + "_" + Func.randomUUID());
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_关机");
alarm.setAlarmSource(AlarmConstants.START_STOP_WARNING);
alarm.setAlarmType(AlarmConstants.STOP);
if(state == 1){
alarm.setAlarmType(AlarmConstants.START);
alarm.setAlarmContext(station.getName() + "_" + real.getDeviceName() + "_开机");
}
alarm.setStatus(0);
alarm.setAlarmTime(new Date());
alarm.setIsRightTabulation(0);
alarm.setIsShowAlert(1);
alarm.setIsSmallBell(1);
alarm.setIsMask(1);
alarm.setIsBroadcast(0);
alarm.setIsPlatformMessage(1);
alarm.setIsShortMessage(1);
alarm.setIsWxMessage(1);
alarm.setTenantId(station.getTenantId());
alarm.setCreateDept(station.getRefDept());
alarm.setCreateUser(station.getCreateUser());
alarm.setUpdateUser(station.getUpdateUser());
alarm.setUpdateTime(station.getUpdateTime());
this.save(alarm);
}
/**
* 查询站点铃铛
* @param codes

8
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java

@ -1577,28 +1577,28 @@ public class RealTargetServiceImpl implements RealTargetService {
return;
}
// 有功功率单位
String power = unitMap.get(device.getId()+HomePageConstant.CONCAT_P);
String power = unitMap.get(device.getEmCode().toUpperCase()+HomePageConstant.CONCAT_P);
if(StringUtil.isNotBlank(power)){
realVo.setPowerUnit(power);
} else {
realVo.setPowerUnit("kW");
}
// 无功功率
String reactivePowerUnit = unitMap.get(device.getId()+HomePageConstant.CONCAT_Q);
String reactivePowerUnit = unitMap.get(device.getEmCode().toUpperCase()+HomePageConstant.CONCAT_Q);
if(StringUtil.isNotBlank(reactivePowerUnit)){
realVo.setReactivePowerUnit(reactivePowerUnit);
} else {
realVo.setReactivePowerUnit("kVa r");
}
// 定子电压单位
String voltage = unitMap.get(device.getId()+HomePageConstant.CONCAT_UAB);
String voltage = unitMap.get(device.getEmCode().toUpperCase()+HomePageConstant.CONCAT_UAB);
if(StringUtil.isNotBlank(voltage)){
realVo.setVoltageUnit(voltage);
} else {
realVo.setVoltageUnit("V");
}
// 定子电流单位
String current = unitMap.get(device.getId()+HomePageConstant.CONCAT_IA);
String current = unitMap.get(device.getEmCode().toUpperCase()+HomePageConstant.CONCAT_IA);
if(StringUtil.isNotBlank(current)){
realVo.setCurrentUnit(current);
} else {

7
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/station/impl/StationAttributeServiceImpl.java

@ -9,8 +9,7 @@ import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -31,6 +30,8 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut
if(CollectionUtil.isEmpty(list)){
return null;
}
return list.stream().collect(Collectors.toMap(StationAttributeEntity::getAttributes, StationAttributeEntity::getUnit));
// 属性去重
return list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(StationAttributeEntity::getAttributes))), ArrayList::new))
.stream().collect(Collectors.toMap(StationAttributeEntity::getAttributes, StationAttributeEntity::getUnit));
}
}

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/station/impl/StationServiceImpl.java

@ -1,5 +1,6 @@
package com.hnac.hzims.scheduled.service.operation.station.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.scheduled.mapper.operation.StationMapper;
import com.hnac.hzims.scheduled.service.operation.station.StationService;
@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
@Slf4j
@DS("master")
public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEntity> implements StationService {
}

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectStatisticsController.java

@ -26,6 +26,7 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept;
@ -89,15 +90,6 @@ public class OperDefectStatisticsController extends BladeController {
LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = statisticsService.getQueryWrapper(entity);
IPage<OperDefectStatisticsEntity> pages = statisticsService.page(Condition.getPage(query), queryWrapper);
IPage<OperDefectStatisticsVO> vos = OperDefectStatisticsWrapper.build().pageVO(pages);
if(CollectionUtil.isNotEmpty(vos.getRecords())){
vos.setRecords(vos.getRecords().stream().map(o->{
R<Dept> result = sysClient.getDept(o.getCreateDept());
if(result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())){
o.setDeptName(result.getData().getDeptName());
}
return o;
}).collect(Collectors.toList()));
}
return R.data(vos);
}

23
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

@ -41,6 +41,8 @@ import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.utils.FlowUtil;
import org.springblade.system.cache.DictCache;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@ -97,6 +99,15 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
if (ObjectUtil.isEmpty(AuthUtil.getDeptId())) {
throw new ServiceException("获取当前用户机构失败!");
}
if (ObjectUtil.isNotEmpty(entity.getFinder())&&StringUtils.isBlank(entity.getFinderName())){
User user = UserCache.getUser(entity.getFinder());
if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getName())) {
entity.setFinderName(user.getName());
}
}
if (StringUtils.isNotBlank(AuthUtil.getUserName())){
entity.setCreateUserName(AuthUtil.getUserName());
}
//加锁
Boolean lock = redisTemplate.opsForValue().setIfAbsent("SysUserLock" + AuthUtil.getDeptId(), AuthUtil.getDeptId(), 30, TimeUnit.SECONDS);
try {
@ -121,7 +132,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
e.printStackTrace();
log.error("保存现象失败!"+e);
//抛出异常,以便回滚
throw new ServiceException("保存现象失败!");
throw new ServiceException("保存现象失败!"+e.getMessage());
}finally {
redisTemplate.delete("SysUserLock" + AuthUtil.getDeptId()); //删除key,释放锁
}
@ -281,7 +292,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
public R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse) {
long taskId;
OperPhenomenonEntity operPhenomenonEntity;
log.info("消缺消息开始转换");
log.info("消缺消息开始转换"+processWorkFlowResponse);
try {
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
//现象缺陷全表更新
@ -294,6 +305,9 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) {
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getTaskName());
operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getNextStepOperator());
}else {
operPhenomenonEntity.setCurrentOperator("流程结束");
operPhenomenonEntity.setCurrentLinkHandler("");
}
//缺陷记录
OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper<OperDefectStatisticsEntity>() {{
@ -324,8 +338,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
defectService.save(operDefectEntity);
taskId = operDefectEntity.getId();
log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功");
operPhenomenonEntity.setCurrentOperator("流程结束");
operPhenomenonEntity.setCurrentLinkHandler(null);
}
//更新数据库
Long statisticsEntityId = statisticsEntity.getId();
@ -341,7 +354,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
operAppearanceService.updateById(appearanceEntity);
//推送消息中心相关消息
sendMessage(processWorkFlowResponse, operPhenomenonEntity,taskId);
log.info("消缺消息转换结束");
log.info("消缺消息转换结束"+processWorkFlowResponse);
return R.success("消息保存成功");
}

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

@ -169,26 +169,29 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
operDefectStatisticsExportVO.setDeptName(deptName.getData());
}
operDefectStatisticsExportVO.setDefectCode(entity.getDefectCode());
if (ObjectUtils.isNotEmpty(entity.getFinder())) {
User user = UserCache.getUser(entity.getFinder());
if (ObjectUtils.isNotEmpty(user)) {
operDefectStatisticsExportVO.setFinderName(user.getName());
}
// R<User> finderUser = userClient.userInfoById(entity.getFinder());
// if (finderUser.isSuccess() && ObjectUtils.isNotEmpty(finderUser.getData())) {
// operDefectStatisticsExportVO.setFinderName(finderUser.getData().getName());
// }
}
if (StringUtils.isNotBlank(entity.getPlanHandler())) {
User user = UserCache.getUser(Long.valueOf(entity.getPlanHandler()));
if (ObjectUtils.isNotEmpty(user)) {
operDefectStatisticsExportVO.setPlanHandler(user.getName());
}
operDefectStatisticsExportVO.setFinderName(entity.getFinderName());
operDefectStatisticsExportVO.setPlanHandler(entity.getPlanHandlerName());
// if (ObjectUtils.isNotEmpty(entity.getFinder())) {
// User user = UserCache.getUser(entity.getFinder());
// if (ObjectUtils.isNotEmpty(user)) {
// operDefectStatisticsExportVO.setFinderName(user.getName());
// }
//// R<User> finderUser = userClient.userInfoById(entity.getFinder());
//// if (finderUser.isSuccess() && ObjectUtils.isNotEmpty(finderUser.getData())) {
//// operDefectStatisticsExportVO.setFinderName(finderUser.getData().getName());
//// }
// }
// if (StringUtils.isNotBlank(entity.getPlanHandler())) {
// User user = UserCache.getUser(Long.valueOf(entity.getPlanHandler()));
// if (ObjectUtils.isNotEmpty(user)) {
// operDefectStatisticsExportVO.setPlanHandler(user.getName());
// }
// R<User> planHandlerUser = userClient.userInfoById(Long.valueOf(entity.getPlanHandler()));
// if (planHandlerUser.isSuccess() && ObjectUtils.isNotEmpty(planHandlerUser.getData())) {
// operDefectStatisticsExportVO.setPlanHandler(planHandlerUser.getData().getName());
// }
}
// }
if (ObjectUtils.isNotEmpty(entity.getFindTime())) {
operDefectStatisticsExportVO.setFindTime(entity.getFindTime());
}
@ -207,7 +210,7 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
}
if (StringUtils.isNotBlank(entity.getTicketId())) {
R<List<WorkTicketInfoEntity>> workTicketInfoById = iTicketInfoClient.getWorkTicketInfoById(Arrays.asList(Long.valueOf(entity.getTicketId())));
if (workTicketInfoById.isSuccess()&&CollectionUtil.isNotEmpty(workTicketInfoById.getData())) {
if (workTicketInfoById.isSuccess() && CollectionUtil.isNotEmpty(workTicketInfoById.getData())) {
//获取工作票的编码Id
operDefectStatisticsExportVO.setTicketId(workTicketInfoById.getData().get(0).getCode());
}

48
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/wrapper/OperDefectStatisticsWrapper.java

@ -24,30 +24,30 @@ public class OperDefectStatisticsWrapper extends BaseEntityWrapper<OperDefectSta
@Override
public OperDefectStatisticsVO entityVO(OperDefectStatisticsEntity entity) {
OperDefectStatisticsVO vo = BeanUtil.copy(entity, OperDefectStatisticsVO.class);
User createUser = UserCache.getUser(entity.getCreateUser());
User updateUser = UserCache.getUser(entity.getUpdateUser());
vo.setCreateUserName(createUser == null ? "" : createUser.getName());
vo.setUpdateUserName(updateUser == null ? "" : updateUser.getName());
if (Func.isNotEmpty(entity.getConclusionPeople())) {
User userC = UserCache.getUser(entity.getConclusionPeople());
vo.setConclusionPeopleName(userC == null ? "" : userC.getName());
}
if (Func.isNotEmpty(entity.getFinder())) {
User userF = UserCache.getUser(entity.getFinder());
vo.setFinderName(userF == null ? "" : userF.getName());
}
if (Func.isNotEmpty(entity.getDiscriminator())) {
User userD = UserCache.getUser(entity.getDiscriminator());
vo.setDiscriminatorName(userD == null ? "" : userD.getName());
}
if (Func.isNotEmpty(entity.getHandler())) {
User userHn = UserCache.getUser(entity.getHandler());
vo.setHandlerName(userHn == null ? "" : userHn.getName());
}
// 赋值消缺处理人名称
vo.setPlanHandlerName(Optional.ofNullable(entity.getPlanHandler()).map(Long::parseLong).map(UserCache::getUser).map(User::getName).orElse(entity.getPlanHandler()));
// 赋值两票工作负责人名称
vo.setPrincipalName(Optional.ofNullable(entity.getPrincipal()).map(UserCache::getUser).map(User::getName).orElse(entity.getPrincipalManual()));
// User createUser = UserCache.getUser(entity.getCreateUser());
// User updateUser = UserCache.getUser(entity.getUpdateUser());
// vo.setCreateUserName(createUser == null ? "" : createUser.getName());
// vo.setUpdateUserName(updateUser == null ? "" : updateUser.getName());
// if (Func.isNotEmpty(entity.getConclusionPeople())) {
// User userC = UserCache.getUser(entity.getConclusionPeople());
// vo.setConclusionPeopleName(userC == null ? "" : userC.getName());
// }
// if (Func.isNotEmpty(entity.getFinder())) {
// User userF = UserCache.getUser(entity.getFinder());
// vo.setFinderName(userF == null ? "" : userF.getName());
// }
// if (Func.isNotEmpty(entity.getDiscriminator())) {
// User userD = UserCache.getUser(entity.getDiscriminator());
// vo.setDiscriminatorName(userD == null ? "" : userD.getName());
// }
// if (Func.isNotEmpty(entity.getHandler())) {
// User userHn = UserCache.getUser(entity.getHandler());
// vo.setHandlerName(userHn == null ? "" : userHn.getName());
// }
// // 赋值消缺处理人名称
// vo.setPlanHandlerName(Optional.ofNullable(entity.getPlanHandler()).map(Long::parseLong).map(UserCache::getUser).map(User::getName).orElse(entity.getPlanHandler()));
// // 赋值两票工作负责人名称
// vo.setPrincipalName(Optional.ofNullable(entity.getPrincipal()).map(UserCache::getUser).map(User::getName).orElse(entity.getPrincipalManual()));
return vo;
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java

@ -132,7 +132,8 @@ public class ImsDutyRecController extends BladeController {
@ApiOperationSupport(order = 8)
@ApiOperation(value = "处理工作流程", notes = "传入flow")
public R submit(@Valid @RequestBody BladeFlow flow) {
return R.status(imsDutyRecService.completeTask(flow));
return R.success("接口已弃用");
// return R.status(imsDutyRecService.completeTask(flow));
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java

@ -66,6 +66,9 @@ public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExam
//设备ID:分析实例编码
R<HzPage<AnalyzeDataList>> analyzeDataByAnalyzeCode = searchClient.getAnalyzeDataByAnalyzeCode(analyzeDataCondition);
if(!analyzeDataByAnalyzeCode.isSuccess()) {
// if(DataResultCode.ANALYZE_INSTANCE_UNDEFINE.getCode()==analyzeDataByAnalyzeCode.getCode()){
// throw new ServiceException("找不到对应的分析实例,请检查好配置后重试!");
// }
throw new ServiceException("设备数据查询异常,请检查好配置后重试!");
}
return analyzeDataByAnalyzeCode;

30
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java

@ -106,6 +106,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
@Override
@Deprecated//2023.12.18
public R submit(ImsDutyRecEntity recEntity, PlanVO vo) {
//获取交班人值班信息
ImsDutyMainEntity handDutyMainEntity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{
@ -200,7 +201,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
* @return 交接班成功标识
*/
@Override
@Transactional(rollbackFor = Exception.class)
// @Transactional(rollbackFor = Exception.class)
public Boolean changeShift(ImsDutyRecDTO recDTO) {
// 获取班组组长
Long managerId = this.getHandleGroupManagerByDuty(recDTO.getDutyId());
@ -338,6 +339,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
@Override
@Transactional(rollbackFor = Exception.class)
@Deprecated//2023.12.18已启弃用
public boolean completeTask(BladeFlow flow) {
log.info("-----------------打印参数-----------------------" + flow);
// 创建变量
@ -1387,16 +1389,26 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
}
ImsDutyRecEntity dutyRec = BeanUtil.copy(recDTO, ImsDutyRecEntity.class);
// 更新交班值班
Assert.isTrue(imsDutyMainService.updateById(headDutyMain),() -> {
throw new RuntimeException("更新交班状态失败,交班执行对象为:"+ JSON.toJSONString(recDTO.getHeadDutyMainVo()));
});
if (ObjectUtil.isNotEmpty(headDutyMain)&&ObjectUtil.isNotEmpty(headDutyMain.getId())) {
Assert.isTrue(imsDutyMainService.updateById(headDutyMain), () -> {
throw new RuntimeException("更新交班状态失败,交班执行对象为:" + JSON.toJSONString(recDTO.getHeadDutyMainVo()));
});
log.info("更新交班状态:"+carryDutyMain);
}
// 更新接班值班
Assert.isTrue(imsDutyMainService.updateById(carryDutyMain),() -> {
throw new RuntimeException("更新接班状态失败,交班执行对象为:"+ JSON.toJSONString(recDTO.getHeadDutyMainVo()));
});
if (ObjectUtil.isNotEmpty(carryDutyMain)&&ObjectUtil.isNotEmpty(carryDutyMain.getId())) {
Assert.isTrue(imsDutyMainService.updateById(carryDutyMain), () -> {
throw new RuntimeException("更新接班状态失败,交班执行对象为:" + JSON.toJSONString(recDTO.getHeadDutyMainVo()));
});
log.info("更新接班状态:"+carryDutyMain);
}
// 更新交接班
this.updateById(dutyRec);
return true;
if (ObjectUtil.isNotEmpty(dutyRec)&&ObjectUtil.isNotEmpty(dutyRec.getId())) {
return this.updateById(dutyRec);
}else {
log.error("更新交接班记录失败"+dutyRec.toString());
return false;
}
}
/**

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/AreaMonthReportController.java

@ -31,6 +31,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -156,7 +157,7 @@ public class AreaMonthReportController extends BladeController {
@ApiOperation("导出水电站月报")
@GetMapping("/exportHydropowerStationMonthReport")
public R exportHydropowerStationMonthReport(HttpServletResponse response, @ApiParam(value = "日期-年", required = true) Integer year,@ApiParam(value = "日期-月", required = true) Integer month,
@ApiParam(value = "站点Id", required = true) Long deptId,@ApiParam(value = "月报类型", required = true) Long type) {
@ApiParam(value = "站点Id", required = true) Long deptId,@ApiParam(value = "月报类型", required = true) Long type) throws ParseException {
HashMap<String, Object> map = new HashMap<>();
if (Func.isEmpty(year)||Func.isEmpty(deptId)||Func.isEmpty(month)||year==0||deptId==0||month==0){

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAreaMonthReportService.java

@ -4,6 +4,7 @@ import com.hnac.hzims.operational.main.vo.AreaMonthReportVo;
import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
@ -19,9 +20,8 @@ public interface IAreaMonthReportService {
R export(HttpServletResponse response, String date);
R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month,Long deptId,String name);
R<List<AreaMonthReportVo>> getReportByType(String date, Integer type);
R exportByType(HttpServletResponse response, String date, Integer type);
R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month,Long deptId,String name) throws ParseException;
}

91
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -258,7 +258,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
return R.data("success");
}
@Override
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId,String deptName) {
public R exportHydropowerStationMonthReport(HttpServletResponse response, HashMap<String, Object> map, Integer year, Integer month, Long deptId,String deptName) throws ParseException {
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
if (!deptByCurrentUser.isSuccess()||deptByCurrentUser.getData()==null){
return R.fail("用户权限查询失败");
@ -276,9 +276,9 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.in(StationEntity::getRefDept, deptIds)
.eq(StationEntity::getType, HomePageConstant.HYDROPOWER));
stationEntityList=Optional.ofNullable(stationEntityList).orElse(new ArrayList<>()).stream().filter(s->Func.isNotEmpty(s.getCommissionTime())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(stationEntityList)) {
int commissionTime = stationEntityList.stream().map(s -> {
List<StationEntity> stationEntityListByCommissionTime=Optional.ofNullable(stationEntityList).orElse(new ArrayList<>()).stream().filter(s->Func.isNotEmpty(s.getCommissionTime())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(stationEntityListByCommissionTime)) {
int commissionTime = stationEntityListByCommissionTime.stream().map(s -> {
Duration dur = Duration.between(s.getCommissionTime(), LocalDateTime.now());
return (int) dur.toDays();
}).reduce(Integer::max).get();
@ -293,10 +293,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
Integer yearBefore = year - 1;
map.put("yearBefore", yearBefore);
map.put("month", month);
Integer monthBefore = month - 1;
String monStartMonBefore = TimeUtils.getEarlyTime(yearBefore, month);
String[] split = monStartMonBefore.split("-");
Integer monthBefore = Integer.valueOf(split[1]);
map.put("monthBefore", monthBefore);
// map.put("date", date);
map.put("stationName", deptName);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
map.put("writeTime", simpleDateFormat.format(new Date()));
@ -319,7 +320,6 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 今年当月
String monthStart = TimeUtils.getMonthStart(year, month);
String monthEndV2 = TimeUtils.getMonthEndV2(year, month);
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
List<HydropowerUnitRealVo> realsByDept = reals.stream().filter(s -> deptIds.contains(s.getDeptId())).collect(Collectors.toList());
// 装机容量占比数据组装
@ -351,6 +351,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
//装机容量占比图
ImageEntity capacityProportionChart = JFreeUtil.pieChartByDouble("水电项目装机容量占比图", capacityProportionMap, 500, 400);
map.put("capacityProportionChart", capacityProportionChart);
map.put("factoryComparisonChart", "---暂无数据---");
//各发电站发电量环比图+表格数据组装
List<MonPowerPercentageVo> powerPercentageVoList = getMonPowerPercentageVos(year, month, deptList, deptIds, stationEntityList, stationIds, yearBefore, monthBefore);
// getPowerData(deptList, yearStart, yearEnd, yearBeforeStart, yearBeforeEnd, monthStart, monthEnd, beforeMonthStart, beforeMonthEnd, monthStartBeforeYear, monthEndBeforeYear, devices, planYearData, powerPercentageVoList);
@ -372,14 +373,21 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
for (MonPowerPercentageVo monPowerPercentageVo : powerPercentageVoList) {
HashMap<String, String> power = new HashMap<>();
power.put("name", monPowerPercentageVo.getDeptName());
power.put("monthBefore", monPowerPercentageVo.getPowerMonBefore()+"MW");
power.put("month",monPowerPercentageVo.getPowerMon()+"MW");
power.put("monthBefore", monPowerPercentageVo.getPowerMonBefore()+"MkWh");
power.put("month",monPowerPercentageVo.getPowerMon()+"MkWh");
powerMap.add(power);
}
map.put("power", powerMap);
String dateFormat="";
if (month<10){
dateFormat=year+"-"+"0"+month;
}else {
dateFormat=year+"-"+month;
}
//表格总计
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null, Collections.singletonList(deptId.toString()), year.toString());
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, Collections.singletonList(deptId.toString()), year + "-" + month);
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString());
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, dateFormat);
getTabelSum(deptId, powerPercentageVoList, planYearAll, planMonAll, map);
//发电情况统计表数据
ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size());
@ -392,7 +400,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
temp.put("year", String.valueOf(monPowerPercentageVo.getPowerYear()));
temp.put("monPercentage", monPowerPercentageVo.getPowerMonPercentage() * 100 + "%");
temp.put("yearPercentage", monPowerPercentageVo.getPowerYearPercentage() * 100 + "%");
temp.put("plan", monPowerPercentageVo.getPlanPercentage() * 100 + "%");
temp.put("plan", monPowerPercentageVo.getPlanPercentage()+ "%");
list.add(temp);
}
map.put("powerGeneration", list);
@ -459,7 +467,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
//表格数据
HashMap<String, String> temp = new HashMap<>();
temp.put("deptName", "总计");
temp.put("checkLevel", "无等级");
temp.put("checkLevel", "");
temp.put("findShortagesMon", "0");
temp.put("shortagesMon", "0");
temp.put("findShortagesYear", "0");
@ -560,10 +568,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
int count = yearTicketCollect.size();
ticketChartCell.setTicketYear(count);
List<Long> ticketIds = yearTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
ticketChartCell.setTicketYearPassCount(0);
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds);
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) {
double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketYeaPercr(ticketYearPerc);
ticketChartCell.setTicketYearPassCount(ticketPassCount.getData().intValue());
}
}
if (CollectionUtils.isNotEmpty(monthTicketCollect)) {
@ -571,10 +581,13 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
int count = monthTicketCollect.size();
ticketChartCell.setTicketMon(count);
List<Long> monthTicketIds = monthTicketCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
//合格数量
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds);
ticketChartCell.setTicketMonPassCount(0);
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) {
double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketMonPerc(ticketMonthPerc);
ticketChartCell.setTicketMonPassCount(ticketMonthPassCount.getData().intValue());
}
}
}
@ -593,9 +606,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ticketChartCell.setTicketYear(count);
List<Long> ticketIds = yearOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketPassCount = ticketInfoClient.getTicketPassByIds(ticketIds);
ticketChartCell.setTicketYearPassCount(0);
if (ticketPassCount.isSuccess() && ticketPassCount.getData() != null && count != 0) {
double ticketYearPerc = BigDecimal.valueOf(ticketPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketYeaPercr(ticketYearPerc);
ticketChartCell.setTicketYearPassCount(ticketPassCount.getData().intValue());
}
}
if (CollectionUtils.isNotEmpty(monthOperateCollect)) {
@ -604,9 +619,11 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
ticketChartCell.setTicketMon(count);
List<Long> monthTicketIds = monthOperateCollect.stream().map(BaseEntity::getId).collect(Collectors.toList());
R<Long> ticketMonthPassCount = ticketInfoClient.getTicketPassByIds(monthTicketIds);
ticketChartCell.setTicketMonPassCount(0);
if (ticketMonthPassCount.isSuccess() && ticketMonthPassCount.getData() != null && count != 0) {
double ticketMonthPerc = BigDecimal.valueOf(ticketMonthPassCount.getData()).divide(BigDecimal.valueOf(count), 2, BigDecimal.ROUND_UP).doubleValue();
ticketChartCell.setTicketMonPerc(ticketMonthPerc);
ticketChartCell.setTicketMonPassCount(ticketMonthPassCount.getData().intValue());
}
}
}
@ -626,10 +643,20 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
sumCell.setTicketType(mapTicketChart.getKey());
sumCell.setTicketName(TicketConstants.TicketTypeNameEnum.getTicketNameByType(mapTicketChart.getKey()));
List<TicketChartCell> ticketChartValue = mapTicketChart.getValue();
sumCell.setTicketMon(ticketChartValue.stream().mapToInt(TicketChartCell::getTicketMon).sum());
sumCell.setTicketYear(ticketChartValue.stream().mapToInt(TicketChartCell::getTicketYear).sum());
sumCell.setTicketMonPerc(ticketChartValue.stream().mapToDouble(TicketChartCell::getTicketMonPerc).sum());
sumCell.setTicketYeaPercr(ticketChartValue.stream().mapToDouble(TicketChartCell::getTicketYeaPercr).sum());
int sumTicketMon = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketMon).sum();
sumCell.setTicketMon(sumTicketMon);
int sumTicketYear = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketYear).sum();
sumCell.setTicketYear(sumTicketYear);
int sumTicketMonPass = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketMonPassCount).sum();
int sumTicketYearPass = ticketChartValue.stream().mapToInt(TicketChartCell::getTicketYearPassCount).sum();
if (sumTicketMonPass>0&&sumTicketMon>0){
BigDecimal monPassPerc = new BigDecimal(sumTicketMonPass).divide(new BigDecimal(sumTicketMon), 2, BigDecimal.ROUND_UP);
sumCell.setTicketMonPerc(monPassPerc.doubleValue());
}
if (sumTicketYear>0&&sumTicketYearPass>0){
BigDecimal yearPassPerc = new BigDecimal(sumTicketYearPass).divide(new BigDecimal(sumTicketYear), 2, BigDecimal.ROUND_UP);
sumCell.setTicketYeaPercr(yearPassPerc.doubleValue());
}
sumCollect.add(sumCell);
}
TicketChartVo ticketChartVo = new TicketChartVo();
@ -678,6 +705,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
private List<MonPowerPercentageVo> getMonPowerPercentageVos(Integer year, Integer month, List<Dept> deptList, List<Long> deptIds, List<StationEntity> stationEntityList, List<Long> stationIds, Integer yearBefore, Integer monthBefore) {
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
//年计划发电量
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString());
List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>();
//水电站,光伏站和带代运维数据近三年数据
@ -686,7 +714,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
List<String> listByYearBefore = TimeUtils.getListByYear(yearBefore);
String monStart = TimeUtils.getMon(year, month);
String monStartYearBefore = TimeUtils.getMon(yearBefore, month);
String monStartMonBefore = TimeUtils.getMon(year, monthBefore);
String monStartMonBefore = TimeUtils.getEarlyTime(yearBefore, month);
// String monStartMonBefore = TimeUtils.getMon(year, monthBefore);
// 格式:站点-日期-发电量
for (Map.Entry<Long, Map<String, Float>> deviceMap : powerMapThree.entrySet()) {
String deptNameByKey;
@ -706,31 +735,33 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
Double planGeneration = 0d;
List<PlanGenerationEntity> planGenerationById = planYearData.stream().filter(s -> collect.get(0).getRefDept().equals(s.getStationDeptId())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(planGenerationById)) {
planGeneration = Double.valueOf(planGenerationById.get(0).getPlanGeneration());
planGeneration = Double.valueOf(planGenerationById.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
}
//当前机构近三年的数据
Map<String, Float> value = deviceMap.getValue();
//今年发电量
powerYear=value.entrySet().stream().filter(s->listByYear.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
//转换单位kwh-》万Kwh
powerYear=powerYear.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP);
powerYear=powerYear.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerYearBefore=value.entrySet().stream().filter(s->listByYearBefore.contains(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
powerYearBefore=powerYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP);
powerYearBefore=powerYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerMonth=value.entrySet().stream().filter(s->monStart.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
powerMonth=powerMonth.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP);
powerMonth=powerMonth.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerMonthBefore=value.entrySet().stream().filter(s->monStartMonBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
powerMonthBefore=powerMonthBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP);
powerMonthBefore=powerMonthBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerMonthYearBefore=value.entrySet().stream().filter(s->monStartYearBefore.equals(s.getKey())).map(s->BigDecimal.valueOf(s.getValue())).reduce(BigDecimal.ZERO, BigDecimal::add);
powerMonthYearBefore=powerMonthYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP);
powerMonthYearBefore=powerMonthYearBefore.divide(new BigDecimal(10000),2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP).setScale(2,BigDecimal.ROUND_UP);
powerVo.setPowerYear(powerYear.doubleValue());
powerVo.setPowerYearBefore(powerYearBefore.doubleValue());
BigDecimal yearPercentage = new BigDecimal(0);
BigDecimal planPercentage = new BigDecimal(0);
if (powerYearBefore.compareTo(BigDecimal.ZERO) != 0) {
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP);
yearPercentage.setScale(2, BigDecimal.ROUND_UP);
}
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) {
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP);
planPercentage.setScale(2, BigDecimal.ROUND_UP);
}
powerVo.setPlanPercentage(planPercentage.doubleValue());
powerVo.setPowerYearPercentage(yearPercentage.doubleValue());
@ -740,6 +771,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
BigDecimal monPercentage = new BigDecimal(0);
if (powerMonthYearBefore.compareTo(BigDecimal.ZERO) != 0) {
monPercentage = (powerMonth.subtract(powerMonthYearBefore)).divide(powerMonthYearBefore, 2, BigDecimal.ROUND_UP);
monPercentage.setScale(2, BigDecimal.ROUND_UP);
}
powerVo.setPowerMonPercentage(monPercentage.doubleValue());
powerPercentageVoList.add(powerVo);
@ -835,11 +867,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
private static void getTabelSum(Long deptId, List<MonPowerPercentageVo> powerPercentageVoList, List<PlanGenerationEntity> planYearAll, List<PlanGenerationEntity> planMonAll, HashMap<String, Object> map) {
Float planGeneration = 0f;
if (Func.isNotEmpty(planYearAll)) {
planGeneration = planYearAll.get(0).getPlanGeneration();
planGeneration =Double.valueOf(planYearAll.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()).floatValue() ;
}
Float planMonGeneration = 0f;
if (Func.isNotEmpty(planMonAll)) {
planMonGeneration = planMonAll.get(0).getPlanGeneration();
planMonGeneration =Double.valueOf(planMonAll.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum()).floatValue() ;
// planMonGeneration = planMonAll.get(0).getPlanGeneration();
}
MonPowerPercentageVo powerVo = new MonPowerPercentageVo();
powerVo.setDeptId(deptId);
@ -860,7 +893,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
yearPercentage = (powerYear.subtract(powerYearBefore)).divide(powerYearBefore, 2, BigDecimal.ROUND_UP);
}
if (BigDecimal.valueOf(planGeneration).compareTo(BigDecimal.ZERO) != 0) {
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration), 2, BigDecimal.ROUND_UP);
//因为计划发电量的单位是kwh,发电量已经转换为万kwh,再加上百分比转换所以需要乘以10000*100
planPercentage = powerYear.divide(BigDecimal.valueOf(planGeneration).divide(new BigDecimal(1000000)), 2, BigDecimal.ROUND_UP);
// 年计划完成率
map.put("yearCompletionRate", planPercentage.toString());
} else {
@ -877,7 +911,8 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 项目月计划完成量
BigDecimal planMonPercentage = new BigDecimal(0);
if (powerMonth.compareTo(BigDecimal.ZERO) != 0 && BigDecimal.valueOf(planMonGeneration).compareTo(BigDecimal.ZERO) != 0) {
planMonPercentage = powerMonth.divide(BigDecimal.valueOf(planMonGeneration), 2, BigDecimal.ROUND_UP);
//因为计划发电量的单位是kwh,发电量已经转换为万kwh,再加上百分比转换所以需要乘以10000*100
planMonPercentage = powerMonth.divide(BigDecimal.valueOf(planMonGeneration).divide(new BigDecimal(1000000)), 2, BigDecimal.ROUND_UP);
}
map.put("monCompletionRate", planMonPercentage);
BigDecimal powerMonthBefore = powerPercentageVoList.stream()

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java

@ -972,7 +972,7 @@ public class HomePageServiceImpl implements IHomePageService {
}
int faInvestment = otherList.stream().mapToInt(OtherEntity::getFaQuantity).sum();
distributionNetworkVo.setFaInvestment(faInvestment);
double onlineRate = otherList.stream().mapToDouble(o-> Double.valueOf(o.getOnlineRate())).average().getAsDouble();;
double onlineRate = otherList.stream().mapToDouble(o-> Double.parseDouble(o.getOnlineRate())).average().getAsDouble();
if(Math.abs(onlineRate) <= 0){
distributionNetworkVo.setOnlineRate("0.0");
countDownLatch.countDown();

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -1149,7 +1149,7 @@ public class HydropowerServiceImpl implements HydropowerService {
long on = reals.stream().filter(real -> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId()) && real.getState()).count();
long sum = reals.stream().filter(real->entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).count();
if(Math.abs(sum) > 0){
scale.setDeviceUse(BigDecimal.valueOf(on / (double)sum * 100).setScale(1, RoundingMode.HALF_UP).doubleValue());
scale.setDeviceUse(BigDecimal.valueOf(on / (double)sum * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
return scale;

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java

@ -137,7 +137,7 @@ public class WindHomeServiceImpl implements WindHomeService {
score.setPlanYear(yearPlans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
// 年发电完成率
if(Math.abs(score.getGenerateYear()) > 0 && Math.abs(score.getPlanYear()) > 0){
score.setCompleteRate(BigDecimal.valueOf(score.getGenerateYear() / score.getPlanYear() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
score.setCompleteRate(BigDecimal.valueOf(score.getGenerateYear() / score.getPlanYear() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}
// 月发电量
score.setGenerateMon(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getPower).sum());
@ -145,10 +145,13 @@ public class WindHomeServiceImpl implements WindHomeService {
score.setPlanMon(yearPlans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
// 月发电量完成率
if(Math.abs(score.getGenerateMon()) > 0 && Math.abs(score.getPlanMon()) > 0){
score.setCompleteMonRate(BigDecimal.valueOf(score.getGenerateMon() / score.getPlanMon() * 100).setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
score.setCompleteMonRate(BigDecimal.valueOf(score.getGenerateMon() / score.getPlanMon() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}
// 月平均风速
score.setSpeedRate(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getSpeed).average().getAsDouble());
OptionalDouble speed = winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getSpeed).average();;
if(speed.isPresent()){
score.setSpeedRate(speed.getAsDouble());
}
// 月利用小时
score.setAvailableMon(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy-MM"))).mapToDouble(WindEntity::getAvailable).sum());
// 日发电量

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

@ -55,11 +55,13 @@ public class MaintenanceController {
@PostMapping("/findPending")
@ApiOperation(value = "日常维护待处理")
public Boolean findPending(@RequestBody ProcessWorkFlowResponse response){
log.info("日常维护消费处理开始:findPending");
try {
maintenanceService.findPending(response);
return true;
} catch (Exception e) {
e.printStackTrace();
log.error("param"+response+"报错信息"+e.toString());
throw new ServiceException("日常维护待处理:" + e.getMessage());
}
}

52
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/scheduled/MaintenanceTaskCreateTask.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.maintenance.scheduled;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.hnac.hzims.message.dto.PlanMsgRecordDto;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import com.hnac.hzims.message.fegin.IMessageClient;
@ -10,11 +11,11 @@ import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.mapper.OperMaintenancePlanMapper;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenancePlanService;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.maintenance.service.MaintenanceService;
import com.hnac.hzims.operational.maintenance.template.service.TemplateService;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskEntityVo;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
@ -29,6 +30,7 @@ import org.springblade.flow.core.feign.IFlowClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
@ -70,6 +72,7 @@ public class MaintenanceTaskCreateTask {
private final MaintenanceService maintenanceService;
private final IOperMaintenancePlanService maintenancePlanService;
private final List<TemplateService> templateService;
@ -79,7 +82,7 @@ public class MaintenanceTaskCreateTask {
final static String REMIND_TASK_END_LIST = "hzims:operation:maintenance:remind:end:tasks";
@XxlJob(TASK_VALUE_MAINTENANCE_TASK_CREATE)
@Transactional
// @Transactional
public ReturnT<String> execute(String param) throws Exception {
log.info(TASK_VALUE_MAINTENANCE_TASK_CREATE + " start....................................................................................");
Date startDate = StringUtil.isNotBlank(param) ? DateUtil.parse(param, DateUtil.PATTERN_DATE) : DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE);
@ -97,9 +100,19 @@ public class MaintenanceTaskCreateTask {
//生成日常巡检任务并插入数据库
for (int i = startIndex; i < endIndex; i++) {
this.generateTaskByPlan(planEntities.get(i),true);
Boolean aBoolean = this.generateTaskByPlan(planEntities.get(i), true);
//更新任务派发时间
if (aBoolean) {
//当所有的任务生成后,才会更新计划的时间状态
LambdaUpdateWrapper<OperMaintenancePlanEntity> planEntityLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
planEntityLambdaUpdateWrapper.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date());
planEntityLambdaUpdateWrapper.eq(OperMaintenancePlanEntity::getId, planEntities.get(i).getId());
maintenancePlanService.update(planEntityLambdaUpdateWrapper);
log.info("更新任务派发"+planEntities.get(i));
}else {
log.error("更新任务派发失败"+planEntities.get(i));
}
}
Thread.sleep(1000);
page++;
} while (page * size < planEntities.size());
@ -113,19 +126,42 @@ public class MaintenanceTaskCreateTask {
* @param planEntity
* @return
*/
public void generateTaskByPlan(OperMaintenancePlanEntity planEntity,Boolean flag) {
public Boolean generateTaskByPlan(OperMaintenancePlanEntity planEntity,Boolean flag) {
log.info("日常维护计划生成任务开始:param"+planEntity);
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(planEntity,OperMaintenanceTaskEntity.class);
//拆分设备 每个设备生成一条任务
List<Long> taskIds=new ArrayList<>();
if(StringUtil.isNotBlank(planEntity.getEmCode())){
List<String> emCodeList = Arrays.asList(planEntity.getEmCode().split(","));
for(String emCode : emCodeList){
taskEntity.setEmCode(emCode);
maintenanceService.fillTask(taskEntity,planEntity,flag);
//一旦有一条任务失败,则删除当前生成的任务,不更新当前的计划状态
try {
taskEntity.setEmCode(emCode);
Long task = maintenanceService.fillTask(taskEntity, planEntity, flag);
if (ObjectUtil.isNotEmpty(task)){
taskIds.add(task);
}
}catch (Exception e){
log.error("日常维护任务生成失败:" + "emCode:" + emCode + "错误原因:" + e);
log.error("日常维护任务生成失败:" + "param:" + planEntity + "错误原因:" + e);
taskService.deleteTaskBatch(taskIds);
return false;
}
}
}
else {
maintenanceService.fillTask(taskEntity,planEntity,flag);
try {
Long task = maintenanceService.fillTask(taskEntity, planEntity, flag);
if (ObjectUtil.isNotEmpty(task)) {
taskIds.add(task);
}
} catch (Exception e) {
log.error("日常维护任务生成失败:" + "param:" + planEntity + "错误原因:" + e);
taskService.deleteTaskBatch(taskIds);
return false;
}
}
return true;
}
/**

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

@ -38,5 +38,5 @@ public interface MaintenanceService {
* @param taskEntity
* @param finalPlanEntity
*/
void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag);
Long fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag);
}

119
hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java

@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.BusinessMessageDTO;
@ -38,10 +37,7 @@ import org.springblade.system.feign.ISysClient;
import org.springframework.beans.BeanUtils;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.time.Instant;
import java.time.LocalDate;
@ -49,7 +45,6 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -87,7 +82,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* @param ids
*/
@Override
@Transactional(rollbackFor = Exception.class)
// @Transactional(rollbackFor = Exception.class)
public void createTask(List<String> ids) {
try {
//获取日常维护计划
@ -95,21 +90,26 @@ public class MaintenanceServiceImpl implements MaintenanceService {
planEntityLambdaQueryWrapper.in(BaseEntity::getId, ids);
List<OperMaintenancePlanEntity> planEntities = maintenancePlanService.list(planEntityLambdaQueryWrapper);
//筛选当月没生成任务的计划
List<OperMaintenancePlanEntity> finalPlanEntities = planEntities.stream().filter(planEntity -> ObjectUtil.isEmpty(planEntity.getCreateTaskTime()) || !DateUtil.judgeSameDay(DateUtil.DateToLocalDateTime(planEntity.getCreateTaskTime()), LocalDate.now())).collect(Collectors.toList());
List<OperMaintenancePlanEntity> finalPlanEntities = planEntities.stream().
filter(planEntity -> ObjectUtil.isEmpty(planEntity.getCreateTaskTime()) ||
!DateUtil.judgeSameDay(DateUtil.DateToLocalDateTime(planEntity.getCreateTaskTime()), LocalDate.now()))
.collect(Collectors.toList());
if (CollectionUtil.isEmpty(finalPlanEntities)) {
throw new ServiceException("所选计划当天已生成任务");
}
for (OperMaintenancePlanEntity finalPlanEntity : finalPlanEntities) {
// 通过计划生成任务
this.createTaskByPlan(finalPlanEntity);
//更新任务派发时间
LambdaUpdateWrapper<OperMaintenancePlanEntity> planEntityLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
planEntityLambdaUpdateWrapper.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date());
planEntityLambdaUpdateWrapper.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
boolean update = maintenancePlanService.update(planEntityLambdaUpdateWrapper);
if (!update) {
log.error("maintenance:generateTask 更新任务派发失败");
throw new ServiceException("更新任务派发失败");
Boolean taskByPlan = this.createTaskByPlan(finalPlanEntity);
if (taskByPlan) {
//更新任务派发时间
LambdaUpdateWrapper<OperMaintenancePlanEntity> planEntityLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
planEntityLambdaUpdateWrapper.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date());
planEntityLambdaUpdateWrapper.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
boolean update = maintenancePlanService.update(planEntityLambdaUpdateWrapper);
if (!update) {
log.error("maintenance:generateTask 更新任务派发失败");
throw new ServiceException("更新任务派发失败");
}
}
}
} catch (Exception e) {
@ -143,24 +143,26 @@ public class MaintenanceServiceImpl implements MaintenanceService {
// standardTicketInfoVo = (OperMaintenanceTaskEntityVo) jsonObject.get("operMaintenanceTaskEntityVo");
// standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, OperMaintenanceTaskEntityVo.class);
} catch (Exception e) {
log.error("获取表单出现异常了~~~~");
log.error("获取表单出现异常了~~~~"+response);
throw new IllegalArgumentException(e.getMessage());
}
//1.查询日常维护信息
Long id = NumberUtils.toLong(response.getBusinessKey());
OperMaintenanceTaskEntity dbOperMaintenanceTaskEntity = taskService.getById(id);
if (ObjectUtils.isEmpty(dbOperMaintenanceTaskEntity)) {
log.error("获取日常维护数据不存在");
return;
}
OperMaintenanceTaskEntity entity = new OperMaintenanceTaskEntity();
BeanUtils.copyProperties(standardTicketInfoVo, entity);
entity.setId(id);
//1.查询日常维护信息
//有Id才进行生成操作
if (StringUtils.isNotBlank(response.getBusinessKey())) {
Long id = NumberUtils.toLong(response.getBusinessKey());
OperMaintenanceTaskEntity dbOperMaintenanceTaskEntity = taskService.getById(id);
if (ObjectUtils.isEmpty(dbOperMaintenanceTaskEntity)) {
log.error("获取日常维护数据不存在" + response);
return;
}
entity.setId(id);
//填充日常维护信息
saveOperMaintenanceTaskEntity(entity, response);
entity.setProcessInstanceId(response.getProcessInstanceId());
taskService.updateById(entity);
//推送消息
if (response.getTaskId() != null) {
// MessagePushRecordDto message = new MessagePushRecordDto();
@ -225,8 +227,10 @@ public class MaintenanceServiceImpl implements MaintenanceService {
}
log.info("推送成功~");
}
}
} catch (Exception e) {
e.printStackTrace();
log.error("日常维护消费异常:param"+response+"报错信息"+e);
}
}
@ -266,20 +270,40 @@ public class MaintenanceServiceImpl implements MaintenanceService {
*
* @param finalPlanEntity
*/
private void createTaskByPlan(OperMaintenancePlanEntity finalPlanEntity) {
private Boolean createTaskByPlan(OperMaintenancePlanEntity finalPlanEntity) {
OperMaintenanceTaskEntity taskEntity = BeanUtil.copy(finalPlanEntity, OperMaintenanceTaskEntity.class);
//拆分设备 每个设备生成一条任务
List<Long> taskIds = new ArrayList<>();
if (StringUtil.isNotBlank(finalPlanEntity.getEmCode())) {
log.info("finalPlanEntity.getEmCode() : {}", finalPlanEntity.getEmCode());
String[] emCodeList = finalPlanEntity.getEmCode().split(",");
for (String emCode : emCodeList) {
taskEntity.setEmCode(emCode);
this.fillTask(taskEntity, finalPlanEntity,false);
try {
taskEntity.setEmCode(emCode);
Long task = this.fillTask(taskEntity, finalPlanEntity, false);
if (ObjectUtil.isNotEmpty(task)) {
taskIds.add(task);
}
} catch (Exception e) {
log.error("日常维护任务生成失败:" + "emCode:" + emCode + "错误原因:" + e);
log.error("日常维护任务生成失败:" + "param:" + finalPlanEntity + "错误原因:" + e);
taskService.deleteTaskBatch(taskIds);
return false;
}
}
} else {
this.fillTask(taskEntity, finalPlanEntity,false);
try {
Long task = this.fillTask(taskEntity, finalPlanEntity, false);
if (ObjectUtil.isNotEmpty(task)) {
taskIds.add(task);
}
} catch (Exception e) {
log.error("日常维护任务生成失败:" + "param:" + finalPlanEntity + "错误原因:" + e);
taskService.deleteTaskBatch(taskIds);
return false;
}
}
return true;
}
@ -290,7 +314,8 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* @param finalPlanEntity
*/
@Override
public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag) {
// @Transactional(rollbackFor = Exception.class)
public Long fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity, Boolean flag) {
// DefaultTransactionDefinition = new DefaultTransactionDefinition();
// defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
// TransactionStatus transaction = dataSourceTransactionManager.getTransaction(defaultTransactionDefinition);
@ -320,29 +345,31 @@ public class MaintenanceServiceImpl implements MaintenanceService {
taskEntity.setDisposer(userId.replaceAll("\\^", ","));
} else {
log.info("计划ID为:{}未查询到排班记录", finalPlanEntity.getId());
LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate()
.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date())
.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
maintenancePlanService.update(planQueryWrapper);
return;
// LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate()
// .set(OperMaintenancePlanEntity::getCreateTaskTime, new Date())
// .eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
// maintenancePlanService.update(planQueryWrapper);
return null;
}
}
taskService.save(taskEntity);
// dataSourceTransactionManager.commit(transaction);
//等当前计划的所有任务生成后更新当前计划时间
// LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate()
// .set(OperMaintenancePlanEntity::getCreateTaskTime, new Date())
// .eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
// maintenancePlanService.update(planQueryWrapper);
executor.execute(() -> {
OperMaintenanceTaskEntity maintenanceTask = taskService.getById(taskEntity.getId());
this.pushTaskMessage(maintenanceTask);
});
//启动流程
String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity,flag);
String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity, flag);
LambdaUpdateWrapper<OperMaintenanceTaskEntity> taskQueryWrapper = Wrappers.<OperMaintenanceTaskEntity>lambdaUpdate()
.set(OperMaintenanceTaskEntity::getProcessInstanceId, processInstanceId)
.eq(OperMaintenanceTaskEntity::getId, taskEntity.getId());
taskService.update(taskQueryWrapper);
LambdaUpdateWrapper<OperMaintenancePlanEntity> planQueryWrapper = Wrappers.<OperMaintenancePlanEntity>lambdaUpdate()
.set(OperMaintenancePlanEntity::getCreateTaskTime, new Date())
.eq(OperMaintenancePlanEntity::getId, finalPlanEntity.getId());
maintenancePlanService.update(planQueryWrapper);
executor.execute(() -> {
OperMaintenanceTaskEntity maintenanceTask = taskService.getById(taskEntity.getId());
this.pushTaskMessage(maintenanceTask);
});
return taskEntity.getId();
}

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

@ -36,6 +36,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.RandomUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@ -147,8 +148,8 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
if (!CollectionUtils.isEmpty(req.getDeptIds())) {
in(OperMaintenanceTaskEntity::getCreateDept, req.getDeptIds());
}
if (req.getCreateDept() != null) {
eq(OperMaintenanceTaskEntity::getCreateDept, req.getCreateDept());
if (!ObjectUtil.isEmpty(req.getCreateDept())) {
in(OperMaintenanceTaskEntity::getCreateDept, req.getCreateDept());
}
if (StringUtil.isNoneBlank(req.getFlowTaskName())) {
eq(OperMaintenanceTaskEntity::getFlowTaskName, req.getFlowTaskName());
@ -516,10 +517,11 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
private VoteChartVo getVoteChartVo(List<OperMaintenanceTaskEntity> list) {
VoteChartVo voteChartVo = new VoteChartVo();
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() == 3).map(s -> s.getId()).collect(Collectors.toList());
List<Long> undoneIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> s.getStatus() != 3).map(s -> s.getId()).collect(Collectors.toList());
List<Long> finishIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> StringUtil.isNotBlank(s.getFlowTaskName())&&"结束".equals(s.getFlowTaskName())).map(BaseEntity::getId).collect(Collectors.toList());
//没有流程名称或者流程名称不等于结束,都算未完成
List<Long> undoneIds = Optional.ofNullable(list).orElse(new ArrayList<>()).stream().filter(s -> StringUtil.isBlank(s.getFlowTaskName())||!"结束".equals(s.getFlowTaskName())).map(BaseEntity::getId).collect(Collectors.toList());
voteChartVo.setSumNum(list.size());
voteChartVo.setSumIds(list.stream().map(s -> s.getId()).collect(Collectors.toList()));
voteChartVo.setSumIds(list.stream().map(BaseEntity::getId).collect(Collectors.toList()));
voteChartVo.setFinishNum(finishIds.size());
voteChartVo.setFinishIds(finishIds);
voteChartVo.setUndoneNum(undoneIds.size());

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

@ -112,7 +112,7 @@ public class TimeUtils {
}
public static List<String> getListByYear(Integer year) {
List<String> monthList=new ArrayList<>();
for (int i = 1; i <13; i++) {
for (int i = 0; i <12; i++) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
@ -143,4 +143,24 @@ public class TimeUtils {
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) ;
return start;
}
public static String getEarlyTime(Integer year, Integer month) {
// 创建一个Calendar对象
Calendar calendar = Calendar.getInstance();
// 设置年份
calendar.set(Calendar.YEAR, year);
// 设置月份为1(即一月)
calendar.set(Calendar.MONTH, month-1);
// 设置日期为1
calendar.set(Calendar.DATE, 1);
// 设置时间为0点0分0秒
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.add(Calendar.MONTH, -1);
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE) ;
return start;
}
}

127
hzims-service/operational/src/main/resources/log/logback-dev.xml

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds">
<!-- 自定义参数监听 -->
<contextListener class="org.springblade.core.log.listener.LoggerStartupListener"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<property name="log.pattern"
value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%X{traceId}] %-5level %logger{50} - %msg%n"/>
<!-- 生成日志文件 -->
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/info/info-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存10天 一天24个文件,一小时生成一个-->
<MaxHistory>240</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 生成日志文件 -->
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/error/error-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存15天 一天24个文件,一小时生成一个-->
<MaxHistory>360</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志输出级别 -->
<root level="ERROR">
<appender-ref ref="STDOUT"/>
<!--<appender-ref ref="INFO"/>-->
<appender-ref ref="ERROR"/>
</root>
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="druid.sql" level="ERROR"/>
<!-- MyBatis log configure -->
<logger name="com.apache.ibatis" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="java.sql.Connection" level="ERROR"/>
<logger name="java.sql.Statement" level="ERROR"/>
<logger name="java.sql.PreparedStatement" level="ERROR"/>
<!-- 减少部分debug日志 -->
<logger name="druid.sql" level="ERROR"/>
<logger name="org.apache.shiro" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="org.springframework" level="ERROR"/>
<logger name="org.springframework.context" level="ERROR"/>
<logger name="org.springframework.beans" level="ERROR"/>
<logger name="com.baomidou.mybatisplus" level="ERROR"/>
<logger name="org.apache.ibatis.io" level="ERROR"/>
<logger name="org.apache.velocity" level="ERROR"/>
<logger name="org.eclipse.jetty" level="ERROR"/>
<logger name="io.undertow" level="ERROR"/>
<logger name="org.xnio.nio" level="ERROR"/>
<logger name="org.thymeleaf" level="ERROR"/>
<logger name="springfox.documentation" level="ERROR"/>
<logger name="org.hibernate.validator" level="ERROR"/>
<logger name="com.netflix.loadbalancer" level="ERROR"/>
<logger name="com.netflix.hystrix" level="ERROR"/>
<logger name="com.netflix.zuul" level="ERROR"/>
<logger name="de.codecentric" level="ERROR"/>
<!-- cache ERROR -->
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="org.springframework.cache" level="ERROR"/>
<!-- cloud -->
<logger name="org.apache.http" level="ERROR"/>
<logger name="com.netflix.discovery" level="ERROR"/>
<logger name="com.netflix.eureka" level="ERROR"/>
<!-- 业务日志 -->
<Logger name="org.springblade" level="ERROR"/>
<Logger name="org.springblade.core.version" level="ERROR"/>
<!-- 减少nacos日志 -->
<logger name="com.alibaba.nacos" level="ERROR"/>
</configuration>

127
hzims-service/operational/src/main/resources/log/logback-prod.xml

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds">
<!-- 自定义参数监听 -->
<contextListener class="org.springblade.core.log.listener.LoggerStartupListener"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<property name="log.pattern"
value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%X{traceId}] %-5level %logger{50} - %msg%n"/>
<!-- 生成日志文件 -->
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/info/info-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存10天 一天24个文件,一小时生成一个-->
<MaxHistory>240</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 生成日志文件 -->
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/error/error-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存15天 一天24个文件,一小时生成一个-->
<MaxHistory>360</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志输出级别 -->
<root level="ERROR">
<appender-ref ref="STDOUT"/>
<!--<appender-ref ref="INFO"/>-->
<appender-ref ref="ERROR"/>
</root>
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="druid.sql" level="ERROR"/>
<!-- MyBatis log configure -->
<logger name="com.apache.ibatis" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="java.sql.Connection" level="ERROR"/>
<logger name="java.sql.Statement" level="ERROR"/>
<logger name="java.sql.PreparedStatement" level="ERROR"/>
<!-- 减少部分debug日志 -->
<logger name="druid.sql" level="ERROR"/>
<logger name="org.apache.shiro" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="org.springframework" level="ERROR"/>
<logger name="org.springframework.context" level="ERROR"/>
<logger name="org.springframework.beans" level="ERROR"/>
<logger name="com.baomidou.mybatisplus" level="ERROR"/>
<logger name="org.apache.ibatis.io" level="ERROR"/>
<logger name="org.apache.velocity" level="ERROR"/>
<logger name="org.eclipse.jetty" level="ERROR"/>
<logger name="io.undertow" level="ERROR"/>
<logger name="org.xnio.nio" level="ERROR"/>
<logger name="org.thymeleaf" level="ERROR"/>
<logger name="springfox.documentation" level="ERROR"/>
<logger name="org.hibernate.validator" level="ERROR"/>
<logger name="com.netflix.loadbalancer" level="ERROR"/>
<logger name="com.netflix.hystrix" level="ERROR"/>
<logger name="com.netflix.zuul" level="ERROR"/>
<logger name="de.codecentric" level="ERROR"/>
<!-- cache INFO -->
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="org.springframework.cache" level="ERROR"/>
<!-- cloud -->
<logger name="org.apache.http" level="ERROR"/>
<logger name="com.netflix.discovery" level="ERROR"/>
<logger name="com.netflix.eureka" level="ERROR"/>
<!-- 业务日志 -->
<Logger name="org.springblade" level="ERROR"/>
<Logger name="org.springblade.core.version" level="ERROR"/>
<!-- 减少nacos日志 -->
<logger name="com.alibaba.nacos" level="ERROR"/>
</configuration>

127
hzims-service/operational/src/main/resources/log/logback-test.xml

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds">
<!-- 自定义参数监听 -->
<contextListener class="org.springblade.core.log.listener.LoggerStartupListener"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="wex"
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="wEx"
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<property name="log.pattern"
value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%t] [%X{traceId}] %-5level %logger{50} - %msg%n"/>
<!-- 生成日志文件
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
&lt;!&ndash; 日志文件输出的文件名 &ndash;&gt;
<fileNamePattern>log/info/info-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
&lt;!&ndash;设置保存10天 一天24个文件,一小时生成一个&ndash;&gt;
<MaxHistory>240</MaxHistory>
&lt;!&ndash;给定日志文件大小,超过指定的大小就新建一个日志文件&ndash;&gt;
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> &lt;!&ndash; 总日志大小 &ndash;&gt;
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
&lt;!&ndash; 打印日志级别 &ndash;&gt;
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>-->
<!-- 生成日志文件 -->
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>log/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 日志文件输出的文件名 -->
<fileNamePattern>log/error/error-%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
<!--设置保存15天 一天24个文件,一小时生成一个-->
<MaxHistory>360</MaxHistory>
<!--给定日志文件大小,超过指定的大小就新建一个日志文件-->
<maxFileSize>20MB</maxFileSize>
<totalSizeCap>10GB</totalSizeCap> <!-- 总日志大小 -->
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${log.pattern}</pattern>
</encoder>
<!-- 打印日志级别 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 日志输出级别 -->
<root level="ERROR">
<appender-ref ref="STDOUT"/>
<!--<appender-ref ref="INFO"/>-->
<appender-ref ref="ERROR"/>
</root>
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="druid.sql" level="ERROR"/>
<!-- MyBatis log configure -->
<logger name="com.apache.ibatis" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="java.sql.Connection" level="ERROR"/>
<logger name="java.sql.Statement" level="ERROR"/>
<logger name="java.sql.PreparedStatement" level="ERROR"/>
<!-- 减少部分debug日志 -->
<logger name="druid.sql" level="ERROR"/>
<logger name="org.apache.shiro" level="ERROR"/>
<logger name="org.mybatis.spring" level="ERROR"/>
<logger name="org.springframework" level="ERROR"/>
<logger name="org.springframework.context" level="ERROR"/>
<logger name="org.springframework.beans" level="ERROR"/>
<logger name="com.baomidou.mybatisplus" level="ERROR"/>
<logger name="org.apache.ibatis.io" level="ERROR"/>
<logger name="org.apache.velocity" level="ERROR"/>
<logger name="org.eclipse.jetty" level="ERROR"/>
<logger name="io.undertow" level="ERROR"/>
<logger name="org.xnio.nio" level="ERROR"/>
<logger name="org.thymeleaf" level="ERROR"/>
<logger name="springfox.documentation" level="ERROR"/>
<logger name="org.hibernate.validator" level="ERROR"/>
<logger name="com.netflix.loadbalancer" level="ERROR"/>
<logger name="com.netflix.hystrix" level="ERROR"/>
<logger name="com.netflix.zuul" level="ERROR"/>
<logger name="de.codecentric" level="ERROR"/>
<!-- cache INFO -->
<logger name="net.sf.ehcache" level="ERROR"/>
<logger name="org.springframework.cache" level="ERROR"/>
<!-- cloud -->
<logger name="org.apache.http" level="ERROR"/>
<logger name="com.netflix.discovery" level="ERROR"/>
<logger name="com.netflix.eureka" level="ERROR"/>
<!-- 业务日志 -->
<Logger name="org.springblade" level="ERROR"/>
<Logger name="org.springblade.core.version" level="ERROR"/>
<!-- 减少nacos日志 -->
<logger name="com.alibaba.nacos" level="ERROR"/>
</configuration>

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

Binary file not shown.

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/library/service/impl/TicketMatterGroupServiceImpl.java

@ -626,7 +626,7 @@ public class TicketMatterGroupServiceImpl extends BaseServiceImpl<TicketMatterGr
}).collect(Collectors.toList());
workTicketInfoMap.put("measureMapList", collect);
Map<String, Object> resultMap = OperationWordHelper.resultMap(workTicketInfoMap);
String workTicketStatus = this.getWorkTicketStatus(status);
String workTicketStatus =getWorkTicketStatus(status);
String os = TicketConstant.OS_NAME;
//Windows操作系统
if (os != null && os.toLowerCase().startsWith("windows")) {

41
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/CensController.java

@ -0,0 +1,41 @@
package com.hnac.hzims.ticket.twoTicket.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.ticket.standardTicket.vo.CensParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo;
import com.hnac.hzims.ticket.twoTicket.service.CensService;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author ysj
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/bill")
public class CensController {
private final CensService censService;
@PostMapping("/cens")
@ApiOperation("两票统计")
@ApiOperationSupport(order = 1)
public R<List<CensVo>> cens(@RequestBody CensParamVo param) {
return R.data(censService.cens(param));
}
@PostMapping("/censYear")
@ApiOperation("两票统计")
@ApiOperationSupport(order = 1)
public R<List<CensYearVo>> censYear(@RequestBody CensYearParamVo param) {
return R.data(censService.censYear(param));
}
}

4
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java

@ -2,6 +2,7 @@ package com.hnac.hzims.ticket.twoTicket.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
@ -13,6 +14,7 @@ import com.hnac.hzims.ticket.twoTicket.vo.ticket.TicketCountVo;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketInfoVO;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
@ -105,6 +107,4 @@ public class TicketCountController {
standardTicketInfoService.listByOperationTicketWithKeyword(entityPage,ticketCountQueryVo);
return R.data(ticketInfoEntities);
}
}

18
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/CensService.java

@ -0,0 +1,18 @@
package com.hnac.hzims.ticket.twoTicket.service;
import com.hnac.hzims.ticket.standardTicket.vo.CensParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo;
import java.util.List;
/**
* @author ysj
*/
public interface CensService {
List<CensVo> cens(CensParamVo param);
List<CensYearVo> censYear(CensYearParamVo param);
}

180
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/CensServiceImpl.java

@ -0,0 +1,180 @@
package com.hnac.hzims.ticket.twoTicket.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
import com.hnac.hzims.ticket.standardTicket.vo.CensParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearParamVo;
import com.hnac.hzims.ticket.standardTicket.vo.CensYearVo;
import com.hnac.hzims.ticket.twoTicket.service.CensService;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ysj
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class CensServiceImpl implements CensService {
private final IStandardTicketInfoService operateTicketService;
private final IWorkTicketInfoService workTicketInfoService;
private final ISysClient sysClient;
@Override
public List<CensVo> cens(CensParamVo param) {
if(StringUtil.isEmpty(param.getStartTime())){
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH));
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
param.setStartTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME));
}
if(StringUtil.isEmpty(param.getEndTime())){
param.setStartTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
}
if(!StringUtil.isEmpty(param.getState()) && param.getState().equals(1)){
param.setFlowTaskName("结束");
}
// 获取权限区域机构
List<Dept> depts = this.authArea();
if(CollectionUtil.isEmpty(depts)){
return new ArrayList<>();
}
// 操作票查询
LambdaQueryWrapper operateWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery()
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime())
.in(StandardTicketInfoEntity::getCreateDept,depts);
if(!StringUtil.isEmpty(param.getFlowTaskName())){
operateWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName());
}
List<StandardTicketInfoEntity> operates = operateTicketService.list(operateWrapper);
// 工作票查询
LambdaQueryWrapper workWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery()
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime())
.in(StandardTicketInfoEntity::getCreateDept,depts);
if(!StringUtil.isEmpty(param.getFlowTaskName())){
workWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName());
}
List<WorkTicketInfoEntity> works = workTicketInfoService.list(workWrapper);
// 工作任务单
return depts.stream().map(dept->{
CensVo cens = new CensVo();
cens.setDeptId(dept.getId());
cens.setDeptName(dept.getDeptName());
if(CollectionUtil.isEmpty(operates)){
cens.setOperateCount(0L);
}else{
cens.setOperateCount(operates.stream().filter(operate->operate.getCreateDept().equals(dept.getId())).count());
}
if(CollectionUtil.isEmpty(works)){
cens.setWorkCount(0L);
}else{
cens.setOperateCount(works.stream().filter(work->work.getCreateDept().equals(dept.getId())).count());
}
cens.setWorkTaskCount((long)new Random().nextInt(10));
return cens;
}).collect(Collectors.toList());
}
/**
* 获取权限区域机构
* @return
*/
private List<Dept> authArea() {
R<List<Dept>> resut = sysClient.getDeptByCurrentUser();
if(!resut.isSuccess() || CollectionUtil.isEmpty(resut.getData())){
return new ArrayList<>();
}
return resut.getData().stream().filter(dept->dept.getDeptCategory().equals(HomePageConstant.AREA)).collect(Collectors.toList());
}
@Override
public List<CensYearVo> censYear(CensYearParamVo param) {
if(StringUtil.isEmpty(param.getYear())){
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH,-calendar.get(Calendar.MONTH));
calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH));
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
param.setStartTime(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME));
param.setEndTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
}else{
param.setStartTime(param.getYear() + "-01-01 00:00:00");
param.setEndTime(param.getYear() + "-12-31 23:59:59");
}
if(!StringUtil.isEmpty(param.getState()) && param.getState().equals(1)){
param.setFlowTaskName("结束");
}
// 获取权限区域机构
List<Dept> depts = this.authArea();
if(CollectionUtil.isEmpty(depts)){
return new ArrayList<>();
}
// 操作票查询
LambdaQueryWrapper operateWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery()
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime())
.in(StandardTicketInfoEntity::getCreateDept,depts);
if(!StringUtil.isEmpty(param.getFlowTaskName())){
operateWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName());
}
List<StandardTicketInfoEntity> operates = operateTicketService.list(operateWrapper);
// 工作票查询
LambdaQueryWrapper workWrapper = Wrappers.<StandardTicketInfoEntity>lambdaQuery()
.between(StandardTicketInfoEntity::getCreateTime,param.getStartTime(),param.getEndTime())
.in(StandardTicketInfoEntity::getCreateDept,depts);
if(!StringUtil.isEmpty(param.getFlowTaskName())){
workWrapper.eq("FLOW_TASK_NAME",param.getFlowTaskName());
}
List<WorkTicketInfoEntity> works = workTicketInfoService.list(workWrapper);
return depts.stream().map(dept -> {
CensYearVo censYear = new CensYearVo();
censYear.setDeptId(dept.getId());
censYear.setDeptName(dept.getDeptName());
for(int mon = 1 ; mon <= 12 ;mon++){
String strMon = param.getYear() + "-" + (mon > 9 ? mon : "0" + mon);
CensVo cens = new CensVo();
cens.setMon(mon);
if(CollectionUtil.isEmpty(operates)){
cens.setOperateCount(0L);
}else{
cens.setOperateCount(operates.stream().filter(operate->operate.getCreateDept().equals(dept.getId()) && DateUtil.format(operate.getCreateTime(),"yyyy-MM").equals(strMon)).count());
}
if(CollectionUtil.isEmpty(works)){
cens.setWorkCount(0L);
}else{
cens.setOperateCount(works.stream().filter(work->work.getCreateDept().equals(dept.getId()) && DateUtil.format(work.getCreateTime(),"yyyy-MM").equals(strMon)).count());
}
cens.setWorkTaskCount((long)new Random().nextInt(10));
}
return censYear;
}).collect(Collectors.toList());
}
}

13
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.middle.process.feign.ProcessDictFeignService;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
@ -59,7 +58,6 @@ import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -963,7 +961,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
for (WorkTicketSafetyMeasureEntity measureVO : workTicketSafetyMeasureEntities) {
String type = measureEnum.getType();
if (tempIndex != Integer.valueOf(type)) {
index = 1;
// index = 1;
tempIndex++;
}
log.info("获取安全措施的信息: {}", measureVO);
@ -984,7 +982,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
//验证工作措施是有有数据
this.isMatterLibraryList(workTicketInfoMap1);
// 工作地点保留带电部位或注意事项
this.matterLibraryListWithMap(workTicketInfoMap1);
matterLibraryListWithMap(workTicketInfoMap1);
result.putAll(workTicketInfoMap1);
}
@ -1025,12 +1023,13 @@ public class TicketProcessServiceImpl implements TicketProcessService {
List<TicketInfoDanger> ticketInfoDangers = workTicketVo.getTicketInfoDangers();
if (CollectionUtils.isNotEmpty(ticketInfoDangers)) {
Map<String, List<Map<String, Object>>> map = new HashMap<>();
int index = 1;
int[] index = {1};
List<Map<String, Object>> collect = ticketInfoDangers.stream().map(item -> {
Map<String, Object> newItem = new HashMap<>();
newItem.put("index", index);
newItem.put("index", index[0]);
newItem.put("maintenance", item.getMaintenance() == null ? "\u00A0" : item.getMaintenance());
newItem.put("dangerousPoint", item.getDangerousPoint() == null ? "\u00A0" : item.getDangerousPoint());
index[0]++;
return newItem;
}).collect(Collectors.toList());
@ -1041,7 +1040,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
WordMapUtils.newMapWithList("ticketInfoDangers", result, true, 4, "maintenance", "dangerousPoint");
//7. 是否包含
this.isExists(result);
isExists(result);
//8. 存入新的数据
this.addMapPut(result);

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/OfflineTicketServiceImpl.java

@ -59,7 +59,7 @@ public class OfflineTicketServiceImpl extends BaseServiceImpl<WorkTicketInfoMapp
private final IWorkTicketContentService contentService;
private final IUserClient userClient;
private final IWorkTicketFlowService workTicketFlowService;
private static Lock lock = new ReentrantLock();
private final Lock lock = new ReentrantLock();
/**
* 线下工作票开票

Loading…
Cancel
Save