Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 2 years ago
parent
commit
ccd9bf372f
  1. 7
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
  2. 29
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeParamVo.java
  3. 31
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeReustVo.java
  4. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/defect/entity/OperDefectEntity.java
  5. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/GenerateEntity.java
  6. 7
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/UseEntity.java
  7. 8
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java
  8. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AreaMonthReportVo.java
  9. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/GenerationPowerVo.java
  10. 50
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java
  11. 1
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicTargetVo.java
  12. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/StationConstants.java
  13. 2
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageSmsClient.java
  14. 2
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java
  15. 4
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordTypeVo.java
  16. 6
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordVo.java
  17. 1
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatTypeVo.java
  18. 3
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatVo.java
  19. 48
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/CheckCompanyFeignClient.java
  20. 35
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeEquipmentTrialFeignClient.java
  21. 48
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeproductFeignClient.java
  22. 41
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/CheckCompanyFeignClientFallback.java
  23. 30
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/SafeEquipmentTrialFeignClientFallback.java
  24. 40
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/SafeproductFeignClientFallback.java
  25. 33
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/CheckCompanyVo.java
  26. 34
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/CheckMonthVo.java
  27. 23
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/SafeEquipmentTrialVO.java
  28. 10
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/SafeEquipmentTrialDTO.java
  29. 13
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckCompanyEntity.java
  30. 25
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java
  31. 32
      hzims-service/message/pom.xml
  32. 7
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java
  33. 18
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
  34. 170
      hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
  35. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java
  36. 13
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java
  37. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.java
  38. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml
  39. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessStatisticsService.java
  40. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java
  41. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java
  42. 62
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  43. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java
  44. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java
  45. 151
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperDefectServiceImpl.java
  46. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyRecController.java
  47. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsAnalyseExampleService.java
  48. 89
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsAnalyseExampleServiceImpl.java
  49. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  50. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  51. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/GenerateMapper.java
  52. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/GenerateMapper.xml
  53. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java
  54. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/PowerService.java
  55. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/UseService.java
  56. 94
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java
  57. 59
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/PowerServiceImpl.java
  58. 84
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/UseServiceImpl.java
  59. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java
  60. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WebHomeController.java
  61. 175
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java
  62. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java
  63. 47
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java
  64. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java
  65. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IWaterService.java
  66. 120
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java
  67. 66
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  68. 369
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  69. 60
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  70. 72
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  71. 340
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  72. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/IOperMaintenanceTaskService.java
  73. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/ImsDeptServiceImpl.java
  74. 1
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/SafeproductApplication.java
  75. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CheckCompanyController.java
  76. 27
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CheckMonthController.java
  77. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafeEquipmentTrialController.java
  78. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.java
  79. 27
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.xml
  80. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICheckCompanyService.java
  81. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICheckMonthService.java
  82. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/SafeEquipmentTrialService.java
  83. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckCompanyServiceImpl.java
  84. 14
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckMonthServiceImpl.java
  85. 14
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafeEquipmentTrialServiceImpl.java

7
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java

@ -13,8 +13,13 @@ public interface AbnormalAlarmConstant {
/**通讯恢复*/
String ABNORMAL_STATUS = "1";
String TYPE_NAMES[] = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"};
String[] TYPE_NAMES = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"};
/**处理、延后、误报*/
List<Long> HANDLE_WAY = Arrays.asList(1L,2L,3L,4L);
/**
* 2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常
*/
List<Integer> SOE_TYPE_LIST = Arrays.asList(2,3,5,13,14);
}

29
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeParamVo.java

@ -0,0 +1,29 @@
package com.hnac.hzims.operational.alert.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/03/23 13:34:37
* @version 4.0.0
*/
@Data
public class SoeParamVo {
@ApiModelProperty(value = "站点编码")
private String code;
@ApiModelProperty(value = "查询开始时间:yyyy-MM-dd HH:mm:ss")
private String date;
@ApiModelProperty(value = "2-告警,3-故障,5-遥测越限,13-通讯异常,14-数据异常")
private Integer type;
@ApiModelProperty(value = "当前页码")
private Integer current;
@ApiModelProperty(value = "每页条目")
private Integer size;
}

31
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/SoeReustVo.java

@ -0,0 +1,31 @@
package com.hnac.hzims.operational.alert.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
* @date 2023/03/23 13:34:37
* @version 4.0.0
*/
@Data
public class SoeReustVo {
@ApiModelProperty(value = "最新的时间")
private String date;
@ApiModelProperty(value = "告警数据")
private List<AlarmDataVo> soeList;
@ApiModelProperty(value = "数量统计")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer count;
@ApiModelProperty(value = "总条数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long total;
}

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

@ -104,9 +104,11 @@ public class OperDefectEntity extends TenantEntity {
/**
* 区域Id
*/
@TableField(exist = false)
private String areaId;
/**
* 年月
*/
@TableField(exist = false)
private YearMonth yearMonth;
}

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/GenerateEntity.java

@ -26,7 +26,7 @@ public class GenerateEntity extends TenantEntity implements Serializable {
private String dataOrigin;
@ApiModelProperty("发电量")
private BigDecimal generate;
private Double generate;
@ApiModelProperty("填报月份")
private String fillDate;

7
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/UseEntity.java

@ -5,12 +5,17 @@ import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author usj
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("hzims_fill_use")
@ApiModel(value="UseEntity", description="保存用电量填报数据对象")
@ -26,7 +31,7 @@ public class UseEntity extends TenantEntity implements Serializable {
private String dataOrigin;
@ApiModelProperty("发电量")
private BigDecimal use;
private Double employ;
@ApiModelProperty("填报月份")
private String fillDate;

8
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java

@ -5,6 +5,11 @@ import lombok.Data;
import java.util.Date;
/**
* @author ysj
* @date 2023/04/10 11:16:07
* @version 4.0.0
*/
@Data
public class QueryVo{
@ -19,4 +24,7 @@ public class QueryVo{
@ApiModelProperty("设备编号")
private String deviceCode;
@ApiModelProperty("站点接入类型")
private String dataOrigin;
}

22
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AreaMonthReportVo.java

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -10,65 +12,85 @@ import lombok.Data;
public class AreaMonthReportVo {
@ApiModelProperty(value = "区域Id")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long areaId;
@ApiModelProperty(value = "区域名称")
private String areaName;
@ApiModelProperty(value = "计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float planPower;
@ApiModelProperty(value = "实际发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float actualPower;
@ApiModelProperty(value = "发电完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerFinishRate;
@ApiModelProperty(value = "同比")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double comparePowerRate;
@ApiModelProperty(value = "发电计划预测")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double predictPlanPower;
@ApiModelProperty(value = "操作票")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer operate;
@ApiModelProperty(value = "操作票合格率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double operaQualifyRate;
@ApiModelProperty(value = "工作票")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer work;
@ApiModelProperty(value = "工作票合格率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double workQualifyRate;
@ApiModelProperty(value = "日常维护")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer routineMaintenance;
@ApiModelProperty(value = "巡检任务")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer inspect;
@ApiModelProperty(value = "缺陷数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer defect;
@ApiModelProperty(value = "消缺率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double defectRate;
@ApiModelProperty(value = "检修任务数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer maintenanceTasks;
@ApiModelProperty(value = "安全生产会议次数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer safetyMeeting;
@ApiModelProperty(value = "月度自查报告")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer selfReport;
@ApiModelProperty(value = "设备试验")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer deviceTry;
@ApiModelProperty(value = "技能培训")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer skillTrainy;
@ApiModelProperty(value = "安全大检查")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer securityCheck;
}

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

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -12,8 +14,10 @@ public class GenerationPowerVo {
private String date;
@ApiModelProperty(value = "发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float generate;
@ApiModelProperty(value = "功率·")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float load;
}

50
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java

@ -198,101 +198,103 @@ public class PhotovoltaicDeviceVo {
private Double dc_voltage_twelve;
@ApiModelProperty(value = "流电流1")
@ApiModelProperty(value = "流电流1")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_one;
@ApiModelProperty(value = "流电流2")
@ApiModelProperty(value = "流电流2")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_two;
@ApiModelProperty(value = "流电流3")
@ApiModelProperty(value = "流电流3")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_three;
@ApiModelProperty(value = "流电流4")
@ApiModelProperty(value = "流电流4")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_four;
@ApiModelProperty(value = "流电流5")
@ApiModelProperty(value = "流电流5")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_five;
@ApiModelProperty(value = "流电流6")
@ApiModelProperty(value = "流电流6")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_six;
@ApiModelProperty(value = "流电流7")
@ApiModelProperty(value = "流电流7")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_seven;
@ApiModelProperty(value = "流电流8")
@ApiModelProperty(value = "流电流8")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_eight;
@ApiModelProperty(value = "流电流9")
@ApiModelProperty(value = "流电流9")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_nine;
@ApiModelProperty(value = "流电流10")
@ApiModelProperty(value = "流电流10")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_ten;
@ApiModelProperty(value = "流电流11")
@ApiModelProperty(value = "流电流11")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_eleven;
@ApiModelProperty(value = "流电流12")
@ApiModelProperty(value = "流电流12")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_twelve;
@ApiModelProperty(value = "直流电压1")
@ApiModelProperty(value = "串流电压1")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_one;
@ApiModelProperty(value = "流电压2")
@ApiModelProperty(value = "流电压2")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_two;
@ApiModelProperty(value = "流电压3")
@ApiModelProperty(value = "流电压3")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_three;
@ApiModelProperty(value = "流电压4")
@ApiModelProperty(value = "流电压4")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_four;
@ApiModelProperty(value = "流电压5")
@ApiModelProperty(value = "流电压5")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_five;
@ApiModelProperty(value = "流电压6")
@ApiModelProperty(value = "流电压6")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_six;
@ApiModelProperty(value = "流电压7")
@ApiModelProperty(value = "流电压7")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_seven;
@ApiModelProperty(value = "流电压8")
@ApiModelProperty(value = "流电压8")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_eight;
@ApiModelProperty(value = "流电压9")
@ApiModelProperty(value = "流电压9")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_nine;
@ApiModelProperty(value = "流电压10")
@ApiModelProperty(value = "流电压10")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_ten;
@ApiModelProperty(value = "流电压11")
@ApiModelProperty(value = "流电压11")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_eleven;
@ApiModelProperty(value = "流电压12")
@ApiModelProperty(value = "流电压12")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_twelve;
}

1
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicTargetVo.java

@ -25,6 +25,7 @@ public class PhotovoltaicTargetVo {
private String deviceName;
@ApiModelProperty(value = "当日运行时长")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double runHours;
@ApiModelProperty(value = "年发电量: kWh")

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/StationConstants.java

@ -20,6 +20,8 @@ public interface StationConstants {
//自动添加或修改机构数据
String TASK_VALUE_IMS_DEPT_CREATE = "imsDeptCreate";
String DATA_ORIGIN_FILL = "1";
enum DeptCategoryEnum {
STATION(4,"站点")
;

2
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageSmsClient.java

@ -4,6 +4,8 @@ package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.req.SmsReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

2
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IPushMsgClient.java

@ -7,6 +7,8 @@ import com.hnac.hzims.message.dto.SmsPushDto;
import com.hnac.hzims.message.dto.WsPushDto;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

4
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordTypeVo.java

@ -17,6 +17,10 @@ public class MessagePushRecordTypeVo {
* 消息类型
*/
private String type;
/**
* 消息类型名称
*/
private String typeName;
private List<MessagePushRecordVo> messagePushRecordList;
}

6
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/MessagePushRecordVo.java

@ -40,6 +40,12 @@ public class MessagePushRecordVo implements Serializable {
*/
private String type;
/**
* 消息类型名称
*/
private String typeName;
/**
* 统计数量
*/

1
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatTypeVo.java

@ -27,7 +27,6 @@ public class PushStatTypeVo {
*/
private String businessClassifyName;
/**
* 业务分类统计
*/

3
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatVo.java

@ -29,15 +29,12 @@ public class PushStatVo {
*/
private Integer status;
/**
* 状态名称
*/
private String statusName;
/**
* 统计数量
*/

48
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/CheckCompanyFeignClient.java

@ -0,0 +1,48 @@
package com.hnac.hzims.safeproduct.areamonthly.feign;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.CheckCompanyFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.SafeproductFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:35
*/
@FeignClient(value = Constants.APP_NAME, fallback = CheckCompanyFeignClientFallback.class)
public interface CheckCompanyFeignClient {
/**
* 查询安全检查
*
* @param req
* @param query
* @return
*/
@GetMapping("/CheckCompany/list")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:startDate,endDate,status")
R<BladePage<CheckCompanyVo>> list(CheckCompanyEntity req, Query query);
/**
* 详情
* @param id
* @return
*/
@GetMapping("/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情", notes = "传入id")
public R<CheckCompanyVo> detail(@RequestParam Long id);
}

35
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeEquipmentTrialFeignClient.java

@ -0,0 +1,35 @@
package com.hnac.hzims.safeproduct.areamonthly.feign;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.CheckCompanyFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.SafeEquipmentTrialFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:50
*/
@FeignClient(value = Constants.APP_NAME, fallback = SafeEquipmentTrialFeignClientFallback.class)
public interface SafeEquipmentTrialFeignClient {
/**
* 分页
*/
@GetMapping("/list")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:createDept,fileName,startTime,endTime")
public R<BladePage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) ;
}

48
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/SafeproductFeignClient.java

@ -0,0 +1,48 @@
package com.hnac.hzims.safeproduct.areamonthly.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.Constants;
import com.hnac.hzims.safeproduct.areamonthly.feign.fallback.SafeproductFeignClientFallback;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 18:06
*/
@FeignClient(value = Constants.APP_NAME, fallback = SafeproductFeignClientFallback.class)
public interface SafeproductFeignClient {
/**
* 分页查询安全生产会议次数
*/
@GetMapping("/checkMonth/listconferenceScope/{page}/{size}")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:month,status,createDept")
public R<BladePage<CheckMonthVo>> listconferenceScope(@PathVariable Long page, @PathVariable Long size, CheckMonthEntity req);
/**
* 详情
*/
@GetMapping("/checkMonth/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情", notes = "传入id")
public R<CheckMonthVo> detail(@RequestParam Long id);
}

41
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/CheckCompanyFeignClientFallback.java

@ -0,0 +1,41 @@
package com.hnac.hzims.safeproduct.areamonthly.feign.fallback;
import com.hnac.hzims.safeproduct.areamonthly.feign.CheckCompanyFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:35
*/
@Service
public class CheckCompanyFeignClientFallback implements CheckCompanyFeignClient {
/**
* 查询安全检查
*
* @param req
* @param query
* @return
*/
@Override
public R<BladePage<CheckCompanyVo>> list(CheckCompanyEntity req, Query query) {
return R.fail("远程调用失败");
}
/**
* 详情
*
* @param id
* @return
*/
@Override
public R<CheckCompanyVo> detail(Long id) {
return null;
}
}

30
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/SafeEquipmentTrialFeignClientFallback.java

@ -0,0 +1,30 @@
package com.hnac.hzims.safeproduct.areamonthly.feign.fallback;
import com.hnac.hzims.safeproduct.areamonthly.feign.SafeEquipmentTrialFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:50
*/
@Service
public class SafeEquipmentTrialFeignClientFallback implements SafeEquipmentTrialFeignClient {
/**
* 分页
*
* @param safeEquipmentTrialDTO
* @param query
*/
@Override
public R<BladePage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) {
return R.fail("远程调用失败");
}
}

40
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/feign/fallback/SafeproductFeignClientFallback.java

@ -0,0 +1,40 @@
package com.hnac.hzims.safeproduct.areamonthly.feign.fallback;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.areamonthly.feign.SafeproductFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 18:07
*/
@Service
public class SafeproductFeignClientFallback implements SafeproductFeignClient {
/**
* 分页查询安全生产会议次数
*
* @param page
* @param size
* @param req
*/
@Override
public R<BladePage<CheckMonthVo>> listconferenceScope(Long page, Long size, CheckMonthEntity req) {
return R.fail("远程调用失败");
}
/**
* 详情
*
* @param id
*/
@Override
public R<CheckMonthVo> detail(Long id) {
return R.fail("远程调用失败");
}
}

33
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/CheckCompanyVo.java

@ -0,0 +1,33 @@
package com.hnac.hzims.safeproduct.areamonthly.vo;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
import java.util.Map;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 19:22
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CheckCompanyVo extends CheckCompanyEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("状态文本值")
private String statusText;
@ApiModelProperty(value = "检查项实例")
List<Map<String, Object>> items;
//
// @ApiModelProperty(value = "检查项实例")
// List<Map<String, Object>> list;
}

34
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/CheckMonthVo.java

@ -0,0 +1,34 @@
package com.hnac.hzims.safeproduct.areamonthly.vo;
import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 18:09
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CheckMonthVo extends CheckMonthEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("创建人名称")
private String createUserName;
@ApiModelProperty("部门名称")
private String deptName;
@ApiModelProperty("状态文本值")
private String statusText;
@ApiModelProperty(value = "检查项实例")
List<CheckItemInstanceEntity> items;
}

23
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/areamonthly/vo/SafeEquipmentTrialVO.java

@ -0,0 +1,23 @@
package com.hnac.hzims.safeproduct.areamonthly.vo;
import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/12 20:04
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class SafeEquipmentTrialVO extends SafeEquipmentTrialEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("创建人名称")
private String createUserName;
}

10
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/dto/SafeEquipmentTrialDTO.java

@ -7,6 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.YearMonth;
import java.util.List;
@ -36,4 +37,13 @@ public class SafeEquipmentTrialDTO extends SafeEquipmentTrialEntity {
@ApiModelProperty("创建部门集合")
private List<Long> deptList;
@ApiModelProperty(value = "区域id")
private String areaId;
@ApiModelProperty(value = "年月")
private YearMonth yearMonth;
}

13
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckCompanyEntity.java

@ -1,5 +1,6 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
@ -11,6 +12,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.YearMonth;
/**
* Created by Sam Huang 2022/5/6 8:16
@ -47,4 +49,15 @@ public class CheckCompanyEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "检查机构")
private String orgId;
@TableField(exist = false)
@ApiModelProperty(value = "区域id")
private String areaId;
@TableField(exist = false)
@ApiModelProperty(value = "年月")
private YearMonth yearMonth;
}

25
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/CheckMonthEntity.java

@ -1,5 +1,6 @@
package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
import java.time.YearMonth;
/**
* Created by Sam Huang 2022/5/6 8:16
@ -32,4 +34,27 @@ public class CheckMonthEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "核查建议")
private String suggest;
/**
* 区域Id
*/
@TableField(exist = false)
@ApiModelProperty(value = "区域Id")
private String areaId;
/**
* 年月
*/
@TableField(exist = false)
private YearMonth yearMonth;
@TableField(exist = false)
private String itemName;
}

32
hzims-service/message/pom.xml

@ -19,7 +19,39 @@
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId>
<exclusions>
<exclusion>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-redis</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springblade</groupId>
<artifactId>blade-core-cloud</artifactId>

7
hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java

@ -36,4 +36,11 @@ public interface MessagePushRecordMapper extends UserDataScopeBaseMapper<Message
*/
List<PushStatTypeVo> pushStat(@Param("vo") MessagePushRecordEntityVo vo);
/**
* 查询出状态信息
* @return
*/
List<Integer> selectByStatus();
}

18
hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml

@ -14,8 +14,6 @@
</resultMap>
<!-- 根据type统计数量-->
<select id="smsPushStat" resultType="com.hnac.hzims.message.vo.msgpushrecord.MessagePushRecordVo">
select count(1) power,
@ -24,9 +22,10 @@
from hzims_message_push_record
<where>
IS_DELETED = 0
and PLAN_TIME BETWEEN DATE_SUB(NOW(), INTERVAL 12 MONTH) AND NOW()
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
DEPT_ID = #{vo.stationCode}
</if>
</where>
group by strMonth, TYPE
@ -41,7 +40,7 @@
IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
DEPT_ID = #{vo.stationCode}
</if>
<if test="vo.yearMonth != null">
and
@ -65,7 +64,7 @@
IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
DEPT_ID = #{vo.stationCode}
</if>
<if test="vo.yearMonth != null">
and
@ -80,7 +79,6 @@
</select>
<!-- 推送成功失败统计-->
<resultMap id="PushStatResultMap" type="com.hnac.hzims.message.vo.msgpushrecord.PushStatTypeVo">
<result column="businessClassify" property="businessClassify"/>
@ -99,7 +97,7 @@
IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''">
and
STATION_CODE = #{vo.stationCode}
DEPT_ID = #{vo.stationCode}
</if>
<if test="vo.yearMonth != null">
and
@ -112,4 +110,10 @@
</where>
group by businessClassify,status
</select>
<!-- 查询出状态信息-->
<select id="selectByStatus" resultType="java.lang.Integer">
select STATUS
from hzims_message_push_record
group by STATUS
</select>
</mapper>

170
hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.utils.CacheUtil;
@ -33,10 +34,13 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.validation.Valid;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Year;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -56,11 +60,12 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
return this.page(Condition.getPage(query), this.getQueryWrapper(request));
}
/** @Author hx
/**
* @return java.lang.Boolean 推送结果
* @Author hx
* @Description 根据ID发送短信
* @Date 2023/4/12 10:22
* @Param [id] 短信记录ID
* @return java.lang.Boolean 推送结果
**/
@Override
public Boolean send(Long id) {
@ -71,18 +76,16 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
throw new ServiceException("发送消息失败!");
});
// 更新推送状态以及推送时间
LambdaUpdateWrapper<MessagePushRecordEntity> luw = Wrappers.<MessagePushRecordEntity>lambdaUpdate()
.set(MessagePushRecordEntity::getPushTime, LocalDateTime.now())
.set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS)
.eq(MessagePushRecordEntity::getId, id);
LambdaUpdateWrapper<MessagePushRecordEntity> luw = Wrappers.<MessagePushRecordEntity>lambdaUpdate().set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()).set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS).eq(MessagePushRecordEntity::getId, id);
return this.update(luw);
}
/** @Author hx
/**
* @return java.lang.Boolean 推送解雇
* @Author hx
* @Description 保存并推送消息
* @Date 2023/4/12 10:23
* @Param [request] 消息记录
* @return java.lang.Boolean 推送解雇
**/
@Override
@Transactional(rollbackFor = Exception.class)
@ -96,17 +99,16 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
return this.send(request.getId());
}
throw new ServiceException("保存消息失败!");
}
else if(MessageConstants.PLAN.equals(request.getPushType())) {
} else if (MessageConstants.PLAN.equals(request.getPushType())) {
return this.save(request);
}
else {
} else {
throw new ServiceException("推送类型只能为即时推送或计划推送");
}
}
/**
* 获取 QueryWrapper
*
* @param request 查询条件
* @return QueryWrapper
*/
@ -121,6 +123,7 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
lambda.orderByDesc(MessagePushRecordEntity::getPushTime);
return lambda;
}
/**
* 短信推送统计
*/
@ -136,8 +139,7 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
});
//按类型分组
Map<String, List<MessagePushRecordVo>> collect =
messagePushRecordVos.stream().collect(Collectors.groupingBy(MessagePushRecordVo::getType));
Map<String, List<MessagePushRecordVo>> collect = messagePushRecordVos.stream().collect(Collectors.groupingBy(MessagePushRecordVo::getType));
List<MessagePushRecordTypeVo> messagePushRecordTypeVos = new ArrayList<>();
//封装数据
@ -147,6 +149,52 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
messagePushRecordTypeVo.setMessagePushRecordList(value);
messagePushRecordTypeVos.add(messagePushRecordTypeVo);
});
//封装typeName的数据
messagePushRecordTypeVos.forEach(item1 -> {
List<MessagePushRecordVo> messagePushRecordList = item1.getMessagePushRecordList();
//String messageType = DictCache.getValue("messageType", item1.getType());
//System.out.println("messageType = " + messageType);
String typeByName = getTypeByName(item1.getType());
item1.setTypeName(typeByName);
//获取以往12个月的数据
List<YearMonth> previousMonth = this.getPreviousMonth();
//创建新的数组 List<MessagePushRecordVo>
List<MessagePushRecordVo> lists = new ArrayList<>();
messagePushRecordList.forEach(item2 -> {
YearMonth strMonth = item2.getStrMonth();
// 字符串转localDate 获取月份
item2.setMonth(strMonth.getMonthValue());
item2.setYear(strMonth.getYear());
if (previousMonth.contains(strMonth)) {
previousMonth.remove(strMonth);
}
//封装typeValue
item2.setTypeName(typeByName);
lists.add(item2);
});
//如果还存在YearMonth,把MessagePushRecordVo添加到新的数组 List<MessagePushRecordVo>
if (CollectionUtils.isNotEmpty(previousMonth)) {
for (YearMonth yearMonth : previousMonth) {
MessagePushRecordVo messagePushRecordVo = new MessagePushRecordVo();
messagePushRecordVo.setYear(yearMonth.getYear());
messagePushRecordVo.setMonth(yearMonth.getMonthValue());
messagePushRecordVo.setType(item1.getType());
messagePushRecordVo.setPower(0L);
messagePushRecordVo.setStrMonth(yearMonth);
//封装typeValue
messagePushRecordVo.setTypeName(typeByName);
lists.add(messagePushRecordVo);
}
}
List<MessagePushRecordVo> newLists = lists.stream().sorted(Comparator.comparing(MessagePushRecordVo::getStrMonth).reversed()).collect(Collectors.toList());
// 封装到 setMessagePushRecordList
item1.setMessagePushRecordList(newLists);
});
return messagePushRecordTypeVos;
}
@ -195,21 +243,44 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
public List<PushStatTypeVo> pushStat(MessagePushRecordEntityVo vo) {
List<PushStatTypeVo> pushStatTypeVos = baseMapper.pushStat(vo);
pushStatTypeVos.forEach(item -> {
//查询出状态信息
List<Integer> statusList = baseMapper.selectByStatus();
//业务类型名称
String businessClassify = item.getBusinessClassify();
String businessTypeName = this.getBusinessClassifyByName(businessClassify);
item.setBusinessClassifyName(businessTypeName);
List<PushStatVo> pushStatList = item.getPushStatList();
pushStatList.forEach(pushStat -> {
Integer status = pushStat.getStatus();
//状态名称
String name = this.getStatusByName(status);
pushStat.setStatusName(name);
List<PushStatVo> newPushStatList = new ArrayList<>();
for (PushStatVo pushStat : pushStatList) {
//业务类型名称
String businessClassifyPushStat = pushStat.getBusinessClassify();
String businessTypeNamePushStat = this.getBusinessClassifyByName(businessClassifyPushStat);
pushStat.setBusinessClassifyName(businessTypeNamePushStat);
});
Integer status = pushStat.getStatus();
//如果list 包含这条数删除
if (statusList.contains(status)) {
statusList.remove(status);
}
//状态名称
String name = this.getStatusByName(status);
pushStat.setStatusName(name);
newPushStatList.add(pushStat);
}
//如何list不为空补0
if (CollectionUtils.isNotEmpty(statusList)) {
for (int i = 0; i < statusList.size(); i++) {
PushStatVo pushStat = new PushStatVo();
int status = statusList.get(i);
pushStat.setStatus(status);
pushStat.setPower(0L);
pushStat.setBusinessClassify(businessClassify);
pushStat.setBusinessClassifyName(businessTypeName);
pushStat.setStatusName(this.getStatusByName(status));
newPushStatList.add(pushStat);
}
}
item.setPushStatList(newPushStatList);
});
return pushStatTypeVos;
}
@ -249,8 +320,44 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
case 3:
value = PushStatEnum.CONFIRMED.getValue();
break;
case 4:
default:
value = DictCache.getValue("messageStatus", key);
if (value == null) {
log.error("状态异常,没有这状态");
value = String.valueOf(key);
}
break;
}
return value;
}
/**
* type ===> typeName
*
* @param key 状态
*/
private String getTypeByName(String key) {
String value = null;
switch (key) {
case "appPush":
value = "app推送";
break;
case "smsPush":
value = "短信推送";
break;
case "websocketPush":
value = "web推送";
break;
case "mailPush":
value = "邮件推送";
break;
default:
value = DictCache.getValue("messageType", key);
if (value == null) {
log.error("状态异常,没有这状态");
value = key;
}
break;
}
return value;
@ -278,8 +385,14 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
case "inspect":
value = "巡检消息";
break;
case "":
case "warning":
value = "告警消息";
default:
value = DictCache.getValue("businessClassify", key);
if (value == null) {
log.error("状态业务分类,没有这状态");
value = key;
}
break;
}
return value;
@ -299,4 +412,17 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
}
/**
* 往前推12个月,获取以往12个月的数据
*/
private List<YearMonth> getPreviousMonth() {
List<YearMonth> month = new ArrayList<>();
YearMonth today = YearMonth.now();
for (int i = 0; i <= 11; i++) {
YearMonth localDate = today.minusMonths(i);
month.add(localDate);
}
return month;
}
}

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

