Browse Source

Merge branch 'prod-5.1.3' of http://175.6.40.68:8081/Jone/hzims-back into prod-5.1.3

zhongwei
liwen 3 months ago
parent
commit
6451a201e1
  1. 11
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClient.java
  2. 3
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClientBack.java
  3. 23
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/DevicePlanGenerationVo.java
  4. 33
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryPointRecordEntity.java
  5. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java
  6. 21
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataParamVo.java
  7. 25
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataVo.java
  8. 22
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailDataVo.java
  9. 19
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailVo.java
  10. 17
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryPointRecordParamVo.java
  11. 45
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryTabulationParamVo.java
  12. 14
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java
  13. 12
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/RectificationEntity.java
  14. 6
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/RectificationParamVo.java
  15. 24
      hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java
  16. 24
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java
  17. 41
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/CommonUseController.java
  18. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java
  19. 11
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.java
  20. 5
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.xml
  21. 9
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java
  22. 16
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryPointRecordService.java
  23. 166
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java
  24. 45
      hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryPointRecordServiceImpl.java
  25. 6
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java
  26. 28
      hzims-service/hzims-big-model/src/main/resources/db/2.0.0.sql
  27. 6
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java
  28. 11
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/VideoTaskSchedule.java
  29. 5
      hzims-service/inspect/src/main/resources/db/2.0.0.sql
  30. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  31. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java
  32. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/DutyGroupGeneratingCapacityServiceImpl.java
  33. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/PointServiceImpl.java
  34. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java
  35. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  36. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  37. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  38. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainSystemMonitoringServiceImpl.java
  39. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  40. 46
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java
  41. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java
  42. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/controller/RectificationController.java
  43. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/RectificationMapper.xml
  44. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.java
  45. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/RectificlationServiceImpl.java
  46. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/TrainServiceImpl.java
  47. 5
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/ViolationServiceImpl.java
  48. 2
      pom.xml

11
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClient.java

@ -2,6 +2,7 @@ package com.hnac.hzims.equipment.feign;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
@ -64,17 +65,13 @@ public interface IPlanGenertionClient {
Map<String, Map<String, Double>> getYAndMGenerationGroupCount(@RequestParam("stationIds") List<String> stationIds, @RequestParam("date") String date);
/**
* 根据参数 站点Id 或者 机构ID 时间 'yyyy-MM' 获取计划发电量
*
* @param stationIds 站点IDS
* @param deptIds 机构IDS
* @param date 时间
* @param param
* @return
*/
@GetMapping(GET_PLAN_GENERATION_BY_PARAM)
List<PlanGenerationEntity> getPlanGenerationByParam(@RequestParam(value = "stationIds", required = false) List<String> stationIds, @RequestParam(value = "deptIds", required = false) List<String> deptIds, @RequestParam(value = "date", required = false) String date);
@PostMapping(GET_PLAN_GENERATION_BY_PARAM)
List<PlanGenerationEntity> getPlanGenerationByParam(@RequestBody DevicePlanGenerationVo param);
/**

3
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClientBack.java

@ -1,6 +1,7 @@
package com.hnac.hzims.equipment.feign;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
@ -42,7 +43,7 @@ public class IPlanGenertionClientBack implements IPlanGenertionClient {
}
@Override
public List<PlanGenerationEntity> getPlanGenerationByParam(List<String> stationIds,List<String> deptIds, String date) {
public List<PlanGenerationEntity> getPlanGenerationByParam(DevicePlanGenerationVo param) {
return null;
}

23
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/DevicePlanGenerationVo.java

@ -0,0 +1,23 @@
package com.hnac.hzims.equipment.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
public class DevicePlanGenerationVo {
@ApiModelProperty(value = "站点编码集合")
private List<String>stationIds;
@ApiModelProperty(value = "机构ID集合")
private List<String> deptIds;
@ApiModelProperty(value = "时间")
private String date;
}

33
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryPointRecordEntity.java

@ -0,0 +1,33 @@
package com.hnac.hzims.history.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* @author ysj
*/
@Data
@TableName("hzims_history_point_record")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备历史数据模板")
public class HistoryPointRecordEntity extends TenantEntity {
@ApiModelProperty(value = "站点编码")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "点位Id")
private String historyPoint;
@ApiModelProperty(value = "点位名称")
private String historyPointName;
@ApiModelProperty(value = "查询次数")
private Integer number;
}

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/entity/HistoryTemplateEntity.java

@ -8,12 +8,10 @@ import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
/**
* 设备树绑定巡检实体类
* @author tanghaihao
* @date 2023年06月14日 16:46
* @author ysj
*/
@Data
@TableName("hzims_device_history_template")
@TableName("hzims_history_template")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "设备历史数据模板")
public class HistoryTemplateEntity extends TenantEntity {

21
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataParamVo.java

@ -17,21 +17,42 @@ import java.time.LocalDateTime;
@ApiModel(value = "设备历史查询参数")
public class HistoryDataParamVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "站点名称")
private String stationName;
@ApiModelProperty(value = "第一个点位")
private String firstAttrId;
@ApiModelProperty(value = "第一个点位名称")
private String firstAttrName;
@ApiModelProperty(value = "第二个点位")
private String secondAttrId;
@ApiModelProperty(value = "第二个点位名称")
private String secondAttrName;
@ApiModelProperty(value = "第三个点位")
private String thirdlyAttrId;
@ApiModelProperty(value = "第三个点位名称")
private String thirdlyAttrName;
@ApiModelProperty(value = "第四个点位")
private String fourthAttrId;
@ApiModelProperty(value = "第四个点位名称")
private String fourthAttrName;
@ApiModelProperty(value = "第五个点位")
private String fifthAttrId;
@ApiModelProperty(value = "第五个点位名称")
private String fifthAttrName;
@ApiModelProperty(value = "开始时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)

25
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDataVo.java

@ -0,0 +1,25 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "设备历史数据")
public class HistoryDataVo {
@ApiModelProperty(value = "点位下标")
private String attrIndex;
@ApiModelProperty(value = "第一个点位")
private String attrIndexName;
@ApiModelProperty(value = "点位历史数据")
private List<HistoryDetailDataVo> data;
}

22
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailDataVo.java

@ -0,0 +1,22 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "设备历史数据")
public class HistoryDetailDataVo {
@ApiModelProperty(value = "时间")
private String ts;
@ApiModelProperty(value = "值")
private String val;
}

19
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryDetailVo.java

@ -0,0 +1,19 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "设备历史数据")
public class HistoryDetailVo {
@ApiModelProperty(value = "数据")
private List<HistoryDetailDataVo> data;
}

17
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryPointRecordParamVo.java

@ -0,0 +1,17 @@
package com.hnac.hzims.history.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class HistoryPointRecordParamVo {
@ApiModelProperty(value = "站点Id")
private String stationId;
@ApiModelProperty(value = "用户Id")
private Long createUser;
}

45
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/history/vo/HistoryTabulationParamVo.java

