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. 44
      hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
  34. 244
      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. 21
      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. 1707
      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. 13
      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. 122
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java
  67. 90
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  68. 409
      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. 386
      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. 206
      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. 162
      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 ABNORMAL_STATUS = "1";
String TYPE_NAMES[] = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"}; String[] TYPE_NAMES = {"默认", "系统", "告警", "故障", "用户操作", "遥测越限", "遥信变位", "注册信息", "信息提示", "设备巡检", "遥控操作", "遥测越限恢复","未定义","通讯中断","数据异常"};
/**处理、延后、误报*/ /**处理、延后、误报*/
List<Long> HANDLE_WAY = Arrays.asList(1L,2L,3L,4L); 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 * 区域Id
*/ */
@TableField(exist = false)
private String areaId; private String areaId;
/** /**
* 年月 * 年月
*/ */
@TableField(exist = false)
private YearMonth yearMonth; 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; private String dataOrigin;
@ApiModelProperty("发电量") @ApiModelProperty("发电量")
private BigDecimal generate; private Double generate;
@ApiModelProperty("填报月份") @ApiModelProperty("填报月份")
private String fillDate; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
/**
* @author usj
*/
@EqualsAndHashCode(callSuper = true)
@Data @Data
@TableName("hzims_fill_use") @TableName("hzims_fill_use")
@ApiModel(value="UseEntity", description="保存用电量填报数据对象") @ApiModel(value="UseEntity", description="保存用电量填报数据对象")
@ -26,7 +31,7 @@ public class UseEntity extends TenantEntity implements Serializable {
private String dataOrigin; private String dataOrigin;
@ApiModelProperty("发电量") @ApiModelProperty("发电量")
private BigDecimal use; private Double employ;
@ApiModelProperty("填报月份") @ApiModelProperty("填报月份")
private String fillDate; 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; import java.util.Date;
/**
* @author ysj
* @date 2023/04/10 11:16:07
* @version 4.0.0
*/
@Data @Data
public class QueryVo{ public class QueryVo{
@ -19,4 +24,7 @@ public class QueryVo{
@ApiModelProperty("设备编号") @ApiModelProperty("设备编号")
private String deviceCode; 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; 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 io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -10,65 +12,85 @@ import lombok.Data;
public class AreaMonthReportVo { public class AreaMonthReportVo {
@ApiModelProperty(value = "区域Id") @ApiModelProperty(value = "区域Id")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long areaId; private Long areaId;
@ApiModelProperty(value = "区域名称") @ApiModelProperty(value = "区域名称")
private String areaName; private String areaName;
@ApiModelProperty(value = "计划发电量") @ApiModelProperty(value = "计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float planPower; private Float planPower;
@ApiModelProperty(value = "实际发电量") @ApiModelProperty(value = "实际发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float actualPower; private Float actualPower;
@ApiModelProperty(value = "发电完成率") @ApiModelProperty(value = "发电完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerFinishRate; private Double powerFinishRate;
@ApiModelProperty(value = "同比") @ApiModelProperty(value = "同比")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double comparePowerRate; private Double comparePowerRate;
@ApiModelProperty(value = "发电计划预测") @ApiModelProperty(value = "发电计划预测")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double predictPlanPower; private Double predictPlanPower;
@ApiModelProperty(value = "操作票") @ApiModelProperty(value = "操作票")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer operate; private Integer operate;
@ApiModelProperty(value = "操作票合格率") @ApiModelProperty(value = "操作票合格率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double operaQualifyRate; private Double operaQualifyRate;
@ApiModelProperty(value = "工作票") @ApiModelProperty(value = "工作票")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer work; private Integer work;
@ApiModelProperty(value = "工作票合格率") @ApiModelProperty(value = "工作票合格率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double workQualifyRate; private Double workQualifyRate;
@ApiModelProperty(value = "日常维护") @ApiModelProperty(value = "日常维护")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer routineMaintenance; private Integer routineMaintenance;
@ApiModelProperty(value = "巡检任务") @ApiModelProperty(value = "巡检任务")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer inspect; private Integer inspect;
@ApiModelProperty(value = "缺陷数") @ApiModelProperty(value = "缺陷数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer defect; private Integer defect;
@ApiModelProperty(value = "消缺率") @ApiModelProperty(value = "消缺率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double defectRate; private Double defectRate;
@ApiModelProperty(value = "检修任务数量") @ApiModelProperty(value = "检修任务数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer maintenanceTasks; private Integer maintenanceTasks;
@ApiModelProperty(value = "安全生产会议次数") @ApiModelProperty(value = "安全生产会议次数")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer safetyMeeting; private Integer safetyMeeting;
@ApiModelProperty(value = "月度自查报告") @ApiModelProperty(value = "月度自查报告")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer selfReport; private Integer selfReport;
@ApiModelProperty(value = "设备试验") @ApiModelProperty(value = "设备试验")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer deviceTry; private Integer deviceTry;
@ApiModelProperty(value = "技能培训") @ApiModelProperty(value = "技能培训")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer skillTrainy; private Integer skillTrainy;
@ApiModelProperty(value = "安全大检查") @ApiModelProperty(value = "安全大检查")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer securityCheck; 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; 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.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -12,8 +14,10 @@ public class GenerationPowerVo {
private String date; private String date;
@ApiModelProperty(value = "发电量") @ApiModelProperty(value = "发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float generate; private Float generate;
@ApiModelProperty(value = "功率·") @ApiModelProperty(value = "功率·")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float load; 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; private Double dc_voltage_twelve;
@ApiModelProperty(value = "流电流1") @ApiModelProperty(value = "流电流1")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_one; private Double series_one;
@ApiModelProperty(value = "流电流2") @ApiModelProperty(value = "流电流2")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_two; private Double series_two;
@ApiModelProperty(value = "流电流3") @ApiModelProperty(value = "流电流3")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_three; private Double series_three;
@ApiModelProperty(value = "流电流4") @ApiModelProperty(value = "流电流4")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_four; private Double series_four;
@ApiModelProperty(value = "流电流5") @ApiModelProperty(value = "流电流5")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_five; private Double series_five;
@ApiModelProperty(value = "流电流6") @ApiModelProperty(value = "流电流6")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_six; private Double series_six;
@ApiModelProperty(value = "流电流7") @ApiModelProperty(value = "流电流7")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_seven; private Double series_seven;
@ApiModelProperty(value = "流电流8") @ApiModelProperty(value = "流电流8")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_eight; private Double series_eight;
@ApiModelProperty(value = "流电流9") @ApiModelProperty(value = "流电流9")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_nine; private Double series_nine;
@ApiModelProperty(value = "流电流10") @ApiModelProperty(value = "流电流10")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_ten; private Double series_ten;
@ApiModelProperty(value = "流电流11") @ApiModelProperty(value = "流电流11")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_eleven; private Double series_eleven;
@ApiModelProperty(value = "流电流12") @ApiModelProperty(value = "流电流12")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_twelve; private Double series_twelve;
@ApiModelProperty(value = "直流电压1")
@ApiModelProperty(value = "串流电压1")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_one; private Double se_voltage_one;
@ApiModelProperty(value = "流电压2") @ApiModelProperty(value = "流电压2")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_two; private Double se_voltage_two;
@ApiModelProperty(value = "流电压3") @ApiModelProperty(value = "流电压3")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_three; private Double se_voltage_three;
@ApiModelProperty(value = "流电压4") @ApiModelProperty(value = "流电压4")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_four; private Double se_voltage_four;
@ApiModelProperty(value = "流电压5") @ApiModelProperty(value = "流电压5")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_five; private Double se_voltage_five;
@ApiModelProperty(value = "流电压6") @ApiModelProperty(value = "流电压6")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_six; private Double se_voltage_six;
@ApiModelProperty(value = "流电压7") @ApiModelProperty(value = "流电压7")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_seven; private Double se_voltage_seven;
@ApiModelProperty(value = "流电压8") @ApiModelProperty(value = "流电压8")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_eight; private Double se_voltage_eight;
@ApiModelProperty(value = "流电压9") @ApiModelProperty(value = "流电压9")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_nine; private Double se_voltage_nine;
@ApiModelProperty(value = "流电压10") @ApiModelProperty(value = "流电压10")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_ten; private Double se_voltage_ten;
@ApiModelProperty(value = "流电压11") @ApiModelProperty(value = "流电压11")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_eleven; private Double se_voltage_eleven;
@ApiModelProperty(value = "流电压12") @ApiModelProperty(value = "流电压12")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_twelve; 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; private String deviceName;
@ApiModelProperty(value = "当日运行时长") @ApiModelProperty(value = "当日运行时长")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double runHours; private Double runHours;
@ApiModelProperty(value = "年发电量: kWh") @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 TASK_VALUE_IMS_DEPT_CREATE = "imsDeptCreate";
String DATA_ORIGIN_FILL = "1";
enum DeptCategoryEnum { enum DeptCategoryEnum {
STATION(4,"站点") 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.MessageConstants;
import com.hnac.hzims.message.req.SmsReq; import com.hnac.hzims.message.req.SmsReq;
import org.springframework.cloud.openfeign.FeignClient; 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; 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 com.hnac.hzims.message.dto.WsPushDto;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; 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 type;
/**
* 消息类型名称
*/
private String typeName;
private List<MessagePushRecordVo> messagePushRecordList; 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 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; 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 Integer status;
/** /**
* 状态名称 * 状态名称
*/ */
private String statusName; 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 lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.YearMonth;
import java.util.List; import java.util.List;
@ -36,4 +37,13 @@ public class SafeEquipmentTrialDTO extends SafeEquipmentTrialEntity {
@ApiModelProperty("创建部门集合") @ApiModelProperty("创建部门集合")
private List<Long> deptList; 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; package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -11,6 +12,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.YearMonth;
/** /**
* Created by Sam Huang 2022/5/6 8:16 * Created by Sam Huang 2022/5/6 8:16
@ -47,4 +49,15 @@ public class CheckCompanyEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "检查机构") @ApiModelProperty(value = "检查机构")
private String orgId; 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; package com.hnac.hzims.safeproduct.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer; import com.fasterxml.jackson.databind.ser.std.NullSerializer;
@ -10,6 +11,7 @@ import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable; import java.io.Serializable;
import java.time.YearMonth;
/** /**
* Created by Sam Huang 2022/5/6 8:16 * Created by Sam Huang 2022/5/6 8:16
@ -32,4 +34,27 @@ public class CheckMonthEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "核查建议") @ApiModelProperty(value = "核查建议")
private String suggest; 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> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-core-boot</artifactId> <artifactId>blade-core-boot</artifactId>
<exclusions>
<exclusion>
<groupId>org.springblade</groupId>
<artifactId>blade-starter-redis</artifactId>
</exclusion>
</exclusions>
</dependency> </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> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-core-cloud</artifactId> <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); List<PushStatTypeVo> pushStat(@Param("vo") MessagePushRecordEntityVo vo);
/**
* 查询出状态信息
* @return
*/
List<Integer> selectByStatus();
} }

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

@ -5,28 +5,27 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hnac.hzims.message.vo.msgpushrecord.UserPushStatTypeVo"> <resultMap id="BaseResultMap" type="com.hnac.hzims.message.vo.msgpushrecord.UserPushStatTypeVo">
<result column="pusherName" property="pusherName"/> <result column="pusherName" property="pusherName"/>
<collection property="pushStatList" ofType="com.hnac.hzims.message.vo.msgpushrecord.UserPushStatVo" > <collection property="pushStatList" ofType="com.hnac.hzims.message.vo.msgpushrecord.UserPushStatVo">
<result column="pusherName" property="pusherName"/> <result column="pusherName" property="pusherName"/>
<result column="businessClassify" property="businessClassify"/> <result column="businessClassify" property="businessClassify"/>
<result column="count" property="power"/> <result column="count" property="power"/>
</collection> </collection>
</resultMap> </resultMap>
<!-- 根据type统计数量--> <!-- 根据type统计数量-->
<select id="smsPushStat" resultType="com.hnac.hzims.message.vo.msgpushrecord.MessagePushRecordVo"> <select id="smsPushStat" resultType="com.hnac.hzims.message.vo.msgpushrecord.MessagePushRecordVo">
select count(1) power, select count(1) power,
date_format(PLAN_TIME, '%Y-%m') strMonth, date_format(PLAN_TIME, '%Y-%m') strMonth,
type type
from hzims_message_push_record from hzims_message_push_record
<where> <where>
IS_DELETED = 0 IS_DELETED = 0
and PLAN_TIME BETWEEN DATE_SUB(NOW(), INTERVAL 12 MONTH) AND NOW()
<if test="vo.stationCode != null and vo.stationCode != ''"> <if test="vo.stationCode != null and vo.stationCode != ''">
and and
STATION_CODE = #{vo.stationCode} DEPT_ID = #{vo.stationCode}
</if> </if>
</where> </where>
group by strMonth, TYPE group by strMonth, TYPE
@ -41,7 +40,7 @@
IS_DELETED = 0 IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''"> <if test="vo.stationCode != null and vo.stationCode != ''">
and and
STATION_CODE = #{vo.stationCode} DEPT_ID = #{vo.stationCode}
</if> </if>
<if test="vo.yearMonth != null"> <if test="vo.yearMonth != null">
and and
@ -57,15 +56,15 @@
<!-- 人员发送统计--> <!-- 人员发送统计-->
<select id="userPushStat" resultMap="BaseResultMap"> <select id="userPushStat" resultMap="BaseResultMap">
select PUSHER_NAME pusherName, select PUSHER_NAME pusherName,
BUSINESS_CLASSIFY businessClassify, BUSINESS_CLASSIFY businessClassify,
count(1) count count(1) count
from hzims_message_push_record from hzims_message_push_record
<where> <where>
IS_DELETED = 0 IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''"> <if test="vo.stationCode != null and vo.stationCode != ''">
and and
STATION_CODE = #{vo.stationCode} DEPT_ID = #{vo.stationCode}
</if> </if>
<if test="vo.yearMonth != null"> <if test="vo.yearMonth != null">
and and
@ -80,11 +79,10 @@
</select> </select>
<!-- 推送成功失败统计--> <!-- 推送成功失败统计-->
<resultMap id="PushStatResultMap" type="com.hnac.hzims.message.vo.msgpushrecord.PushStatTypeVo"> <resultMap id="PushStatResultMap" type="com.hnac.hzims.message.vo.msgpushrecord.PushStatTypeVo">
<result column="businessClassify" property="businessClassify"/> <result column="businessClassify" property="businessClassify"/>
<collection property="pushStatList" ofType="com.hnac.hzims.message.vo.msgpushrecord.PushStatVo" > <collection property="pushStatList" ofType="com.hnac.hzims.message.vo.msgpushrecord.PushStatVo">
<result column="businessClassify" property="businessClassify"/> <result column="businessClassify" property="businessClassify"/>
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="count" property="power"/> <result column="count" property="power"/>
@ -93,13 +91,13 @@
<select id="pushStat" resultMap="PushStatResultMap"> <select id="pushStat" resultMap="PushStatResultMap">
select BUSINESS_CLASSIFY businessClassify,STATUS status,count(1) count select BUSINESS_CLASSIFY businessClassify,STATUS status,count(1) count
from hzims_message_push_record from hzims_message_push_record
<where> <where>
IS_DELETED = 0 IS_DELETED = 0
<if test="vo.stationCode != null and vo.stationCode != ''"> <if test="vo.stationCode != null and vo.stationCode != ''">
and and
STATION_CODE = #{vo.stationCode} DEPT_ID = #{vo.stationCode}
</if> </if>
<if test="vo.yearMonth != null"> <if test="vo.yearMonth != null">
and and
@ -110,6 +108,12 @@
type = #{vo.type} type = #{vo.type}
</if> </if>
</where> </where>
group by businessClassify,status group by businessClassify,status
</select>
<!-- 查询出状态信息-->
<select id="selectByStatus" resultType="java.lang.Integer">
select STATUS
from hzims_message_push_record
group by STATUS
</select> </select>
</mapper> </mapper>

244
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.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.utils.CacheUtil; import com.hnac.hzims.common.utils.CacheUtil;
@ -33,10 +34,13 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.validation.Valid; import javax.validation.Valid;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.Year;
import java.time.YearMonth; import java.time.YearMonth;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -56,71 +60,70 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
return this.page(Condition.getPage(query), this.getQueryWrapper(request)); return this.page(Condition.getPage(query), this.getQueryWrapper(request));
} }
/** @Author hx /**
* @return java.lang.Boolean 推送结果
* @Author hx
* @Description 根据ID发送短信 * @Description 根据ID发送短信
* @Date 2023/4/12 10:22 * @Date 2023/4/12 10:22
* @Param [id] 短信记录ID * @Param [id] 短信记录ID
* @return java.lang.Boolean 推送结果
**/ **/
@Override @Override
public Boolean send(Long id) { public Boolean send(Long id) {
MessagePushRecordEntity record = this.getById(id); MessagePushRecordEntity record = this.getById(id);
IMessageService messageSend = MessageFactory.getMessageSend(record.getType()); IMessageService messageSend = MessageFactory.getMessageSend(record.getType());
Boolean result = messageSend.send(record); Boolean result = messageSend.send(record);
Assert.isTrue(result , ()-> { Assert.isTrue(result, () -> {
throw new ServiceException("发送消息失败!"); throw new ServiceException("发送消息失败!");
}); });
// 更新推送状态以及推送时间 // 更新推送状态以及推送时间
LambdaUpdateWrapper<MessagePushRecordEntity> luw = Wrappers.<MessagePushRecordEntity>lambdaUpdate() LambdaUpdateWrapper<MessagePushRecordEntity> luw = Wrappers.<MessagePushRecordEntity>lambdaUpdate().set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()).set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS).eq(MessagePushRecordEntity::getId, id);
.set(MessagePushRecordEntity::getPushTime, LocalDateTime.now()) return this.update(luw);
.set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS) }
.eq(MessagePushRecordEntity::getId, id);
return this.update(luw); /**
} * @return java.lang.Boolean 推送解雇
* @Author hx
/** @Author hx
* @Description 保存并推送消息 * @Description 保存并推送消息
* @Date 2023/4/12 10:23 * @Date 2023/4/12 10:23
* @Param [request] 消息记录 * @Param [request] 消息记录
* @return java.lang.Boolean 推送解雇
**/ **/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean saveAndSend(MessagePushRecordEntity request) { public Boolean saveAndSend(MessagePushRecordEntity request) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
if(MessageConstants.IMMEDIATELY.equals(request.getPushType())) { if (MessageConstants.IMMEDIATELY.equals(request.getPushType())) {
request.setPlanTime(now); request.setPlanTime(now);
request.setPushTime(now); request.setPushTime(now);
// 立即推送消息 // 立即推送消息
if(this.save(request) && Func.isNotEmpty(request.getId())) { if (this.save(request) && Func.isNotEmpty(request.getId())) {
return this.send(request.getId()); return this.send(request.getId());
} }
throw new ServiceException("保存消息失败!"); throw new ServiceException("保存消息失败!");
} } else if (MessageConstants.PLAN.equals(request.getPushType())) {
else if(MessageConstants.PLAN.equals(request.getPushType())) {
return this.save(request); return this.save(request);
} } else {
else {
throw new ServiceException("推送类型只能为即时推送或计划推送"); throw new ServiceException("推送类型只能为即时推送或计划推送");
} }
} }
/** /**
* 获取 QueryWrapper * 获取 QueryWrapper
* @param request 查询条件 *
* @return QueryWrapper * @param request 查询条件
*/ * @return QueryWrapper
private LambdaQueryWrapper<MessagePushRecordEntity> getQueryWrapper(MessagePushRecordEntity request) { */
LambdaQueryWrapper<MessagePushRecordEntity> lambda = Condition.getQueryWrapper(request).lambda(); private LambdaQueryWrapper<MessagePushRecordEntity> getQueryWrapper(MessagePushRecordEntity request) {
if(Func.isNotEmpty(request.getStartTime())) { LambdaQueryWrapper<MessagePushRecordEntity> lambda = Condition.getQueryWrapper(request).lambda();
lambda.ge(MessagePushRecordEntity::getPushTime,request.getStartTime()); if (Func.isNotEmpty(request.getStartTime())) {
} lambda.ge(MessagePushRecordEntity::getPushTime, request.getStartTime());
if(Func.isNotEmpty(request.getEndTime())) { }
lambda.le(MessagePushRecordEntity::getPushTime,request.getEndTime()); if (Func.isNotEmpty(request.getEndTime())) {
} lambda.le(MessagePushRecordEntity::getPushTime, request.getEndTime());
lambda.orderByDesc(MessagePushRecordEntity::getPushTime); }
return lambda; lambda.orderByDesc(MessagePushRecordEntity::getPushTime);
} return lambda;
}
/** /**
* 短信推送统计 * 短信推送统计
*/ */
@ -136,8 +139,7 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
}); });
//按类型分组 //按类型分组
Map<String, List<MessagePushRecordVo>> collect = Map<String, List<MessagePushRecordVo>> collect = messagePushRecordVos.stream().collect(Collectors.groupingBy(MessagePushRecordVo::getType));
messagePushRecordVos.stream().collect(Collectors.groupingBy(MessagePushRecordVo::getType));
List<MessagePushRecordTypeVo> messagePushRecordTypeVos = new ArrayList<>(); List<MessagePushRecordTypeVo> messagePushRecordTypeVos = new ArrayList<>();
//封装数据 //封装数据
@ -147,6 +149,52 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
messagePushRecordTypeVo.setMessagePushRecordList(value); messagePushRecordTypeVo.setMessagePushRecordList(value);
messagePushRecordTypeVos.add(messagePushRecordTypeVo); 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; return messagePushRecordTypeVos;
} }
@ -195,21 +243,44 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
public List<PushStatTypeVo> pushStat(MessagePushRecordEntityVo vo) { public List<PushStatTypeVo> pushStat(MessagePushRecordEntityVo vo) {
List<PushStatTypeVo> pushStatTypeVos = baseMapper.pushStat(vo); List<PushStatTypeVo> pushStatTypeVos = baseMapper.pushStat(vo);
pushStatTypeVos.forEach(item -> { pushStatTypeVos.forEach(item -> {
//查询出状态信息
List<Integer> statusList = baseMapper.selectByStatus();
//业务类型名称 //业务类型名称
String businessClassify = item.getBusinessClassify(); String businessClassify = item.getBusinessClassify();
String businessTypeName = this.getBusinessClassifyByName(businessClassify); String businessTypeName = this.getBusinessClassifyByName(businessClassify);
item.setBusinessClassifyName(businessTypeName); item.setBusinessClassifyName(businessTypeName);
List<PushStatVo> pushStatList = item.getPushStatList(); List<PushStatVo> pushStatList = item.getPushStatList();
pushStatList.forEach(pushStat -> { List<PushStatVo> newPushStatList = new ArrayList<>();
Integer status = pushStat.getStatus(); for (PushStatVo pushStat : pushStatList) {
//状态名称
String name = this.getStatusByName(status);
pushStat.setStatusName(name);
//业务类型名称 //业务类型名称
String businessClassifyPushStat = pushStat.getBusinessClassify(); String businessClassifyPushStat = pushStat.getBusinessClassify();
String businessTypeNamePushStat = this.getBusinessClassifyByName(businessClassifyPushStat); String businessTypeNamePushStat = this.getBusinessClassifyByName(businessClassifyPushStat);
pushStat.setBusinessClassifyName(businessTypeNamePushStat); 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; return pushStatTypeVos;
} }
@ -218,12 +289,12 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
public List<UnreadMessageVO> getPersonalUnreadMessage() { public List<UnreadMessageVO> getPersonalUnreadMessage() {
QueryWrapper<MessagePushRecordEntity> query = Wrappers.query(); QueryWrapper<MessagePushRecordEntity> query = Wrappers.query();
query.select("business_classify businessClassify,count(0) todoNum"); query.select("business_classify businessClassify,count(0) todoNum");
query.eq("account",AuthUtil.getUserId()); query.eq("account", AuthUtil.getUserId());
query.groupBy("business_classify"); query.groupBy("business_classify");
List<Map<String, Object>> list = this.listMaps(query); List<Map<String, Object>> list = this.listMaps(query);
return list.stream().map(map -> { return list.stream().map(map -> {
UnreadMessageVO unreadMessageVO = Func.toBean(map, UnreadMessageVO.class); UnreadMessageVO unreadMessageVO = Func.toBean(map, UnreadMessageVO.class);
unreadMessageVO.setBusinessName(DictCache.getValue("businessClassify",unreadMessageVO.getBusinessClassify())); unreadMessageVO.setBusinessName(DictCache.getValue("businessClassify", unreadMessageVO.getBusinessClassify()));
return unreadMessageVO; return unreadMessageVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@ -249,8 +320,44 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
case 3: case 3:
value = PushStatEnum.CONFIRMED.getValue(); value = PushStatEnum.CONFIRMED.getValue();
break; break;
case 4: default:
log.error("状态异常,没有这状态"); 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; break;
} }
return value; return value;
@ -278,8 +385,14 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl<MessagePushRec
case "inspect": case "inspect":
value = "巡检消息"; value = "巡检消息";
break; break;
case "": case "warning":
log.error("状态业务分类,没有这状态"); value = "告警消息";
default:
value = DictCache.getValue("businessClassify", key);
if (value == null) {
log.error("状态业务分类,没有这状态");
value = key;
}
break; break;
} }
return value; 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 @Resource
public class OperationApplication extends SpringBootServletInitializer { 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) { public static void main(String[] args) {
BladeApplication.run(OperationalConstants.APP_NAME, OperationApplication.class, 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 lombok.EqualsAndHashCode;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity; import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity;
import java.time.YearMonth;
import java.util.List; import java.util.List;
/** /**
@ -25,4 +26,16 @@ public class OperAccessStatisticsDTO extends OperAccessStatisticsEntity {
@ApiModelProperty(value = "创建机构集合") @ApiModelProperty(value = "创建机构集合")
private List<Long> deptIds; private List<Long> deptIds;
/**
* 年月
*/
private YearMonth yearMonth;
/**
* 区域Id
*/
private String areaId;
} }

21
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.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO; import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity; 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.annotation.UserDataAuth;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List; import java.util.List;
/** /**
*
* Mapper 接口 * Mapper 接口
* *
* @author xiashandong * @author xiashandong
@ -18,14 +18,13 @@ import java.util.List;
public interface OperAccessStatisticsMapper extends UserDataScopeBaseMapper<OperAccessStatisticsEntity> { public interface OperAccessStatisticsMapper extends UserDataScopeBaseMapper<OperAccessStatisticsEntity> {
/**
/** * 自定义分页
* 自定义分页 *
* * @param page
* @param page * @param dto
* @param dto * @return
* @return */
*/ @UserDataAuth
@UserDataAuth List<OperAccessStatisticsEntity> selectPageList(IPage page, @Param("dto") OperAccessStatisticsDTO dto);
List<OperAccessStatisticsEntity> selectPageList(IPage page, 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"> <if test="dto.planEndTime != null">
and OS.PLAN_END_TIME &lt;= #{dto.planEndTime} and OS.PLAN_END_TIME &lt;= #{dto.planEndTime}
</if> </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 ORDER BY OS.CREATE_TIME DESC
</select> </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.entity.OperAccessStatisticsEntity;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO; import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import javax.servlet.http.HttpServletResponse; 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.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo; import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo; 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.config.vo.*;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo; import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -112,7 +114,7 @@ public class AbnormalAlarmController extends BladeController {
* *
*/ */
@ApiLog @ApiLog
@ApiOperation(value = "智能优化接口") @ApiOperation(value = "原始告警接口")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@RequestMapping(value = "/alarms", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/alarms", method = {RequestMethod.GET, RequestMethod.POST})
public R<AlarmReustVo> alarms(AlarmParamVo param){ 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 @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.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo; import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo; 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.config.vo.*;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo; import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
@ -33,4 +35,6 @@ public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormal
IPage<AlarmVo> alarmData(AlarmDataPageVo page,Query query); IPage<AlarmVo> alarmData(AlarmDataPageVo page,Query query);
List<String> queryStationName(); 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.constants.AbnormalAlarmConstant;
import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.mapper.HistoryAbnormalAlarmMapper; import com.hnac.hzims.operational.alert.mapper.HistoryAbnormalAlarmMapper;
import com.hnac.hzims.operational.alert.service.AlarmHandleService; import com.hnac.hzims.operational.alert.service.AlarmHandleService;
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService; import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.operational.alert.vo.AlarmDataVo; import com.hnac.hzims.operational.alert.vo.*;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo; import com.hnac.hzims.operational.config.vo.AlarmDataPageVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo; import com.hnac.hzims.operational.config.vo.AlarmVo;
import com.hnac.hzims.operational.config.vo.*; import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
@ -24,7 +23,9 @@ import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation; import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result; 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.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils; 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 ISoeClient alarmClient;
private final SoeClient soeClient;
@Value("${hzims.operation.alarm.types}") @Value("${hzims.operation.alarm.types}")
private String 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集合 * 获取处理数据ID集合
* @return * @return
*/ */
@ -372,7 +419,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
alarm.setRealId(record.getRealId()); alarm.setRealId(record.getRealId());
alarm.setTs(record.getTs()); alarm.setTs(record.getTs());
alarm.setSoeStatus(record.getSoeStatus()); 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.setOptionvals(record.getOptionvals());
alarm.setSoeStatus(record.getSoeStatus()); alarm.setSoeStatus(record.getSoeStatus());
alarm.setStation(record.getStation()); alarm.setStation(record.getStation());
@ -402,6 +449,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
} }
private Boolean entityIsNull(Object object) { private Boolean entityIsNull(Object object) {
if (null == object) { if (null == object) {
return true; 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) { if (defect.getEndTime() != null) {
queryWrapper.le(OperDefectEntity::getCreateTime, defect.getEndTime()); 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); queryWrapper.orderByDesc(OperDefectEntity::getActStartTime);
IPage<OperDefectEntity> pages = defectService.page(Condition.getPage(query), queryWrapper); IPage<OperDefectEntity> pages = defectService.page(Condition.getPage(query), queryWrapper);
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages); 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; 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.OperDefectEntity;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.OperDefectVO; import com.hnac.hzims.operational.defect.vo.OperDefectVO;
@ -88,4 +90,12 @@ public interface IOperDefectService extends BaseService<OperDefectEntity> {
boolean updateDefectInfo(OperDefectEntity entity); boolean updateDefectInfo(OperDefectEntity entity);
boolean updateDefectHanderState(OperDefectEntity entity); boolean updateDefectHanderState(OperDefectEntity entity);
/**
* 分页查询
* @param operDefectEntityPage
* @param defect
* @return
*/
IPage<OperDefectEntity> selectPage(Page<OperDefectEntity> operDefectEntityPage, OperDefectEntity defect);
} }

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

File diff suppressed because it is too large Load Diff

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 org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
@ -268,6 +269,16 @@ public class ImsDutyRecController extends BladeController {
public R queryAnalyseExampleData( AnalyzeDataCondition analyzeDataCondition) { public R queryAnalyseExampleData( AnalyzeDataCondition analyzeDataCondition) {
return iImsAnalyseExampleService.queryAnalyseExampleData(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.tool.api.R;
import org.springblade.core.mp.support.Query; 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> { public interface IImsAnalyseExampleService extends BaseService<AnalyseExample> {
R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition); R queryAnalyseExampleData(AnalyzeDataCondition analyzeDataCondition);
R queryAnalyseExample(AnalyseExample analyseExample,Query query); R queryAnalyseExample(AnalyseExample analyseExample,Query query);
@ -23,4 +23,6 @@ public interface IImsAnalyseExampleService extends BaseService<AnalyseExample> {
R getAnalyseId(String projectId); R getAnalyseId(String projectId);
R updateAnalyseExample(AnalyseExample analyseExample); 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; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.duty.entity.AnalyseExample; import com.hnac.hzims.operational.duty.entity.AnalyseExample;
import com.hnac.hzims.operational.duty.mapper.ImsAnalyseExampleMapper; 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.duty.service.IImsAnalyseExampleService;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.StationClient; import com.hnac.hzims.operational.station.feign.StationClient;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition; import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataCondition;
import com.hnac.hzinfo.datasearch.analyse.domain.AnalyzeDataList; 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.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.analyse.AnalyseDataHandlerClient; 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 lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils; import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; 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.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.io.IOException;
import java.util.List; import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
/** /**
@ -38,8 +48,6 @@ import java.util.List;
@Slf4j @Slf4j
@Service @Service
public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExampleMapper, AnalyseExample> implements IImsAnalyseExampleService { public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExampleMapper, AnalyseExample> implements IImsAnalyseExampleService {
@Resource
private ImsDutyMainMapper imsDutyMainMapper;
@Autowired @Autowired
private IAnalyseDataSearchClient searchClient; private IAnalyseDataSearchClient searchClient;
@Autowired @Autowired
@ -119,6 +127,75 @@ public class ImsAnalyseExampleServiceImpl extends BaseServiceImpl<ImsAnalyseExam
return R.success("保存成功"); 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) { private QueryWrapper<AnalyseExample> getQueryWrapper(AnalyseExample analyseExample) {
QueryWrapper<AnalyseExample> queryWrapper = new QueryWrapper(); 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()) { if (null == imsSchedulingVo.getGroupId()) {
imsSchedulingVo.setGroupName("临时班组"); imsSchedulingVo.setGroupName("临时班组");
ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ ImsDutyMainPersonEntity imsDutyMainPersonEntity = imsDutyMainPersonMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, id); eq(ImsDutyMainPersonEntity::getDutyMainId, imsSchedulingVo.getId());
last("limit 1"); last("limit 1");
}}); }});
imsSchedulingVo.setManagerId(imsDutyMainPersonEntity.getDutyChargePerson()); 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>() {{ ImsDutyMainPersonEntity personEntity = imsDutyMainPersonService.getOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{
eq(ImsDutyMainPersonEntity::getDutyMainId, entity.getId()); eq(ImsDutyMainPersonEntity::getDutyMainId, entity.getId());
eq(ImsDutyMainPersonEntity::getDutyChargePerson, AuthUtil.getUserId()); eq(ImsDutyMainPersonEntity::getDutyChargePerson, AuthUtil.getUserId());
last(" limit 1");
}}); }});
if (ObjectUtil.isEmpty(groupEntity)&&ObjectUtil.isEmpty(personEntity)) { if (ObjectUtil.isEmpty(groupEntity)&&ObjectUtil.isEmpty(personEntity)) {
return R.success("您不是该班组负责人,不可交班!"); 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; package com.hnac.hzims.operational.fill.mapper;
import com.hnac.hzims.operational.fill.entity.GenerateEntity; import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
/** /**
* @author ysj * @author ysj
* @date 2023/04/10 11:22:14 * @date 2023/04/10 11:22:14
@ -10,4 +13,5 @@ import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
*/ */
public interface GenerateMapper extends UserDataScopeBaseMapper<GenerateEntity> { 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" ?> <?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" > <!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"> <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> </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.GenerateVo;
import com.hnac.hzims.operational.fill.vo.QueryVo; import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.RainfallVo; 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.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
/** /**
* @author ysj * @author ysj
* @date 2023/04/10 11:16:07 * @date 2023/04/10 11:16:07
@ -22,4 +28,13 @@ public interface GenerateService extends BaseService<GenerateEntity> {
// 新增/修改发电量填报数据 // 新增/修改发电量填报数据
boolean saveUpdate(GenerateEntity entity); 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.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.fill.entity.PowerEntity; import com.hnac.hzims.operational.fill.entity.PowerEntity;
import com.hnac.hzims.operational.fill.vo.PowerVo; 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.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; 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 upd(PowerEntity entity);
R<IPage<PowerVo>> pageCondition(PowerVo vo, Query query); 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.entity.UseEntity;
import com.hnac.hzims.operational.fill.vo.QueryVo; import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.UseVo; 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.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
/** /**
* @author ysj * @author ysj
* @date 2023/04/10 11:16:07 * @date 2023/04/10 11:16:07
@ -20,4 +24,12 @@ public interface UseService extends BaseService<UseEntity> {
// 新增/修改用电量填报数据 // 新增/修改用电量填报数据
boolean saveUpdate(UseEntity entity); 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.GenerateEntity;
import com.hnac.hzims.operational.fill.entity.UseEntity;
import com.hnac.hzims.operational.fill.mapper.GenerateMapper; import com.hnac.hzims.operational.fill.mapper.GenerateMapper;
import com.hnac.hzims.operational.fill.service.GenerateService; import com.hnac.hzims.operational.fill.service.GenerateService;
import com.hnac.hzims.operational.fill.vo.GenerateVo; import com.hnac.hzims.operational.fill.vo.GenerateVo;
import com.hnac.hzims.operational.fill.vo.QueryVo; import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.wrapper.GenerateWrapper; 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.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; 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.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; 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.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author ysj * @author ysj
@ -50,6 +60,9 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
if(!ObjectUtil.isEmpty(filter.getEndTime())){ if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime()); le("FILL_DATE",filter.getEndTime());
} }
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin());
}
orderByDesc("create_time"); orderByDesc("create_time");
}}; }};
IPage pages = super.page(Condition.getPage(query), queryWrapper); IPage pages = super.page(Condition.getPage(query), queryWrapper);
@ -78,4 +91,85 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
return this.updateById(entity); 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; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.entity.PowerEntity;
import com.hnac.hzims.operational.fill.mapper.PowerMapper; import com.hnac.hzims.operational.fill.mapper.PowerMapper;
import com.hnac.hzims.operational.fill.service.PowerService; import com.hnac.hzims.operational.fill.service.PowerService;
import com.hnac.hzims.operational.fill.vo.PowerVo; import com.hnac.hzims.operational.fill.vo.PowerVo;
import com.hnac.hzims.operational.fill.wrapper.PowerWrapper; 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.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl; 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.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; 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.feign.ISysClient;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@ -97,4 +105,55 @@ public class PowerServiceImpl extends BaseServiceImpl<PowerMapper, PowerEntity>
return R.data(pages.setRecords(list)); 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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.entity.UseEntity;
import com.hnac.hzims.operational.fill.mapper.UseMapper; import com.hnac.hzims.operational.fill.mapper.UseMapper;
import com.hnac.hzims.operational.fill.service.UseService; import com.hnac.hzims.operational.fill.service.UseService;
import com.hnac.hzims.operational.fill.vo.QueryVo; import com.hnac.hzims.operational.fill.vo.QueryVo;
import com.hnac.hzims.operational.fill.vo.UseVo; import com.hnac.hzims.operational.fill.vo.UseVo;
import com.hnac.hzims.operational.fill.wrapper.UseWrapper; 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.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; 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.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; 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.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author ysj * @author ysj
@ -50,6 +58,9 @@ public class UseServiceImpl extends BaseServiceImpl<UseMapper, UseEntity> implem
if(!ObjectUtil.isEmpty(filter.getEndTime())){ if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime()); le("FILL_DATE",filter.getEndTime());
} }
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin());
}
orderByDesc("create_time"); orderByDesc("create_time");
}}; }};
IPage pages = super.page(Condition.getPage(query), queryWrapper); IPage pages = super.page(Condition.getPage(query), queryWrapper);
@ -78,4 +89,75 @@ public class UseServiceImpl extends BaseServiceImpl<UseMapper, UseEntity> implem
return this.updateById(entity); 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 @ApiLog
@ApiOperation("计划发电趋势") @ApiOperation("计划发电趋势")
@GetMapping("/planGenerationTrend") @GetMapping("/planGenerationTrend")

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

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; 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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; 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.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; 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.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; 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 io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; 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.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.SpringQueryMap; import org.springframework.cloud.openfeign.SpringQueryMap;
@ -43,6 +60,10 @@ public class AreaMonthlyDetailsController {
private final IOperMaintenanceTaskService taskService; private final IOperMaintenanceTaskService taskService;
private final IOperDefectService defectService;
private final IOperAccessStatisticsService accessStatisticsService;
/** /**
* 操作票 根据月份区域 获取操作详情数据 * 操作票 根据月份区域 获取操作详情数据
@ -143,4 +164,158 @@ public class AreaMonthlyDetailsController {
return R.data(task); 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.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Arrays; import java.util.Arrays;
@ -44,7 +43,7 @@ public class ScheduledCreateTask {
@Autowired @Autowired
private IAreaMonthReportService reportService; private IAreaMonthReportService reportService;
@Autowired @Autowired
private IWebHomeService webHomeService; private HydropowerService hydropowerService;
@Autowired @Autowired
private PhotovoltaicService photovoltaicService; private PhotovoltaicService photovoltaicService;
@Autowired @Autowired
@ -169,10 +168,9 @@ public class ScheduledCreateTask {
* 获取站点近3年发电量数据 * 获取站点近3年发电量数据
* @return ReturnT<String> * @return ReturnT<String>
*/ */
//@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR) @XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
@Scheduled(cron = "0/40 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> powerGenerationRecentYear() throws Exception { public ReturnT<String> powerGenerationRecentYear(String param) throws Exception {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
@ -274,7 +272,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
webHomeService.loadHydropowerReal(param); hydropowerService.loadHydropowerReal(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
@ -288,7 +286,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
webHomeService.loadHydropowerTarget(param); hydropowerService.loadHydropowerTarget(param);
return new ReturnT<>("SUCCESS"); 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; package com.hnac.hzims.operational.main.service;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
@ -75,4 +81,45 @@ public interface AreaMonthlyDetailsService {
* @return * @return
*/ */
TaskEntity queryCheckTaskById(Long id); 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.HydropowerStationVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitVo; import com.hnac.hzims.operational.main.vo.HydropowerUnitVo;
import com.hnac.hzims.operational.main.vo.WaterStationVo;
import java.util.List; import java.util.List;
/** /**
* WEB水电站首页接口 * WEB水电站首页接口
*/ */
public interface IWebHomeService { public interface HydropowerService {
void loadHydropowerReal(String param); void loadHydropowerReal(String param);
void loadHydropowerTarget(String param); void loadHydropowerTarget(String param);
HydropowerStationVo webStation(Long deptId); HydropowerStationVo station(Long deptId);
List<HydropowerUnitVo> hydropowerDevice(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); List<WaterYearDataVo> waterYearRain(Long deptId);
Dept getTitleDetp(List<Dept> authList, Long deptId); Dept getTitleDetp(Long deptId);
WaterStationVo waterStationPage(Long deptId); WaterStationVo waterStationPage(Long deptId);

122
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; package com.hnac.hzims.operational.main.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoEvaluateVO;
import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto; import com.hnac.hzims.ticket.areamonthly.dto.TicketInfoEvaluateDto;
@ -38,6 +47,13 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
private final TaskFeignClient taskFeignClient; 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 @Override
public BladePage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly) { public BladePage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, StandardTicketWithAreaVo areaMonthly) {
R<BladePage<StandardTicketVo>> pageR = R<BladePage<StandardTicketVo>> pageR = ticketFeignClient.areaMonthlyWithOperation(page, size, areaMonthly);
ticketFeignClient.areaMonthlyWithOperation(page, size, areaMonthly);
if (pageR.isSuccess()) { if (pageR.isSuccess()) {
log.info("获取操作详情数据成功"); log.info("获取操作详情数据成功");
return pageR.getData(); return pageR.getData();
@ -68,9 +83,8 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
* @return * @return
*/ */
@Override @Override
public BladePage<StandardWorkVo> workTicketListByMonthAndArea(Long page, Long size,StandardTicketWithAreaVo areaMonthlyVo) { public BladePage<StandardWorkVo> workTicketListByMonthAndArea(Long page, Long size, StandardTicketWithAreaVo areaMonthlyVo) {
R<BladePage<StandardWorkVo>> pageR = R<BladePage<StandardWorkVo>> pageR = ticketFeignClient.workTicketListByMonthAndArea(page, size, areaMonthlyVo);
ticketFeignClient.workTicketListByMonthAndArea(page, size, areaMonthlyVo);
if (pageR.isSuccess()) { if (pageR.isSuccess()) {
log.info("获取操作详情数据成功"); log.info("获取操作详情数据成功");
return pageR.getData(); return pageR.getData();
@ -149,6 +163,7 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
/** /**
* 根据id查询巡检任务 * 根据id查询巡检任务
*
* @param id * @param id
* @return * @return
*/ */
@ -162,4 +177,101 @@ public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService
log.error("获取检查巡检任务详情失败", detail.getMsg()); log.error("获取检查巡检任务详情失败", detail.getMsg());
return null; 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;
}
} }

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

409
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.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; 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.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; 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.service.*;
import com.hnac.hzims.operational.main.vo.*; 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.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationAttributeService;
import com.hnac.hzims.operational.station.service.IStationService; 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 org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -43,25 +44,27 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class WebHomeServiceImpl implements IWebHomeService { public class HydropowerServiceImpl implements HydropowerService {
private final IAnalyseDataService analyseDataService; private final IWaterService waterService;
private final IHomePageService homePageService;
private final IMainSystemMonitoringService maintenanceTaskService; private final IWeatherService weatherService;
private final IStationService stationService; 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 ISoeClient soeClient;
private final IWeatherService weatherService; private final IPlanGenertionClient planGenertionClient;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
@ -80,63 +83,54 @@ public class WebHomeServiceImpl implements IWebHomeService {
*/ */
@Override @Override
public void loadHydropowerReal(String param) { public void loadHydropowerReal(String param) {
// 有效设备 // 水电站站点
List<EminfoAndEmParamVo> valid = this.getValidDeviceList(); List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
if(CollectionUtil.isEmpty(valid)){ .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; return;
} }
// 实时数据 // 实时数据
Map<String, String> map = this.getRealMap(); Map<String, String> map = this.getRealMap();
// 单位 // 单位
Map<String, String> unitMap = this.attributeService.getPointUnit(); Map<String, String> unitMap = this.attributeService.getPointUnit();
List<HydropowerUnitRealVo> list = new ArrayList<>(); // 实时数据
valid.forEach(device->{ List<HydropowerUnitRealVo> reals = devices.stream().map(device->{
HydropowerUnitRealVo realVo = new HydropowerUnitRealVo(); HydropowerUnitRealVo real = new HydropowerUnitRealVo();
realVo.setDeptId(device.getCreateDept()); real.setDeptId(device.getCreateDept());
realVo.setDeviceCode(device.getEmCode()); real.setDeviceCode(device.getEmCode());
realVo.setDeptName(device.getName()); real.setDeptName(device.getName());
realVo.setDeviceName(device.getName()); real.setDeviceName(device.getName());
// 开关机状态 // 开关机状态
String state = this.getSignageValue(device,map,HomePageConstant.JOINT_RELAY); real.setState(this.getSignageValue(device,map,HomePageConstant.JOINT_RELAY));
realVo.setState(state);
// 有功功率 // 有功功率
String activePower = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_ACTIVE_POWER); real.setActivePower(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_ACTIVE_POWER));
realVo.setActivePower(activePower);
// 无功功率 // 无功功率
String reactivePower = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_REACTIVE_POWER); real.setReactivePower(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_REACTIVE_POWER));
realVo.setReactivePower(reactivePower);
// 功率因数 // 功率因数
String powerFactor = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_POWERFACTOR); real.setPowerFactor(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_POWERFACTOR));
realVo.setPowerFactor(powerFactor);
// 机组频率 // 机组频率
String frequency = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_FREQUENCY); real.setFrequency(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_FREQUENCY));
realVo.setFrequency(frequency);
// 导叶开度 // 导叶开度
String guideOpen = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_GUIDEOPEN); real.setGuideOpen(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_GUIDEOPEN));
realVo.setGuideOpen(guideOpen);
// 定子电压 // 定子电压
String statorVoltage = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_VOLTAGE); real.setStatorVoltage(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_VOLTAGE));
realVo.setStatorVoltage(statorVoltage);
// 定子电流 // 定子电流
String statorCurrent = this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_CURRENT); real.setStatorCurrent(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_CURRENT));
realVo.setStatorCurrent(statorCurrent);
// 单位设置 // 单位设置
this.setttingUnit(device,unitMap,realVo); this.setttingUnit(device,unitMap,real);
list.add(realVo); return real;
}); }).collect(Collectors.toList());
redisTemplate.opsForValue().set(load_hydropower_unit_real_key,list); if(CollectionUtil.isEmpty(reals)){
} return;
/**
* 获取实时数据
* @return
*/
private Map<String, String> getRealMap() {
String json = (String) redisTemplate.opsForValue().get(real_id_key);
if(StringUtil.isBlank(json)){
return null;
} }
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 @Override
public void loadHydropowerTarget(String param) { public void loadHydropowerTarget(String param) {
// 有效设备 // 水电站站点
List<EminfoAndEmParamVo> valid = this.getValidDeviceList(); List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
if(CollectionUtil.isEmpty(valid)){ .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER)
);
if(CollectionUtil.isEmpty(stations)){
return;
}
// 补充填补发电指标
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());
// 当年发电量
target.setPowerYear(this.getGenerationPower(device,0));
// 当月发电量
target.setPowerMon(this.getGenerationPower(device,1));
// 当日发电量
target.setPowerDay(this.getGenerationPower(device,2));
// 当天有功功率
target.setActivePowerVoList(waterService.getActivePowerVoList(device));
// 30天发电量
target.setGenerationPowerVoList(this.getGenerationPowerList(device));
return target;
}).collect(Collectors.toList()));
}
// 站点指标数据为空
if(CollectionUtil.isEmpty(targets)){
return; return;
} }
List<HydropowerUnitTargetVo> list = new ArrayList<>(); redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets);
valid.forEach(device->{ }
HydropowerUnitTargetVo targetVo = new HydropowerUnitTargetVo();
targetVo.setDeptId(device.getCreateDept()); /**
targetVo.setDeviceCode(device.getEmCode()); * 获取填报用电量
targetVo.setDeviceName(device.getName()); * @param stations
targetVo.setDeptName(device.getName()); * @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());
// 当年发电量 // 当年发电量
float powerYear = this.getGenerationPower(device,0); target.setPowerYear(generateService.generate(year,station.getCode()));
targetVo.setPowerYear(powerYear);
// 当月发电量 // 当月发电量
float powerMon = this.getGenerationPower(device,1); target.setPowerMon(generateService.generate(mon,station.getCode()));
targetVo.setPowerMon(powerMon);
// 当日发电量 // 当日发电量
float powerDay = this.getGenerationPower(device,2); target.setPowerDay(generateService.generate(day,station.getCode()));
// 当天有功功率
List<ActivePowerVo> activePowerVoList = waterService.getActivePowerVoList(device);
targetVo.setActivePowerVoList(activePowerVoList);
// 30天发电量 // 30天发电量
List<GenerationPowerVo> generationPowerVoList = this.getGenerationPowerList(device); target.setGenerationPowerVoList(generateService.generate30Day(day,station.getCode()));
targetVo.setGenerationPowerVoList(generationPowerVoList); return target;
targetVo.setPowerDay(powerDay); }).collect(Collectors.toList());
list.add(targetVo);
});
redisTemplate.opsForValue().set(load_hydropower_unit_target_key,list);
} }
/** /**
* 获取有效设备 * 泵站设备
* @param stations
* @return * @return
*/ */
private List<EminfoAndEmParamVo> getValidDeviceList() { private List<EminfoAndEmParamVo> pumpDevices(List<Long> stations){
// 水利站点(All) if(CollectionUtil.isEmpty(stations)){
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), null); return new ArrayList<>();
if(CollectionUtil.isEmpty(stationList)){
return null;
} }
// 获取所有设备 List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList();
List<EminfoAndEmParamVo> deviceList = maintenanceTaskService.getEmInfoList(); if(CollectionUtil.isEmpty(devices)){
if(CollectionUtil.isEmpty(deviceList)){ return new ArrayList<>();
return null;
} }
// 有效泵租设备 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 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 * @return
*/ */
@Override @Override
public HydropowerStationVo webStation(Long deptId) { public HydropowerStationVo station(Long deptId) {
if(ObjectUtil.isEmpty(deptId)){ if(ObjectUtil.isEmpty(deptId)){
return null; return null;
} }
@ -344,86 +377,76 @@ public class WebHomeServiceImpl implements IWebHomeService {
if(ObjectUtil.isEmpty(station)){ if(ObjectUtil.isEmpty(station)){
return null; return null;
} }
List<HydropowerStationVo> list = this.getHydropowerStationList(Collections.singletonList(station)); // 实时监测点数据
if(CollectionUtil.isEmpty(list)){ List<HydropowerUnitRealVo> realList = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
return null; // 获取站点机组指标数据
} List<HydropowerUnitTargetVo> targetList = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
return list.get(0); // 所有设备
List<EminfoAndEmParamVo> deviceList = maintenanceTaskService.getEmInfoList();
// 实时天气
Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(Collections.singletonList(station.getCode()));
// 七天天气
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();
response.setStationStatus(!CollectionUtil.isNotEmpty(soeDataList));
// 站点实时天气
response.setTemp(this.getTemp(weather,station.getCode()));
// 站点七天天气
response.setWeather(this.getDailyList(weekWeather,station.getCode()));
// 限制水位
response.setLimitWaterLevel(station.getLimitWaterLevel());
// 运行天数
response.setRunDay(this.getRunDay(station));
// 装机容量
response.setInstalledCapacity(this.getInstalledCapacity(deviceList,station.getRefDept()));
// 总有功功率(总发电负荷)
response.setPowerSum(this.getPowerSum(realList,station.getRefDept()));
// 总有功单位
response.setPowerUnit(this.getPowerUnit(realList,station.getRefDept()));
// 月计划发电量
response.setPlanPowerMon(this.getPlanPowerrMon(station.getCode()));
// 年计划发电量
response.setPlanPowerYear(this.getPlanPowerYear(station.getCode()));
// 月发电量、年发电量、年发电完成率
this.handleStationInfo(station.getRefDept(),response);
// 水位、水位曲线
this.handleWaterLeve(station.getCode(),response);
// 年发电量完成百分比
response.setPowerYearMap(this.handlePowerFinish(station));
// 设备信息
response.setDeviceList(this.getDevices(station,realList,targetList));
return response;
} }
/** /**
* 获取首页站点信息 * 水电站-机组列表
* @param list * @param deptId
* @return * @return
*/ */
private List<HydropowerStationVo> getHydropowerStationList(List<StationEntity> list) { @Override
if(CollectionUtil.isEmpty(list)){ public List<HydropowerUnitVo> hydropowerDevice(Long deptId) {
if(ObjectUtil.isEmpty(deptId)){
return null;
}
// 查询站点
StationEntity station = stationService.getStationByCodeOrRefDept(null,deptId);
if(ObjectUtil.isEmpty(station)){
return null; return null;
} }
// 实时监测点数据 // 实时监测点数据
List<HydropowerUnitRealVo> realList = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); 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); List<HydropowerUnitTargetVo> targetList = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
// 所有设备 return this.getDevices(station,realList,targetList);
List<EminfoAndEmParamVo> deviceList = maintenanceTaskService.getEmInfoList();
// 实时天气
Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(list.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 七天天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(list.stream().map(StationEntity::getCode).collect(Collectors.toList()));
List<HydropowerStationVo> result = new ArrayList<>();
list.forEach(station ->{
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);
}
// 站点实时天气
String temp = this.getTemp(weather,station.getCode());
response.setTemp(temp);
// 站点七天天气
List<Daily> dailys = this.getDailyList(weekWeather,station.getCode());
response.setWeather(dailys);
// 限制水位
response.setLimitWaterLevel(station.getLimitWaterLevel());
// 运行天数
int runDay = this.getRunDay(station);
response.setRunDay(runDay);
// 装机容量
double installedCapacity = this.getInstalledCapacity(deviceList,station.getRefDept());
response.setInstalledCapacity(installedCapacity);
// 总有功功率(总发电负荷)
double powerSum = this.getPowerSum(realList,station.getRefDept());
response.setPowerSum(powerSum);
// 总有功单位
String unit = this.getPowerUnit(realList,station.getRefDept());
response.setPowerUnit(unit);
// 月计划发电量
float planPowerMon = this.getPlanPowerrMon(station.getCode());
response.setPlanPowerMon(planPowerMon);
// 年计划发电量
float planPowerYear = this.getPlanPowerYear(station.getCode());
response.setPlanPowerYear(planPowerYear);
// 月发电量、年发电量、年发电完成率
this.handleStationInfo(station.getRefDept(),response);
// 水位、水位曲线
this.handleWaterLeve(station.getCode(),response);
// 年发电量完成百分比
List<PowerMonthVo> powerYearList = this.handlePowerFinish(station);
response.setPowerYearMap(powerYearList);
// 设备信息
List<HydropowerUnitVo> devices = this.getDevices(station,realList,targetList);
response.setDeviceList(devices);
result.add(response);
});
return result;
} }
/** /**
* 获取站点设备信息 * 获取站点设备信息
* @param station * @param station
@ -706,39 +729,63 @@ public class WebHomeServiceImpl implements IWebHomeService {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
/** /**
* 水电站-机组列表 * 水电站站点列表
* @param deptId * @param deptId
* @return * @return
*/ */
@Override @Override
public List<HydropowerUnitVo> hydropowerDevice(Long deptId) { public List<HydropowerStationVo> webStationList(Long deptId) {
if(ObjectUtil.isEmpty(deptId)){ List<StationEntity> stations = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE,Collections.singletonList(HomePageConstant.HYDROPOWER),null);
return null; if(CollectionUtil.isEmpty(stations)){
}
// 查询站点
StationEntity station = stationService.getStationByCodeOrRefDept(null,deptId);
if(ObjectUtil.isEmpty(station)){
return null; return null;
} }
// 实时监测点数据 // 实时监测点数据
List<HydropowerUnitRealVo> realList = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); 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); List<HydropowerUnitTargetVo> targetList = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
return this.getDevices(station,realList,targetList); // 所有设备
} List<EminfoAndEmParamVo> deviceList = maintenanceTaskService.getEmInfoList();
// 实时天气
/** Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
* 水电站站点列表 // 七天天气
* @param deptId Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
* @return return stations.stream().map(station->{
*/ HydropowerStationVo hydropower = new HydropowerStationVo();
@Override hydropower.setDeptId(station.getRefDept());
public List<HydropowerStationVo> webStationList(Long deptId) { hydropower.setDeptName(station.getName());
List<StationEntity> list = stationService.getStationType(null,Collections.singletonList(HomePageConstant.HYDROPOWER),null); hydropower.setStationCode(station.getCode());
if(CollectionUtil.isEmpty(list)){ // 站点状态
return null; List<SoeData> soeDataList = soeClient.getByLastLimitTime(null, station.getCode(), 1).getData();
} hydropower.setStationStatus(!CollectionUtil.isNotEmpty(soeDataList));
return this.getHydropowerStationList(list); // 站点实时天气
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.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; 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.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*; import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*; import com.hnac.hzims.operational.main.vo.*;
@ -68,10 +69,12 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
private final IAnalyseDataService analyseDataService; private final IAnalyseDataService analyseDataService;
private final IHistoryDataSearchClient historySearchClient;
private final IMainTaskStatisticService taskService; private final IMainTaskStatisticService taskService;
private final PowerService generateService;
private final IHistoryDataSearchClient historySearchClient;
private final ISysClient sysClient; private final ISysClient sysClient;
private final ITicketInfoClient ticketInfoClient; private final ITicketInfoClient ticketInfoClient;
@ -243,6 +246,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
return; return;
} }
List<PhotovoltaicTargetVo> list = new ArrayList<>(); List<PhotovoltaicTargetVo> list = new ArrayList<>();
// 接入站点设备统计
devices.forEach(device -> { devices.forEach(device -> {
PhotovoltaicTargetVo target = new PhotovoltaicTargetVo(); PhotovoltaicTargetVo target = new PhotovoltaicTargetVo();
target.setDeptId(device.getCreateDept()); target.setDeptId(device.getCreateDept());
@ -273,9 +277,18 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
target.setGenerationPowerVoList(this.getGenerateByMon(device)); target.setGenerationPowerVoList(this.getGenerateByMon(device));
list.add(target); 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); 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()); }).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( 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(); PhotovoltaicPowerVo load = new PhotovoltaicPowerVo();
load.setHour(entry.getKey()); load.setHour(entry.getKey());
load.setActivePower(String.valueOf(entry.getValue().stream().mapToDouble(o -> Double.parseDouble(o.getActivePower())).sum())); 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( 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(); GenerationPowerVo generate = new GenerationPowerVo();
generate.setDate(entry.getKey()); generate.setDate(entry.getKey());
generate.setGenerate((float) entry.getValue().stream().mapToDouble(o -> Double.valueOf(o.getGenerate())).sum()); 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.DutyInfoVo;
import com.hnac.hzims.operational.duty.vo.DutyTaskVo; import com.hnac.hzims.operational.duty.vo.DutyTaskVo;
import com.hnac.hzims.operational.duty.vo.NextDutyInfoVo; 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.service.*;
import com.hnac.hzims.operational.main.vo.*; 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.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; 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.concurrent.Executors;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* @author ysj
*/
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
@ -308,13 +311,6 @@ public class SideHustleServiceImpl implements ISideHustleService {
}}); }});
List<String> faultList = operPhenomenonEntityList.stream().map(OperPhenomenonEntity::getEmCode).distinct().collect(Collectors.toList()); List<String> faultList = operPhenomenonEntityList.stream().map(OperPhenomenonEntity::getEmCode).distinct().collect(Collectors.toList());
deviceClassifyMap.put(HomePageConstant.FAULT,faultList); 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>() {{ List<OperAccessTaskEntity> operAccessTaskEntityList = operAccessTaskService.list(new QueryWrapper<OperAccessTaskEntity>() {{
in("EM_CODE", deviceCodeList); in("EM_CODE", deviceCodeList);
@ -506,11 +502,11 @@ public class SideHustleServiceImpl implements ISideHustleService {
areaDutyVo.setGeneratingCapacity(generatingCapacity); areaDutyVo.setGeneratingCapacity(generatingCapacity);
} }
/** /***
* 根据当班时间查询发电量 * 根据当班时间查询发电量
* @param devices * @param devices
* @param startDate * @param start
* @param endDate * @param end
* @return * @return
*/ */
private float generateByDuty(List<EminfoAndEmParamVo> devices, Date start, Date end) { private float generateByDuty(List<EminfoAndEmParamVo> devices, Date start, Date end) {
@ -520,7 +516,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
} }
for(EminfoAndEmParamVo device : devices ){ 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); 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; return generate;
} }
@ -585,7 +581,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE)); dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE));
dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND)); dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND));
return dateCal.getTime(); return dateCal.getTime();
}; }
/** /**
* 获取结束时间 * 获取结束时间
@ -608,7 +604,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
dateCal.set(Calendar.MINUTE, endCal.get(Calendar.MINUTE)); dateCal.set(Calendar.MINUTE, endCal.get(Calendar.MINUTE));
dateCal.set(Calendar.SECOND, endCal.get(Calendar.SECOND)); dateCal.set(Calendar.SECOND, endCal.get(Calendar.SECOND));
return dateCal.getTime(); return dateCal.getTime();
}; }
/** /**
* 当班运行数据 * 当班运行数据
@ -840,7 +836,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
return null; return null;
} }
Map<Long, Map<String, Float>> powerMap = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA); 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); float sumPower = this.getSumPower(map.values(),powerMap,monList);
List<AreaPowerScaleVo> list = new ArrayList<>(); List<AreaPowerScaleVo> list = new ArrayList<>();
@ -854,7 +850,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
} }
areaPowerScaleVo.setPower(power); areaPowerScaleVo.setPower(power);
// 发电量占比 // 发电量占比
double scale = this.getPowerScale(power,sumPower);; double scale = this.getPowerScale(power,sumPower);
areaPowerScaleVo.setScale(scale); areaPowerScaleVo.setScale(scale);
list.add(areaPowerScaleVo); list.add(areaPowerScaleVo);
}); });
@ -874,7 +870,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
return null; 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); Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather( codes);
// 获取站点7日天气 // 获取站点7日天气
@ -974,7 +970,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
* @return * @return
*/ */
private List<StationBodyVo> getStationData() { private List<StationBodyVo> getStationData() {
Map<String, StationBodyVo> map = new HashMap<>(); Map<String, StationBodyVo> map;
Object json = redisTemplate.opsForValue().get(station_data_key); Object json = redisTemplate.opsForValue().get(station_data_key);
if (ObjectUtil.isNotEmpty(json)) { if (ObjectUtil.isNotEmpty(json)) {
map = JSONObject.parseObject(json.toString(), new TypeReference<Map<String, StationBodyVo>>() { map = JSONObject.parseObject(json.toString(), new TypeReference<Map<String, StationBodyVo>>() {
@ -1166,9 +1162,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
} }
List<String> codeList = new ArrayList<>(); List<String> codeList = new ArrayList<>();
// 添加所有站点Code // 添加所有站点Code
map.values().forEach(item->{ map.values().forEach(item-> codeList.addAll(item.stream().map(StationEntity::getCode).collect(Collectors.toList())));
codeList.addAll(item.stream().map(StationEntity::getCode).collect(Collectors.toList()));
});
if(CollectionUtil.isEmpty(codeList)){ if(CollectionUtil.isEmpty(codeList)){
return null; return null;
} }
@ -1214,7 +1208,6 @@ public class SideHustleServiceImpl implements ISideHustleService {
return; return;
} }
// 存放设备信息集合 // 存放设备信息集合
List<DeviceVo> deviceVoList = new ArrayList<>();
List<String> equipmentCodeList = R.getData().stream().map(EmInfoEntity::getNumber).collect(Collectors.toList()); 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,"故障"); List<DeviceVo> fault = this.handlerDeviceStatus(faultList,equipmentCodeList,"故障");
equipmentCountVo.setFaultCount((long) fault.size()); equipmentCountVo.setFaultCount((long) fault.size());
deviceVoList.addAll(fault); List<DeviceVo> deviceVoList = new ArrayList<>(fault);
// 检修 // 检修
List<DeviceVo> overhaul = this.handlerDeviceStatus(overhaultList,equipmentCodeList,"检修"); List<DeviceVo> overhaul = this.handlerDeviceStatus(overhaultList,equipmentCodeList,"检修");
equipmentCountVo.setOverhaulCount((long) overhaul.size()); equipmentCountVo.setOverhaulCount((long) overhaul.size());
@ -1266,7 +1259,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
if(CollectionUtil.isEmpty(statusList) || CollectionUtil.isEmpty(equipmentCodeList)){ if(CollectionUtil.isEmpty(statusList) || CollectionUtil.isEmpty(equipmentCodeList)){
return new ArrayList<>(); 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)){ if(CollectionUtil.isEmpty(statusDevice)){
return new ArrayList<>(); 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 deptAuthList
* @param area * @param area

386
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.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo; 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.service.*;
import com.hnac.hzims.operational.main.vo.*; 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.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IHzimsAnalyzeModelStationService; 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 org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -60,26 +61,28 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class WaterServiceImpl implements IWaterService { public class WaterServiceImpl implements IWaterService {
private final IAnalyseDataService analyseDataService; private final UseService useService;
private final IHomePageService homePageService; private final IHomePageService homePageService;
private final IStationService stationService; private final IStationService stationService;
private final IWeatherService weatherService;
private final IAnalyseDataService analyseDataService;
private final ISideHustleService sideHustleService; private final ISideHustleService sideHustleService;
private final IMainSystemMonitoringService maintenanceTaskService; private final IMainSystemMonitoringService maintenanceTaskService;
private final IHzimsAnalyzeModelStationService modelStationService; 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 IHistoryDataSearchClient historyDataSearchClient;
private final ISysClient sysClient;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
@Value("${hzims.operation.realIdKey}") @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"; 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 * @param param
*/ */
@Override @Override
public void loadWaterPumpReal(String param) { public void loadWaterPumpReal(String param) {
// 有效设备 // 水利站点
List<EminfoAndEmParamVo> valid = this.getValidDeviceList(); List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
if(CollectionUtil.isEmpty(valid)){ .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; return;
} }
// 实时数据 // 实时数据
Map<String, String> map = this.getRealMap(); Map<String, String> map = this.getRealMap();
List<WaterPumpRealVo> list = new ArrayList<>(); List<WaterPumpRealVo> list = devices.stream().map(device->{
valid.forEach(device->{ WaterPumpRealVo real = new WaterPumpRealVo();
WaterPumpRealVo waterPumpRealVo = new WaterPumpRealVo(); real.setDeptId(device.getCreateDept());
waterPumpRealVo.setDeptId(device.getCreateDept()); real.setDeviceCode(device.getEmCode());
waterPumpRealVo.setDeviceCode(device.getEmCode()); real.setDeptName(device.getName());
waterPumpRealVo.setDeptName(device.getName());
// 装机容量 // 装机容量
waterPumpRealVo.setInstalledCapacity(device.getInstalledCapacity()); real.setInstalledCapacity(device.getInstalledCapacity());
// 开机状态 // 开机状态
int state = this.getPumpState(device,map); real.setState(this.getPumpState(device,map));
waterPumpRealVo.setState(state);
// 功率因数 // 功率因数
double powerFactor = this.getPowerFactor(device,map); real.setPowerFactor(this.getPowerFactor(device,map));
waterPumpRealVo.setPowerFactor(powerFactor);
// 有功功率 // 有功功率
float activePower = this.getActivePower(device,map); real.setActivePower(this.getActivePower(device,map));
waterPumpRealVo.setActivePower(activePower);
// 无功功率 // 无功功率
float reactivePower = this.getReactivePower(device,map); real.setReactivePower(this.getReactivePower(device,map));
waterPumpRealVo.setReactivePower(reactivePower);
// 电压 // 电压
double voltage = this.getVoltage(device,map); real.setVoltage(this.getVoltage(device,map));
waterPumpRealVo.setVoltage(voltage);
// 电流 // 电流
double current = this.getCurrent(device,map); real.setCurrent(this.getCurrent(device,map));
waterPumpRealVo.setCurrent(current); return real;
list.add(waterPumpRealVo); }).collect(Collectors.toList());
});
redisTemplate.opsForValue().set(loadwaterpump_real_key,list); redisTemplate.opsForValue().set(loadwaterpump_real_key,list);
} }
@ -148,44 +145,48 @@ public class WaterServiceImpl implements IWaterService {
*/ */
@Override @Override
public void loadWaterPumpTarget(String param) { 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; return;
} }
List<WaterPumpTargetVo> list = new ArrayList<>(); // 泵站设备
valid.forEach(device->{ List<EminfoAndEmParamVo> devices = this.pumpDevices(stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
WaterPumpTargetVo waterPumpTargetVo = new WaterPumpTargetVo(); // 补充站点填报发电量
waterPumpTargetVo.setDeptId(device.getCreateDept()); List<WaterPumpTargetVo> list = this.useFill(stations);
waterPumpTargetVo.setDeviceCode(device.getEmCode()); // 站点设备数据统计
waterPumpTargetVo.setDeptName(device.getName()); if(CollectionUtil.isNotEmpty(devices)){
// 当年用电量 list.addAll(devices.stream().map(device->{
float usrPowerYear = this.getUsrPowerYear(device); WaterPumpTargetVo target = new WaterPumpTargetVo();
waterPumpTargetVo.setUsrPowerYear(usrPowerYear); target.setDeptId(device.getCreateDept());
// 当月用电量 target.setDeviceCode(device.getEmCode());
float usrPowerMon = this.getUsrPowerMon(device); target.setDeptName(device.getName());
waterPumpTargetVo.setUsrPowerMon(usrPowerMon); // 当年用电量
// 当日用电量 target.setUsrPowerYear(this.getUsrPowerYear(device));
float usrPowerDay = this.getUsrPowerDay(device); // 当月用电量
waterPumpTargetVo.setUsrPowerDay(usrPowerDay); target.setUsrPowerMon(this.getUsrPowerMon(device));
// 月运行次数、时长 // 当日用电量
WaterRunVo runMon = this.getRunData(device,1); target.setUsrPowerDay(this.getUsrPowerDay(device));
waterPumpTargetVo.setRunCountMon(runMon.getCount()); // 当日机组有功功率
waterPumpTargetVo.setRunDurationMon(runMon.getHour()); target.setActivePowerVoList(this.getActivePowerVoList(device));
// 年运行次数、时长 // 近30天用电量
WaterRunVo runYear = this.getRunData(device,0); target.setUsrPowerVoList(this.getUsrPowerVoList(device));
waterPumpTargetVo.setRunCountYear(runYear.getCount()); // 近3年用电量
waterPumpTargetVo.setRunDurationYear(runYear.getHour()); target.setUsrYearMap(this.getUsrYearMap(device));
// 当日机组有功功率 // 月运行次数、时长
List<ActivePowerVo> activePowerVoList = this.getActivePowerVoList(device); WaterRunVo runMon = this.getRunData(device,1);
waterPumpTargetVo.setActivePowerVoList(activePowerVoList); target.setRunCountMon(runMon.getCount());
// 近30天用电量 target.setRunDurationMon(runMon.getHour());
List<UsrPowerVo> usrPowerVoList = this.getUsrPowerVoList(device); // 年运行次数、时长
waterPumpTargetVo.setUsrPowerVoList(usrPowerVoList); WaterRunVo runYear = this.getRunData(device,0);
// 近3年用电量 target.setRunCountYear(runYear.getCount());
Map<String,Float> usrYearMap = this.getUsrYearMap(device); target.setRunDurationYear(runYear.getHour());
waterPumpTargetVo.setUsrYearMap(usrYearMap); return target;
list.add(waterPumpTargetVo); }).collect(Collectors.toList()));
}); }
redisTemplate.opsForValue().set(loadwaterpump_target_key,list); redisTemplate.opsForValue().set(loadwaterpump_target_key,list);
} }
@ -231,22 +232,19 @@ public class WaterServiceImpl implements IWaterService {
} }
/** /**
* 获取监测点位是否配置 * 泵站设备
* @param instanceCode * @param stations
* @return * @return
*/ */
private boolean getSetting(String instanceCode) { private List<EminfoAndEmParamVo> pumpDevices(List<Long> stations){
// 获取设备监测点位:未配置监测点位不进行统计设备 if(CollectionUtil.isEmpty(stations)){
List<MultiAnalyzeCodePO> list = new ArrayList<>(); return 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;
} }
return false; List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList();
if(CollectionUtil.isEmpty(devices)){
return new ArrayList<>();
}
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); List<String> signages = Collections.singletonList(signage);
realData.setSignages(signages); realData.setSignages(signages);
// 调用fegin接口查询实时数据 // 调用fegin接口查询实时数据
R<List<FieldsData>> R = null; R<List<FieldsData>> R;
try { try {
R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData); R = analyseDataSearchClient.getRealDataByAnalyzeCode(realData);
} catch (Exception e) { } catch (Exception e) {
@ -279,12 +277,8 @@ public class WaterServiceImpl implements IWaterService {
if(StringUtil.isBlank(time)){ if(StringUtil.isBlank(time)){
return 0.0; return 0.0;
} }
try{ Date date = DateUtil.parse(time,DateUtil.DATETIME_FORMAT);
Date date = sdf.parse(time); if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){
if(System.currentTimeMillis() - date.getTime() > 30 * 60 * 1000L){
return 0.0;
}
}catch (ParseException e){
return 0.0; return 0.0;
} }
return Double.parseDouble(R.getData().get(0).getValue()); return Double.parseDouble(R.getData().get(0).getValue());
@ -297,7 +291,7 @@ public class WaterServiceImpl implements IWaterService {
* @return * @return
*/ */
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) { 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(); LocalDateTime endTime = LocalDateTime.now();
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>(); 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 * @return
*/ */
@ -573,11 +544,11 @@ public class WaterServiceImpl implements IWaterService {
*/ */
private float getUsrPowerYear(EminfoAndEmParamVo device) { private float getUsrPowerYear(EminfoAndEmParamVo device) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
String end = sdf.format(calendar.getTime()); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); 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); 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(); PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE)); 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; return generate;
}).collect(Collectors.toMap(PowerMonthVo::getStrMonth,PowerMonthVo::getPower)); }).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 * @param deptId
* @return * @return
*/ */
@Override @Override
public WaterConservancyVo waterConservancy(Long deptId) { public WaterConservancyVo waterConservancy(Long deptId) {
//根据用户权限获取机构 // 查询水利站点
R<List<Dept>> R = sysClient.getDeptByCurrentUser(); List<StationEntity> stations = stationService.getHomeStationList(deptId, HomePageConstant.waterList, HomePageConstant.HYDROPOWER_SERVETYPE);
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { if (CollectionUtil.isEmpty(stations)) {
return null; return new WaterConservancyVo();
}
// 获取水利站点
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;
} }
WaterConservancyVo response = new WaterConservancyVo(); WaterConservancyVo response = new WaterConservancyVo();
// 查询指标标题机构 // 查询指标标题机构
Dept title = this.getTitleDetp(R.getData(),deptId); Dept title = this.getTitleDetp(deptId);
if(ObjectUtil.isNotEmpty(title)){ if(ObjectUtil.isNotEmpty(title)){
response.setDepartId(title.getId()); response.setDepartId(title.getId());
response.setDepartName(title.getDeptName()); response.setDepartName(title.getDeptName());
} }
response.setWaterStationCount((int) stationList.stream().filter(o->HomePageConstant.PUMPING.equals(o.getType())).count()); response.setWaterStationCount((int) stations.stream().filter(o->HomePageConstant.PUMPING.equals(o.getType())).count());
response.setSluiceGateCount((int) stationList.stream().filter(o->HomePageConstant.GATE.equals(o.getType())).count()); response.setSluiceGateCount((int) stations.stream().filter(o->HomePageConstant.GATE.equals(o.getType())).count());
response.setWaterInstall(0.0); response.setWaterInstall(0.0);
response.setWaterPower(0.0); response.setWaterPower(0.0);
response.setKWhYear(0f); response.setKWhYear(0f);
@ -838,39 +853,35 @@ public class WaterServiceImpl implements IWaterService {
response.setKWhDay(0f); response.setKWhDay(0f);
// 获取设备实时数据 // 获取设备实时数据
List<WaterPumpRealVo> list = (List<WaterPumpRealVo>) redisTemplate.opsForValue().get(loadwaterpump_real_key); List<WaterPumpRealVo> list = (List<WaterPumpRealVo>) redisTemplate.opsForValue().get(loadwaterpump_real_key);
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isNotEmpty(list)){
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)){
List<WaterPumpRealVo> valid = list.stream().filter(o->deptList.contains(o.getDeptId())).collect(Collectors.toList()); // 装机容量
if(CollectionUtil.isEmpty(valid)){ double waterInstall = valid.stream().mapToDouble(WaterPumpRealVo::getInstalledCapacity).sum();
return response; response.setWaterInstall(waterInstall);
// 有功功率
double waterPower = valid.stream().mapToDouble(WaterPumpRealVo::getActivePower).sum();
response.setWaterPower(waterPower);
}
} }
// 装机容量
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); List<WaterPumpTargetVo> targetList = (List<WaterPumpTargetVo>) redisTemplate.opsForValue().get(loadwaterpump_target_key);
if(CollectionUtil.isEmpty(targetList)){ if(CollectionUtil.isNotEmpty(targetList)){
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)){
List<WaterPumpTargetVo> validTarget = targetList.stream().filter(o->deptList.contains(o.getDeptId())).collect(Collectors.toList()); // 年用电量
if(CollectionUtil.isEmpty(valid)){ double kwhYear = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerYear).sum();
return response; response.setKWhYear((float) kwhYear);
// 月用电量
double kwhMon = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerMon).sum();
response.setKWhMon((float) kwhMon);
// 日用电量
double kwhDay = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerDay).sum();
response.setKWhDay((float) kwhDay);
}
} }
// 年用电量
double kwhYear = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerYear).sum();
response.setKWhYear((float) kwhYear);
// 月用电量
double kwhMon = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerMon).sum();
response.setKWhMon((float) kwhMon);
// 日用电量
double kwhDay = validTarget.stream().mapToDouble(WaterPumpTargetVo::getUsrPowerDay).sum();
response.setKWhDay((float) kwhDay);
return response; return response;
} }
@ -888,7 +899,7 @@ public class WaterServiceImpl implements IWaterService {
return null; 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); Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather(codes);
// 获取七天天气 // 获取七天天气
@ -977,7 +988,7 @@ public class WaterServiceImpl implements IWaterService {
* @return * @return
*/ */
private List<StationEntity> getStationList(Map<Dept, List<StationEntity>> map) { 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)){ if(CollectionUtil.isEmpty(stationList)){
return null; 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)){ if(CollectionUtil.isEmpty(codeList)){
return null; return null;
} }
@ -1154,16 +1165,17 @@ public class WaterServiceImpl implements IWaterService {
* @return * @return
*/ */
@Override @Override
public Dept getTitleDetp(List<Dept> authList, Long deptId) { public Dept getTitleDetp(Long deptId) {
R<List<Dept>> depts = sysClient.getDeptByCurrentUser();
if(null == deptId){ 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)){ if(ObjectUtil.isEmpty(dept)){
return null; return null;
} }
return dept; 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)){ if(CollectionUtil.isEmpty(list)){
return null; return null;
} }
@ -1289,12 +1301,12 @@ public class WaterServiceImpl implements IWaterService {
response.setUsePowerMon((float) kwhMon); response.setUsePowerMon((float) kwhMon);
// 月运行时长 // 月运行时长
Optional<WaterPumpTargetVo> waterPumpTargetVoOptional = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationMon)); 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(); //double monRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationMon)).get().getRunDurationMon();
response.setRunDurationMon(monRunTime); response.setRunDurationMon(monRunTime);
// 年运行时长 // 年运行时长
Optional<WaterPumpTargetVo> optionalWaterPumpTargetVo = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear)); 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(); //double yearRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear)).get().getRunDurationYear();
response.setRunDurationYear(yearRunTime); 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 * @param deptId
* @return * @return
@ -1536,7 +1528,7 @@ public class WaterServiceImpl implements IWaterService {
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
return null; return null;
} }
Dept title = this.getTitleDetp(R.getData(),deptId); Dept title = this.getTitleDetp(deptId);
if(ObjectUtil.isEmpty(title)){ if(ObjectUtil.isEmpty(title)){
return null; 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; 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.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; 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.MaintenanceTaskVo;
import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo; import com.hnac.hzims.ticket.areamonthly.vo.MaintenanceTaskWithAreaVo;
import com.hnac.hzims.vo.SafeCheckStatisticVO; 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.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; 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 org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map; 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())){ if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){
return null; return null;
} }
Dept dept = waterService.getTitleDetp(R.getData(),deptId); Dept dept = waterService.getTitleDetp(deptId);
if(ObjectUtil.isEmpty(dept)){ if(ObjectUtil.isEmpty(dept)){
return null; 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.*"}) @ComponentScan(basePackages = {"com.hnac.*"})
public class SafeproductApplication { public class SafeproductApplication {
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(Constants.APP_NAME, SafeproductApplication.class, 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 io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; 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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
@ -76,7 +77,7 @@ public class CheckCompanyController extends BladeController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation(value = "分页", notes = "查询条件:startDate,endDate,status") @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); 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; package com.hnac.hzims.safeproduct.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.safeproduct.dto.CheckMonthDTO; import com.hnac.hzims.safeproduct.dto.CheckMonthDTO;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity; import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
@ -11,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; 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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
@ -108,4 +110,29 @@ public class CheckMonthController extends BladeController {
return R.data(page); 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 io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; 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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
@ -58,7 +59,7 @@ public class SafeEquipmentTrialController extends BladeController {
@ApiOperation(value = "分页", notes = "查询条件:createDept,fileName,startTime,endTime") @ApiOperation(value = "分页", notes = "查询条件:createDept,fileName,startTime,endTime")
@OperationAnnotation(title = "设备试验",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, @OperationAnnotation(title = "设备试验",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,
action = "分页条件") action = "分页条件")
public R<IPage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) { public R<BladePage<SafeEquipmentTrialVO>> list(SafeEquipmentTrialDTO safeEquipmentTrialDTO, Query query) {
return service.pageCondition(safeEquipmentTrialDTO, 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.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.entity.CheckMonthEntity;
import com.hnac.hzims.safeproduct.vo.CheckMonthVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import org.springblade.core.mp.support.Query; 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); 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> </if>
order by CREATE_TIME desc order by CREATE_TIME desc
</select> </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> </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.CheckCompanyVo;
import com.hnac.hzims.safeproduct.vo.CheckQuarterVo; import com.hnac.hzims.safeproduct.vo.CheckQuarterVo;
import org.springblade.core.mp.base.BaseService; 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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -24,6 +25,6 @@ public interface ICheckCompanyService extends BaseService<CheckCompanyEntity> {
R<CheckCompanyVo> detail(Long id); 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; package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.dto.CheckMonthDTO;
import com.hnac.hzims.safeproduct.entity.CheckMonthEntity; import com.hnac.hzims.safeproduct.entity.CheckMonthEntity;
import com.hnac.hzims.safeproduct.vo.CheckMonthVo; 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); 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.entity.SafeEquipmentTrialEntity;
import com.hnac.hzims.safeproduct.vo.SafeEquipmentTrialVO; import com.hnac.hzims.safeproduct.vo.SafeEquipmentTrialVO;
import org.springblade.core.mp.base.BaseService; 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.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -16,7 +17,7 @@ import java.util.List;
*/ */
public interface SafeEquipmentTrialService extends BaseService<SafeEquipmentTrialEntity> { 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); int getSafeEquipmentCount(SafeEquipmentTrialDTO dto);

206
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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.dto.CheckCompanyDTO;
import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity; import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity;
import com.hnac.hzims.safeproduct.entity.CheckItemEntity; 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 com.hnac.hzims.safeproduct.wrapper.CheckCompanyWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl; 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.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -37,112 +40,117 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class CheckCompanyServiceImpl extends BaseServiceImpl<CheckCompanyMapper, CheckCompanyEntity> implements ICheckCompanyService { public class CheckCompanyServiceImpl extends BaseServiceImpl<CheckCompanyMapper, CheckCompanyEntity> implements ICheckCompanyService {
private final CheckCompanyMapper CheckCompanyMapper; private final CheckCompanyMapper CheckCompanyMapper;
private final ICheckItemInstanceService itemInstanceService; private final ICheckItemInstanceService itemInstanceService;
private final ISysClient sysClient; private final ISysClient sysClient;
@Override @Override
public boolean doSave(CheckCompanyDTO req) { public boolean doSave(CheckCompanyDTO req) {
boolean result = save(req); boolean result = save(req);
if (result) { if (result) {
Long checkId = req.getId(); Long checkId = req.getId();
List<CheckItemInstanceEntity> items = req.getItems(); List<CheckItemInstanceEntity> items = req.getItems();
items.forEach(item -> { items.forEach(item -> {
item.setOid(item.getId()); item.setOid(item.getId());
item.setId(null); item.setId(null);
item.setCheckId(checkId); item.setCheckId(checkId);
}); });
itemInstanceService.saveBatch(items); itemInstanceService.saveBatch(items);
} }
return result; return result;
} }
@Override @Override
public boolean doUpdate(CheckCompanyDTO req) { public boolean doUpdate(CheckCompanyDTO req) {
boolean result = updateById(req); boolean result = updateById(req);
if (result) { if (result) {
List<CheckItemInstanceEntity> items = req.getItems(); List<CheckItemInstanceEntity> items = req.getItems();
items.forEach(itemInstanceService::updateById); items.forEach(itemInstanceService::updateById);
} }
return result; return result;
} }
@Override @Override
public R<CheckCompanyVo> detail(Long id) { public R<CheckCompanyVo> detail(Long id) {
CheckCompanyEntity entity = CheckCompanyMapper.selectById(id); CheckCompanyEntity entity = CheckCompanyMapper.selectById(id);
CheckCompanyVo vo = CheckCompanyWrapper.build().entityVO(entity); CheckCompanyVo vo = CheckCompanyWrapper.build().entityVO(entity);
//查询检查项 //查询检查项
QueryWrapper<CheckItemInstanceEntity> queryMapper = new QueryWrapper<>(); QueryWrapper<CheckItemInstanceEntity> queryMapper = new QueryWrapper<>();
queryMapper.eq("CHECK_ID", vo.getId()); queryMapper.eq("CHECK_ID", vo.getId());
queryMapper.orderByAsc("ORG_ID", "SORT"); queryMapper.orderByAsc("ORG_ID", "SORT");
List<CheckItemInstanceEntity> items = itemInstanceService.list(queryMapper); List<CheckItemInstanceEntity> items = itemInstanceService.list(queryMapper);
//查询子项,用于前端判断 //查询子项,用于前端判断
items.forEach(item -> item.setChildren(findChildren(item, items))); items.forEach(item -> item.setChildren(findChildren(item, items)));
//按部门分组 //按部门分组
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
Map<Long, List<CheckItemInstanceEntity>> map = items.stream().collect(Collectors.groupingBy(CheckItemInstanceEntity::getOrgId)); Map<Long, List<CheckItemInstanceEntity>> map = items.stream().collect(Collectors.groupingBy(CheckItemInstanceEntity::getOrgId));
for (Map.Entry<Long, List<CheckItemInstanceEntity>> entry : map.entrySet()) { for (Map.Entry<Long, List<CheckItemInstanceEntity>> entry : map.entrySet()) {
Map<String, Object> data = new HashMap<>(); Map<String, Object> data = new HashMap<>();
data.put("deptId", entry.getKey()); data.put("deptId", entry.getKey());
R<Dept> deptR = sysClient.getDept(entry.getKey()); R<Dept> deptR = sysClient.getDept(entry.getKey());
if (deptR.isSuccess()) { if (deptR.isSuccess()) {
data.put("deptName", Optional.ofNullable(deptR.getData()).map(Dept::getDeptName).orElse(null)); data.put("deptName", Optional.ofNullable(deptR.getData()).map(Dept::getDeptName).orElse(null));
} else { } else {
data.put("deptName", null); data.put("deptName", null);
} }
data.put("items", entry.getValue()); data.put("items", entry.getValue());
list.add(data); list.add(data);
} }
vo.setItems(list); vo.setItems(list);
return R.data(vo); return R.data(vo);
} }
private List<CheckItemEntity> findChildren(CheckItemInstanceEntity entity, List<CheckItemInstanceEntity> list) { private List<CheckItemEntity> findChildren(CheckItemInstanceEntity entity, List<CheckItemInstanceEntity> list) {
List<CheckItemEntity> child = new ArrayList<>(); List<CheckItemEntity> child = new ArrayList<>();
for (CheckItemInstanceEntity itemEntity : list) { for (CheckItemInstanceEntity itemEntity : list) {
if (null != itemEntity.getParentItem() if (null != itemEntity.getParentItem()
&& itemEntity.getParentItem().equals(entity.getOid()) && itemEntity.getParentItem().equals(entity.getOid())
&& itemEntity.getOrgId().equals(entity.getOrgId())) { && itemEntity.getOrgId().equals(entity.getOrgId())) {
child.add(itemEntity); child.add(itemEntity);
itemEntity.setChildren(findChildren(itemEntity, list)); itemEntity.setChildren(findChildren(itemEntity, list));
} }
} }
return child; return child;
} }
@Override @Override
public boolean doDelete(String ids) { public boolean doDelete(String ids) {
List<Long> list = Func.toLongList(ids); List<Long> list = Func.toLongList(ids);
boolean result = deleteLogic(list); boolean result = deleteLogic(list);
if (result) { if (result) {
list.forEach(id -> { list.forEach(id -> {
QueryWrapper<CheckItemInstanceEntity> queryMapper = new QueryWrapper<>(); QueryWrapper<CheckItemInstanceEntity> queryMapper = new QueryWrapper<>();
queryMapper.eq("CHECK_ID", id); queryMapper.eq("CHECK_ID", id);
itemInstanceService.remove(queryMapper); itemInstanceService.remove(queryMapper);
}); });
} }
return result; return result;
} }
@Override @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>() {{ Wrapper<CheckCompanyEntity> queryWrapper = new LambdaQueryWrapper<CheckCompanyEntity>() {{
orderByDesc(CheckCompanyEntity::getCreateTime); orderByDesc(CheckCompanyEntity::getCreateTime);
if (ObjectUtil.isNotEmpty(req.getStartTime())) { if (ObjectUtil.isNotEmpty(req.getStartTime())) {
ge(CheckCompanyEntity::getStartTime, req.getStartTime()); ge(CheckCompanyEntity::getStartTime, req.getStartTime());
} }
if (ObjectUtil.isNotEmpty(req.getEndTime())) { if (ObjectUtil.isNotEmpty(req.getEndTime())) {
le(CheckCompanyEntity::getEndTime, req.getEndTime()); le(CheckCompanyEntity::getEndTime, req.getEndTime());
} }
if (ObjectUtil.isNotEmpty(req.getStatus())) { if (ObjectUtil.isNotEmpty(req.getStatus())) {
eq(CheckCompanyEntity::getStatus, req.getStatus()); eq(CheckCompanyEntity::getStatus, req.getStatus());
} }
}}; eq(StringUtils.isNotBlank(req.getAreaId()), BaseEntity::getCreateDept, req.getAreaId());
IPage page = page(Condition.getPage(query), queryWrapper); apply(req.getYearMonth() != null, "date_format(start_time ,'%Y-%m') = '"
page.setRecords(CheckCompanyWrapper.build().listVO(page.getRecords())); + req.getYearMonth() + "'" + "and date_format(end_time,'%Y-%m') = '" + req.getYearMonth() + "'");
return R.data(page);
} }};
IPage page = page(Condition.getPage(query), queryWrapper);
page.setRecords(CheckCompanyWrapper.build().listVO(page.getRecords()));
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.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.dto.CheckMonthDTO;
import com.hnac.hzims.safeproduct.entity.CheckItemEntity; import com.hnac.hzims.safeproduct.entity.CheckItemEntity;
import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity; 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())); page.setRecords(CheckMonthWrapper.build().listVO(page.getRecords()));
return R.data(page); 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);
}
} }

162
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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.SafeEquipmentDTO;
import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO; import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO;
import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity; 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 com.hnac.hzims.safeproduct.wrapper.SafeEquipmentTrialWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl; 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.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -26,83 +28,91 @@ import java.util.Optional;
@RequiredArgsConstructor @RequiredArgsConstructor
public class SafeEquipmentTrialServiceImpl extends BaseServiceImpl<SafeEquipmentTrialMapper, SafeEquipmentTrialEntity> implements SafeEquipmentTrialService { public class SafeEquipmentTrialServiceImpl extends BaseServiceImpl<SafeEquipmentTrialMapper, SafeEquipmentTrialEntity> implements SafeEquipmentTrialService {
/** /**
* 分页查询 * 分页查询
* @param param *
* @param query * @param param
* @return * @param query
*/ * @return
@Override */
public R<IPage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO param, Query query) { @Override
QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{ public R<BladePage<SafeEquipmentTrialVO>> pageCondition(SafeEquipmentTrialDTO param, Query query) {
if(Optional.ofNullable(param.getCreateDept()).isPresent()){ QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{
eq("create_dept",param.getCreateDept()); if (Optional.ofNullable(param.getCreateDept()).isPresent()) {
} eq("create_dept", param.getCreateDept());
if(Optional.ofNullable(param.getFileName()).isPresent()){ }
like("file_name","%".concat(param.getFileName()).concat("%")); if (Optional.ofNullable(param.getFileName()).isPresent()) {
} like("file_name", "%".concat(param.getFileName()).concat("%"));
if(Optional.ofNullable(param.getStartTime()).isPresent()){ }
gt("create_time", param.getStartTime()); if (Optional.ofNullable(param.getStartTime()).isPresent()) {
} gt("create_time", param.getStartTime());
if(Optional.ofNullable(param.getEndTime()).isPresent()){ }
lt("create_time", param.getEndTime()); if (Optional.ofNullable(param.getEndTime()).isPresent()) {
} lt("create_time", param.getEndTime());
orderByDesc("create_time"); }
}}; lambda().eq(StringUtils.isNotBlank(param.getAreaId()), SafeEquipmentTrialEntity::getCreateDept,
IPage pages = super.page(Condition.getPage(query), queryWrapper); param.getAreaId());
List list = SafeEquipmentTrialWrapper.build().listVO(pages.getRecords()); eq(param.getYearMonth() != null, "date_format(CREATE_TIME,'%Y-%m)", param.getYearMonth());
return R.data(pages.setRecords(list)); orderByDesc("create_time");
} }};
IPage pages = super.page(Condition.getPage(query), queryWrapper);
List list = SafeEquipmentTrialWrapper.build().listVO(pages.getRecords());
pages.setRecords(list);
BladePage bladePage = BladePage.of(pages);
return R.data(bladePage);
}
/** /**
* 获取设备试验次数 * 获取设备试验次数
* @param param *
* @return * @param param
*/ * @return
@Override */
public int getSafeEquipmentCount(SafeEquipmentTrialDTO param) { @Override
if(ObjectUtil.isEmpty(param)){ public int getSafeEquipmentCount(SafeEquipmentTrialDTO param) {
return 0; if (ObjectUtil.isEmpty(param)) {
} return 0;
QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{ }
if(CollectionUtil.isEmpty(param.getDeptList())){ QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{
if(Optional.ofNullable(param.getCreateDept()).isPresent()){ if (CollectionUtil.isEmpty(param.getDeptList())) {
eq("create_dept",param.getCreateDept()); if (Optional.ofNullable(param.getCreateDept()).isPresent()) {
} eq("create_dept", param.getCreateDept());
} else { }
in("create_dept",param.getDeptList()); } else {
} in("create_dept", param.getDeptList());
if(Optional.ofNullable(param.getStartTime()).isPresent()){ }
gt("create_time", param.getStartTime()); if (Optional.ofNullable(param.getStartTime()).isPresent()) {
} gt("create_time", param.getStartTime());
if(Optional.ofNullable(param.getEndTime()).isPresent()){ }
lt("create_time", param.getEndTime()); if (Optional.ofNullable(param.getEndTime()).isPresent()) {
} lt("create_time", param.getEndTime());
}}; }
return this.baseMapper.selectCount(queryWrapper); }};
} return this.baseMapper.selectCount(queryWrapper);
}
/** /**
* 查询设备列表 * 查询设备列表
* @param entity *
* @return * @param entity
*/ * @return
@Override */
public List<SafeEquipmentTrialEntity> getList(SafeEquipmentDTO entity) { @Override
QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{ public List<SafeEquipmentTrialEntity> getList(SafeEquipmentDTO entity) {
if(CollectionUtil.isEmpty(entity.getDeptList())){ QueryWrapper<SafeEquipmentTrialEntity> queryWrapper = new QueryWrapper<SafeEquipmentTrialEntity>() {{
if(Optional.ofNullable(entity.getCreateDept()).isPresent()){ if (CollectionUtil.isEmpty(entity.getDeptList())) {
eq("create_dept",entity.getCreateDept()); if (Optional.ofNullable(entity.getCreateDept()).isPresent()) {
} eq("create_dept", entity.getCreateDept());
} else { }
in("create_dept",entity.getDeptList()); } else {
} in("create_dept", entity.getDeptList());
if(Optional.ofNullable(entity.getTime()).isPresent()){ }
gt("create_time", entity.getTime()); if (Optional.ofNullable(entity.getTime()).isPresent()) {
lt("create_time", entity.getTime()); gt("create_time", entity.getTime());
} lt("create_time", entity.getTime());
}}; }
return this.baseMapper.selectList(queryWrapper); }};
} return this.baseMapper.selectList(queryWrapper);
}
} }

Loading…
Cancel
Save