@ -40,6 +40,15 @@ import javax.annotation.Resource;
@Resource
public class OperationApplication extends SpringBootServletInitializer {
static{
System.setProperty("--spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:10042");
System.setProperty("--spring.cloud.nacos.config.server-addr", "http://175.6.40.67:10042");
System.setProperty("--spring.cloud.nacos.username", "nacos");
System.setProperty("--spring.cloud.nacos.password", "nacos");
}
public static void main(String[] args) {
BladeApplication.run(OperationalConstants.APP_NAME, OperationApplication.class, args);
}

13
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java

@ -5,6 +5,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity;
import java.time.YearMonth;
import java.util.List;
/**
@ -25,4 +26,16 @@ public class OperAccessStatisticsDTO extends OperAccessStatisticsEntity {
@ApiModelProperty(value = "创建机构集合")
private List<Long> deptIds;
/**
* 年月
*/
private YearMonth yearMonth;
/**
* 区域Id
*/
private String areaId;
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.java

@ -3,13 +3,13 @@ package com.hnac.hzims.operational.access.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.annotation.UserDataAuth;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/**
*
* Mapper 接口
*
* @author xiashandong
@ -18,7 +18,6 @@ import java.util.List;
public interface OperAccessStatisticsMapper extends UserDataScopeBaseMapper<OperAccessStatisticsEntity> {
/**
* 自定义分页
*
@ -27,5 +26,5 @@ public interface OperAccessStatisticsMapper extends UserDataScopeBaseMapper<Oper
* @return
*/
@UserDataAuth
List<OperAccessStatisticsEntity> selectPageList(IPage page, OperAccessStatisticsDTO dto);
List<OperAccessStatisticsEntity> selectPageList(IPage page, @Param("dto") OperAccessStatisticsDTO dto);
}

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessStatisticsMapper.xml

@ -37,6 +37,12 @@
<if test="dto.planEndTime != null">
and OS.PLAN_END_TIME &lt;= #{dto.planEndTime}
</if>
<if test="dto.areaId != null and dto.areaId != ''">
and OS.CREATE_DEPT = #{dto.areaId}
</if>
<if test="dto.yearMonth != null">
and date_format(os.CREATE_TIME,'%Y-%m') = #{dto.yearMonth}
</if>
ORDER BY OS.CREATE_TIME DESC
</select>

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/IOperAccessStatisticsService.java

@ -5,7 +5,6 @@ import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse;

16
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java