@ -0,0 +1,45 @@
package com.hnac.hzims.history.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author ysj
*/
@Data
@ApiModel(value = "设备历史查询参数")
public class HistoryTabulationParamVo {
@ApiModelProperty(value = "站点Id")
private String projectId;
@ApiModelProperty(value = "站点Id")
private List<String> facDeivceAttrIds;
@ApiModelProperty(value = "开始时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime startTime;
@ApiModelProperty(value = "结束时间")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private LocalDateTime endTime;
@ApiModelProperty(value = "是否分页")
private Boolean isPage;
@ApiModelProperty(value = "页码")
private Integer current;
@ApiModelProperty(value = "页码条数")
private Integer pageSize;
}

14
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/homePage/hydroelectric/vo/HydroelectricStationVo.java

@ -1,9 +1,12 @@
package com.hnac.hzims.operational.homePage.hydroelectric.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Tolerate;
import java.util.List;
@ -22,36 +25,47 @@ public class HydroelectricStationVo {
private String stationName;
@ApiModelProperty(value = "总装机容量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double installedCapacity;
@ApiModelProperty(value = "总发电负荷")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerSum;
@ApiModelProperty(value = "容量利用率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double capacityRate;
@ApiModelProperty(value = "月计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerMonPlan;
@ApiModelProperty(value = "月发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerMon;
@ApiModelProperty(value = "月发电量完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerRateMon;
@ApiModelProperty(value = "年计划发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerYearPlan;
@ApiModelProperty(value = "年发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerYear;
@ApiModelProperty(value = "年发电完成率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerRateYear;
@ApiModelProperty(value = "今日发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerDay;
@ApiModelProperty(value = "昨日发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double powerYesterDay;
@ApiModelProperty(value = "七日内天气")

12
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/entity/RectificationEntity.java

@ -37,18 +37,18 @@ public class RectificationEntity extends TenantEntity {
private Integer rectificationType;
@ApiModelProperty(value = "限时日期")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
private Date limitTime;
@ApiModelProperty(value = "提醒日期")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
private Date remindTime;
@ApiModelProperty(value = "完成日期")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@DateTimeFormat(pattern = DateUtil.PATTERN_DATE)
@JsonFormat(pattern = DateUtil.PATTERN_DATE)
private Date completeTime;
@ApiModelProperty(value = "问题事项")

6
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/train/vo/RectificationParamVo.java

@ -24,4 +24,10 @@ public class RectificationParamVo {
@ApiModelProperty(value = "责任人")
private String personLiableName;
@ApiModelProperty(value = "限时开始时间")
private String startTime;
@ApiModelProperty(value = "限时结束时间")
private String endTime;
}

24
hzims-service/equipment/src/main/java/com/hnac/hzims/electric/service/impl/ElectricReportServiceImpl.java

@ -156,6 +156,21 @@ public class ElectricReportServiceImpl implements IElectricReportService {
}else{
comprehensive.setLastMonthGenerateRate(0.0);
}
// 本年发电
if(CollectionUtil.isEmpty(electrics)){
comprehensive.setYearGenerate(comprehensive.getMonthGenerate());
comprehensive.setLastYearGenerate(comprehensive.getLastMonthGenerate());
}else{
// 累计发电
comprehensive.setYearGenerate(electrics.stream().mapToDouble(ComprehensiveElectricVo::getMonthGenerate).sum() + comprehensive.getMonthGenerate());
comprehensive.setLastYearGenerate(electrics.stream().mapToDouble(ComprehensiveElectricVo::getLastMonthGenerate).sum() + comprehensive.getLastMonthGenerate());
}
if(comprehensive.getYearGenerate() > 0 && comprehensive.getLastYearGenerate() > 0){
comprehensive.setLastYearGenerateRate(BigDecimal.valueOf(comprehensive.getYearGenerate() / comprehensive.getLastYearGenerate() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}else{
comprehensive.setLastYearGenerateRate(0.0);
}
// 本月等效小时
if(comprehensive.getMonthGenerate() > 0){
comprehensive.setMonthEquivalent(BigDecimal.valueOf(comprehensive.getMonthGenerate() / installedCapacity).setScale(2, RoundingMode.HALF_UP).doubleValue());
@ -168,11 +183,6 @@ public class ElectricReportServiceImpl implements IElectricReportService {
}else{
comprehensive.setLastMonthEquivalent(0.0);
}
comprehensive.setYearGenerate(threes.stream().filter(o->o.getStrMonth().contains(currentYear)).mapToDouble(o->o.getGenerate().doubleValue()).sum());
comprehensive.setLastYearGenerate(threes.stream().filter(o->o.getStrMonth().contains(lastYear)).mapToDouble(o->o.getGenerate().doubleValue()).sum());
if(comprehensive.getYearGenerate() > 0 && comprehensive.getLastYearGenerate() > 0){
comprehensive.setLastYearGenerateRate(BigDecimal.valueOf(comprehensive.getYearGenerate() / comprehensive.getLastYearGenerate() * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
}
if(CollectionUtil.isEmpty(electrics)){
// 本年等效小时
comprehensive.setYearEquivalent(comprehensive.getMonthEquivalent());
@ -783,7 +793,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
AnalyzeDataConditionPO generate = new AnalyzeDataConditionPO();
generate.setFull(1);
generate.setKeepFigures(2);
generate.setAccessRules(6);
generate.setAccessRules(5);
generate.setSaveTimeType(2);
generate.setSignages("generation_capacity");
generate.setTimeInterval(1);
@ -794,7 +804,7 @@ public class ElectricReportServiceImpl implements IElectricReportService {
AnalyzeDataConditionPO reactive = new AnalyzeDataConditionPO();
reactive.setFull(1);
reactive.setKeepFigures(2);
reactive.setAccessRules(6);
reactive.setAccessRules(5);
reactive.setSaveTimeType(2);
reactive.setSignages("reactive_generation");
reactive.setTimeInterval(1);

24
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java

@ -1,17 +1,23 @@
package com.hnac.hzims.equipment.feign;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.service.IPlanGenerationService;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -81,18 +87,22 @@ public class PlanGenertionClient implements IPlanGenertionClient{
public Map<String, Map<String, Double>> getYAndMGenerationGroupCount(List<String> stationIds,String date) {
return service.getYAndMGenerationGroupCount(stationIds,date);
}
/**
* 根据参数 站点Id 或者 机构ID 时间 'yyyy-MM' 获取计划发电量
*
* @param stationIds 站点IDS
* @param deptIds 机构IDS
* @param date 时间
* @param param
* @return
*/
@GetMapping(GET_PLAN_GENERATION_BY_PARAM)
@PostMapping(GET_PLAN_GENERATION_BY_PARAM)
@Override
public List<PlanGenerationEntity> getPlanGenerationByParam(List<String> stationIds,List<String> deptIds, String date) {
return service.getPlanGenerationByParam(stationIds,deptIds,date);
public List<PlanGenerationEntity> getPlanGenerationByParam(DevicePlanGenerationVo param) {
if(CollectionUtil.isEmpty(param.getStationIds()) && CollectionUtil.isEmpty(param.getDeptIds())){
return new ArrayList<>();
}
if(StringUtils.isEmpty(param.getDate())){
return new ArrayList<>();
}
return service.getPlanGenerationByParam(param.getStationIds(),param.getDeptIds(),param.getDate());
}
/**

41
hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/CommonUseController.java

@ -0,0 +1,41 @@
package com.hnac.hzims.history.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.history.entity.HistoryPointRecordEntity;
import com.hnac.hzims.history.entity.HistoryTemplateEntity;
import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.service.IHistoryPointRecordService;
import com.hnac.hzims.history.vo.*;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* @author ysj
*/
@RestController
@AllArgsConstructor
@RequestMapping("/commonUse")
@Api(value = "曲线常用点位", tags = "曲线常用点位")
public class CommonUseController extends BladeController {
private final IHistoryPointRecordService service;
@GetMapping("/tabulation")
@ApiOperationSupport(order = 5)
@ApiOperation(value = "常用点位列表", notes = "查询条件:params、query")
public R<List<HistoryPointRecordEntity>> tabulation(HistoryPointRecordParamVo params) {
return R.data(service.tabulation(params));
}
}

8
hzims-service/equipment/src/main/java/com/hnac/hzims/history/controller/DeviceHistoryController.java

@ -2,9 +2,7 @@ package com.hnac.hzims.history.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.vo.HistoryDataParamVo;
import com.hnac.hzims.history.vo.HistoryDevicePointVo;
import com.hnac.hzims.history.vo.HistoryFactoryPointVo;
import com.hnac.hzims.history.vo.*;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
@ -70,14 +68,14 @@ public class DeviceHistoryController extends BladeController {
@PostMapping("/history_curve")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "设备历史数据曲线图", notes = "获取设备历史数据曲线图")
public R<Map<String, Object>> historyCurve(@RequestBody HistoryDataParamVo param) {
public R<List<HistoryDataVo>> historyCurve(@RequestBody HistoryDataParamVo param) {
return R.data(service.historyCurve(param));
}
@PostMapping("/history_tabulation")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "设备历史数据列表", notes = "获取设备历史数据列表")
public R<Map<String, Object>> historyTabulation(@RequestBody HistoryDataParamVo param) {
public R<List<Map<String, Object>>> historyTabulation(@RequestBody HistoryTabulationParamVo param) {
return R.data(service.historyTabulation(param));
}

11
hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.history.mapper;
import com.hnac.hzims.history.entity.HistoryPointRecordEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @author ysj
*/
public interface HistoryPointRecordMapper extends UserDataScopeBaseMapper<HistoryPointRecordEntity> {
}

5
hzims-service/equipment/src/main/java/com/hnac/hzims/history/mapper/HistoryPointRecordMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hnac.hzims.history.mapper.HistoryPointRecordMapper" >
</mapper>

9
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryDeviceService.java

@ -1,8 +1,6 @@
package com.hnac.hzims.history.service;
import com.hnac.hzims.history.vo.HistoryDataParamVo;
import com.hnac.hzims.history.vo.HistoryDevicePointVo;
import com.hnac.hzims.history.vo.HistoryFactoryPointVo;
import com.hnac.hzims.history.vo.*;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
@ -24,8 +22,7 @@ public interface IHistoryDeviceService {
List<HistoryFactoryPointVo> factory_point(String projectId, String facDeviceId, String facDeviceName, String attrName);
List<HistoryDataVo> historyCurve(HistoryDataParamVo param);
Map<String, Object> historyCurve(HistoryDataParamVo param);
Map<String, Object> historyTabulation(HistoryDataParamVo param);
List<Map<String, Object>> historyTabulation(HistoryTabulationParamVo param);
}

16
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/IHistoryPointRecordService.java

@ -0,0 +1,16 @@
package com.hnac.hzims.history.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.history.entity.HistoryPointRecordEntity;
import com.hnac.hzims.history.entity.HistoryTemplateEntity;
import com.hnac.hzims.history.vo.HistoryPointRecordParamVo;
import java.util.List;
/**
* @author ysj
*/
public interface IHistoryPointRecordService extends IService<HistoryPointRecordEntity> {
List<HistoryPointRecordEntity> tabulation(HistoryPointRecordParamVo params);
}

166
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryDeviceServiceImpl.java

@ -1,12 +1,17 @@
package com.hnac.hzims.history.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.history.entity.HistoryPointRecordEntity;
import com.hnac.hzims.history.service.IHistoryDeviceService;
import com.hnac.hzims.history.vo.HistoryDataParamVo;
import com.hnac.hzims.history.vo.HistoryDevicePointVo;
import com.hnac.hzims.history.vo.HistoryFactoryPointVo;
import com.hnac.hzims.history.service.IHistoryPointRecordService;
import com.hnac.hzims.history.vo.*;
import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient;
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient;
import com.hnac.hzinfo.sdk.v5.device.source.dto.HisFacSourceDataDTO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO;
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceVO;
import com.hnac.hzinfo.sdk.v5.hzfac.HzFacClient;
@ -14,14 +19,20 @@ import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceAttrVO;
import com.hnac.hzinfo.sdk.v5.hzfac.vo.FacDeviceVO;
import lombok.AllArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
/**
@ -31,12 +42,17 @@ import java.util.stream.Collectors;
@AllArgsConstructor
public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
private final IHistoryPointRecordService pointRecordService;
private final HzFacClient hzFacClient;
private final DeviceClient deviceClient;
private final DeviceDataClient deviceDataClient;
private static final ExecutorService pool = new ThreadPoolExecutor(2, 2, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(10), new ThreadFactoryBuilder().setNameFormat("history-point-save-%d").build() , new ThreadPoolExecutor.CallerRunsPolicy());
/**
* 项目设备列表
* @param projectId
@ -163,7 +179,7 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
* @return
*/
@Override
public Map<String, Object> historyCurve(HistoryDataParamVo param) {
public List<HistoryDataVo> historyCurve(HistoryDataParamVo param) {
// 计算查询数据维度 : 0-10秒 、 1-1分钟 、2-5分钟 .....
Integer intervalType = this.computeInterval(param.getStartTime(),param.getEndTime());
// 查询数据
@ -186,10 +202,62 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
throw new ServiceException(result.getMsg());
}
if(CollectionUtil.isEmpty(result.getData())){
return new HashMap<>();
return new ArrayList<>();
}
// 异步线程保存常用查询
this.commonUserSave(param);
// 返回结构
return result.getData().entrySet().stream().map(entry->{
HistoryDataVo history = new HistoryDataVo();
if("firstAttr".equals(entry.getKey())){
history.setAttrIndex(param.getFirstAttrId());
history.setAttrIndexName(param.getFirstAttrName());
}else if("secondAttr".equals(entry.getKey())){
history.setAttrIndex(param.getSecondAttrId());
history.setAttrIndexName(param.getSecondAttrName());
}else if("thirdlyAttr".equals(entry.getKey())){
history.setAttrIndex(param.getThirdlyAttrId());
history.setAttrIndexName(param.getThirdlyAttrName());
}else if("fourthAttr".equals(entry.getKey())){
history.setAttrIndex(param.getFourthAttrId());
history.setAttrIndexName(param.getFourthAttrName());
}else{
history.setAttrIndex(param.getFifthAttrName());
history.setAttrIndexName(param.getFifthAttrName());
}
HistoryDetailVo historyDetail = JSONObject.parseObject(JSONObject.toJSONString(entry.getValue()),HistoryDetailVo.class);
Date start = null;
String val = null;
List<HistoryDetailDataVo> detailRecords = new ArrayList<>();
for(HistoryDetailDataVo data : historyDetail.getData()) {
HistoryDetailDataVo detail = new HistoryDetailDataVo();
detail.setTs(data.getTs());
if(ObjectUtil.isEmpty(val)){
start = DateUtil.parse(data.getTs(),DateUtil.PATTERN_DATETIME);
val = data.getVal();
detail.setVal(val);
}else{
Date end = DateUtil.parse(data.getTs(),DateUtil.PATTERN_DATETIME);
if(StringUtils.isEmpty(data.getVal())){
if(end.getTime() - start.getTime() <= 5 * 60 * 1000L){
detail.setVal(val);
}else{
detail.setVal(data.getVal());
}
}else{
detail.setVal(data.getVal());
start = DateUtil.parse(data.getTs(),DateUtil.PATTERN_DATETIME);
val = data.getVal();
}
return result.getData();
}
detailRecords.add(detail);
}
history.setData(detailRecords);
return history;
}).collect(Collectors.toList());
}
/**
* 获取设备历史数据列表
@ -197,8 +265,20 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
* @return
*/
@Override
public Map<String, Object> historyTabulation(HistoryDataParamVo param) {
return null;
public List<Map<String, Object>> historyTabulation(HistoryTabulationParamVo param) {
HisFacSourceDataDTO source = new HisFacSourceDataDTO();
source.setProjectId(param.getProjectId());
source.setFacDeivceAttrIds(param.getFacDeivceAttrIds());
source.setBeginTime(param.getStartTime());
source.setFinishTime(param.getEndTime());
source.setIsPage(true);
source.setCurrent(param.getCurrent());
source.setPageSize(param.getPageSize());
Result<List<Map<String, Object>>> tabulations = deviceDataClient.hisFacSourceData(source);
if(!tabulations.isSuccess() || CollectionUtil.isEmpty(tabulations.getData())){
return new ArrayList<>();
}
return tabulations.getData();
}
@ -231,4 +311,74 @@ public class HistoryDeviceServiceImpl implements IHistoryDeviceService {
}
return 5;
}
/**
* 异步保存常用记录
* @param param
*/
@Async
@Transactional(rollbackFor = Exception.class)
protected void commonUserSave(HistoryDataParamVo param) {
// 当前用户Id
Long userId = AuthUtil.getUserId();
// 点位Id
List<String> points = new ArrayList<>();
if(StringUtils.isNotEmpty(param.getFirstAttrId())){
points.add(param.getFirstAttrId());
}
if(StringUtils.isNotEmpty(param.getSecondAttrId())){
points.add(param.getSecondAttrId());
}
if(StringUtils.isNotEmpty(param.getThirdlyAttrId())){
points.add(param.getThirdlyAttrId());
}
if(StringUtils.isNotEmpty(param.getFourthAttrId())){
points.add(param.getFourthAttrId());
}
if(StringUtils.isNotEmpty(param.getFifthAttrId())){
points.add(param.getFifthAttrId());
}
// 查询历史保存数据
List<HistoryPointRecordEntity> records = pointRecordService.list(Wrappers.<HistoryPointRecordEntity>lambdaQuery()
.in(HistoryPointRecordEntity::getHistoryPoint,points)
.eq(HistoryPointRecordEntity::getCreateUser,userId)
.eq(HistoryPointRecordEntity::getStationId,param.getStationId())
);
pointRecordService.saveOrUpdateBatch(points.stream().map(point->{
HistoryPointRecordEntity entity = new HistoryPointRecordEntity();
entity.setStationId(param.getStationId());
entity.setStationName(param.getStationName());
entity.setHistoryPoint(point);
if(param.getFirstAttrId().equals(point)){
entity.setHistoryPointName(param.getFirstAttrName());
}else if(param.getSecondAttrId().equals(point)){
entity.setHistoryPointName(param.getSecondAttrName());
}else if(param.getThirdlyAttrId().equals(point)){
entity.setHistoryPointName(param.getThirdlyAttrName());
}else if(param.getFourthAttrId().equals(point)){
entity.setHistoryPointName(param.getFourthAttrName());
}else{
entity.setHistoryPointName(param.getFifthAttrName());
}
if(CollectionUtil.isEmpty(records)){
entity.setNumber(1);
}else{
// 包含
if(records.stream().map(HistoryPointRecordEntity::getHistoryPoint).collect(Collectors.toList()).contains(point)){
Optional<HistoryPointRecordEntity> optional = records.stream().filter(o->o.getHistoryPoint().equals(point)).findFirst();
if(optional.isPresent()){
entity.setId(optional.get().getId());
entity.setNumber(optional.get().getNumber() + 1);
}else{
entity.setNumber(1);
}
}else{
entity.setNumber(1);
}
}
return entity;
}).collect(Collectors.toList()));
}
}

45
hzims-service/equipment/src/main/java/com/hnac/hzims/history/service/impl/HistoryPointRecordServiceImpl.java

@ -0,0 +1,45 @@
package com.hnac.hzims.history.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.history.entity.HistoryPointRecordEntity;
import com.hnac.hzims.history.mapper.HistoryPointRecordMapper;
import com.hnac.hzims.history.service.IHistoryPointRecordService;
import com.hnac.hzims.history.vo.HistoryPointRecordParamVo;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author ysj
*/
@Service
public class HistoryPointRecordServiceImpl extends ServiceImpl<HistoryPointRecordMapper, HistoryPointRecordEntity> implements IHistoryPointRecordService {
/**
* 查询常用点位前30名
* @param params
* @return
*/
@Override
public List<HistoryPointRecordEntity> tabulation(HistoryPointRecordParamVo params) {
IPage<HistoryPointRecordEntity> page = new Page<>();
page.setPages(1L);
page.setSize(30);
LambdaQueryWrapper wrapper = Wrappers.<HistoryPointRecordEntity>lambdaQuery()
.eq(HistoryPointRecordEntity::getStationId,params.getStationId())
.eq(HistoryPointRecordEntity::getCreateUser,params.getCreateUser())
.orderByDesc(HistoryPointRecordEntity::getNumber);
IPage<HistoryPointRecordEntity> date = super.page(page,wrapper);
if(ObjectUtil.isEmpty(date) || CollectionUtil.isEmpty(date.getRecords())){
return new ArrayList<>();
}
return date.getRecords();
}
}

6
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/mqtt/MqttConfigHzims.java

@ -60,11 +60,11 @@ public class MqttConfigHzims {
log.info(fdpClient.toString()+fdpClient.getClientId());
//drools
DroolsSoeSubscribe droolsSoeSubscribe = new DroolsSoeSubscribe();
MqttAsyncClient droolsClient = droolsSoeSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), droolsMqttConsumer);
MqttAsyncClient droolsClient = droolsSoeSubscribe.subscribe(mqttConfig, "#",Collections.singletonList("#"), droolsMqttConsumer);
log.info(droolsClient.toString()+droolsClient.getClientId());
//Soe
SoeSubscribe soeSubscribe = new SoeSubscribe();
MqttAsyncClient soeClient = soeSubscribe.subscribe(mqttConfig, Collections.singletonList("#"), soeMqttConsumer);
MqttAsyncClient soeClient = soeSubscribe.subscribe(mqttConfig,"#", Collections.singletonList("#"), soeMqttConsumer);
log.info(soeClient.toString()+soeClient.getClientId());
//hz3000
HZ3000SoeSubscribe hz3000SoeSubscribe = new HZ3000SoeSubscribe();
@ -72,7 +72,7 @@ public class MqttConfigHzims {
log.info(hz3000Client.toString()+hz3000Client.getClientId());
//视频
SoeSubscribe subscribe = new SoeSubscribe();
MqttAsyncClient videoClient = subscribe.subscribe(mqttConfig, Collections.singletonList("#"), videoMqttConsumer);
MqttAsyncClient videoClient = subscribe.subscribe(mqttConfig,"#" , Collections.singletonList("#"), videoMqttConsumer);
log.info(videoClient.toString()+videoClient.getClientId());
}catch (Exception e){
log.error(e.toString()) ;

28
hzims-service/hzims-big-model/src/main/resources/db/2.0.0.sql

@ -63,3 +63,31 @@ CREATE TABLE IF NOT EXISTS `HZIMS_DATASOURCE` (
PRIMARY KEY (`ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='模型函数参数';
-- 智谱大模型配置信息
CREATE TABLE `hzims_analysis_info` (
`ID` bigint(20) NOT NULL COMMENT '主键ID',
`CODE` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '策略编码',
`NAME` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '策略名称',
`MODEL` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '调用模型名称',
`REQUEST_CONTENT` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模型交互内容',
`REQUEST_CONSTRAINS` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '模型交互约束',
`REQUEST_OUTPUT_FORMAT` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '模型交互返回格式定义',
`RESULT_STRATEGY` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '结果解析策略',
`RESULT_TYPE` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '结果类型',
`RESULT_KEY` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '结果查询key值',
`RESULT_CONDITION` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '结果对比内容',
`RESULT_JUDGE_MODEL` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '对比方式',
`CHECK_TYPE_SON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '对应字典表“AI识别类型”的key值',
`MESSAGE` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '消息',
`TENANT_ID` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '租户ID',
`STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态',
`CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建单位',
`CREATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
`CREATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '修改人',
`UPDATE_TIME` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除',
`IS_REQUIRE` tinyint(2) NULL DEFAULT NULL COMMENT '是否必须',
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '大模型分析信息' ROW_FORMAT = Dynamic;

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

@ -1486,12 +1486,12 @@ public class RealTargetServiceImpl implements RealTargetService {
Calendar calendar = Calendar.getInstance();
// 结束日期
Date end = calendar.getTime();
calendar.add(Calendar.DAY_OF_MONTH,-1);
calendar.add(Calendar.HOUR_OF_DAY,-23);
// 开始日期
Date start = calendar.getTime();
List<AnalyseDataTaosVO> records = dataService.periodTargetData(DateUtil.format(start,"yyyy-MM-dd HH") + ":00:00", DateUtil.format(end,DateUtil.PATTERN_DATETIME), 3, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
List<ActivePowerVo> activePowers = new ArrayList<>();
while (start.compareTo(end) < 0){
while (start.compareTo(end) <= 0){
String time = DateUtil.format(start,"yyyy-MM-dd HH");
ActivePowerVo active = new ActivePowerVo();
active.setStrHour(time);
@ -2002,7 +2002,7 @@ public class RealTargetServiceImpl implements RealTargetService {
*/
private List<ThirtyGenerationEntity> thirtyGenerations(List<String> stations) {
Calendar calendar = Calendar.getInstance();
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE);
String end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.DAY_OF_MONTH,-30);
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATE);
return thirtyGenerateService.list(Wrappers.<ThirtyGenerationEntity>lambdaQuery()

11
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/schedule/VideoTaskSchedule.java

@ -38,6 +38,7 @@ import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.*;
@ -251,11 +252,11 @@ public class VideoTaskSchedule {
log.error("获取截图文件失败", e);
throw new HzServiceException("获取截图文件失败");
}
// R<BladeFile> fileResponse = ossClient.putFile(multipartFile);
// log.info("【taskId:{}}】视频巡检任务执行,上传minio结果,{}", task.getId(), Optional.ofNullable(fileResponse).map(JsonUtil::toJson).orElse("null"));
// if (fileResponse.isSuccess()) {
// record.setFileUrl(Optional.ofNullable(fileResponse.getData().getLink()).orElse(record.getFileUrl()));
// }
R<BladeFile> fileResponse = ossClient.putFileByNameAndTenantId("file", multipartFile, task.getTenantId());
log.info("【taskId:{}}】视频巡检任务执行,上传minio结果,{}", task.getId(), Optional.ofNullable(fileResponse).map(JsonUtil::toJson).orElse("null"));
if (fileResponse.isSuccess()) {
record.setFileUrl(Optional.ofNullable(fileResponse.getData().getLink()).orElse(record.getFileUrl()));
}
ContentEntity content = contentService.getById(contentId);
if (StringUtil.isBlank(content.getMultiCheckTypeSon())) {

5
hzims-service/inspect/src/main/resources/db/2.0.0.sql

@ -234,3 +234,8 @@ ALTER TABLE `hz_st_ex_task_user` ADD COLUMN `user_name` varchar(255) CHARACTER S
alter table `hz_st_robot` add column `station_code` varchar(50) default null comment '站点编号';
alter table `hz_st_robot` add column `is_device_instance` tinyint(2) default 0 comment '是否绑定设备实例';
alter table `hz_st_re_object` change COLUMN `EM_CODE` `EM_CODE` VARCHAR(50) COMMENT '设备编号';
-- 大模型分析增加多选字段
ALTER TABLE `hz_st_re_content` ADD COLUMN `MULTI_CHECK_TYPE_SON` VARCHAR ( 255 ) NULL COMMENT '存字典表key 检测类型子类 多个数据之间使用逗号分隔开' AFTER `CHECK_TYPE_SON`;
ALTER TABLE `hz_st_re_content_definition` ADD COLUMN `MULTI_CHECK_TYPE_SON` VARCHAR ( 255 ) NULL COMMENT '存字典表key 检测类型子类 多个数据之间使用逗号分隔开' AFTER `CHECK_TYPE_SON`;
ALTER TABLE `hz_st_re_content` ADD COLUMN `ANALYSER_TYPE` VARCHAR ( 255 ) NULL COMMENT 'ai识别分析方式,设备或大模型' AFTER `MULTI_CHECK_TYPE_SON`;
ALTER TABLE `hz_st_re_content_definition` ADD COLUMN `ANALYSER_TYPE` VARCHAR ( 255 ) NULL COMMENT 'ai识别分析方式,设备或大模型' AFTER `MULTI_CHECK_TYPE_SON`;

12
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -9,6 +9,7 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
@ -282,7 +283,10 @@ public class TargetServiceImpl implements TargetService {
List<CompleteGenerationVo> generations;
if(HomePageConstant.HYDROPOWER.equals(type)){
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(), "yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
// 设备指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if(CollectionUtils.isEmpty(targets)){
@ -363,8 +367,12 @@ public class TargetServiceImpl implements TargetService {
return item;
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList());
}else{
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
String mon = DateUtil.format(new Date(),"yyyy");
List<WindEntity> powers = windService.list(Wrappers.<WindEntity>lambdaQuery()
.in(WindEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
@ -740,7 +741,10 @@ public class HzimsDataServiceImpl implements HzimsDataService {
// 查询计划发电量
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, String.valueOf(calendar.get(Calendar.YEAR)));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(String.valueOf(calendar.get(Calendar.YEAR)));
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(param);
// 获取月份集合
List<String> monList = this.mons(0, 12, false);
return monList.stream().map(o -> {

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/DutyGroupGeneratingCapacityServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.operational.duty.entity.DutyGroupGeneratingCapacityEntity;
import com.hnac.hzims.operational.duty.entity.ImsDutyGroupEntity;
import com.hnac.hzims.operational.duty.mapper.DutyGroupGeneratingCapacityMapper;
@ -82,7 +83,10 @@ public class DutyGroupGeneratingCapacityServiceImpl extends ServiceImpl<DutyGrou
if(CollectionUtil.isNotEmpty(imsDeptEntityList)) {
ImsDeptEntity imsDeptEntity = imsDeptEntityList.get(0);
if (imsDeptEntity.getDeptCategory() == 4) {
List<PlanGenerationEntity> planGenerationEntities = planGenertionClient.getPlanGenerationByParam(null, Arrays.asList(imsDeptEntity.getId().toString().split(",")), DateUtil.format(new Date(), "yyyy-MM"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setDeptIds(Arrays.asList(imsDeptEntity.getId().toString().split(",")));
param.setDate(DateUtil.format(new Date(), "yyyy-MM"));
List<PlanGenerationEntity> planGenerationEntities = planGenertionClient.getPlanGenerationByParam(param);
if (CollectionUtil.isNotEmpty(planGenerationEntities)) {
planGenerationCount = planGenerationEntities.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
}
@ -90,7 +94,10 @@ public class DutyGroupGeneratingCapacityServiceImpl extends ServiceImpl<DutyGrou
List<StationEntity> stationList = stationService.getStationByUserAuth(user);
if (CollectionUtil.isNotEmpty(stationList)) {
List<String> stationIdList = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList());
List<PlanGenerationEntity> planGenerationByDateAndStation = planGenertionClient.getPlanGenerationByParam(stationIdList, null, DateUtil.format(new Date(), "yyyy-MM"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setDeptIds(stationIdList);
param.setDate(DateUtil.format(new Date(), "yyyy-MM"));
List<PlanGenerationEntity> planGenerationByDateAndStation = planGenertionClient.getPlanGenerationByParam(param);
if (CollectionUtil.isNotEmpty(planGenerationByDateAndStation)) {
planGenerationCount = planGenerationByDateAndStation.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/history/service/impl/PointServiceImpl.java

@ -130,6 +130,9 @@ public class PointServiceImpl implements PointService {
return result.getData();
}
/**
* 历史数据统计
* @param curve

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/homePage/service/impl/HydroelectricServiceImpl.java

@ -6,6 +6,7 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
@ -194,12 +195,11 @@ public class HydroelectricServiceImpl implements HydroelectricService {
// 今日发电量、昨日发电量
result.setPowerDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerDay).sum());
result.setPowerYesterDay(result.getDevices().stream().mapToDouble(HydroelectricDeviceVo::getPowerYesterDay).sum());
}
// 近30日降雨量/发电量
result.setPowerRains(this.stationPowerRains(result.getDevices(),rains));
// 电站月发电/计划发电
result.setGenerateMons(this.stationGenerateMons(plans,map.get(station.getCode())));
}
return result;
}
@ -217,7 +217,10 @@ public class HydroelectricServiceImpl implements HydroelectricService {
return area;
}
// 站点计划发电量数据
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
// 机构名称
R<Dept> dept = sysClient.getDept(deptId);
@ -310,7 +313,11 @@ public class HydroelectricServiceImpl implements HydroelectricService {
return group;
}
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,DateUtil.format(new Date(),"yyyy"));
// 查询计划发电量
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
// 机构名称
Optional<Dept> dept = currents.getData().stream().min(Comparator.comparing(Dept::getDeptCategory));
@ -728,11 +735,13 @@ public class HydroelectricServiceImpl implements HydroelectricService {
*/
private List<HydroelectricPowerRainVo> stationPowerRains(List<HydroelectricDeviceVo> devices, List<Map<String, Object>> rains) {
List<HydroelectricDeviceGenerateVo> generates = new ArrayList<>();
if(CollectionUtil.isNotEmpty(devices)){
devices.forEach(device->{
if(CollectionUtil.isNotEmpty(device.getGenerates())){
generates.addAll(device.getGenerates());
}
});
}
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
Date end = calendar.getTime();

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

@ -7,6 +7,7 @@ import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmParamClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.defect.constants.TreatMethodConstant;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
@ -388,8 +389,12 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
}
//表格总计
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString());
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, dateFormat);
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setDeptIds(deptIdsString);
param.setDate(year.toString());
List<PlanGenerationEntity> planYearAll = planGenertionClient.getPlanGenerationByParam(param);
param.setDate(dateFormat);
List<PlanGenerationEntity> planMonAll = planGenertionClient.getPlanGenerationByParam(param);
getTabelSum(deptId, powerPercentageVoList, planYearAll, planMonAll, map);
//发电情况统计表数据
ArrayList<HashMap<String, String>> list = new ArrayList<>(powerPercentageVoList.size());
@ -709,7 +714,10 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
private List<MonPowerPercentageVo> getMonPowerPercentageVos(Integer year, Integer month, List<Dept> deptList, List<Long> deptIds, List<StationEntity> stationEntityList, List<String> stationIds, Integer yearBefore, Integer monthBefore) {
List<String> deptIdsString = deptIds.stream().map(String::valueOf).collect(Collectors.toList());
//年计划发电量
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(null, deptIdsString, year.toString());
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setDeptIds(deptIdsString);
param.setDate(year.toString());
List<PlanGenerationEntity> planYearData = planGenertionClient.getPlanGenerationByParam(param);
List<MonPowerPercentageVo> powerPercentageVoList = new ArrayList<>();
//水电站,光伏站和带代运维数据近三年数据
Map<String, Map<String, Float>> powerMapThree = (Map<String, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
@ -1510,8 +1518,10 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
* @return
*/
private List<PlanGenerationEntity> getPlanPower(List<StationEntity> stationList, String mon) {
List<String> list = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList());
return planGenertionClient.getPlanGenerationByParam(list, null, mon);
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stationList.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(mon);
return planGenertionClient.getPlanGenerationByParam(param);
}
/**

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.HomeService;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
@ -228,7 +229,10 @@ public class HomeServiceImpl implements HomeService {
target.setTaget_two(targets.stream().filter(tar->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(tar.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum());
}
if(CollectionUtil.isNotEmpty(stations)){
List<PlanGenerationEntity> plans = planService.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(), "yyyy"));
List<PlanGenerationEntity> plans = planService.getPlanGenerationByParam(param);
if(CollectionUtil.isNotEmpty(plans)){
double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
if(Math.abs(plan) > 0){

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

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.feign.IRainfallClient;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
@ -581,7 +582,10 @@ public class HydropowerServiceImpl implements HydropowerService {
// 查询计划发电量
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,String.valueOf(calendar.get(Calendar.YEAR)));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(String.valueOf(calendar.get(Calendar.YEAR)));
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(param);
// 获取月份集合
List<String> monList = this.mons(0,12,false);
return monList.stream().map(o->{
@ -805,7 +809,10 @@ public class HydropowerServiceImpl implements HydropowerService {
// 获取站点7日天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.weatherService.getWeekWeather(stations);
// 计划发电量
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(codes, null, DateUtil.format(new Date(), "yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(codes);
param.setDate(DateUtil.format(new Date(), "yyyy"));
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(param);
// 实时监测点数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
// 获取站点机组指标数据
@ -1038,7 +1045,10 @@ public class HydropowerServiceImpl implements HydropowerService {
List<String> codes = new ArrayList<>();
areas.forEach((key,value)-> codes.addAll(value.stream().map(StationEntity::getCode).collect(Collectors.toList())));
// 计划发电量
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(codes,null,String.valueOf(Calendar.getInstance().get(Calendar.YEAR)));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(codes);
param.setDate(String.valueOf(Calendar.getInstance().get(Calendar.YEAR)));
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(param);
List<HydropowerAreaVo> hydropowerAreas = areas.entrySet().stream().map(entry->{
HydropowerAreaVo area = new HydropowerAreaVo();
area.setDeptId(entry.getKey().getId());

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

@ -12,6 +12,7 @@ import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IEmParamClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.EmInfoExtendVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.monitor.utils.DateUtils;
@ -416,7 +417,10 @@ public class MainSystemMonitoringServiceImpl implements IMainSystemMonitoringSer
List<EminfoAndEmParamVo> eminfoAndEmParamVos = this.getEmInfoList();
//获取计划发电量
List<PlanGenerationEntity> planGenerationByDateAndStationList = planGenertionClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy-"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(), "yyyy"));
List<PlanGenerationEntity> planGenerationByDateAndStationList = planGenertionClient.getPlanGenerationByParam(param);
LocalDateTime yearBeginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-01-01 00:00:00"), df);

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

@ -8,6 +8,7 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
@ -458,7 +459,10 @@ public class SideHustleServiceImpl implements ISideHustleService {
if(CollectionUtil.isEmpty(codeList)){
return null;
}
return planGenertionClient.getPlanGenerationByParam(codeList, null, DateUtil.format(new Date(), "yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(codeList);
param.setDate(DateUtil.format(new Date(), "yyyy"));
return planGenertionClient.getPlanGenerationByParam(param);
}
@ -714,7 +718,10 @@ public class SideHustleServiceImpl implements ISideHustleService {
List<String> stationCodeList = value.stream().map(StationEntity::getCode).collect(Collectors.toList());
String month = DateUtil.format(new Date(), "yyyy-MM");
// 获取站点的计划发电量
List<PlanGenerationEntity> planList = planGenertionClient.getPlanGenerationByParam(stationCodeList, null, month);
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stationCodeList);
param.setDate(month);
List<PlanGenerationEntity> planList = planGenertionClient.getPlanGenerationByParam(param);
PowerFinishVo powerFinishVo = new PowerFinishVo();
powerFinishVo.setDepartId(key.getId());
powerFinishVo.setDepartName(key.getDeptName());

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

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
@ -133,7 +134,10 @@ public class WindHomeServiceImpl implements WindHomeService {
// 年发电量
score.setGenerateYear(winds.stream().filter(o->o.getFillDate().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(WindEntity::getPower).sum());
// 年计划发电量
List<PlanGenerationEntity> yearPlans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> yearPlans = planClient.getPlanGenerationByParam(param);
score.setPlanYear(yearPlans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
// 年发电完成率
if(Math.abs(score.getGenerateYear()) > 0 && Math.abs(score.getPlanYear()) > 0){
@ -198,7 +202,10 @@ public class WindHomeServiceImpl implements WindHomeService {
*/
private List<PowerMonthVo> currentGenerateCurve(List<WindEntity> winds) {
List<String> mons = this.mons(0,12,false);
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(winds.stream().map(WindEntity::getStationCode).distinct().collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(winds.stream().map(WindEntity::getStationCode).distinct().collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
return mons.stream().map(mon->{
PowerMonthVo power = new PowerMonthVo();
LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
@ -268,7 +275,10 @@ public class WindHomeServiceImpl implements WindHomeService {
subordinate.setGenerationRate(0.0);
}
// 计划发电量查询
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
// 发电完成率
if(Math.abs(subordinate.getGeneration()) > 0 && Math.abs(plan) > 0){
@ -329,7 +339,10 @@ public class WindHomeServiceImpl implements WindHomeService {
// 装机容量
kpi.setCapacity(devices.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum());
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
kpi.setPlan(plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
// 实际发电量
kpi.setGenerate(winds.stream().mapToDouble(WindEntity::getPower).sum());
@ -384,7 +397,10 @@ public class WindHomeServiceImpl implements WindHomeService {
.like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy"));
}});
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(codes, null,DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(codes);
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
return areas.entrySet().stream().map(entry -> {
WindAreaVo area = new WindAreaVo();
area.setDeptId(entry.getKey().getId());
@ -525,7 +541,10 @@ public class WindHomeServiceImpl implements WindHomeService {
.like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy-MM"));
}});
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy-MM"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy-MM"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
if(CollectionUtil.isNotEmpty(windMons)){
areaDuty.setGenerateMon(windMons.stream().mapToDouble(WindEntity::getPower).sum());
// 月计划发电量
@ -829,7 +848,10 @@ public class WindHomeServiceImpl implements WindHomeService {
.like(WindEntity::getFillDate,DateUtil.format(new Date(),"yyyy"));
}});
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null,DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
// 设备
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
subordinate.setStations(stations.stream().map(station -> {
@ -953,7 +975,10 @@ public class WindHomeServiceImpl implements WindHomeService {
.eq(WindEntity::getStationCode,station.getCode())
);
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(Collections.singletonList(station.getCode()), null,DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(Collections.singletonList(station.getCode()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
if(CollectionUtil.isNotEmpty(all)){
// 年计划发电量
wind.setPlanYear(plans.stream().filter(o->o.getDateTime().contains(DateUtil.format(new Date(),"yyyy"))).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
@ -997,7 +1022,10 @@ public class WindHomeServiceImpl implements WindHomeService {
}
List<String> monList = this.mons(1,12,false);
// 计划发电量查询
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(Collections.singletonList(station.getCode()), null,DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(Collections.singletonList(station.getCode()));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
return monList.stream().map(mon->{
LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), mon), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
WindGenerationVo generation = new WindGenerationVo();

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/RunMonthServiceImpl.java

@ -16,6 +16,7 @@ import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.DevicePlanGenerationVo;
import com.hnac.hzims.equipment.vo.RideDeviceVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.IAnalyseDataService;
@ -230,7 +231,10 @@ public class RunMonthServiceImpl extends ServiceImpl<RunMonthMapper, RunMonthEnt
throw new ServiceException("站点未配置机组设备信息、请先为站点添加设备,绑定设备实例,再进行月报查询!");
}
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(Collections.singletonList(stationCode), null , DateUtil.format(new Date(),"yyyy"));
DevicePlanGenerationVo param = new DevicePlanGenerationVo();
param.setStationIds(Collections.singletonList(stationCode));
param.setDate(DateUtil.format(new Date(),"yyyy"));
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(param);
RunMonthEntity run = new RunMonthEntity();
run.setTenantId(station.getTenantId());
run.setCreateDept(station.getRefDept());

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

@ -39,6 +39,7 @@ public class RectificationController extends BladeController {
@ApiOperationSupport(order = 1)
@ApiOperation(value = "新增违章考核", notes = "传入RectificationEntity")
public R save(@RequestBody RectificationEntity entity) {
entity.setStatus(0);
return R.status(service.save(entity));
}
@ -64,7 +65,7 @@ public class RectificationController extends BladeController {
}
@GetMapping("/summary")
@ApiOperationSupport(order = 5)
@ApiOperationSupport(order = 6)
@ApiOperation(value = "汇总", notes = "查询条件:站点ID、月份")
public R<IPage<RectificationSummaryVo>> summary(RectificationParamVo params, Query query) {
return R.data(service.summary(params,Condition.getPage(query)));

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/RectificationMapper.xml

@ -15,6 +15,9 @@
<if test="params.month != null and params.month != ''">
and create_time like concat('%', #{params.month}, '%')
</if>
<if test="params.rectificationType != null">
and rectification_type = #{params.rectificationType}
</if>
</where>
group by station_id,rectification_type
) a

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/mapper/TrainMapper.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.train.entity.TrainEntity;
import com.hnac.hzims.safeproduct.train.vo.TrainParamVo;
import com.hnac.hzims.safeproduct.train.vo.TrainSummaryVo;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
@ -13,5 +14,5 @@ import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
public interface TrainMapper extends UserDataScopeBaseMapper<TrainEntity> {
IPage<TrainSummaryVo> summary(TrainParamVo params, IPage<TrainSummaryVo> page);
IPage<TrainSummaryVo> summary(@Param("params") TrainParamVo params, IPage<TrainSummaryVo> page);
}

7
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/RectificlationServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.train.entity.RectificationEntity;
import com.hnac.hzims.safeproduct.train.entity.ViolationEntity;
import com.hnac.hzims.safeproduct.train.mapper.RectificationMapper;
import com.hnac.hzims.safeproduct.train.service.IRectificlationService;
import com.hnac.hzims.safeproduct.train.vo.RectificationParamVo;
@ -42,6 +43,12 @@ public class RectificlationServiceImpl extends ServiceImpl<RectificationMapper,
if(ObjectUtil.isNotEmpty(params.getPersonLiableName())){
wrapper.like(RectificationEntity::getPersonLiableName,params.getPersonLiableName());
}
if(StringUtil.isNotBlank(params.getStartTime())){
wrapper.ge(RectificationEntity::getLimitTime,params.getStartTime() + " 00:00:00");
}
if(StringUtil.isNotBlank(params.getEndTime())){
wrapper.le(RectificationEntity::getLimitTime,params.getEndTime() + " 23:59:59");
}
return super.page(page,wrapper);
}

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/TrainServiceImpl.java

@ -35,10 +35,10 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, TrainEntity> impl
wrapper.eq(TrainEntity::getStationId,params.getStartTime());
}
if(StringUtil.isNotBlank(params.getStartTime())){
wrapper.ge(TrainEntity::getTrainStartTime,params.getStartTime());
wrapper.ge(TrainEntity::getTrainStartTime,params.getStartTime() + " 00:00:00");
}
if(StringUtil.isNotBlank(params.getEndTime())){
wrapper.le(TrainEntity::getTrainEndTime,params.getEndTime());
wrapper.le(TrainEntity::getTrainStartTime,params.getEndTime() + " 23:59:59");
}
return super.page(page,wrapper);
}

5
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/train/service/impl/ViolationServiceImpl.java

@ -3,6 +3,7 @@ package com.hnac.hzims.safeproduct.train.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.train.entity.TrainEntity;
import com.hnac.hzims.safeproduct.train.entity.ViolationEntity;
import com.hnac.hzims.safeproduct.train.mapper.ViolationMapper;
import com.hnac.hzims.safeproduct.train.service.IViolationService;
@ -33,10 +34,10 @@ public class ViolationServiceImpl extends ServiceImpl<ViolationMapper, Violation
wrapper.eq(ViolationEntity::getStationId,params.getStationId());
}
if(StringUtil.isNotBlank(params.getStartTime())){
wrapper.ge(ViolationEntity::getDiscoverTime,params.getStartTime());
wrapper.ge(ViolationEntity::getDiscoverTime,params.getStartTime() + " 00:00:00");
}
if(StringUtil.isNotBlank(params.getEndTime())){
wrapper.le(ViolationEntity::getDiscoverTime,params.getEndTime());
wrapper.le(ViolationEntity::getDiscoverTime,params.getEndTime() + " 23:59:59");
}
if(ObjectUtil.isNotEmpty(params.getViolationLevel())){
wrapper.eq(ViolationEntity::getViolationLevel,params.getViolationLevel());

2
pom.xml

@ -15,7 +15,7 @@
<properties>
<hzinfo.platform.version>5.1.3.RELEASE.fix2</hzinfo.platform.version>
<data.sdk.version>5.1.3.RELEASE.fix3</data.sdk.version>
<data.sdk.version>5.2.0.0.RELEASE</data.sdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

Loading…
Cancel
Save