@ -7,6 +7,8 @@ import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo;
import com.hnac.hzims.operational.alert.vo.SoeParamVo;
import com.hnac.hzims.operational.alert.vo.SoeReustVo;
import com.hnac.hzims.operational.config.vo.*;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import io.swagger.annotations.Api;
@ -112,7 +114,7 @@ public class AbnormalAlarmController extends BladeController {
*
*/
@ApiLog
@ApiOperation(value = "智能优化接口")
@ApiOperation(value = "原始告警接口")
@ApiOperationSupport(order = 7)
@RequestMapping(value = "/alarms", method = {RequestMethod.GET, RequestMethod.POST})
public R<AlarmReustVo> alarms(AlarmParamVo param){
@ -120,6 +122,18 @@ public class AbnormalAlarmController extends BladeController {
}
/**
*
*/
@ApiLog
@ApiOperation(value = "等级告警接口")
@ApiOperationSupport(order = 7)
@RequestMapping(value = "/terrace_alarms", method = {RequestMethod.GET, RequestMethod.POST})
public R<SoeReustVo> terrace_alarms(SoeParamVo param){
return R.data(service.terrace_alarms(param));
}
/**
* 智能告警数量: 时间范围当天
*/
@ApiLog

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

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo;
import com.hnac.hzims.operational.alert.vo.SoeParamVo;
import com.hnac.hzims.operational.alert.vo.SoeReustVo;
import com.hnac.hzims.operational.config.vo.*;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import org.springblade.core.mp.base.BaseService;
@ -33,4 +35,6 @@ public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormal
IPage<AlarmVo> alarmData(AlarmDataPageVo page,Query query);
List<String> queryStationName();
SoeReustVo terrace_alarms(SoeParamVo param);
}

62
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java

@ -4,17 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.core.type.TypeReference;
import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant;
import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.mapper.HistoryAbnormalAlarmMapper;
import com.hnac.hzims.operational.alert.service.AlarmHandleService;
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.operational.alert.vo.AlarmDataVo;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo;
import com.hnac.hzims.operational.config.vo.*;
import com.hnac.hzims.operational.alert.vo.*;
import com.hnac.hzims.operational.config.vo.AlarmDataPageVo;
import com.hnac.hzims.operational.config.vo.AlarmVo;
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
@ -24,7 +23,9 @@ import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.core.utils.JsonUtil;
import com.hnac.hzinfo.sdk.v5.soe.SoeClient;
import com.hnac.hzinfo.sdk.v5.soe.dto.SoeDTO;
import com.hnac.hzinfo.sdk.v5.soe.vo.SoeVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
@ -60,6 +61,9 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
private final ISoeClient alarmClient;
private final SoeClient soeClient;
@Value("${hzims.operation.alarm.types}")
private String types;
@ -282,6 +286,49 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
/**
* 等级告警查询接口
* @param param
* @return
*/
@Override
public SoeReustVo terrace_alarms(SoeParamVo param) {
// 查询站点
LambdaQueryWrapper<StationEntity> wrapper = Wrappers.lambdaQuery();
if(StringUtils.isNotEmpty(param.getCode())){
wrapper.eq(StationEntity::getCode,param.getCode());
}
List<StationEntity> stations = stationService.list(wrapper);
if(CollectionUtil.isEmpty(stations)){
return new SoeReustVo();
}
// 参数设置
SoeDTO soe_params = new SoeDTO();
//soe_params.setProjectId();
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME) + " 00:00:00";
soe_params.setBeginTime(DateUtil.parse(start,DateUtil.PATTERN_DATETIME));
soe_params.setEndTime(DateUtil.parse(end,DateUtil.PATTERN_DATETIME));
soe_params.setNeedPage(true);
soe_params.setPage(param.getCurrent());
soe_params.setPageSize(param.getSize());
if(ObjectUtil.isEmpty(param.getType())){
soe_params.setTypes(AbnormalAlarmConstant.SOE_TYPE_LIST);
}else{
soe_params.setTypes(Collections.singletonList(param.getType()));
}
// 查询等级告警数据
Result<HzPage<SoeVO>> soes = soeClient.pageQuery(soe_params);
if(!soes.isSuccess() || ObjectUtil.isEmpty(soes.getData())){
return new SoeReustVo();
}
List<Long> handles = this.getAlarmHandleIds();
return null;
}
/**
* 获取处理数据ID集合
* @return
*/
@ -372,7 +419,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
alarm.setRealId(record.getRealId());
alarm.setTs(record.getTs());
alarm.setSoeStatus(record.getSoeStatus());
alarm.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.valueOf(record.getSoeType())]);
alarm.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(record.getSoeType())]);
alarm.setOptionvals(record.getOptionvals());
alarm.setSoeStatus(record.getSoeStatus());
alarm.setStation(record.getStation());
@ -402,6 +449,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
}
private Boolean entityIsNull(Object object) {
if (null == object) {
return true;

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/controller/OperDefectController.java

@ -85,11 +85,6 @@ public class OperDefectController extends BladeController {
if (defect.getEndTime() != null) {
queryWrapper.le(OperDefectEntity::getCreateTime, defect.getEndTime());
}
queryWrapper.eq(StringUtils.isNotBlank(defect.getAreaId()), BaseEntity::getCreateDept, defect.getCreateDept());
queryWrapper.apply(defect.getYearMonth() != null,"date_format(CREATE_TIME,'%Y-%m')", defect.getYearMonth());
queryWrapper.orderByDesc(OperDefectEntity::getActStartTime);
IPage<OperDefectEntity> pages = defectService.page(Condition.getPage(query), queryWrapper);
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages);

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

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.defect.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.OperDefectVO;
@ -88,4 +90,12 @@ public interface IOperDefectService extends BaseService<OperDefectEntity> {
boolean updateDefectInfo(OperDefectEntity entity);
boolean updateDefectHanderState(OperDefectEntity entity);
/**
* 分页查询
* @param operDefectEntityPage
* @param defect
* @return
*/
IPage<OperDefectEntity> selectPage(Page<OperDefectEntity> operDefectEntityPage, OperDefectEntity defect);
}

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

@ -2,7 +2,10 @@ package com.hnac.hzims.operational.defect.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.entity.OperAccessPlanEntity;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
@ -36,6 +39,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.secure.utils.AuthUtil;
@ -90,6 +94,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 开始问题处理流程
* 问题处理流程的第一个处理节点人key 必须是 problemUser
*
* @param
*/
@Override
@ -103,10 +108,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
defectEntity.setTenantId(phenomenonEntity.getTenantId());
save(defectEntity);
Kv variables = Kv.create()
.set(ProcessConstant.TASK_VARIABLE_CREATE_USER, "taskUser_" + phenomenonEntity.getCreateUser())
.set(DefectConstant.PROCESS_VARIABLE_HANDLE_USER, "taskUser_" + phenomenonEntity.getHandler())
;
Kv variables = Kv.create().set(ProcessConstant.TASK_VARIABLE_CREATE_USER, "taskUser_" + phenomenonEntity.getCreateUser()).set(DefectConstant.PROCESS_VARIABLE_HANDLE_USER, "taskUser_" + phenomenonEntity.getHandler());
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(defectEntity.getProcDefId(), FlowUtil.getBusinessKey("hzims_oper_defect", String.valueOf(defectEntity.getId())), processName, variables);
if (result.isSuccess()) {
BladeFlow flow = result.getData();
@ -124,6 +126,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 处理问题
*
* @param flow
* @return
*/
@ -175,6 +178,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 获取缺陷的统计月报
*
* @param month 格式"2021-01"
*/
@Override
@ -249,6 +253,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
public List<OperDefectEntity> getDefectList(String emCode, List<String> list) {
return this.baseMapper.selectDefectList(emCode, list);
}
@Override
public List<OperDefectEntity> getDefectByEmCodeList(String emCode) {
return this.baseMapper.selectDefectByEmCodeList(emCode);
@ -262,8 +267,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
defectReportsVOList = operDefectVOS.stream().map(operDefectVO -> {
User finder = UserCache.getUser(operDefectVO.getFinder());
String finderAndTime = (ObjectUtil.isNotEmpty(finder) && StringUtil.isNotBlank(finder.getName()) ? finder.getName() : operDefectVO.getFinder().toString())
+ ":" + DateFormatUtils.format(operDefectVO.getFindTime(), DateUtil.PATTERN_DATETIME);
String finderAndTime = (ObjectUtil.isNotEmpty(finder) && StringUtil.isNotBlank(finder.getName()) ? finder.getName() : operDefectVO.getFinder().toString()) + ":" + DateFormatUtils.format(operDefectVO.getFindTime(), DateUtil.PATTERN_DATETIME);
String handlerAndTime = "";
if (Func.isNotEmpty(operDefectVO.getHandler())) {
User handler = UserCache.getUser(operDefectVO.getHandler());
@ -272,8 +276,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
handlerAndTime = String.format("%s:%s", handlerName, handleTime);
}
String seriousSituation = DictCache.getValue(DefectConstant.LEVEL_CODE_DICT_KEY, operDefectVO.getDefectLevel());
return DefectReportsVO.builder().faultName(operDefectVO.getFaultName()).seriousSituation(seriousSituation)
.finderAndTime(finderAndTime).handlerAndTime(handlerAndTime).handleSituation(operDefectVO.getConclusion()).build();
return DefectReportsVO.builder().faultName(operDefectVO.getFaultName()).seriousSituation(seriousSituation).finderAndTime(finderAndTime).handlerAndTime(handlerAndTime).handleSituation(operDefectVO.getConclusion()).build();
}).collect(Collectors.toList());
return defectReportsVOList;
@ -300,15 +303,12 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
operDefectVO = OperDefectWrapper.build().entityVO(detail);
//获取检修计划
IOperAccessPlanService planService = SpringUtil.getBean(OperAccessPlanServiceImpl.class);
OperAccessPlanEntity accessPlanEntity = planService.getOne(Wrappers.<OperAccessPlanEntity>lambdaQuery()
.eq(OperAccessPlanEntity::getDefectId,detail.getId())
);
OperAccessPlanEntity accessPlanEntity = planService.getOne(Wrappers.<OperAccessPlanEntity>lambdaQuery().eq(OperAccessPlanEntity::getDefectId, detail.getId()));
if (ObjectUtil.isNotEmpty(accessPlanEntity)) {
operDefectVO.setAccessPlanId(accessPlanEntity.getId());
if (ObjectUtil.isNotEmpty(accessPlanEntity.getStatus()) && accessPlanEntity.getStatus() > AccessConstants.PLAN_DRAFT) {
operDefectVO.setEditStatus(0);
}
else {
} else {
operDefectVO.setEditStatus(1);
}
}
@ -318,6 +318,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 获取安全检查消缺项统计
*
* @param startDate 开始时间
* @param endDate 结束时间
* @param dept 机构ID
@ -328,18 +329,13 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
public SafeCheckStatisticVO getDefectCheck(String startDate, String endDate, Long dept, String defectType) {
SafeCheckStatisticVO vo = new SafeCheckStatisticVO();
//获取消缺总数
LambdaQueryWrapper<OperPhenomenonEntity> wrapper = Wrappers.<OperPhenomenonEntity>lambdaQuery()
.eq(OperPhenomenonEntity::getCreateDept,dept)
.ge(OperPhenomenonEntity::getPlanStartTime,startDate)
.le(OperPhenomenonEntity::getPlanStartTime,endDate)
.eq(OperPhenomenonEntity::getIsDefect,1);
LambdaQueryWrapper<OperPhenomenonEntity> wrapper = Wrappers.<OperPhenomenonEntity>lambdaQuery().eq(OperPhenomenonEntity::getCreateDept, dept).ge(OperPhenomenonEntity::getPlanStartTime, startDate).le(OperPhenomenonEntity::getPlanStartTime, endDate).eq(OperPhenomenonEntity::getIsDefect, 1);
//缺陷等级为Ⅰ级缺陷时为重大缺陷 其他为一般缺陷
if ("1".equals(defectType)) {
vo.setProjectType(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.SERIOUS_DEFECT.getName());
wrapper.eq(OperPhenomenonEntity::getDefectLevel, DefectConstant.DefectLevelEnum.ONE.getStatus());
}
else if("2".equals(defectType)){
} else if ("2".equals(defectType)) {
vo.setProjectType(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.NORMAL_DEFECT.getName());
wrapper.ne(OperPhenomenonEntity::getDefectLevel, DefectConstant.DefectLevelEnum.ONE.getStatus());
@ -347,9 +343,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
List<OperPhenomenonEntity> operPhenomenonEntities = operPhenomenonMapper.selectList(wrapper);
if (CollectionUtil.isNotEmpty(operPhenomenonEntities)) {
//获取消缺率
List<OperPhenomenonEntity> finishDefects = operPhenomenonEntities.stream().filter(
p-> ObjectUtil.isNotEmpty(p.getConclusionStatus()) && "1".equals(p.getConclusionStatus())
).collect(Collectors.toList());
List<OperPhenomenonEntity> finishDefects = operPhenomenonEntities.stream().filter(p -> ObjectUtil.isNotEmpty(p.getConclusionStatus()) && "1".equals(p.getConclusionStatus())).collect(Collectors.toList());
vo.setTotal(operPhenomenonEntities.size());
vo.setQualified(finishDefects.size());
vo.setQualifiedRate(new BigDecimal(finishDefects.size() / (double) operPhenomenonEntities.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
@ -359,6 +353,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 根据流程ID判断该缺陷是否能执行
*
* @param processInstanceId 流程ID
* @return
*/
@ -397,6 +392,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 创建标题单元格样式
*
* @param wb
* @return
*/
@ -425,6 +421,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 创建表格内容单元格样式
*
* @param wb
* @return
*/
@ -449,6 +446,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 设置缺陷月报表excel导出-本月与前几月缺陷报表内单元格
*
* @param sheet
* @param currentRow
*/
@ -509,14 +507,11 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
HSSFCell compare_content_cell1 = row.getCell(0);
if ("1".equals(currentRatioDTO.getDefectLevel())) {
compare_content_cell1.setCellValue("一类缺陷");
}
else if("2".equals(currentRatioDTO.getDefectLevel())){
} else if ("2".equals(currentRatioDTO.getDefectLevel())) {
compare_content_cell1.setCellValue("二类缺陷");
}
else if("3".equals(currentRatioDTO.getDefectLevel())){
} else if ("3".equals(currentRatioDTO.getDefectLevel())) {
compare_content_cell1.setCellValue("三类缺陷");
}
else if("合计".equals(currentRatioDTO.getDefectLevel())){
} else if ("合计".equals(currentRatioDTO.getDefectLevel())) {
compare_content_cell1.setCellValue(currentRatioDTO.getDefectLevel());
}
HSSFCell compare_content_cell2 = row.getCell(1);
@ -543,6 +538,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 设置缺陷月报表excel导出-管理指标本月表内单元格
*
* @param wb
* @param sheet
* @param currentRow 记录表格中叠加后的数据
@ -617,6 +613,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 设置缺陷月报表excel导出-重复分类缺陷汇总表内单元格
*
* @param wb
* @param sheet
* @param currentRow 记录表格中叠加后的数据
@ -665,14 +662,11 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
sheet.addMergedRegion(repeat_content_religon);
if ("1".equals(repeat.get(i).getDefectLevel())) {
repeat_cell1.setCellValue("一类缺陷");
}
else if("2".equals(repeat.get(i).getDefectLevel())){
} else if ("2".equals(repeat.get(i).getDefectLevel())) {
repeat_cell1.setCellValue("二类缺陷");
}
else if("3".equals(repeat.get(i).getDefectLevel())){
} else if ("3".equals(repeat.get(i).getDefectLevel())) {
repeat_cell1.setCellValue("三类缺陷");
}
else if("合计".equals(repeat.get(i).getDefectLevel())){
} else if ("合计".equals(repeat.get(i).getDefectLevel())) {
repeat_cell1.setCellValue(repeat.get(i).getDefectLevel());
}
//第二列
@ -699,6 +693,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 补全合并单元格时 表格行所有单元格
*
* @param headRow
* @param rowLen
* @param status 0:设置表头样式 1设置内容样式
@ -708,8 +703,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
HSSFCell hssfcell = headRow.createCell(i);
if (status == 0) {
hssfcell.setCellStyle(this.setHeadCellStyle(wb));
}
else if(status == 1){
} else if (status == 1) {
hssfcell.setCellStyle(this.setContentCellStyle(wb));
}
}
@ -717,6 +711,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 处理double数据保留两位小数
*
* @param num
* @return
*/
@ -730,6 +725,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 获取当前月统计数据
*
* @param month
* @return
*/
@ -740,6 +736,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 当年1月 - 当前月获取缺陷等级统计数据
*
* @param month "2021-01"
* @return
*/
@ -765,6 +762,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 获取按月管理指标统计数据
*
* @param month
* @return
*/
@ -785,6 +783,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 获取重复缺陷等级统计数据
*
* @param month
* @return
*/
@ -795,16 +794,9 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
//总缺陷数
int total = repetStatistics.stream().mapToInt(OperDefectStatisticsCodeDTO::getDefectNum).sum();
//总重复缺陷数
int totalRepeat = repetStatistics
.stream()
.filter(s-> s.getDefectNum() > 1 && s.getDefectLevel() != null )
.collect(Collectors.summingInt(OperDefectStatisticsCodeDTO::getDefectNum));
int totalRepeat = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.summingInt(OperDefectStatisticsCodeDTO::getDefectNum));
//等级重复统计
Map<String, IntSummaryStatistics> repeatList = repetStatistics
.stream()
.filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null )
.collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel,
Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum)));
Map<String, IntSummaryStatistics> repeatList = repetStatistics.stream().filter(s -> s.getDefectNum() > 1 && s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsCodeDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsCodeDTO::getDefectNum)));
OperDefectRepeatRatioDTO one = new OperDefectRepeatRatioDTO();
one.setDefectLevel(DefectConstant.DefectLevelEnum.ONE.getStatus());
@ -830,12 +822,7 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
three.setRepeatRatio(three.getHappenNum() / Double.valueOf(totalRepeat));
}
OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder()
.defectLevel("合计")
.happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum())
.happenRatio(one.getHappenRatio() + two.getHappenRatio() + three.getHappenRatio())
.repeatRatio(1.00)
.build();
OperDefectRepeatRatioDTO addUp = OperDefectRepeatRatioDTO.builder().defectLevel("合计").happenNum(one.getHappenNum() + two.getHappenNum() + three.getHappenNum()).happenRatio(one.getHappenRatio() + two.getHappenRatio() + three.getHappenRatio()).repeatRatio(1.00).build();
if (addUp.getHappenNum().equals(0L)) {
addUp.setRepeatRatio(0.0);
}
@ -856,13 +843,11 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
three.setDefectLevel(DefectConstant.DefectLevelEnum.THREE.getStatus());
//等级统计
Map<String, IntSummaryStatistics> collectLevel = dtos.stream().filter(s-> s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getDefectLevel,
Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum)));
Map<String, IntSummaryStatistics> collectLevel = dtos.stream().filter(s -> s.getDefectLevel() != null).collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getDefectLevel, Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum)));
//总缺陷数
int total = dtos.stream().mapToInt(OperDefectStatisticsStatusDTO::getDefectNum).sum();
//状态统计
Map<String, IntSummaryStatistics> collectStatus = dtos.stream().collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getHandleStatus,
Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum)));
Map<String, IntSummaryStatistics> collectStatus = dtos.stream().collect(Collectors.groupingBy(OperDefectStatisticsStatusDTO::getHandleStatus, Collectors.summarizingInt(OperDefectStatisticsStatusDTO::getDefectNum)));
for (OperDefectStatisticsStatusDTO dto : dtos) {
if (dto.getDefectLevel() != null) {
@ -882,20 +867,13 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
}
}
int solveNum = collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()) == null ? 0 : (int) collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum();
OperDefectRatioDTO addUp = OperDefectRatioDTO.builder()
.happenNum(total)
.happenRatio(total == 0 ? 0 : 1.00)
.defectLevel("合计")
.sovleRatio(solveNum == 0 ? 0 : 1.00)
.sovleNum(solveNum)
.build();
OperDefectRatioDTO addUp = OperDefectRatioDTO.builder().happenNum(total).happenRatio(total == 0 ? 0 : 1.00).defectLevel("合计").sovleRatio(solveNum == 0 ? 0 : 1.00).sovleNum(solveNum).build();
re.addAll(Arrays.asList(one, two, three, addUp));
return re;
}
private void setReturnRatio(int total, OperDefectRatioDTO ratio, OperDefectStatisticsStatusDTO dto,
Map<String, IntSummaryStatistics> collectLevel, Map<String, IntSummaryStatistics> collectStatus){
private void setReturnRatio(int total, OperDefectRatioDTO ratio, OperDefectStatisticsStatusDTO dto, Map<String, IntSummaryStatistics> collectLevel, Map<String, IntSummaryStatistics> collectStatus) {
if (dto.getHandleStatus().equals(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus())) {
ratio.setSovleNum(dto.getDefectNum());
ratio.setSovleRatio(Double.valueOf(dto.getDefectNum()) / collectStatus.get(DefectConstant.HandlerStatusEnum.FINISH_STATUS.getStatus()).getSum());
@ -909,24 +887,49 @@ public class OperDefectServiceImpl extends BaseServiceImpl<OperDefectMapper, Ope
/**
* 更新缺陷信息
*
* @param entity
* @return
*/
@Override
public boolean updateDefectInfo(OperDefectEntity entity) {
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate()
.set(OperDefectEntity::getActHours, entity.getActHours())
.set(OperDefectEntity::getActStartTime,entity.getActStartTime())
.set(OperDefectEntity::getActEndTime,entity.getActEndTime())
.set(OperDefectEntity::getDisposeDesc,entity.getDisposeDesc())
.eq(OperDefectEntity::getDefectCode,entity.getDefectCode()));
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate().set(OperDefectEntity::getActHours, entity.getActHours()).set(OperDefectEntity::getActStartTime, entity.getActStartTime()).set(OperDefectEntity::getActEndTime, entity.getActEndTime()).set(OperDefectEntity::getDisposeDesc, entity.getDisposeDesc()).eq(OperDefectEntity::getDefectCode, entity.getDefectCode()));
}
@Override
public boolean updateDefectHanderState(OperDefectEntity entity) {
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate()
.set(OperDefectEntity::getHandleStatus, entity.getHandleStatus())
.eq(OperDefectEntity::getDefectCode,entity.getDefectCode()));
return this.update(Wrappers.<OperDefectEntity>lambdaUpdate().set(OperDefectEntity::getHandleStatus, entity.getHandleStatus()).eq(OperDefectEntity::getDefectCode, entity.getDefectCode()));
}
/**
* 分页查询
*
* @param operDefectEntityPage
* @param defect
* @return
*/
@Override
public IPage<OperDefectEntity> selectPage(Page<OperDefectEntity> operDefectEntityPage, OperDefectEntity defect) {
LambdaQueryWrapper<OperDefectEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.like(StringUtils.isNotBlank(defect.getDefectCode()), OperDefectEntity::getDefectCode, defect.getDefectCode());
//缺陷编号
queryWrapper.ge(defect.getActStartTime() != null, OperDefectEntity::getActStartTime, defect.getActStartTime());
queryWrapper.le(defect.getActEndTime() != null, OperDefectEntity::getActEndTime, defect.getActEndTime());
queryWrapper.ge(defect.getStartTime() != null, OperDefectEntity::getCreateTime, defect.getStartTime());
queryWrapper.le(defect.getEndTime() != null, OperDefectEntity::getCreateTime, defect.getEndTime());
//区域Id
queryWrapper.eq(BaseEntity::getCreateDept, defect.getCreateDept());
//年月查询
queryWrapper.apply(defect.getYearMonth() != null, "date_format(CREATE_TIME,'%Y-%m') = '" +
defect.getYearMonth() + "'");
queryWrapper.orderByDesc(OperDefectEntity::getActStartTime);
return baseMapper.selectPage(operDefectEntityPage, queryWrapper);
}

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

@ -31,6 +31,7 @@ import org.springblade.flow.core.entity.BladeFlow;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@ -268,6 +269,16 @@ public class ImsDutyRecController extends BladeController {
public R queryAnalyseExampleData( AnalyzeDataCondition analyzeDataCondition) {
return iImsAnalyseExampleService.queryAnalyseExampleData(analyzeDataCondition);
}
/**
* 导出分析实例数据
*/
@PostMapping("/outPutAnalyseExampleData")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "导出分析实例数据", notes = "传入analyseExample")
public void outPutAnalyseExampleData(HttpServletResponse response, @Valid @RequestBody AnalyzeDataCondition analyzeDataCondition) {
iImsAnalyseExampleService.outPutAnalyseExampleData(response, analyzeDataCondition);
}
/**
* 查询分析实例模板

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsAnalyseExampleService.java

@ -6,6 +6,8 @@ import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
import org.springblade.core.mp.support.Query;
import javax.servlet.http.HttpServletResponse;
/**
* 服务类
*
@ -14,8 +16,6 @@ import org.springblade.core.mp.support.Query;
public interface IImsAnalyseExampleService extends BaseService<AnalyseExample> {
R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition);
R queryAnalyseExample(AnalyseExample analyseExample,Query query);
@ -23,4 +23,6 @@ public interface IImsAnalyseExampleService extends BaseService<AnalyseExample> {
R getAnalyseId(String projectId);
R updateAnalyseExample(AnalyseExample analyseExample);
void outPutAnalyseExampleData(HttpServletResponse response, AnalyzeDataCondition analyzeDataCondition);
}

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

@ -1,16 +1,22 @@
package com.hnac.hzims.operational.duty.service.impl;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.duty.entity.AnalyseExample;
import com.hnac.hzims.operational.duty.mapper.ImsAnalyseExampleMapper;
import com.hnac.hzims.operational.duty.mapper.ImsDutyMainMapper;
import com.hnac.hzims.operational.duty.service.IImsAnalyseExampleService;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.StationClient;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataList;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.analyse.AnalyseDataHandlerClient;
@ -18,16 +24,20 @@ import com.hnac.hzinfo.sdk.v5.analyse.vo.AnalseInstanceVO;
import lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
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.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -38,8 +48,6 @@ import java.util.List;
@Slf4j
@Service
public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExampleMapper, AnalyseExample> implements IImsAnalyseExampleService {
@Resource
private ImsDutyMainMapper imsDutyMainMapper;
@Autowired
private IAnalyseDataSearchClient searchClient;
@Autowired
@ -119,6 +127,75 @@ public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExam
return R.success("保存成功");
}
@Override
public void outPutAnalyseExampleData(HttpServletResponse response, AnalyzeDataCondition analyzeDataCondition) {
try {
R analyseExampleData =queryAnalyseExampleData(analyzeDataCondition);
String name="值班日志";
if(ObjectUtils.isEmpty(analyzeDataCondition.getBeginTime())){
String format = DateUtil.format(analyzeDataCondition.getBeginTime(), DateUtil.PATTERN_DATE);
name=format+name;
}
HzPage<AnalyzeDataList> page = (HzPage<AnalyzeDataList>) analyseExampleData.getData();
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
String fileName = URLEncoder.encode( name, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
if(page.getRecords()!=null){
List<List<String>> head=new ArrayList<>();
List<String> title = new ArrayList<>(Arrays.asList("时间"));
head.add(title);
List<AnalyzeDataList> records = page.getRecords();
AnalyzeDataList analyzeDataList = records.get(0);
//把时间加属性名称作为表头
List<String> stringList=analyzeDataList.getFields().stream().map(FieldsData::getFieldName).collect(Collectors.toList());
for (String s : stringList) {
head.add(Arrays.asList(s));
}
//把数据填充
List<List<String>> data=new ArrayList<>();
for (int i = 0; i < records.size(); i++) {
List<String> arrayData=new ArrayList<>();
String date = DateUtil.format(records.get(i).getTs(), DateUtil.PATTERN_DATETIME);
arrayData.add(date);
List<String> dataBefore = records.get(i).getFields().stream().map(FieldsData::getValue).collect(Collectors.toList());
arrayData.addAll(dataBefore);
data.add(arrayData);
}
System.out.println("---------------- 数据详情 = " + records.toString());
//ExcelWriter初始化
ExcelWriter excelWriter = EasyExcel
.write(response.getOutputStream())
.autoCloseStream(Boolean.TRUE)
.registerConverter(new LongStringConverter())
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(45))
.build();
WriteSheet writeSheet = EasyExcel.writerSheet(1, "值班日志").head(head).build();
excelWriter.write(data, writeSheet);
// 这里需要设置关闭流
excelWriter.finish();
}
} catch (Exception e) {
System.out.println("exportExcel = " + e.toString());
// 重置response
response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
Map<String, String> map = new HashMap<>();
map.put("success", "false");
map.put("msg", "值班日志信息导出失败" + e.getMessage());
try {
response.getWriter().println(JSONUtils.toJSONString(map));
} catch (IOException e3) {
throw new ServiceException( "发生异常 :" + e.toString());
}
}
}
private QueryWrapper<AnalyseExample> getQueryWrapper(AnalyseExample analyseExample) {
QueryWrapper<AnalyseExample> queryWrapper = new QueryWrapper();

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

@ -176,7 +176,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
if (null == imsSchedulingVo.getGroupId()) {
imsSchedulingVo.setGroupName("临时班组");
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, id);
eq(ImsDutyMainPersonEntity::getDutyMainId, imsSchedulingVo.getId());
last("limit 1");
}});
imsSchedulingVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson());

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

@ -338,6 +338,8 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims
ImsDutyMainPersonEntity personEntity = imsDutyMainPersonService.getOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, entity.getId());
eq(ImsDutyMainPersonEntity::getDutyChargePerson, AuthUtil.getUserId());
last(" limit 1");
}});
if (ObjectUtil.isEmpty(groupEntity)&&ObjectUtil.isEmpty(personEntity)) {
return R.success("您不是该班组负责人,不可交班!");

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/GenerateMapper.java

@ -1,8 +1,11 @@
package com.hnac.hzims.operational.fill.mapper;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/**
* @author ysj
* @date 2023/04/10 11:22:14
@ -10,4 +13,5 @@ import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
*/
public interface GenerateMapper extends UserDataScopeBaseMapper<GenerateEntity> {
List<GenerateEntity> records(@Param("date") String date,@Param("station") String station);
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/GenerateMapper.xml

@ -1,4 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.operational.fill.mapper.GenerateMapper">
<select id="records" resultType="com.hnac.hzims.operational.fill.entity.GenerateEntity">
select * from hzims_fill_generate
where is_deleted = 0
and date = #{date}
and station_code = #{station}
</select>
</mapper>

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/GenerateService.java

@ -6,10 +6,16 @@ import com.hnac.hzims.operational.fill.entity.RainfallEntity;
import com.hnac.hzims.operational.fill.vo.GenerateVo;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.RainfallVo;
import com.hnac.hzims.operational.main.vo.GenerationPowerVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import com.hnac.hzims.operational.main.vo.UsrPowerVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
/**
* @author ysj
* @date 2023/04/10 11:16:07
@ -22,4 +28,13 @@ public interface GenerateService extends BaseService<GenerateEntity> {
// 新增/修改发电量填报数据
boolean saveUpdate(GenerateEntity entity);
// 查询填报用电量
Float generate(String date,String station);
// 查询30天填报用电量
List<GenerationPowerVo> generate30Day(String day, String station);
// 获取站点填报发电量
List<PowerMonthVo> generateThreeYear(String start, String end, String station);
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/PowerService.java

@ -3,10 +3,14 @@ package com.hnac.hzims.operational.fill.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.fill.vo.PowerVo;
import com.hnac.hzims.operational.main.vo.GenerationPowerVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
/**
* 其他填报接口
*/
@ -17,4 +21,8 @@ public interface PowerService extends BaseService<PowerEntity> {
R upd(PowerEntity entity);
R<IPage<PowerVo>> pageCondition(PowerVo vo, Query query);
Double generate(String date,Long station);
List<PowerMonthVo> generateThreeYear(String start,String end,Long station);
}

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/UseService.java

@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.UseVo;
import com.hnac.hzims.operational.main.vo.UsrPowerVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
/**
* @author ysj
* @date 2023/04/10 11:16:07
@ -20,4 +24,12 @@ public interface UseService extends BaseService<UseEntity> {
// 新增/修改用电量填报数据
boolean saveUpdate(UseEntity entity);
// 查询填报用电量
Float use(String date,String station);
// 查询30天填报用电量
List<UsrPowerVo> use30Day(String day, String station);
Map<String, Float> generateThreeYear(String start, String end, String station);
}

94
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java

@ -3,12 +3,17 @@ package com.hnac.hzims.operational.fill.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import com.hnac.hzims.operational.fill.mapper.GenerateMapper;
import com.hnac.hzims.operational.fill.service.GenerateService;
import com.hnac.hzims.operational.fill.vo.GenerateVo;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.wrapper.GenerateWrapper;
import com.hnac.hzims.operational.main.vo.GenerationPowerVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import com.hnac.hzims.operational.main.vo.UsrPowerVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
@ -16,11 +21,16 @@ import org.springblade.core.mp.base.BaseServiceImpl;
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.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author ysj
@ -50,6 +60,9 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime());
}
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin());
}
orderByDesc("create_time");
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
@ -78,4 +91,85 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
return this.updateById(entity);
}
/**
* 根据时间机构查询用电量
* @param date 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 所属机构
* @return
*/
@Override
public Float generate(String date, String station) {
List<GenerateEntity> powers = this.list(Wrappers.<GenerateEntity>lambdaQuery()
.likeRight(GenerateEntity::getFillDate,date)
.eq(GenerateEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(powers)){
return 0f;
}
return (float) powers.stream().mapToDouble(GenerateEntity::getGenerate).sum();
}
/**
* 查询30天填报用电量
* @param day : 结束日期 yyyy-MM-dd
* @param station 站点编码
* @return
*/
@Override
public List<GenerationPowerVo> generate30Day(String day, String station) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse(day,DateUtil.PATTERN_DATE));
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
calendar.add(Calendar.DAY_OF_MONTH,-29);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
List<GenerateEntity> records = this.list(Wrappers.<GenerateEntity>lambdaQuery()
.between(GenerateEntity::getFillDate,start,end)
.eq(GenerateEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
return records.stream().map(record->{
GenerationPowerVo generate = new GenerationPowerVo();
generate.setDate(record.getFillDate());
if(Math.abs(record.getGenerate()) <= 0){
generate.setGenerate(0f);
}else{
generate.setGenerate(Float.parseFloat(record.getGenerate().toString()));
}
return generate;
}).collect(Collectors.toList());
}
/**
*
* @param start 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param end 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 站点编码
* @return
*/
@Override
public List<PowerMonthVo> generateThreeYear(String start, String end, String station) {
List<GenerateEntity> records = this.list(Wrappers.<GenerateEntity>lambdaQuery()
.eq(GenerateEntity::getStationCode,station)
.between(GenerateEntity::getFillDate,start,end)
);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
// 返回结果
return records.stream().peek(
record-> record.setFillDate(DateUtil.format(DateUtil.parse(record.getFillDate(),"yyyy-MM"),"yyyy-MM") + "-01")
).collect(Collectors.toMap(GenerateEntity::getFillDate,GenerateEntity::getGenerate,Double::sum)).
entrySet().stream().map(entry->{
PowerMonthVo mon = new PowerMonthVo();
mon.setStrMonth(entry.getKey());
if(Math.abs(entry.getValue()) <= 0){
mon.setPower(0f);
}else{
mon.setPower(Float.parseFloat(entry.getValue().toString()));
}
return mon;
}).collect(Collectors.toList());
}
}

59
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/PowerServiceImpl.java

@ -1,12 +1,16 @@
package com.hnac.hzims.operational.fill.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
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.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.fill.mapper.PowerMapper;
import com.hnac.hzims.operational.fill.service.PowerService;
import com.hnac.hzims.operational.fill.vo.PowerVo;
import com.hnac.hzims.operational.fill.wrapper.PowerWrapper;
import com.hnac.hzims.operational.main.vo.GenerationPowerVo;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -14,12 +18,16 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Slf4j
@ -97,4 +105,55 @@ public class PowerServiceImpl extends BaseServiceImpl<PowerMapper, PowerEntity>
return R.data(pages.setRecords(list));
}
/**
* 根据时间机构查询发电量
* @param date 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 所属机构
* @return
*/
@Override
public Double generate(String date, Long station) {
List<PowerEntity> powers = this.list(Wrappers.<PowerEntity>lambdaQuery()
.likeRight(PowerEntity::getMon,date)
.eq(PowerEntity::getCreateDept,station)
// 类型: 光伏
.eq(PowerEntity::getType,1)
);
if(CollectionUtil.isEmpty(powers)){
return 0.0;
}
return powers.stream().mapToDouble(PowerEntity::getPowerMon).sum();
}
/**
*
* @param start 开始时间 : yyyy-mm
* @param end 结束时间 : yyyy-mm
* @param station 所属机构
* @return
*/
@Override
public List<PowerMonthVo> generateThreeYear(String start, String end, Long station) {
List<PowerEntity> fills = this.list(Wrappers.<PowerEntity>lambdaQuery()
.between(PowerEntity::getMon,start,end)
.eq(PowerEntity::getCreateDept,station)
// 类型: 光伏
.eq(PowerEntity::getType,1)
);
if(CollectionUtil.isEmpty(fills)){
return new ArrayList<>();
}
return fills.stream().map(fill->{
PowerMonthVo mon = new PowerMonthVo();
mon.setStrMonth(DateUtil.format(DateUtil.parse(fill.getMon(),"yyyy-MM"),DateUtil.PATTERN_DATE));
if(Math.abs(fill.getPowerMon()) <= 0){
mon.setPower(0f);
}else{
mon.setPower(Float.parseFloat(fill.getPowerMon().toString()));
}
return mon;
}).collect(Collectors.toList());
}
}

84
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/UseServiceImpl.java

@ -3,12 +3,17 @@ package com.hnac.hzims.operational.fill.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import com.hnac.hzims.operational.fill.mapper.UseMapper;
import com.hnac.hzims.operational.fill.service.UseService;
import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.UseVo;
import com.hnac.hzims.operational.fill.wrapper.UseWrapper;
import com.hnac.hzims.operational.main.vo.PowerMonthVo;
import com.hnac.hzims.operational.main.vo.UsrPowerVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
@ -16,11 +21,14 @@ import org.springblade.core.mp.base.BaseServiceImpl;
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.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author ysj
@ -50,6 +58,9 @@ public class UseServiceImpl extends BaseServiceImpl<UseMapper, UseEntity> implem
if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime());
}
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin());
}
orderByDesc("create_time");
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
@ -78,4 +89,75 @@ public class UseServiceImpl extends BaseServiceImpl<UseMapper, UseEntity> implem
return this.updateById(entity);
}
/**
* 根据时间机构查询用电量
* @param date 时间: - yyyy/ yyyy-mm/ yyyy-mm-dd
* @param station 所属机构
* @return
*/
@Override
public Float use(String date, String station) {
List<UseEntity> powers = this.list(Wrappers.<UseEntity>lambdaQuery()
.likeRight(UseEntity::getFillDate,date)
.eq(UseEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(powers)){
return 0f;
}
return (float) powers.stream().mapToDouble(UseEntity::getEmploy).sum();
}
/**
* 查询30天填报用电量
* @param day : 结束日期 yyyy-MM-dd
* @param station 站点编码
* @return
*/
@Override
public List<UsrPowerVo> use30Day(String day, String station) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(DateUtil.parse(day,DateUtil.PATTERN_DATE));
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
calendar.add(Calendar.DAY_OF_MONTH,-29);
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
List<UseEntity> records = this.list(Wrappers.<UseEntity>lambdaQuery()
.between(UseEntity::getFillDate,start,end)
.eq(UseEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(records)){
return new ArrayList<>();
}
return records.stream().map(record->{
UsrPowerVo use = new UsrPowerVo();
use.setDate(record.getFillDate());
if(Math.abs(record.getEmploy()) <= 0){
use.setUsrPower(0f);
}else{
use.setUsrPower(Float.parseFloat(record.getEmploy().toString()));
}
return use;
}).collect(Collectors.toList());
}
/**
* 查询近3年的填报用电量
* @param start
* @param end
* @param station
* @return
*/
@Override
public Map<String, Float> generateThreeYear(String start, String end, String station) {
List<UseEntity> records = this.list(Wrappers.<UseEntity>lambdaQuery()
.between(UseEntity::getFillDate,start,end)
.eq(UseEntity::getStationCode,station)
);
if(CollectionUtil.isEmpty(records)){
return new HashMap<>();
}
return records.stream().peek(record-> record.setFillDate(DateUtil.format(DateUtil.parse(record.getFillDate(),"yyyy-MM"),"yyyy-MM") + "-01")).
collect(Collectors.toMap(UseEntity::getFillDate, value->Float.parseFloat(value.getEmploy().toString()),Float::sum));
}
}

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java

@ -88,7 +88,6 @@ public class HydropowerController extends BladeController {
@ApiLog
@ApiOperation("计划发电趋势")
@GetMapping("/planGenerationTrend")

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/WebHomeController.java

@ -1,7 +1,7 @@
package com.hnac.hzims.operational.main.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.main.service.IWebHomeService;
import com.hnac.hzims.operational.main.service.HydropowerService;
import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitVo;
import io.swagger.annotations.Api;
@ -17,19 +17,23 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author ysj
*/
@RestController
@RequestMapping("/webHome")
@Api(value = "app首页", tags = "app-首页")
@AllArgsConstructor
public class WebHomeController extends BladeController {
private final IWebHomeService service;
private final HydropowerService service;
@ApiLog
@ApiOperation("水电站站点统计")
@GetMapping("/webStation")
@ApiOperationSupport(order = 1)
public R<HydropowerStationVo> hydropowerStation(@ApiParam(value = "站点机构ID") Long deptId) {
HydropowerStationVo response = service.webStation(deptId);
HydropowerStationVo response = service.station(deptId);
return R.data(response);
}
@ApiLog
@ -41,7 +45,6 @@ public class WebHomeController extends BladeController {
return R.data(list);
}
@ApiLog
@ApiOperation("水电站站点列表")
@GetMapping("/webStationList")
@ApiOperationSupport(order = 2)

175
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java

@ -1,11 +1,26 @@
package com.hnac.hzims.operational.main.controller.web;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.service.IOperAccessStatisticsService;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import com.hnac.hzims.operational.defect.entity.OperDefectEntity;
import com.hnac.hzims.operational.defect.service.IOperDefectService;
import com.hnac.hzims.operational.defect.vo.OperDefectVO;
import com.hnac.hzims.operational.defect.wrapper.OperDefectWrapper;
import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
@ -16,7 +31,9 @@ import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.SpringQueryMap;
@ -43,6 +60,10 @@ public class AreaMonthlyDetailsController {
private final IOperMaintenanceTaskService taskService;
private final IOperDefectService defectService;
private final IOperAccessStatisticsService accessStatisticsService;
/**
* 操作票 根据月份区域 获取操作详情数据
@ -143,4 +164,158 @@ public class AreaMonthlyDetailsController {
return R.data(task);
}
/**
* 根据区域和月份分页查询缺陷库
*/
@ApiOperationSupport(order = 70)
@ApiOperation(value = "分页查询")
@GetMapping("/queryDefectPageList/{page}/{size}")
public R<IPage<OperDefectVO>> queryDefectPageList(
@PathVariable Long page,
@PathVariable Long size,
OperDefectEntity defect) {
Page<OperDefectEntity> operDefectEntityPage = new Page<>(page, size);
IPage<OperDefectEntity> pages = defectService.selectPage(operDefectEntityPage, defect);
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages);
return R.data(vos);
}
/**
* 根据区域和月份分页查询缺陷库 详情
*/
@GetMapping("queryDefectPageDetail/detail")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入defect")
public R<OperDefectVO> queryDefectPageDetail(OperDefectEntity defect) {
return defectService.detail(defect);
}
/**
* 根据区域和月份分页查询检修任务
*/
@ApiOperationSupport(order = 80)
@ApiOperation(value = "根据区域和月份分页查询检修任务")
@GetMapping("/queryReconditionPageList/{page}/{size}")
public R<IPage<OperAccessStatisticsVO>> queryReconditionPageList(
@PathVariable Long page, @PathVariable Long size,
OperAccessStatisticsDTO result) {
Page<OperAccessStatisticsVO> dbPage = new Page<>(page, size);
R<IPage<OperAccessStatisticsVO>> r = accessStatisticsService.list(result, dbPage);
return r;
}
/**
* 根据区域 编号查询检修任务详情
*/
@GetMapping("/queryReconditionPageDetail/detail")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "根据区域 编号查询检修任务详情")
public R<OperAccessStatisticsVO> queryReconditionPageDetail(@RequestParam Long id) {
R<OperAccessStatisticsVO> detail = accessStatisticsService.detail(id);
return detail;
}
/**
* 根据区域编号查询安全生产会议次数
*/
@GetMapping("/queryProduceNumByAreaCode/{page}/{size}")
@ApiOperationSupport(order = 90)
@ApiOperation(value = "根据区域编号查询安全生产会议次数")
public R<BladePage<CheckMonthVo>> queryProduceNumByAreaCode(@PathVariable Long page, @PathVariable Long size,
CheckMonthEntity req) {
req.setItemName("现场每月1次安全生产会议");
BladePage<CheckMonthVo> checkMonthVoBladePage = areaMonthlyDetailsService.queryProduceByAreaCode(page, size,
req);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询技能培训
*/
@GetMapping("/querySkillByAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询技能培训")
public R<BladePage<CheckMonthVo>> querySkillByAreaCode(@PathVariable Long page, @PathVariable Long size, CheckMonthEntity req) {
req.setItemName("每月开展1次技能培训");
BladePage<CheckMonthVo> checkMonthVoBladePage = areaMonthlyDetailsService.queryProduceByAreaCode(page, size,
req);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询月度自查
*/
@GetMapping("/queryProduceByAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询技能培训")
public R<BladePage<CheckMonthVo>> queryProduceByAreaCode(@PathVariable Long page, @PathVariable Long size, CheckMonthEntity req) {
BladePage<CheckMonthVo> checkMonthVoBladePage = areaMonthlyDetailsService.queryProduceByAreaCode(page, size,
req);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询 月度自查 技能培训 安全生产会议次数
*/
@GetMapping("/queryProduceByAreaCodeDetail/detail/{id}")
@ApiOperationSupport(order = 40)
@ApiOperation(value = "详情", notes = "传入id")
public R<CheckMonthVo> queryProduceByAreaCodeDetail(@PathVariable Long id){
CheckMonthVo checkMonthVo = areaMonthlyDetailsService.queryProduceByAreaCodeDetail(id);
return R.data(checkMonthVo);
}
/**
* 根据区域编号查询安全检查
*/
@GetMapping("/querySecurityAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询安全检查")
public R<BladePage<CheckCompanyVo>> querySecurityAreaCode(@PathVariable Long page,
@PathVariable Long size,
CheckCompanyEntity req) {
BladePage<CheckCompanyVo> checkMonthVoBladePage = areaMonthlyDetailsService.querySecurityAreaCode(page, size,
req);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询安全检查 详情
*/
@GetMapping("/querySecurityAreaCode/detail/{id}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询安全检查 详情")
public R<CheckCompanyVo> querySecurityAreaCodeDetail(@PathVariable Long id) {
CheckCompanyVo checkMonthVoBladePage = areaMonthlyDetailsService.querySecurityAreaCodeDetail(id);
return R.data(checkMonthVoBladePage);
}
/**
* 根据区域编号查询设备试验
*/
@GetMapping("/queryEquipmentAreaCode/{page}/{size}")
@ApiOperationSupport(order = 100)
@ApiOperation(value = "根据区域编号查询设备试验")
public R<BladePage<SafeEquipmentTrialVO>> queryEquipmentAreaCode(
@PathVariable Long page,
@PathVariable Long size,
SafeEquipmentTrialDTO safeEquipmentTrialDTO) {
BladePage<SafeEquipmentTrialVO> checkMonthVoBladePage = areaMonthlyDetailsService.queryEquipmentAreaCode(page
,size,safeEquipmentTrialDTO);
return R.data(checkMonthVoBladePage);
}
}

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java

@ -13,7 +13,6 @@ import org.springblade.core.tool.utils.CollectionUtil;
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;
@ -44,7 +43,7 @@ public class ScheduledCreateTask {
@Autowired
private IAreaMonthReportService reportService;
@Autowired
private IWebHomeService webHomeService;
private HydropowerService hydropowerService;
@Autowired
private PhotovoltaicService photovoltaicService;
@Autowired
@ -169,10 +168,9 @@ public class ScheduledCreateTask {
* 获取站点近3年发电量数据
* @return ReturnT<String>
*/
//@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> powerGenerationRecentYear() throws Exception {
String param = "";
@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> powerGenerationRecentYear(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
@ -274,7 +272,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
webHomeService.loadHydropowerReal(param);
hydropowerService.loadHydropowerReal(param);
return new ReturnT<>("SUCCESS");
}
@ -288,7 +286,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
webHomeService.loadHydropowerTarget(param);
hydropowerService.loadHydropowerTarget(param);
return new ReturnT<>("SUCCESS");
}

47
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java

@ -1,6 +1,12 @@
package com.hnac.hzims.operational.main.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
@ -75,4 +81,45 @@ public interface AreaMonthlyDetailsService {
* @return
*/
TaskEntity queryCheckTaskById(Long id);
/**
* 根据区域编号查询安全生产会议次数 技能培训
* @param page
* @param size
* @param req
* @return
*/
BladePage<CheckMonthVo> queryProduceByAreaCode(Long page, Long size, CheckMonthEntity req);
/**
* 根据区域编号查询 月度自查 技能培训 安全生产会议次数
*/
CheckMonthVo queryProduceByAreaCodeDetail(Long id);
/**
* 根据区域编号查询安全检查
* @param page
* @param size
* @param req
* @return
*/
BladePage<CheckCompanyVo> querySecurityAreaCode(Long page, Long size, CheckCompanyEntity req);
/**
* 根据区域编号查询安全检查 详情
* @param id
* @return
*/
CheckCompanyVo querySecurityAreaCodeDetail(Long id);
/**
* 根据区域编号查询设备试验
* @param page
* @param size
* @param safeEquipmentTrialDTO
* @return
*/
BladePage<SafeEquipmentTrialVO> queryEquipmentAreaCode(Long page, Long size, SafeEquipmentTrialDTO safeEquipmentTrialDTO);
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IWebHomeService.java → hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java

@ -2,20 +2,19 @@ package com.hnac.hzims.operational.main.service;
import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitVo;
import com.hnac.hzims.operational.main.vo.WaterStationVo;
import java.util.List;
/**
* WEB水电站首页接口
*/
public interface IWebHomeService {
public interface HydropowerService {
void loadHydropowerReal(String param);
void loadHydropowerTarget(String param);
HydropowerStationVo webStation(Long deptId);
HydropowerStationVo station(Long deptId);
List<HydropowerUnitVo> hydropowerDevice(Long deptId);

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

@ -27,7 +27,7 @@ public interface IWaterService {
List<WaterYearDataVo> waterYearRain(Long deptId);
Dept getTitleDetp(List<Dept> authList, Long deptId);
Dept getTitleDetp(Long deptId);
WaterStationVo waterStationPage(Long deptId);

120
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java

@ -1,6 +1,15 @@
package com.hnac.hzims.operational.main.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.areamonthly.feign.CheckCompanyFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.feign.SafeEquipmentTrialFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.feign.SafeproductFeignClient;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.CheckMonthVo;
import com.hnac.hzims.safeproduct.areamonthly.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
@ -38,6 +47,13 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
private final TaskFeignClient taskFeignClient;
private final SafeproductFeignClient safeproductFeignClient;
private final CheckCompanyFeignClient checkCompanyFeignClient;
private final SafeEquipmentTrialFeignClient safeEquipmentTrialFeignClient;
/**
* 根据月份区域 获取操作详情数据
@ -49,8 +65,7 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
*/
@Override
public BladePage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly) {
R<BladePage<StandardTicketVo>> pageR =
ticketFeignClient.areaMonthlyWithOperation(page, size, areaMonthly);
R<BladePage<StandardTicketVo>> pageR = ticketFeignClient.areaMonthlyWithOperation(page, size, areaMonthly);
if (pageR.isSuccess()) {
log.info("获取操作详情数据成功");
return pageR.getData();
@ -69,8 +84,7 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
*/
@Override
public BladePage<StandardWorkVo> workTicketListByMonthAndArea(Long page, Long size, StandardTicketWithAreaVo areaMonthlyVo) {
R<BladePage<StandardWorkVo>> pageR =
ticketFeignClient.workTicketListByMonthAndArea(page, size, areaMonthlyVo);
R<BladePage<StandardWorkVo>> pageR = ticketFeignClient.workTicketListByMonthAndArea(page, size, areaMonthlyVo);
if (pageR.isSuccess()) {
log.info("获取操作详情数据成功");
return pageR.getData();
@ -149,6 +163,7 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
/**
* 根据id查询巡检任务
*
* @param id
* @return
*/
@ -162,4 +177,101 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
log.error("获取检查巡检任务详情失败", detail.getMsg());
return null;
}
/**
* 根据区域编号查询安全生产会议次数 技能培训
*
* @param page
* @param size
* @param req
* @return
*/
@Override
public BladePage<CheckMonthVo> queryProduceByAreaCode(Long page, Long size, CheckMonthEntity req) {
R<BladePage<CheckMonthVo>> detail = safeproductFeignClient.listconferenceScope(page, size, req);
if (detail.isSuccess()) {
log.info("获取安全生产会议次数 技能培训成功");
return detail.getData();
}
log.error("获取安全生产会议次数 技能培训失败", detail.getMsg());
return null;
}
/**
* 根据区域编号查询 月度自查 技能培训 安全生产会议次数
*
* @param id
*/
@Override
public CheckMonthVo queryProduceByAreaCodeDetail(Long id) {
R<CheckMonthVo> detail = safeproductFeignClient.detail(id);
if (detail.isSuccess()) {
log.info("根据区域编号查询 月度自查 技能培训 安全生产会议次数成功");
return detail.getData();
}
log.error("根据区域编号查询 月度自查 技能培训 安全生产会议次数失败", detail.getMsg());
return null;
}
/**
* 根据区域编号查询安全检查
*
* @param page
* @param size
* @param req
* @return
*/
@Override
public BladePage<CheckCompanyVo> querySecurityAreaCode(Long page, Long size, CheckCompanyEntity req) {
Query query = new Query();
query.setCurrent(page.intValue());
query.setSize(size.intValue());
R<BladePage<CheckCompanyVo>> list = checkCompanyFeignClient.list(req, query);
if (list.isSuccess()) {
log.info("根据区域编号查询安全检查成功");
return list.getData();
}
log.error("根据区域编号查询安全检查失败", list.getMsg());
return null;
}
/**
* 根据区域编号查询安全检查详情
*
* @param id
* @return
*/
@Override
public CheckCompanyVo querySecurityAreaCodeDetail(Long id) {
R<CheckCompanyVo> detailed = checkCompanyFeignClient.detail(id);
if (detailed.isSuccess()) {
log.info(" 根据区域编号查询安全检查详情成功");
return detailed.getData();
}
log.error(" 根据区域编号查询安全检查详情失败", detailed.getMsg());
return null;
}
/**
* 根据区域编号查询设备试验
*
* @param page
* @param size
* @param safeEquipmentTrialDTO
* @return
*/
@Override
public BladePage<SafeEquipmentTrialVO> queryEquipmentAreaCode(Long page, Long size, SafeEquipmentTrialDTO safeEquipmentTrialDTO) {
Query query = new Query();
query.setCurrent(page.intValue());
query.setSize(size.intValue());
R<BladePage<SafeEquipmentTrialVO>> list = safeEquipmentTrialFeignClient.list(safeEquipmentTrialDTO, query);
if (list.isSuccess()) {
log.info("根据区域编号查询设备试验成功");
return list.getData();
}
log.error("根据区域编号查询设备试验失败", list.getMsg());
return null;
}
}

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

@ -65,22 +65,40 @@ import java.util.stream.Collectors;
@Slf4j
public class HomePageServiceImpl implements IHomePageService {
private final IAnalyseDataService analyseDataService;
private final IPlanGenertionClient planGenertionClient;
private final IMainSystemMonitoringService maintenanceTaskService;
private final IMainTaskStatisticService mainTaskStatisticService;
private final IStationService stationService;
private final PowerService powerService;
private final OverService overService;
private final OverDetailsService overDetailsService;
private final SolveService solveService;
private final OtherService otherService;
private final OverDetailsService overDetailsService;
private final IAnalyseDataService analyseDataService;
private final PowerService photovoltaicService;
private final GenerateService hydropowerService;
private final IMainSystemMonitoringService maintenanceTaskService;
private final IMainTaskStatisticService mainTaskStatisticService;
private final ISysClient sysClient;
private final ISoeClient soeClient;
private final IPlanGenertionClient planGenertionClient;
private final ITicketInfoAllClient ticketInfoAllClient;
private final RedisTemplate redisTemplate;
private final IAnalyseInstanceClient analyseInstanceClient;
private final RedisTemplate redisTemplate;
private final static String KEY_INDICATORS_INFO = "hzims:operation:key:indicators:info";
private final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data";
@ -154,6 +172,8 @@ public class HomePageServiceImpl implements IHomePageService {
// 充电桩
case 7:
break;
default:
break;
}
});
redisTemplate.opsForValue().set(KEY_INDICATORS_INFO, keyIndicatorsVo);
@ -237,10 +257,7 @@ public class HomePageServiceImpl implements IHomePageService {
stationList.forEach(station -> {
// 站点设备集合
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(stationDevices)){
return;
}
Map<String, Float> generateMap = this.getGenerateYear(stationDevices,start,end);
Map<String, Float> generateMap = this.getGenerateYear(station,stationDevices,start,end);
if(MapUtils.isEmpty(generateMap)){
return;
}
@ -256,8 +273,10 @@ public class HomePageServiceImpl implements IHomePageService {
* @param end
* @return
*/
private Map<String, Float> getGenerateYear(List<EminfoAndEmParamVo> devices, String start, String end) {
private Map<String, Float> getGenerateYear(StationEntity station,List<EminfoAndEmParamVo> devices, String start, String end) {
List<PowerMonthVo> datas = new ArrayList<>();
// 设备采集发电量
if(CollectionUtil.isNotEmpty(devices)){
devices.forEach(device->{
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
@ -267,15 +286,34 @@ public class HomePageServiceImpl implements IHomePageService {
PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setStrMonth(DateUtil.format(time,DateUtil.PATTERN_DATE));
generate.setPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
generate.setPower(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
return generate;
}).collect(Collectors.toList()));
});
}
// 补充填报数据
datas.addAll(this.generateFill(station,start,end));
if(CollectionUtil.isEmpty(datas)){
return null;
}
return datas.stream().collect(Collectors.groupingBy(PowerMonthVo::getStrMonth, Collectors.collectingAndThen(
Collectors.mapping(PowerMonthVo::getPower, Collectors.reducing(Float::sum)),Optional::get)));
return datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum));
}
/**
* 补充填报数据
* @param station
* @param start
* @param end
*/
private List<PowerMonthVo> generateFill(StationEntity station, String start, String end) {
start = DateUtil.format(DateUtil.parse(start,DateUtil.PATTERN_DATETIME),"yyyy-MM");
end = DateUtil.format(DateUtil.parse(end,DateUtil.PATTERN_DATETIME),"yyyy-MM");
// 光伏
if(HomePageConstant.PHOTOVOLTAIC.equals(station.getType())){
return photovoltaicService.generateThreeYear(start,end,station.getRefDept());
// 水电
}
return hydropowerService.generateThreeYear(start,end,station.getCode());
}
/**

369
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WebHomeServiceImpl.java → hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.main.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
@ -9,9 +10,10 @@ import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.operational.fill.service.GenerateService;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationAttributeService;
import com.hnac.hzims.operational.station.service.IStationService;
@ -30,7 +32,6 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -43,25 +44,27 @@ import java.util.stream.Collectors;
*/
@Service
@RequiredArgsConstructor
public class WebHomeServiceImpl implements IWebHomeService {
public class HydropowerServiceImpl implements HydropowerService {
private final IAnalyseDataService analyseDataService;
private final IHomePageService homePageService;
private final IWaterService waterService;
private final IMainSystemMonitoringService maintenanceTaskService;
private final IWeatherService weatherService;
private final IStationService stationService;
private final IStationAttributeService attributeService;
private final GenerateService generateService;
private final IWaterService waterService;
private final IHomePageService homePageService;
private final IPlanGenertionClient planGenertionClient;
private final IAnalyseDataService analyseDataService;
private final IStationAttributeService attributeService;
private final IMainSystemMonitoringService maintenanceTaskService;
private final ISoeClient soeClient;
private final IWeatherService weatherService;
private final IPlanGenertionClient planGenertionClient;
private final RedisTemplate redisTemplate;
@ -80,63 +83,54 @@ public class WebHomeServiceImpl implements IWebHomeService {
*/
@Override
public void loadHydropowerReal(String param) {
// 有效设备
List<EminfoAndEmParamVo> valid = this.getValidDeviceList();
if(CollectionUtil.isEmpty(valid)){
// 水电站站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 水电站设备
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
if(CollectionUtil.isEmpty(devices)){
return;
}
// 实时数据
Map<String, String> map = this.getRealMap();
// 单位
Map<String, String> unitMap = this.attributeService.getPointUnit();
List<HydropowerUnitRealVo> list = new ArrayList<>();
valid.forEach(device->{
HydropowerUnitRealVo realVo = new HydropowerUnitRealVo();
realVo.setDeptId(device.getCreateDept());
realVo.setDeviceCode(device.getEmCode());
realVo.setDeptName(device.getName());
realVo.setDeviceName(device.getName());
// 实时数据
List<HydropowerUnitRealVo> reals = devices.stream().map(device->{
HydropowerUnitRealVo real = new HydropowerUnitRealVo();
real.setDeptId(device.getCreateDept());
real.setDeviceCode(device.getEmCode());
real.setDeptName(device.getName());
real.setDeviceName(device.getName());
// 开关机状态
String state = this.getSignageValue(device,map,HomePageConstant.JOINT_RELAY);
realVo.setState(state);
real.setState(this.getSignageValue(device,map,HomePageConstant.JOINT_RELAY));
// 有功功率
String activePower = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_ACTIVE_POWER);
realVo.setActivePower(activePower);
real.setActivePower(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_ACTIVE_POWER));
// 无功功率
String reactivePower = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_REACTIVE_POWER);
realVo.setReactivePower(reactivePower);
real.setReactivePower(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_REACTIVE_POWER));
// 功率因数
String powerFactor = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_POWERFACTOR);
realVo.setPowerFactor(powerFactor);
real.setPowerFactor(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_POWERFACTOR));
// 机组频率
String frequency = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_FREQUENCY);
realVo.setFrequency(frequency);
real.setFrequency(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_FREQUENCY));
// 导叶开度
String guideOpen = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_GUIDEOPEN);
realVo.setGuideOpen(guideOpen);
real.setGuideOpen(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_GUIDEOPEN));
// 定子电压
String statorVoltage = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_VOLTAGE);
realVo.setStatorVoltage(statorVoltage);
real.setStatorVoltage(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_VOLTAGE));
// 定子电流
String statorCurrent = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_CURRENT);
realVo.setStatorCurrent(statorCurrent);
real.setStatorCurrent(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_CURRENT));
// 单位设置
this.setttingUnit(device,unitMap,realVo);
list.add(realVo);
});
redisTemplate.opsForValue().set(load_hydropower_unit_real_key,list);
}
/**
* 获取实时数据
* @return
*/
private Map<String, String> getRealMap() {
String json = (String) redisTemplate.opsForValue().get(real_id_key);
if(StringUtil.isBlank(json)){
return null;
this.setttingUnit(device,unitMap,real);
return real;
}).collect(Collectors.toList());
if(CollectionUtil.isEmpty(reals)){
return;
}
return JSONObject.parseObject(json, new TypeReference<Map<String, String>>() {});
redisTemplate.opsForValue().set(load_hydropower_unit_real_key,reals);
}
/**
@ -145,59 +139,98 @@ public class WebHomeServiceImpl implements IWebHomeService {
*/
@Override
public void loadHydropowerTarget(String param) {
// 有效设备
List<EminfoAndEmParamVo> valid = this.getValidDeviceList();
if(CollectionUtil.isEmpty(valid)){
// 水电站站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
List<HydropowerUnitTargetVo> list = new ArrayList<>();
valid.forEach(device->{
HydropowerUnitTargetVo targetVo = new HydropowerUnitTargetVo();
targetVo.setDeptId(device.getCreateDept());
targetVo.setDeviceCode(device.getEmCode());
targetVo.setDeviceName(device.getName());
targetVo.setDeptName(device.getName());
// 补充填补发电指标
List<HydropowerUnitTargetVo> targets = this.generteFill(stations);
// 水电站设备
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
if(CollectionUtil.isNotEmpty(devices)){
targets.addAll(devices.stream().map(device->{
HydropowerUnitTargetVo target = new HydropowerUnitTargetVo();
target.setDeptId(device.getCreateDept());
target.setDeviceCode(device.getEmCode());
target.setDeviceName(device.getName());
target.setDeptName(device.getName());
// 当年发电量
float powerYear = this.getGenerationPower(device,0);
targetVo.setPowerYear(powerYear);
target.setPowerYear(this.getGenerationPower(device,0));
// 当月发电量
float powerMon = this.getGenerationPower(device,1);
targetVo.setPowerMon(powerMon);
target.setPowerMon(this.getGenerationPower(device,1));
// 当日发电量
float powerDay = this.getGenerationPower(device,2);
target.setPowerDay(this.getGenerationPower(device,2));
// 当天有功功率
List<ActivePowerVo> activePowerVoList = waterService.getActivePowerVoList(device);
targetVo.setActivePowerVoList(activePowerVoList);
target.setActivePowerVoList(waterService.getActivePowerVoList(device));
// 30天发电量
target.setGenerationPowerVoList(this.getGenerationPowerList(device));
return target;
}).collect(Collectors.toList()));
}
// 站点指标数据为空
if(CollectionUtil.isEmpty(targets)){
return;
}
redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets);
}
/**
* 获取填报用电量
* @param stations
* @return
*/
private List<HydropowerUnitTargetVo> generteFill(List<StationEntity> stations) {
Calendar calendar = Calendar.getInstance();
String day = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
String mon = DateUtil.format(calendar.getTime(),"yyyy-MM");
String year = String.valueOf(calendar.get(Calendar.YEAR));
return stations.stream().map(station ->{
HydropowerUnitTargetVo target = new HydropowerUnitTargetVo();
target.setDeptId(station.getRefDept());
target.setDeptName(station.getName());
// 当年发电量
target.setPowerYear(generateService.generate(year,station.getCode()));
// 当月发电量
target.setPowerMon(generateService.generate(mon,station.getCode()));
// 当日发电量
target.setPowerDay(generateService.generate(day,station.getCode()));
// 30天发电量
List<GenerationPowerVo> generationPowerVoList = this.getGenerationPowerList(device);
targetVo.setGenerationPowerVoList(generationPowerVoList);
targetVo.setPowerDay(powerDay);
list.add(targetVo);
});
redisTemplate.opsForValue().set(load_hydropower_unit_target_key,list);
target.setGenerationPowerVoList(generateService.generate30Day(day,station.getCode()));
return target;
}).collect(Collectors.toList());
}
/**
* 获取有效设备
* 泵站设备
* @param stations
* @return
*/
private List<EminfoAndEmParamVo> getValidDeviceList() {
// 水利站点(All)
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), null);
if(CollectionUtil.isEmpty(stationList)){
return null;
private List<EminfoAndEmParamVo> pumpDevices(List<Long> stations){
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}
// 获取所有设备
List<EminfoAndEmParamVo> deviceList = maintenanceTaskService.getEmInfoList();
if(CollectionUtil.isEmpty(deviceList)){
return null;
List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList();
if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
return devices.stream().filter(device->stations.contains(device.getCreateDept())).collect(Collectors.toList());
}
// 有效泵租设备
List<Long> deptIdList = stationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isEmpty(deptIdList)){
/**
* 获取实时数据
* @return
*/
private Map<String, String> getRealMap() {
String json = (String) redisTemplate.opsForValue().get(real_id_key);
if(StringUtil.isBlank(json)){
return null;
}
return deviceList.stream().filter(o->deptIdList.contains(o.getCreateDept())).collect(Collectors.toList());
return JSONObject.parseObject(json, new TypeReference<Map<String, String>>() {});
}
@ -335,7 +368,7 @@ public class WebHomeServiceImpl implements IWebHomeService {
* @return
*/
@Override
public HydropowerStationVo webStation(Long deptId) {
public HydropowerStationVo station(Long deptId) {
if(ObjectUtil.isEmpty(deptId)){
return null;
}
@ -344,22 +377,6 @@ public class WebHomeServiceImpl implements IWebHomeService {
if(ObjectUtil.isEmpty(station)){
return null;
}
List<HydropowerStationVo> list = this.getHydropowerStationList(Collections.singletonList(station));
if(CollectionUtil.isEmpty(list)){
return null;
}
return list.get(0);
}
/**
* 获取首页站点信息
* @param list
* @return
*/
private List<HydropowerStationVo> getHydropowerStationList(List<StationEntity> list) {
if(CollectionUtil.isEmpty(list)){
return null;
}
// 实时监测点数据
List<HydropowerUnitRealVo> realList = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
// 获取站点机组指标数据
@ -367,63 +384,69 @@ public class WebHomeServiceImpl implements IWebHomeService {
// 所有设备
List<EminfoAndEmParamVo> deviceList = maintenanceTaskService.getEmInfoList();
// 实时天气
Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(list.stream().map(StationEntity::getCode).collect(Collectors.toList()));
Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(Collections.singletonList(station.getCode()));
// 七天天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(list.stream().map(StationEntity::getCode).collect(Collectors.toList()));
List<HydropowerStationVo> result = new ArrayList<>();
list.forEach(station ->{
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(Collections.singletonList(station.getCode()));
HydropowerStationVo response = new HydropowerStationVo();
response.setDeptId(station.getRefDept());
response.setDeptName(station.getName());
response.setStationCode(station.getCode());
// 站点状态
List<SoeData> soeDataList = soeClient.getByLastLimitTime(null, station.getCode(), 1).getData();
if (CollectionUtil.isNotEmpty(soeDataList)) {
response.setStationStatus(false);
} else {
response.setStationStatus(true);
}
response.setStationStatus(!CollectionUtil.isNotEmpty(soeDataList));
// 站点实时天气
String temp = this.getTemp(weather,station.getCode());
response.setTemp(temp);
response.setTemp(this.getTemp(weather,station.getCode()));
// 站点七天天气
List<Daily> dailys = this.getDailyList(weekWeather,station.getCode());
response.setWeather(dailys);
response.setWeather(this.getDailyList(weekWeather,station.getCode()));
// 限制水位
response.setLimitWaterLevel(station.getLimitWaterLevel());
// 运行天数
int runDay = this.getRunDay(station);
response.setRunDay(runDay);
response.setRunDay(this.getRunDay(station));
// 装机容量
double installedCapacity = this.getInstalledCapacity(deviceList,station.getRefDept());
response.setInstalledCapacity(installedCapacity);
response.setInstalledCapacity(this.getInstalledCapacity(deviceList,station.getRefDept()));
// 总有功功率(总发电负荷)
double powerSum = this.getPowerSum(realList,station.getRefDept());
response.setPowerSum(powerSum);
response.setPowerSum(this.getPowerSum(realList,station.getRefDept()));
// 总有功单位
String unit = this.getPowerUnit(realList,station.getRefDept());
response.setPowerUnit(unit);
response.setPowerUnit(this.getPowerUnit(realList,station.getRefDept()));
// 月计划发电量
float planPowerMon = this.getPlanPowerrMon(station.getCode());
response.setPlanPowerMon(planPowerMon);
response.setPlanPowerMon(this.getPlanPowerrMon(station.getCode()));
// 年计划发电量
float planPowerYear = this.getPlanPowerYear(station.getCode());
response.setPlanPowerYear(planPowerYear);
response.setPlanPowerYear(this.getPlanPowerYear(station.getCode()));
// 月发电量、年发电量、年发电完成率
this.handleStationInfo(station.getRefDept(),response);
// 水位、水位曲线
this.handleWaterLeve(station.getCode(),response);
// 年发电量完成百分比
List<PowerMonthVo> powerYearList = this.handlePowerFinish(station);
response.setPowerYearMap(powerYearList);
response.setPowerYearMap(this.handlePowerFinish(station));
// 设备信息
List<HydropowerUnitVo> devices = this.getDevices(station,realList,targetList);
response.setDeviceList(devices);
result.add(response);
});
return result;
response.setDeviceList(this.getDevices(station,realList,targetList));
return response;
}
/**
* 水电站-机组列表
* @param deptId
* @return
*/
@Override
public List<HydropowerUnitVo> hydropowerDevice(Long deptId) {
if(ObjectUtil.isEmpty(deptId)){
return null;
}
// 查询站点
StationEntity station = stationService.getStationByCodeOrRefDept(null,deptId);
if(ObjectUtil.isEmpty(station)){
return null;
}
// 实时监测点数据
List<HydropowerUnitRealVo> realList = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
// 获取站点机组指标数据
List<HydropowerUnitTargetVo> targetList = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
return this.getDevices(station,realList,targetList);
}
/**
* 获取站点设备信息
* @param station
@ -706,39 +729,63 @@ public class WebHomeServiceImpl implements IWebHomeService {
}).collect(Collectors.toList());
}
/**
* 水电站-机组列表
* 水电站站点列表
* @param deptId
* @return
*/
@Override
public List<HydropowerUnitVo> hydropowerDevice(Long deptId) {
if(ObjectUtil.isEmpty(deptId)){
return null;
}
// 查询站点
StationEntity station = stationService.getStationByCodeOrRefDept(null,deptId);
if(ObjectUtil.isEmpty(station)){
public List<HydropowerStationVo> webStationList(Long deptId) {
List<StationEntity> stations = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE,Collections.singletonList(HomePageConstant.HYDROPOWER),null);
if(CollectionUtil.isEmpty(stations)){
return null;
}
// 实时监测点数据
List<HydropowerUnitRealVo> realList = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
// 获取站点机组指标数据
List<HydropowerUnitTargetVo> targetList = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
return this.getDevices(station,realList,targetList);
}
/**
* 水电站站点列表
* @param deptId
* @return
*/
@Override
public List<HydropowerStationVo> webStationList(Long deptId) {
List<StationEntity> list = stationService.getStationType(null,Collections.singletonList(HomePageConstant.HYDROPOWER),null);
if(CollectionUtil.isEmpty(list)){
return null;
}
return this.getHydropowerStationList(list);
// 所有设备
List<EminfoAndEmParamVo> deviceList = maintenanceTaskService.getEmInfoList();
// 实时天气
Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 七天天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
return stations.stream().map(station->{
HydropowerStationVo hydropower = new HydropowerStationVo();
hydropower.setDeptId(station.getRefDept());
hydropower.setDeptName(station.getName());
hydropower.setStationCode(station.getCode());
// 站点状态
List<SoeData> soeDataList = soeClient.getByLastLimitTime(null, station.getCode(), 1).getData();
hydropower.setStationStatus(!CollectionUtil.isNotEmpty(soeDataList));
// 站点实时天气
hydropower.setTemp(this.getTemp(weather,station.getCode()));
// 站点七天天气
hydropower.setWeather(this.getDailyList(weekWeather,station.getCode()));
// 限制水位
hydropower.setLimitWaterLevel(station.getLimitWaterLevel());
// 运行天数
hydropower.setRunDay(this.getRunDay(station));
// 装机容量
hydropower.setInstalledCapacity(this.getInstalledCapacity(deviceList,station.getRefDept()));
// 总有功功率(总发电负荷)
hydropower.setPowerSum(this.getPowerSum(realList,station.getRefDept()));
// 总有功单位
hydropower.setPowerUnit(this.getPowerUnit(realList,station.getRefDept()));
// 月计划发电量
hydropower.setPlanPowerMon(this.getPlanPowerrMon(station.getCode()));
// 年计划发电量
hydropower.setPlanPowerYear(this.getPlanPowerYear(station.getCode()));
// 月发电量、年发电量、年发电完成率
this.handleStationInfo(station.getRefDept(),hydropower);
// 水位、水位曲线
this.handleWaterLeve(station.getCode(),hydropower);
// 年发电量完成百分比
hydropower.setPowerYearMap(this.handlePowerFinish(station));
// 设备信息
hydropower.setDeviceList(this.getDevices(station,realList,targetList));
return hydropower;
}).collect(Collectors.toList());
}
}

60
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java

@ -7,6 +7,7 @@ import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.operational.fill.service.PowerService;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
@ -68,10 +69,12 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
private final IAnalyseDataService analyseDataService;
private final IHistoryDataSearchClient historySearchClient;
private final IMainTaskStatisticService taskService;
private final PowerService generateService;
private final IHistoryDataSearchClient historySearchClient;
private final ISysClient sysClient;
private final ITicketInfoClient ticketInfoClient;
@ -243,6 +246,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
return;
}
List<PhotovoltaicTargetVo> list = new ArrayList<>();
// 接入站点设备统计
devices.forEach(device -> {
PhotovoltaicTargetVo target = new PhotovoltaicTargetVo();
target.setDeptId(device.getCreateDept());
@ -273,9 +277,18 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
target.setGenerationPowerVoList(this.getGenerateByMon(device));
list.add(target);
});
// 补充站点填报发电量
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType, HomePageConstant.PHOTOVOLTAIC)
.eq(StationEntity::getServeType, HomePageConstant.HYDROPOWER_SERVETYPE)
);
if(CollectionUtil.isNotEmpty(stations)){
list.addAll(this.generateFill(stations));
}
redisTemplate.opsForValue().set(load_photovoltaic_target_key, list);
}
/**
* 当天有功功率
*
@ -325,6 +338,45 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
}).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList());
}
/**
* 获取光伏站点填报数据
* @param stations
* @return
*/
private List<PhotovoltaicTargetVo> generateFill(List<StationEntity> stations) {
Calendar calendar = Calendar.getInstance();
//String day = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
String mon = DateUtil.format(calendar.getTime(),"yyyy-MM");
String year = String.valueOf(calendar.get(Calendar.YEAR));
//calendar.add(Calendar.DAY_OF_MONTH,-1);
//String yesterday = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
return stations.stream().map(station ->{
PhotovoltaicTargetVo target = new PhotovoltaicTargetVo();
target.setDeptId(station.getRefDept());
target.setDeptName(station.getName());
// 当日运行时长
target.setRunHours(0.0);
// 日发电量
target.setGenerationDay(0.0);
// 昨日发电量
target.setGenerationYesterday(0.0);
// 收益
target.setIncome(0.0);
// 日发电量
// 月发电量
target.setGenerationMon(generateService.generate(mon,station.getRefDept()));
// 节约标准煤
target.setTec(target.getGenerationMon() * 0.0001229);
// 二氧化碳减排
target.setCo2(target.getGenerationMon() * 0.000997);
// 减少森林砍伐
target.setDeforest(target.getGenerationMon() * 0.000553);
// 年发电量
target.setGenerationYear(generateService.generate(year,station.getRefDept()));
// 30天发电量
return target;
}).collect(Collectors.toList());
}
/**
* 根据事件查询数据值
@ -1462,7 +1514,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
}
// 功率
photovoltaic.setActivePowerVoList(
devices.stream().map(PhotovoltaicDeviceVo::getActivePowerVoList).flatMap(Collection::stream).collect(Collectors.groupingBy(PhotovoltaicPowerVo::getHour)).entrySet().stream().map(entry -> {
devices.stream().map(PhotovoltaicDeviceVo::getActivePowerVoList).filter(ObjectUtil::isNotEmpty).flatMap(Collection::stream).collect(Collectors.groupingBy(PhotovoltaicPowerVo::getHour)).entrySet().stream().map(entry -> {
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo();
load.setHour(entry.getKey());
load.setActivePower(String.valueOf(entry.getValue().stream().mapToDouble(o -> Double.parseDouble(o.getActivePower())).sum()));
@ -1471,7 +1523,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
);
// 发电量
photovoltaic.setGenerationPowerVoList(
devices.stream().map(PhotovoltaicDeviceVo::getGenerationPowerVoList).flatMap(Collection::stream).collect(Collectors.groupingBy(GenerationPowerVo::getDate)).entrySet().stream().map(entry -> {
devices.stream().map(PhotovoltaicDeviceVo::getGenerationPowerVoList).filter(ObjectUtil::isNotEmpty).flatMap(Collection::stream).collect(Collectors.groupingBy(GenerationPowerVo::getDate)).entrySet().stream().map(entry -> {
GenerationPowerVo generate = new GenerationPowerVo();
generate.setDate(entry.getKey());
generate.setGenerate((float) entry.getValue().stream().mapToDouble(o -> Double.valueOf(o.getGenerate())).sum());

72
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java

@ -23,9 +23,9 @@ import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.vo.DutyInfoVo;
import com.hnac.hzims.operational.duty.vo.DutyTaskVo;
import com.hnac.hzims.operational.duty.vo.NextDutyInfoVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
@ -66,6 +66,9 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/**
* @author ysj
*/
@Service
@RequiredArgsConstructor
@Slf4j
@ -308,13 +311,6 @@ public class SideHustleServiceImpl implements ISideHustleService {
}});
List<String> faultList = operPhenomenonEntityList.stream().map(OperPhenomenonEntity::getEmCode).distinct().collect(Collectors.toList());
deviceClassifyMap.put(HomePageConstant.FAULT,faultList);
// 保养
/*List<OperMaintenanceTaskEntity> operMaintenanceTaskEntityList = operMaintenanceTaskService.list(new QueryWrapper<OperMaintenanceTaskEntity>() {{
in("EM_CODE", deviceCodeList);
ne("STATUS", MaintenanceConstant.TASK_STATUS_5);
}});
List<String> maintainList = operMaintenanceTaskEntityList.stream().map(OperMaintenanceTaskEntity::getEmCode).collect(Collectors.toList());
deviceClassifyMap.put(HomePageConstant.MAINTAIN,maintainList);*/
// 检修
List<OperAccessTaskEntity> operAccessTaskEntityList = operAccessTaskService.list(new QueryWrapper<OperAccessTaskEntity>() {{
in("EM_CODE", deviceCodeList);
@ -506,11 +502,11 @@ public class SideHustleServiceImpl implements ISideHustleService {
areaDutyVo.setGeneratingCapacity(generatingCapacity);
}
/**
/***
* 根据当班时间查询发电量
* @param devices
* @param startDate
* @param endDate
* @param start
* @param end
* @return
*/
private float generateByDuty(List<EminfoAndEmParamVo> devices, Date start, Date end) {
@ -520,7 +516,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
}
for(EminfoAndEmParamVo device : devices ){
generate += analyseDataService.periodTargetFloat(DateUtil.format(start,DateUtil.PATTERN_DATETIME),DateUtil.format(end,DateUtil.PATTERN_DATETIME),3,5,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
};
}
return generate;
}
@ -585,7 +581,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE));
dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
return dateCal.getTime();
};
}
/**
* 获取结束时间
@ -608,7 +604,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
dateCal.set(Calendar.MINUTE, endCal.get(Calendar.MINUTE));
dateCal.set(Calendar.SECOND, endCal.get(Calendar.SECOND));
return dateCal.getTime();
};
}
/**
* 当班运行数据
@ -840,7 +836,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
return null;
}
Map<Long, Map<String, Float>> powerMap = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
List<String> monList = homePageService.getMonthList(0,12,false);;
List<String> monList = homePageService.getMonthList(0,12,false);
// 获取总发电量
float sumPower = this.getSumPower(map.values(),powerMap,monList);
List<AreaPowerScaleVo> list = new ArrayList<>();
@ -854,7 +850,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
}
areaPowerScaleVo.setPower(power);
// 发电量占比
double scale = this.getPowerScale(power,sumPower);;
double scale = this.getPowerScale(power,sumPower);
areaPowerScaleVo.setScale(scale);
list.add(areaPowerScaleVo);
});
@ -874,7 +870,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
return null;
}
// 获取站点编码集合
List<String> codes = map.entrySet().stream().map(o-> o.getValue().get(0).getCode()).collect(Collectors.toList());
List<String> codes = map.values().stream().map(stationEntities -> stationEntities.get(0).getCode()).collect(Collectors.toList());
// 获取站点实时天气
Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather( codes);
// 获取站点7日天气
@ -974,7 +970,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
* @return
*/
private List<StationBodyVo> getStationData() {
Map<String, StationBodyVo> map = new HashMap<>();
Map<String, StationBodyVo> map;
Object json = redisTemplate.opsForValue().get(station_data_key);
if (ObjectUtil.isNotEmpty(json)) {
map = JSONObject.parseObject(json.toString(), new TypeReference<Map<String, StationBodyVo>>() {
@ -1166,9 +1162,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
}
List<String> codeList = new ArrayList<>();
// 添加所有站点Code
map.values().forEach(item->{
codeList.addAll(item.stream().map(StationEntity::getCode).collect(Collectors.toList()));
});
map.values().forEach(item-> codeList.addAll(item.stream().map(StationEntity::getCode).collect(Collectors.toList())));
if(CollectionUtil.isEmpty(codeList)){
return null;
}
@ -1214,7 +1208,6 @@ public class SideHustleServiceImpl implements ISideHustleService {
return;
}
// 存放设备信息集合
List<DeviceVo> deviceVoList = new ArrayList<>();
List<String> equipmentCodeList = R.getData().stream().map(EmInfoEntity::getNumber).collect(Collectors.toList());
// 总数
@ -1224,7 +1217,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
// 故障
List<DeviceVo> fault = this.handlerDeviceStatus(faultList,equipmentCodeList,"故障");
equipmentCountVo.setFaultCount((long) fault.size());
deviceVoList.addAll(fault);
List<DeviceVo> deviceVoList = new ArrayList<>(fault);
// 检修
List<DeviceVo> overhaul = this.handlerDeviceStatus(overhaultList,equipmentCodeList,"检修");
equipmentCountVo.setOverhaulCount((long) overhaul.size());
@ -1266,7 +1259,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
if(CollectionUtil.isEmpty(statusList) || CollectionUtil.isEmpty(equipmentCodeList)){
return new ArrayList<>();
}
List<String> statusDevice = statusList.stream().filter(o->equipmentCodeList.contains(o)).distinct().collect(Collectors.toList());
List<String> statusDevice = statusList.stream().filter(equipmentCodeList::contains).distinct().collect(Collectors.toList());
if(CollectionUtil.isEmpty(statusDevice)){
return new ArrayList<>();
}
@ -1340,37 +1333,6 @@ public class SideHustleServiceImpl implements ISideHustleService {
}
/**
* 递归查询子站点
*
* @param departList
* @param parentPart
* @param list
* @return
*/
private List<Dept> getAreaStation(List<Dept> departList, Dept parentPart, List<Dept> list) {
departList.forEach(dept -> {
if (dept.getParentId().equals(parentPart.getId())) {
// FIXME 是否只需要添加站点
if (dept.getDeptCategory().equals(4)) {
list.add(dept);
}
getAreaStation(departList, dept, list);
}
});
if(CollectionUtil.isEmpty(list)){
return null;
}
List<Long> deptList = list.stream().map(Dept::getId).collect(Collectors.toList());
List<StationEntity> stationList = this.getStation(Collections.singletonList(HomePageConstant.HYDROPOWER), deptList);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
List<Long> refDeptList = stationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
return list.stream().filter(o->refDeptList.contains(o.getId())).collect(Collectors.toList());
}
/**
* 区域机构下是否存在水电站
* @param deptAuthList
* @param area

340
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

@ -3,15 +3,18 @@ package com.hnac.hzims.operational.main.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo;
import com.hnac.hzims.operational.fill.service.UseService;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.StationConstants;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IHzimsAnalyzeModelStationService;
@ -44,8 +47,6 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -60,26 +61,28 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor
public class WaterServiceImpl implements IWaterService {
private final IAnalyseDataService analyseDataService;
private final UseService useService;
private final IHomePageService homePageService;
private final IStationService stationService;
private final IWeatherService weatherService;
private final IAnalyseDataService analyseDataService;
private final ISideHustleService sideHustleService;
private final IMainSystemMonitoringService maintenanceTaskService;
private final IHzimsAnalyzeModelStationService modelStationService;
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final ISysClient sysClient;
private final IWeatherService weatherService;
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final IHistoryDataSearchClient historyDataSearchClient;
private final ISysClient sysClient;
private final RedisTemplate redisTemplate;
@Value("${hzims.operation.realIdKey}")
@ -91,54 +94,48 @@ public class WaterServiceImpl implements IWaterService {
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key";
// 日期格式化yyyy-mm-dd
private final SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE);
// 日期格式化yyyy-mm-dd
private final SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME);
// 时间格式化yyyy-MM-dd HH:mm:ss"
private final DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME);
/**
* 水利-泵组实时加载
* @param param
*/
@Override
public void loadWaterPumpReal(String param) {
// 有效设备
List<EminfoAndEmParamVo> valid = this.getValidDeviceList();
if(CollectionUtil.isEmpty(valid)){
// 水利站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.in(StationEntity::getType,HomePageConstant.waterList)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 泵站设备
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
if(CollectionUtil.isEmpty(devices)){
return;
}
// 实时数据
Map<String, String> map = this.getRealMap();
List<WaterPumpRealVo> list = new ArrayList<>();
valid.forEach(device->{
WaterPumpRealVo waterPumpRealVo = new WaterPumpRealVo();
waterPumpRealVo.setDeptId(device.getCreateDept());
waterPumpRealVo.setDeviceCode(device.getEmCode());
waterPumpRealVo.setDeptName(device.getName());
List<WaterPumpRealVo> list = devices.stream().map(device->{
WaterPumpRealVo real = new WaterPumpRealVo();
real.setDeptId(device.getCreateDept());
real.setDeviceCode(device.getEmCode());
real.setDeptName(device.getName());
// 装机容量
waterPumpRealVo.setInstalledCapacity(device.getInstalledCapacity());
real.setInstalledCapacity(device.getInstalledCapacity());
// 开机状态
int state = this.getPumpState(device,map);
waterPumpRealVo.setState(state);
real.setState(this.getPumpState(device,map));
// 功率因数
double powerFactor = this.getPowerFactor(device,map);
waterPumpRealVo.setPowerFactor(powerFactor);
real.setPowerFactor(this.getPowerFactor(device,map));
// 有功功率
float activePower = this.getActivePower(device,map);
waterPumpRealVo.setActivePower(activePower);
real.setActivePower(this.getActivePower(device,map));
// 无功功率
float reactivePower = this.getReactivePower(device,map);
waterPumpRealVo.setReactivePower(reactivePower);
real.setReactivePower(this.getReactivePower(device,map));
// 电压
double voltage = this.getVoltage(device,map);
waterPumpRealVo.setVoltage(voltage);
real.setVoltage(this.getVoltage(device,map));
// 电流
double current = this.getCurrent(device,map);
waterPumpRealVo.setCurrent(current);
list.add(waterPumpRealVo);
});
real.setCurrent(this.getCurrent(device,map));
return real;
}).collect(Collectors.toList());
redisTemplate.opsForValue().set(loadwaterpump_real_key,list);
}
@ -148,44 +145,48 @@ public class WaterServiceImpl implements IWaterService {
*/
@Override
public void loadWaterPumpTarget(String param) {
List<EminfoAndEmParamVo> valid = this.getValidDeviceList();
if(CollectionUtil.isEmpty(valid)){
// 水利站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.in(StationEntity::getType,HomePageConstant.waterList)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
List<WaterPumpTargetVo> list = new ArrayList<>();
valid.forEach(device->{
WaterPumpTargetVo waterPumpTargetVo = new WaterPumpTargetVo();
waterPumpTargetVo.setDeptId(device.getCreateDept());
waterPumpTargetVo.setDeviceCode(device.getEmCode());
waterPumpTargetVo.setDeptName(device.getName());
// 泵站设备
List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
// 补充站点填报发电量
List<WaterPumpTargetVo> list = this.useFill(stations);
// 站点设备数据统计
if(CollectionUtil.isNotEmpty(devices)){
list.addAll(devices.stream().map(device->{
WaterPumpTargetVo target = new WaterPumpTargetVo();
target.setDeptId(device.getCreateDept());
target.setDeviceCode(device.getEmCode());
target.setDeptName(device.getName());
// 当年用电量
float usrPowerYear = this.getUsrPowerYear(device);
waterPumpTargetVo.setUsrPowerYear(usrPowerYear);
target.setUsrPowerYear(this.getUsrPowerYear(device));
// 当月用电量
float usrPowerMon = this.getUsrPowerMon(device);
waterPumpTargetVo.setUsrPowerMon(usrPowerMon);
target.setUsrPowerMon(this.getUsrPowerMon(device));
// 当日用电量
float usrPowerDay = this.getUsrPowerDay(device);
waterPumpTargetVo.setUsrPowerDay(usrPowerDay);
target.setUsrPowerDay(this.getUsrPowerDay(device));
// 当日机组有功功率
target.setActivePowerVoList(this.getActivePowerVoList(device));
// 近30天用电量
target.setUsrPowerVoList(this.getUsrPowerVoList(device));
// 近3年用电量
target.setUsrYearMap(this.getUsrYearMap(device));
// 月运行次数、时长
WaterRunVo runMon = this.getRunData(device,1);
waterPumpTargetVo.setRunCountMon(runMon.getCount());
waterPumpTargetVo.setRunDurationMon(runMon.getHour());
target.setRunCountMon(runMon.getCount());
target.setRunDurationMon(runMon.getHour());
// 年运行次数、时长
WaterRunVo runYear = this.getRunData(device,0);
waterPumpTargetVo.setRunCountYear(runYear.getCount());
waterPumpTargetVo.setRunDurationYear(runYear.getHour());
// 当日机组有功功率
List<ActivePowerVo> activePowerVoList = this.getActivePowerVoList(device);
waterPumpTargetVo.setActivePowerVoList(activePowerVoList);
// 近30天用电量
List<UsrPowerVo> usrPowerVoList = this.getUsrPowerVoList(device);
waterPumpTargetVo.setUsrPowerVoList(usrPowerVoList);
// 近3年用电量
Map<String,Float> usrYearMap = this.getUsrYearMap(device);
waterPumpTargetVo.setUsrYearMap(usrYearMap);
list.add(waterPumpTargetVo);
});
target.setRunCountYear(runYear.getCount());
target.setRunDurationYear(runYear.getHour());
return target;
}).collect(Collectors.toList()));
}
redisTemplate.opsForValue().set(loadwaterpump_target_key,list);
}
@ -231,22 +232,19 @@ public class WaterServiceImpl implements IWaterService {
}
/**
* 获取监测点位是否配置
* @param instanceCode
* 泵站设备
* @param stations
* @return
*/
private boolean getSetting(String instanceCode) {
// 获取设备监测点位:未配置监测点位不进行统计设备
List<MultiAnalyzeCodePO> list = new ArrayList<>();
MultiAnalyzeCodePO po = new MultiAnalyzeCodePO();
po.setDeviceCode(instanceCode);
po.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL));
list.add(po);
R<List<AnalyzeCodeBySignagesVO>> result = analyseDataSearchClient.getAnalyzeCodeBySignages(list);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return true;
private List<EminfoAndEmParamVo> pumpDevices(List<Long> stations){
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}
List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList();
if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
return false;
return devices.stream().filter(device->stations.contains(device.getCreateDept())).collect(Collectors.toList());
}
/**
@ -261,7 +259,7 @@ public class WaterServiceImpl implements IWaterService {
List<String> signages = Collections.singletonList(signage);
realData.setSignages(signages);
// 调用fegin接口查询实时数据
R<List<FieldsData>> R = null;
R<List<FieldsData>> R;
try {
R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData);
} catch (Exception e) {
@ -279,14 +277,10 @@ public class WaterServiceImpl implements IWaterService {
if(StringUtil.isBlank(time)){
return 0.0;
}
try{
Date date = sdf.parse(time);
Date date = DateUtil.parse(time,DateUtil.DATETIME_FORMAT);
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){
return 0.0;
}
}catch (ParseException e){
return 0.0;
}
return Double.parseDouble(R.getData().get(0).getValue());
}
@ -297,7 +291,7 @@ public class WaterServiceImpl implements IWaterService {
* @return
*/
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) {
LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), dtf);
LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER);
LocalDateTime endTime = LocalDateTime.now();
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
@ -334,29 +328,6 @@ public class WaterServiceImpl implements IWaterService {
}
/**
* 获取有效设备
* @return
*/
private List<EminfoAndEmParamVo> getValidDeviceList() {
// 水利站点(All)
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, HomePageConstant.waterList, null);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
// 获取所有设备
List<EminfoAndEmParamVo> deviceList = maintenanceTaskService.getEmInfoList();
if(CollectionUtil.isEmpty(deviceList)){
return null;
}
// 有效泵租设备
List<Long> deptIdList = stationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isEmpty(deptIdList)){
return null;
}
return deviceList.stream().filter(o->deptIdList.contains(o.getCreateDept())).collect(Collectors.toList());
}
/**
* 获取有效站点模型
* @return
*/
@ -573,11 +544,11 @@ public class WaterServiceImpl implements IWaterService {
*/
private float getUsrPowerYear(EminfoAndEmParamVo device) {
Calendar calendar = Calendar.getInstance();
String end = sdf.format(calendar.getTime());
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.setTime(new Date());
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String start = df.format(calendar.getTime());
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
// 当年用电量
return analyseDataService.periodTargetFloat(start,end,6,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
}
@ -794,43 +765,87 @@ public class WaterServiceImpl implements IWaterService {
PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE));
generate.setPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
generate.setPower(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
return generate;
}).collect(Collectors.toMap(PowerMonthVo::getStrMonth,PowerMonthVo::getPower));
}
/**
* 获取填报用电量
* @param stations
* @return
*/
private List<WaterPumpTargetVo> useFill(List<StationEntity> stations) {
Calendar calendar = Calendar.getInstance();
String day = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
String mon = DateUtil.format(calendar.getTime(),"yyyy-MM");
String year = String.valueOf(calendar.get(Calendar.YEAR));
return stations.stream().map(station ->{
WaterPumpTargetVo target = new WaterPumpTargetVo();
target.setDeptId(station.getRefDept());
target.setDeptName(station.getName());
// 月运行次数、时长
target.setRunCountMon(0);
target.setRunDurationMon(0.0);
// 年运行次数、时长
target.setRunCountYear(0);
target.setRunDurationYear(0.0);
// 当年用电量
target.setUsrPowerYear(useService.use(year,station.getCode()));
// 当月用电量
target.setUsrPowerMon(useService.use(mon,station.getCode()));
// 当日用电量
target.setUsrPowerDay(useService.use(day,station.getCode()));
if(StationConstants.DATA_ORIGIN_FILL.equals(station.getDataOrigin())){
// 30天用电量
target.setUsrPowerVoList(useService.use30Day(day,station.getCode()));
}
// 近3年用电量
target.setUsrYearMap(this.useThreeYear(station.getCode()));
return target;
}).collect(Collectors.toList());
}
/**
* 填报近3年发电量
* @param station
* @return
*/
private Map<String, Float> useThreeYear(String station) {
// 开始时间
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12);
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String end = DateUtil.format(calendar.getTime(),"yyyy-MM");
// 结束日期
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 3);
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
return useService.generateThreeYear(start,end,station);
}
/**
* 水利首页-指标数据
* @param deptId
* @return
*/
@Override
public WaterConservancyVo waterConservancy(Long deptId) {
//根据用户权限获取机构
R<List<Dept>> R = sysClient.getDeptByCurrentUser();
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
return null;
}
// 获取水利站点
List<StationEntity> stationList = stationService.getStationList(R.getData(),deptId,HomePageConstant.waterList,HomePageConstant.HYDROPOWER_SERVETYPE);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
// 站点归属机构集合
List<Long> deptList = stationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isEmpty(deptList)){
return null;
// 查询水利站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, HomePageConstant.waterList, HomePageConstant.HYDROPOWER_SERVETYPE);
if (CollectionUtil.isEmpty(stations)) {
return new WaterConservancyVo();
}
WaterConservancyVo response = new WaterConservancyVo();
// 查询指标标题机构
Dept title = this.getTitleDetp(R.getData(),deptId);
Dept title = this.getTitleDetp(deptId);
if(ObjectUtil.isNotEmpty(title)){
response.setDepartId(title.getId());
response.setDepartName(title.getDeptName());
}
response.setWaterStationCount((int) stationList.stream().filter(o->HomePageConstant.PUMPING.equals(o.getType())).count());
response.setSluiceGateCount((int) stationList.stream().filter(o->HomePageConstant.GATE.equals(o.getType())).count());
response.setWaterStationCount((int) stations.stream().filter(o->HomePageConstant.PUMPING.equals(o.getType())).count());
response.setSluiceGateCount((int) stations.stream().filter(o->HomePageConstant.GATE.equals(o.getType())).count());
response.setWaterInstall(0.0);
response.setWaterPower(0.0);
response.setKWhYear(0f);
@ -838,30 +853,24 @@ public class WaterServiceImpl implements IWaterService {
response.setKWhDay(0f);
// 获取设备实时数据
List<WaterPumpRealVo> list = (List<WaterPumpRealVo>) redisTemplate.opsForValue().get(loadwaterpump_real_key);
if(CollectionUtil.isEmpty(list)){
return response;
}
if(CollectionUtil.isNotEmpty(list)){
// 获取站点机构有效设备
List<WaterPumpRealVo> valid = list.stream().filter(o->deptList.contains(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(valid)){
return response;
}
List<WaterPumpRealVo> valid = list.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(valid)){
// 装机容量
double waterInstall = valid.stream().mapToDouble(WaterPumpRealVo::getInstalledCapacity).sum();
response.setWaterInstall(waterInstall);
// 有功功率
double waterPower = valid.stream().mapToDouble(WaterPumpRealVo::getActivePower).sum();
response.setWaterPower(waterPower);
}
}
// 获取设备指标数据
List<WaterPumpTargetVo> targetList = (List<WaterPumpTargetVo>) redisTemplate.opsForValue().get(loadwaterpump_target_key);
if(CollectionUtil.isEmpty(targetList)){
return response;
}
if(CollectionUtil.isNotEmpty(targetList)){
// 获取站点机构有效设备
List<WaterPumpTargetVo> validTarget = targetList.stream().filter(o->deptList.contains(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(valid)){
return response;
}
List<WaterPumpTargetVo> validTarget = targetList.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(validTarget)){
// 年用电量
double kwhYear = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerYear).sum();
response.setKWhYear((float) kwhYear);
@ -871,6 +880,8 @@ public class WaterServiceImpl implements IWaterService {
// 日用电量
double kwhDay = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerDay).sum();
response.setKWhDay((float) kwhDay);
}
}
return response;
}
@ -888,7 +899,7 @@ public class WaterServiceImpl implements IWaterService {
return null;
}
// 获取站点编码集合
List<String> codes = map.entrySet().stream().map(o-> o.getValue().get(0).getCode()).collect(Collectors.toList());
List<String> codes = map.values().stream().map(stationEntities -> stationEntities.get(0).getCode()).collect(Collectors.toList());
// 获取实时天气
Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather(codes);
// 获取七天天气
@ -977,7 +988,7 @@ public class WaterServiceImpl implements IWaterService {
* @return
*/
private List<StationEntity> getStationList(Map<Dept, List<StationEntity>> map) {
return map.values().stream().collect(Collectors.toList()).get(0);
return new ArrayList<>(map.values()).get(0);
}
/**
@ -1061,7 +1072,7 @@ public class WaterServiceImpl implements IWaterService {
if(CollectionUtil.isEmpty(stationList)){
return null;
}
List<String> codeList = stationList.stream().filter(o->StringUtil.isNotBlank(o.getCode())).map(StationEntity::getCode).collect(Collectors.toList());
List<String> codeList = stationList.stream().map(StationEntity::getCode).filter(StringUtil::isNotBlank).collect(Collectors.toList());
if(CollectionUtil.isEmpty(codeList)){
return null;
}
@ -1154,16 +1165,17 @@ public class WaterServiceImpl implements IWaterService {
* @return
*/
@Override
public Dept getTitleDetp(List<Dept> authList, Long deptId) {
public Dept getTitleDetp(Long deptId) {
R<List<Dept>> depts = sysClient.getDeptByCurrentUser();
if(null == deptId){
// 最小类型机构
Dept dept = authList.stream().min(Comparator.comparing(Dept::getDeptCategory)).orElse(null);
Dept dept = depts.getData().stream().min(Comparator.comparing(Dept::getDeptCategory)).orElse(null);
if(ObjectUtil.isEmpty(dept)){
return null;
}
return dept;
}
List<Dept> list = authList.stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList());
List<Dept> list = depts.getData().stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return null;
}
@ -1289,12 +1301,12 @@ public class WaterServiceImpl implements IWaterService {
response.setUsePowerMon((float) kwhMon);
// 月运行时长
Optional<WaterPumpTargetVo> waterPumpTargetVoOptional = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationMon));
double monRunTime = waterPumpTargetVoOptional.isPresent() ? waterPumpTargetVoOptional.map(WaterPumpTargetVo::getRunDurationMon).orElse(0.0) : 0.0;
double monRunTime = waterPumpTargetVoOptional.map(WaterPumpTargetVo::getRunDurationMon).orElse(0.0);
//double monRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationMon)).get().getRunDurationMon();
response.setRunDurationMon(monRunTime);
// 年运行时长
Optional<WaterPumpTargetVo> optionalWaterPumpTargetVo = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear));
double yearRunTime = optionalWaterPumpTargetVo.isPresent() ? optionalWaterPumpTargetVo.map(WaterPumpTargetVo::getRunDurationYear).orElse(0.0) : 0.0;
double yearRunTime = optionalWaterPumpTargetVo.map(WaterPumpTargetVo::getRunDurationYear).orElse(0.0);
//double yearRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear)).get().getRunDurationYear();
response.setRunDurationYear(yearRunTime);
// 水位曲线/年用电量
@ -1496,26 +1508,6 @@ public class WaterServiceImpl implements IWaterService {
}
/**
* 获取近30天集合
* @return
*/
private List<String> getRecent30Day() {
List<String> list = new ArrayList<>();
// 开始日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
list.add(df.format(calendar.getTime()));
// 获取日期之间的月
int i = 0;
while (i < 30) {
calendar.add(Calendar.DATE, - 1);
list.add(df.format(calendar.getTime()));
i++;
}
return list.stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
}
/**
* 闸门列表
* @param deptId
* @return
@ -1536,7 +1528,7 @@ public class WaterServiceImpl implements IWaterService {
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
return null;
}
Dept title = this.getTitleDetp(R.getData(),deptId);
Dept title = this.getTitleDetp(deptId);
if(ObjectUtil.isEmpty(title)){
return null;
}

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

@ -3,16 +3,13 @@ package com.hnac.hzims.operational.maintenance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.vo.RegularWorkVO;
import com.hnac.hzims.operational.report.vo.MaintenanceReportVO;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.operational.maintenance.vo.RegularWorkVO;
import com.hnac.hzims.operational.report.vo.MaintenanceReportVO;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo;
import com.hnac.hzims.vo.SafeCheckStatisticVO;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskListQuery;
import com.hnac.hzinfo.inspect.areamonthly.vo.TaskVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -20,7 +17,6 @@ import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

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

@ -319,7 +319,7 @@ public class ImsDeptServiceImpl extends ServiceImpl<ImsDeptMapper, ImsDeptEntity
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){
return null;
}
Dept dept = waterService.getTitleDetp(R.getData(),deptId);
Dept dept = waterService.getTitleDetp(deptId);
if(ObjectUtil.isEmpty(dept)){
return null;
}

1
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/SafeproductApplication.java

@ -35,6 +35,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@ComponentScan(basePackages = {"com.hnac.*"})
public class SafeproductApplication {
public static void main(String[] args) {
BladeApplication.run(Constants.APP_NAME, SafeproductApplication.class, args);
}

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CheckCompanyController.java

@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept;
@ -76,7 +77,7 @@ public class CheckCompanyController extends BladeController {
@GetMapping("/list")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:startDate,endDate,status")
public R<IPage<CheckCompanyVo>> list(CheckCompanyEntity req, Query query) {
public R<BladePage<CheckCompanyVo>> list(CheckCompanyEntity req, Query query) {
return CheckCompanyService.pageCondition(req, query);
}

27
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/CheckMonthController.java

@ -1,6 +1,7 @@
package com.hnac.hzims.safeproduct.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.safeproduct.dto.CheckMonthDTO;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
@ -11,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept;
@ -108,4 +110,29 @@ public class CheckMonthController extends BladeController {
return R.data(page);
}
/**
* 分页查询安全生产会议次数
*/
@GetMapping("/listconferenceScope/{page}/{size}")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:month,status,createDept")
public R<BladePage<CheckMonthVo>> listconferenceScope(
@PathVariable Long page, @PathVariable Long size,
CheckMonthEntity req) {
Page<CheckMonthEntity> objectPage = new Page<>(page, size);
R<IPage<CheckMonthVo>> pageR = checkMonthlyService.listconferenceScope(req,objectPage);
IPage<CheckMonthVo> pages = pageR.getData();
pages.getRecords().forEach(monthlyVo -> {
R<Dept> deptR = sysClient.getDept(monthlyVo.getCreateDept());
if (deptR.isSuccess()) {
monthlyVo.setDeptName(Optional.ofNullable(deptR.getData()).map(Dept::getDeptName).orElse(null));
}
});
BladePage<CheckMonthVo> bladePage = BladePage.of(pages);
return R.data(bladePage);
}
}

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/SafeEquipmentTrialController.java

@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
@ -58,7 +59,7 @@ public class SafeEquipmentTrialController extends BladeController {
@ApiOperation(value = "分页", notes = "查询条件:createDept,fileName,startTime,endTime")
@OperationAnnotation(title = "设备试验",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "分页条件")
public R<IPage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) {
public R<BladePage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) {
return service.pageCondition(safeEquipmentTrialDTO, query);
}

9
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.java

@ -2,7 +2,9 @@ package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.safeproduct.vo.CheckMonthVo;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import org.springblade.core.mp.support.Query;
@ -21,4 +23,11 @@ public interface CheckMonthMapper extends UserDataScopeBaseMapper<CheckMonthEnti
*/
IPage<CheckMonthEntity> pageNotDataScope(IPage page, @Param("req") CheckMonthEntity req);
/**
* 分页查询安全生产会议次数
* @param objectPage
* @param req
* @return
*/
IPage<CheckMonthEntity> listconferenceScope(IPage<CheckMonthEntity> objectPage, @Param("req") CheckMonthEntity req);
}

27
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckMonthMapper.xml

@ -15,5 +15,32 @@
</if>
order by CREATE_TIME desc
</select>
<!-- 分页查询安全生产会议次数-->
<select id="listconferenceScope" resultType="com.hnac.hzims.safeproduct.entity.CheckMonthEntity">
select p.* from hzims_safe_check_month p LEFT JOIN
hzims_safe_check_item_instance c
on p.id = c.CHECK_ID
<where>
<if test="req.itemName!=null and req.itemName!=''">
c.item = #{req.itemName}
</if>
<if test="req.month!=null and req.month!=''">
AND p.MONTH = #{req.month}
</if>
<if test="req.status!=null">
AND p.STATUS = #{req.status}
</if>
<if test="req.createDept!=null">
AND p.CREATE_DEPT = #{req.createDept}
</if>
<if test="req.areaId !=null">
AND p.CREATE_DEPT = #{req.areaId}
</if>
<if test="req.yearMonth !=null">
AND p.month = #{req.yearMonth}
</if>
</where>
</select>
</mapper>

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICheckCompanyService.java

@ -8,6 +8,7 @@ import com.hnac.hzims.safeproduct.entity.CheckQuarterEntity;
import com.hnac.hzims.safeproduct.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.vo.CheckQuarterVo;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -24,6 +25,6 @@ public interface ICheckCompanyService extends BaseService<CheckCompanyEntity> {
R<CheckCompanyVo> detail(Long id);
R<IPage<CheckCompanyVo>> pageCondition(CheckCompanyEntity req, Query query);
R<BladePage<CheckCompanyVo>> pageCondition(CheckCompanyEntity req, Query query);
}

9
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ICheckMonthService.java

@ -1,6 +1,7 @@
package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.safeproduct.dto.CheckMonthDTO;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.safeproduct.vo.CheckMonthVo;
@ -25,4 +26,12 @@ public interface ICheckMonthService extends BaseService<CheckMonthEntity> {
R<IPage<CheckMonthVo>> pageNotDataScope(CheckMonthEntity req, Query query);
/**
* 分页查询安全生产会议次数
* @param req
* @param objectPage
* @return
*/
R<IPage<CheckMonthVo>> listconferenceScope(CheckMonthEntity req, Page<CheckMonthEntity> objectPage);
}

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/SafeEquipmentTrialService.java

@ -6,6 +6,7 @@ import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity;
import com.hnac.hzims.safeproduct.vo.SafeEquipmentTrialVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -16,7 +17,7 @@ import java.util.List;
*/
public interface SafeEquipmentTrialService extends BaseService<SafeEquipmentTrialEntity> {
R<IPage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query);
R<BladePage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query);
int getSafeEquipmentCount(SafeEquipmentTrialDTO dto);

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

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.hnac.hzims.safeproduct.dto.CheckCompanyDTO;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckItemEntity;
@ -15,7 +16,9 @@ import com.hnac.hzims.safeproduct.vo.CheckCompanyVo;
import com.hnac.hzims.safeproduct.wrapper.CheckCompanyWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -128,7 +131,7 @@ public class CheckCompanyServiceImpl extends BaseServiceImpl<CheckCompanyMapper,
}
@Override
public R<IPage<CheckCompanyVo>> pageCondition(CheckCompanyEntity req, Query query) {
public R<BladePage<CheckCompanyVo>> pageCondition(CheckCompanyEntity req, Query query) {
Wrapper<CheckCompanyEntity> queryWrapper = new LambdaQueryWrapper<CheckCompanyEntity>() {{
orderByDesc(CheckCompanyEntity::getCreateTime);
if (ObjectUtil.isNotEmpty(req.getStartTime())) {
@ -140,9 +143,14 @@ public class CheckCompanyServiceImpl extends BaseServiceImpl<CheckCompanyMapper,
if (ObjectUtil.isNotEmpty(req.getStatus())) {
eq(CheckCompanyEntity::getStatus, req.getStatus());
}
eq(StringUtils.isNotBlank(req.getAreaId()), BaseEntity::getCreateDept, req.getAreaId());
apply(req.getYearMonth() != null, "date_format(start_time ,'%Y-%m') = '"
+ req.getYearMonth() + "'" + "and date_format(end_time,'%Y-%m') = '" + req.getYearMonth() + "'");
}};
IPage page = page(Condition.getPage(query), queryWrapper);
page.setRecords(CheckCompanyWrapper.build().listVO(page.getRecords()));
return R.data(page);
BladePage bladePage = BladePage.of(page);
return R.data(bladePage);
}
}

14
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckMonthServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.safeproduct.dto.CheckMonthDTO;
import com.hnac.hzims.safeproduct.entity.CheckItemEntity;
import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity;
@ -140,4 +141,17 @@ public class CheckMonthServiceImpl extends BaseServiceImpl<CheckMonthMapper, Che
page.setRecords(CheckMonthWrapper.build().listVO(page.getRecords()));
return R.data(page);
}
/**
* 分页查询安全生产会议次数
* @param req
* @param objectPage
* @return
*/
@Override
public R<IPage<CheckMonthVo>> listconferenceScope(CheckMonthEntity req, Page<CheckMonthEntity> objectPage) {
IPage page = checkMonthMapper.listconferenceScope(objectPage, req);
page.setRecords(CheckMonthWrapper.build().listVO(page.getRecords()));
return R.data(page);
}
}

14
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafeEquipmentTrialServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.safeproduct.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentDTO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity;
@ -11,6 +12,7 @@ import com.hnac.hzims.safeproduct.vo.SafeEquipmentTrialVO;
import com.hnac.hzims.safeproduct.wrapper.SafeEquipmentTrialWrapper;
import lombok.RequiredArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
@ -28,12 +30,13 @@ public class SafeEquipmentTrialServiceImpl extends BaseServiceImpl<SafeEquipment
/**
* 分页查询
*
* @param param
* @param query
* @return
*/
@Override
public R<IPage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO param, Query query) {
public R<BladePage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO param, Query query) {
QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{
if (Optional.ofNullable(param.getCreateDept()).isPresent()) {
eq("create_dept", param.getCreateDept());
@ -47,16 +50,22 @@ public class SafeEquipmentTrialServiceImpl extends BaseServiceImpl<SafeEquipment
if (Optional.ofNullable(param.getEndTime()).isPresent()) {
lt("create_time", param.getEndTime());
}
lambda().eq(StringUtils.isNotBlank(param.getAreaId()), SafeEquipmentTrialEntity::getCreateDept,
param.getAreaId());
eq(param.getYearMonth() != null, "date_format(CREATE_TIME,'%Y-%m)", param.getYearMonth());
orderByDesc("create_time");
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
List list = SafeEquipmentTrialWrapper.build().listVO(pages.getRecords());
return R.data(pages.setRecords(list));
pages.setRecords(list);
BladePage bladePage = BladePage.of(pages);
return R.data(bladePage);
}
/**
* 获取设备试验次数
*
* @param param
* @return
*/
@ -85,6 +94,7 @@ public class SafeEquipmentTrialServiceImpl extends BaseServiceImpl<SafeEquipment
/**
* 查询设备列表
*
* @param entity
* @return
*/

Loading…
Cancel
Save