Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
H.X 2 years ago
parent
commit
ed57cf4d63
  1. 13
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/constants/CensusConstant.java
  2. 25
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteDefectVo.java
  3. 25
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteGenerationVo.java
  4. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteOtherVo.java
  5. 25
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteTicketVo.java
  6. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/ElectricGenerationVo.java
  7. 24
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/ExamineCardVo.java
  8. 22
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/InstalledCapacityVo.java
  9. 21
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/WaterFlowDataVo.java
  10. 21
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/WaterFlowResponseVo.java
  11. 31
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/WaterFlowVo.java
  12. 12
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AreaDutyVo.java
  13. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitTargetVo.java
  14. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceTaskDTO.java
  15. 6
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/vo/DoublePassRateVO.java
  16. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessStatisticsDTO.java
  17. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessTaskDTO.java
  18. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml
  19. 34
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/CensusController.java
  20. 94
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java
  21. 18
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/CensusService.java
  22. 49
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java
  23. 137
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/CensusServiceImpl.java
  24. 519
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  25. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  26. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WebHomeServiceImpl.java
  27. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenanceTaskServiceImpl.java
  28. 39
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java
  29. 15
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

13
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/constants/CensusConstant.java

@ -0,0 +1,13 @@
package com.hnac.hzims.operational.census.constants;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
public interface CensusConstant {
String WATER_SIGNAGE = "front_water_level";
Integer QUERY_TYPE_DEFAULT = 0;
}

25
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteDefectVo.java

@ -0,0 +1,25 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class CompleteDefectVo {
@ApiModelProperty("区域名称")
private String areaName;
@ApiModelProperty("缺陷总数")
private Integer defectCount;
@ApiModelProperty("消缺数")
private Integer completeCount;
@ApiModelProperty("消缺率")
private Double completeRate;
}

25
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteGenerationVo.java

@ -0,0 +1,25 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class CompleteGenerationVo {
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("计划发电量")
private Double planGeneration;
@ApiModelProperty("实际发电量")
private Double realityGeneration;
@ApiModelProperty("完成率")
private Double completeRate;
}

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

@ -0,0 +1,22 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class CompleteOtherVo {
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("设备在线率")
private Double onlineRate;
@ApiModelProperty("Fa投入条数")
private Double faCount;
}

25
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/CompleteTicketVo.java

@ -0,0 +1,25 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class CompleteTicketVo {
@ApiModelProperty("站点名称")
private String areaName;
@ApiModelProperty("两票数量")
private Integer ticketCount;
@ApiModelProperty("合格票据数量")
private Integer completeCount;
@ApiModelProperty("合格率")
private String completeRate;
}

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

@ -0,0 +1,22 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class ElectricGenerationVo {
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("发容量")
private Double electricGeneration;
@ApiModelProperty("详情")
private String detail;
}

24
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/ExamineCardVo.java

@ -0,0 +1,24 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class ExamineCardVo {
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("检修卡数量")
private Integer cardCount;
@ApiModelProperty("检修卡总额")
private Double cardTotal;
}

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

@ -0,0 +1,22 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class InstalledCapacityVo {
@ApiModelProperty("站点名称")
private String stationName;
@ApiModelProperty("装机容量")
private Double installedCapacity;
@ApiModelProperty("详情")
private String detail;
}

21
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/WaterFlowDataVo.java

@ -0,0 +1,21 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class WaterFlowDataVo {
@ApiModelProperty("时间")
private String time;
@ApiModelProperty("值")
private String value;
}

21
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/WaterFlowResponseVo.java

@ -0,0 +1,21 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class WaterFlowResponseVo {
@ApiModelProperty("站点名称")
private String station;
@ApiModelProperty("站点集合")
private List<WaterFlowDataVo> datas;
}

31
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/WaterFlowVo.java

@ -0,0 +1,31 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Data
public class WaterFlowVo {
@ApiModelProperty("站点集合")
private List<String> stations;
@ApiModelProperty("监测类型:水位/流量")
private String type;
@ApiModelProperty("时间跨域单位:2->h(小时)/3->d(天)/5->n(自然月)/6->y(自然年)")
private Integer timeType;
@ApiModelProperty("开始时间")
private String startDate;
@ApiModelProperty("结束时间")
private String endDate;
}

12
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AreaDutyVo.java

@ -160,4 +160,16 @@ public class AreaDutyVo {
@ApiModelProperty(value = "排序字段")
private Integer sort;
@ApiModelProperty(value = "当班开始时间")
private String startTimeDuty;
@ApiModelProperty(value = "当班结束时间")
private String endTimeDuty;
@ApiModelProperty(value = "当月开始时间")
private String endTimeMoth;
@ApiModelProperty(value = "当月结束时间")
private String startTimeMoth;
}

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

@ -20,6 +20,9 @@ public class HydropowerUnitTargetVo {
@ApiModelProperty(value = "设备Code")
private String deviceCode;
@ApiModelProperty(value = "设备名称")
private String deviceName;
@ApiModelProperty(value = "当年发电量")
private Float powerYear;

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/dto/OperMaintenanceTaskDTO.java

@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* @author hx
*/
@ -22,4 +24,8 @@ public class OperMaintenanceTaskDTO extends OperMaintenanceTaskEntity {
@ApiModelProperty("任务Id 多个按逗号分隔")
private String taskIds;
@ApiModelProperty("任务Id 多个按逗号分隔")
private List<Long> deptIds;
}

6
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/allTicket/vo/DoublePassRateVO.java

@ -9,6 +9,12 @@ import lombok.EqualsAndHashCode;
public class DoublePassRateVO {
private static final long serialVersionUID = -8870464581684939369L;
@ApiModelProperty("双票数量")
private Integer doubleTicketCount;
@ApiModelProperty("双票合格数量")
private Integer doubleTicketPassCount;
@ApiModelProperty("合格率")
private String doublePassRate;
}

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

@ -5,6 +5,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity;
import java.util.List;
/**
* 模型DTO
*
@ -20,4 +22,7 @@ public class OperAccessStatisticsDTO extends OperAccessStatisticsEntity {
@ApiModelProperty(value = "任务名称")
private String taskName;
@ApiModelProperty(value = "创建机构集合")
private List<Long> deptIds;
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/dto/OperAccessTaskDTO.java

@ -19,6 +19,9 @@ public class OperAccessTaskDTO extends OperAccessTaskEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "创建机构集合")
private List<Long> deptIds;
@ApiModelProperty(value = "工作流Key")
private String procDefId;

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

@ -77,6 +77,12 @@
<if test="req.excludeNullTicket != null and req.excludeNullTicket == 1">
and t1.`TICKET_ID` is null
</if>
<if test="req.deptIds != null">
and t1.create_dept in
<foreach collection="req.deptIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
ORDER BY t1.ID DESC
</select>

34
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/CensusController.java

@ -0,0 +1,34 @@
package com.hnac.hzims.operational.census.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.census.service.CensusService;
import com.hnac.hzims.operational.census.vo.WaterFlowVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@RestController
@AllArgsConstructor
@RequestMapping("/census")
@Api(value = "统计", tags = "数据统计")
public class CensusController {
private final CensusService service;
@ApiOperation("水位-流量统计")
@PostMapping("/water-flow")
@ApiOperationSupport(order = 1)
public R waterFlow(@RequestBody WaterFlowVo waterFlow) {
return R.data(service.waterFlow(waterFlow));
}
}

94
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java

@ -0,0 +1,94 @@
package com.hnac.hzims.operational.census.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.census.service.TargetService;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
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.*;
/**
* @author ysj
* @date 2023/03/01 16:12:22
* @version 4.0.0
*/
@RestController
@AllArgsConstructor
@RequestMapping("/target")
@Api(value = "指标关联数据", tags = "指标关联数据")
public class TargetController {
private final TargetService service;
@ApiOperation("装机容量统计")
@PostMapping("/installed-capacity")
@ApiOperationSupport(order = 1)
public R installedCapacity(@RequestParam(value = "stationName") String stationName,@RequestParam(value = "type") Integer type) {
return R.data(service.installedCapacity(stationName,type));
}
@ApiOperation("发电量统计")
@PostMapping("/electric-generation")
@ApiOperationSupport(order = 2)
public R electricGeneration() {
return R.data(service.electricGeneration());
}
@ApiOperation("计划发电量/实际发电量统计")
@PostMapping("/complete-generation")
@ApiOperationSupport(order = 3)
public R completeGeneration() {
return R.data(service.completeGeneration());
}
@ApiOperation("两票统计")
@PostMapping("/complete-ticket")
@ApiOperationSupport(order = 4)
public R completeTicket(@RequestParam(value = "areaName") String areaName,@RequestParam(value = "type") Integer type) {
return R.data(service.completeTicket(areaName,type));
}
@ApiOperation("缺陷率统计")
@GetMapping("/complete-defect")
@ApiOperationSupport(order = 6)
public R completeDefect(@RequestParam(value = "areaName") String areaName,@RequestParam(value = "type") Integer type) {
return R.data(service.defect(areaName,type));
}
@ApiOperation("上线率/Fa投入条数统计")
@GetMapping("/complete-other")
@ApiOperationSupport(order = 6)
public R completeOther(@RequestParam(value = "stationName") String stationName,@RequestParam(value = "type") Integer type,@RequestParam(value = "queryType") Integer queryType) {
return R.data(service.completeOther(stationName,type,queryType));
}
@ApiOperation("日常维护统计")
@GetMapping("/routine-maintenance")
@ApiOperationSupport(order = 5)
public R<IPage<OperMaintenanceTaskVO>> routineMaintenance(OperMaintenanceTaskDTO params,Query query,Integer type) {
return service.routineMaintenance(params,query,type);
}
@ApiOperation("检修任务统计")
@GetMapping("/examine-repair")
@ApiOperationSupport(order = 6)
public R<IPage<OperAccessTaskVO>> examineRepair(OperAccessTaskDTO params, Query query, Integer type) {
return service.examineRepair(params, query,type);
}
@ApiOperation("检修卡统计")
@GetMapping("/examineCard")
@ApiOperationSupport(order = 6)
public R examineCard(@RequestParam(value = "stationName") String stationName,@RequestParam(value = "type") Integer type) {
return R.data(service.examineCard(stationName,type));
}
}

18
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/CensusService.java

@ -0,0 +1,18 @@
package com.hnac.hzims.operational.census.service;
import com.hnac.hzims.operational.census.vo.WaterFlowResponseVo;
import com.hnac.hzims.operational.census.vo.WaterFlowVo;
import java.util.List;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
public interface CensusService {
// 查询水位/流量数据
List<WaterFlowResponseVo> waterFlow(WaterFlowVo waterFlow);
}

49
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java

@ -0,0 +1,49 @@
package com.hnac.hzims.operational.census.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.census.vo.*;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
/**
* @author ysj
* @date 2023/03/01 16:12:22
* @version 4.0.0
*/
public interface TargetService {
// 获取站点装机容量
List<InstalledCapacityVo> installedCapacity(String stationName,Integer type);
// 发电量统计
List<ElectricGenerationVo> electricGeneration();
// 计划发电量/实际发电量统计
List<CompleteGenerationVo> completeGeneration();
// 两票统计
List<CompleteTicketVo> completeTicket(String areaName,Integer type);
// 缺陷率统计
List<CompleteDefectVo> defect(String areaName, Integer type);
// 检修卡统计
List<ExamineCardVo> examineCard(String stationName, Integer type);
// 设备在线率/Fa投入条数统计
List<CompleteOtherVo> completeOther(String stationName, Integer type,Integer queryType);
// 日常维护统计
R<IPage<OperMaintenanceTaskVO>> routineMaintenance(OperMaintenanceTaskDTO params, Query query, Integer type);
// 检修任务统计
R<IPage<OperAccessTaskVO>> examineRepair(OperAccessTaskDTO params, Query query, Integer type);
}

137
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/CensusServiceImpl.java

@ -0,0 +1,137 @@
package com.hnac.hzims.operational.census.service.impl;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.operational.census.constants.CensusConstant;
import com.hnac.hzims.operational.census.service.CensusService;
import com.hnac.hzims.operational.census.vo.WaterFlowDataVo;
import com.hnac.hzims.operational.census.vo.WaterFlowResponseVo;
import com.hnac.hzims.operational.census.vo.WaterFlowVo;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.service.IHzimsAnalyzeModelStationService;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Service
@RequiredArgsConstructor
public class CensusServiceImpl implements CensusService {
private final IAnalyseDataSearchClient dateSearch;
private final IHzimsAnalyzeModelStationService analyzeStationService;
/**
* 查询水位/流量统计数据
* @param waterFlow
* @return
*/
@Override
public List<WaterFlowResponseVo> waterFlow(WaterFlowVo waterFlow) {
// 查询参数设置
List<String> instances = this.getDefaultStations(waterFlow.getStations());
if(CollectionUtils.isEmpty(instances)){
return new ArrayList<>();
}
List<AnalyseCodeByAnalyseDataPO> params = instances.stream().map(instance->{
AnalyseCodeByAnalyseDataPO analyseCodeByAnalyseData = new AnalyseCodeByAnalyseDataPO();
analyseCodeByAnalyseData.setDeviceCode(instance);
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataCondition = new AnalyzeDataConditionPO();
analyzeDataCondition.setFull(1);
analyzeDataCondition.setSignages(Optional.ofNullable(waterFlow.getType()).orElse(CensusConstant.WATER_SIGNAGE));
// 取数规则: 0=(整点值/最早值)、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值) 6=最新值
analyzeDataCondition.setAccessRules(EquipmentConstants.AccessRulesEnum.AVG_CYCLE.getType());
// 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时)3->、d(天)4->、w(周)5->、n(自然月)、6->y(自然年)
analyzeDataCondition.setSaveTimeType(Optional.ofNullable(waterFlow.getTimeType()).orElse(3));
// 间隔
analyzeDataCondition.setTimeInterval(1);
analyzeDataCondition.setBeginTime(this.getSearchStartTime(waterFlow.getStartDate()));
analyzeDataCondition.setEndTime(this.getSearchEndTime(waterFlow.getEndDate()));
signboardConditions.add(analyzeDataCondition);
analyseCodeByAnalyseData.setSignboardConditions(signboardConditions);
return analyseCodeByAnalyseData;
}).collect(Collectors.toList());
// 查询数据
return params.stream().map(o->{
WaterFlowResponseVo waterFlowResponse = new WaterFlowResponseVo();
waterFlowResponse.setStation(o.getDeviceCode());
List<AnalyzeDataConditionVO> data = dateSearch.getAnalyzeDataByAnalyzeCodeAndSignages(o).getData();
if(CollectionUtils.isEmpty(data)){
waterFlowResponse.setDatas(null);
}else{
List<WaterFlowDataVo> datas = data.get(0).getList().stream().map(m->{
WaterFlowDataVo waterFlowDataVo = new WaterFlowDataVo();
waterFlowDataVo.setTime(m.getTs());
waterFlowDataVo.setValue(m.getVal());
return waterFlowDataVo;
}).collect(Collectors.toList());
waterFlowResponse.setDatas(datas);
}
return waterFlowResponse;
}).collect(Collectors.toList());
}
/**
* 查询默认水位/流量站点
* @return
*/
private List<String> getDefaultStations(List<String> stations) {
if(CollectionUtils.isEmpty(stations)){
List<HzimsAnalyzeModelStationEntity> models = analyzeStationService.list();
if(CollectionUtils.isEmpty(models)){
return new ArrayList<>();
}
return models.stream().map(HzimsAnalyzeModelStationEntity::getInstanceCode).collect(Collectors.toList());
}
return stations;
}
/**
* 获取开始时间
* @param date
* @return
*/
private LocalDateTime getSearchStartTime(String date) {
if(ObjectUtils.isEmpty(date)){
Date startDate = new Date();
startDate.setMonth(startDate.getMonth()-1);
date = DateUtil.format(startDate, "yyyy-MM-dd HH:mm:ss");
}
return LocalDateTime.parse(DateUtil.format(new Date(), date), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME));
}
/**
* 获取结束时间
* @param date
* @return
*/
private LocalDateTime getSearchEndTime(String date) {
if(ObjectUtils.isEmpty(date)){
date = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
}
return LocalDateTime.parse(DateUtil.format(new Date(), date), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME));
}
}

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

@ -0,0 +1,519 @@
package com.hnac.hzims.operational.census.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.service.IOperAccessStatisticsService;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.census.constants.CensusConstant;
import com.hnac.hzims.operational.census.service.TargetService;
import com.hnac.hzims.operational.census.vo.*;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.fill.entity.*;
import com.hnac.hzims.operational.fill.service.*;
import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.vo.HydropowerUnitTargetVo;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import io.swagger.models.auth.In;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
/**
* @author ysj
* @date 2023/02/23 13:37:22
* @version 4.0.0
*/
@Service
@RequiredArgsConstructor
public class TargetServiceImpl implements TargetService {
private final IStationService stationService;
private final IMainSystemMonitoringService maintenanceService;
private final PowerService powerService;
private final AreaService areaService;
private final IOperMaintenanceTaskService maintenanceTaskService;
private final IOperPhenomenonService phenomenonService;
private final OverService overService;
private final OverDetailsService overDetailsService;
private final SolveService solveService;
private final OtherService otherService;
private final IOperAccessTaskService accessTaskService;
private final IPlanGenertionClient planClient;
private final ITicketInfoAllClient ticketInfoAllClient;
private final RedisTemplate redisTemplate;
private final SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME);
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key";
/**
* 获取站点装机容量
* @return
*/
@Override
public List<InstalledCapacityVo> installedCapacity(String stationName,Integer type) {
// 站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType, type)
.eq(StationEntity::getServeType,2)
.like(StationEntity::getName,stationName)
);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
}
if(HomePageConstant.HYDROPOWER.equals(type)){
// 设备
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList();
return stations.stream().map(station->{
InstalledCapacityVo item = new InstalledCapacityVo();
item.setStationName(station.getName());
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device->device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationDevices)){
item.setInstalledCapacity(0.0);
item.setDetail("站点暂无设备!");
return item;
}
// 装机容量
double sum = stationDevices.stream().mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum();
item.setInstalledCapacity(sum);
// 装机容量详情
List<String> details = stationDevices.stream().map(device-> "[" + device.getName() + " " +device.getInstalledCapacity() +"kw]").collect(Collectors.toList());
item.setDetail(String.join("|",details));
return item;
}).collect(Collectors.toList());
}
// 查询填报数据
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
);
return stations.stream().map(station -> {
InstalledCapacityVo item = new InstalledCapacityVo();
item.setStationName(station.getName());
// 装机容量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setInstalledCapacity(0.0);
}else{
item.setInstalledCapacity(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getInstalledCapacity());
}
item.setDetail("站点为填报数据,暂无设备装机容量信息!");
return item;
}).collect(Collectors.toList());
}
/**
* 发电量
* @return
*/
@Override
public List<ElectricGenerationVo> electricGeneration() {
// 站点
List<StationEntity> stations = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), null);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
}
// 设备指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if(CollectionUtils.isEmpty(targets)){
return new ArrayList<>();
}
return stations.stream().map(station->{
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(device->device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationTargets)){
item.setElectricGeneration(0.0);
item.setDetail("站点暂无发电");
return item;
}
// 年发电量
double sum = targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum();
item.setElectricGeneration(sum);
// 装机容量详情
List<String> details = targets.stream().map(target-> "[" + target.getDeviceCode() + " " + target.getPowerYear() +"kw]").collect(Collectors.toList());
item.setDetail(String.join("|",details));
return item;
}).collect(Collectors.toList());
}
/**
* 电量完成率
* @return
*/
@Override
public List<CompleteGenerationVo> completeGeneration() {
// 站点
List<StationEntity> stations = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), null);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
}
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy"));
// 设备指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if(CollectionUtils.isEmpty(targets)){
return new ArrayList<>();
}
return stations.stream().map(station->{
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(device->device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
// 实际发电量
if(CollectionUtils.isEmpty(stationTargets)){
item.setRealityGeneration(0.0);
}else {
double sum = targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum();
item.setRealityGeneration(sum);
}
// 计划发电量
List<Float> planGenerations = plans.stream().filter(plan->plan.getStationId().equals(station.getCode())).map(PlanGenerationEntity::getPlanGeneration).collect(Collectors.toList());
if(CollectionUtils.isEmpty(planGenerations)){
item.setPlanGeneration(0.0);
}else{
item.setPlanGeneration(BigDecimal.valueOf(planGenerations.get(0)).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
// 完成率
if(Math.abs(item.getPlanGeneration()) <= 0){
item.setCompleteRate(0.0);
}else{
item.setCompleteRate(BigDecimal.valueOf(item.getRealityGeneration() / item.getPlanGeneration() * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
return item;
}).collect(Collectors.toList());
}
/**
* 双票合格率
* @return
*/
@Override
public List<CompleteTicketVo> completeTicket(String areaName,Integer type) {
// 获取水电站区域机构
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE);
if(MapUtils.isEmpty(areas)){
return new ArrayList<>();
}
List<Dept> depts = areas.keySet().stream().filter(dept -> StringUtils.isEmpty(areaName) || dept.getDeptName().contains(areaName)).collect(Collectors.toList());
if(CollectionUtils.isEmpty(depts)){
return new ArrayList<>();
}
// 开始时间
LocalDate firstDay = LocalDate.now().withDayOfYear(1);
LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN);
ExecutorService pool = Executors.newFixedThreadPool(depts.size());
//监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(depts.size());
List<CompleteTicketVo> completeTickets = new ArrayList<>();
pool.execute(()-> {
for (Dept dept: depts) {
// 双票
DoublePassRateVO doublePass = ticketInfoAllClient.getDoublePassRate(Collections.singletonList(dept.getId()), firstDateTime, LocalDateTime.now());
CompleteTicketVo completeTicketVo = new CompleteTicketVo();
if (ObjectUtil.isEmpty(doublePass)) {
completeTicketVo.setAreaName(dept.getDeptName());
completeTicketVo.setTicketCount(0);
completeTicketVo.setCompleteCount(0);
completeTicketVo.setCompleteRate("0.0");
} else {
completeTicketVo.setAreaName(dept.getDeptName());
completeTicketVo.setTicketCount(doublePass.getDoubleTicketCount());
completeTicketVo.setCompleteCount(doublePass.getDoubleTicketPassCount());
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate());
}
completeTickets.add(completeTicketVo);
countDownLatch.countDown();
}
});
// 等待所有线程执行完成
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
pool.shutdown();
return completeTickets;
}
/**
* 缺陷统计
* @param areaName
* @param type
* @return
*/
@Override
public List<CompleteDefectVo> defect(String areaName, Integer type) {
if(HomePageConstant.DISTRIBUTION_NETWORK.equals(type)){
return this.getFillDefect(areaName,type);
}
// 获取区域机构
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE);
if(MapUtils.isEmpty(areas)){
return new ArrayList<>();
}
List<Dept> depts = areas.keySet().stream().filter(dept -> StringUtils.isEmpty(areaName) || dept.getDeptName().contains(areaName)).collect(Collectors.toList());
if(CollectionUtils.isEmpty(depts)){
return new ArrayList<>();
}
String startTime = this.getFristDayByYear();
String endTime = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
ExecutorService pool = Executors.newFixedThreadPool(depts.size());
//监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(depts.size());
List<CompleteDefectVo> completeDefects = new ArrayList<>();
pool.execute(()-> {
for (Dept dept: depts) {
// 缺陷
DutyDefectVO defectVO = phenomenonService.getDutyDefect(startTime, endTime, Collections.singletonList(dept.getId()));
CompleteDefectVo defect = new CompleteDefectVo();
defect.setDefectCount(defectVO.getDefectSum());
defect.setCompleteCount(defectVO.getDefect());
if (defect.getDefectCount() <= 0) {
defect.setCompleteRate(0.0);
} else {
defect.setCompleteRate(BigDecimal.valueOf(defect.getCompleteCount() / defect.getDefectCount() * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
completeDefects.add(defect);
countDownLatch.countDown();
}
});
// 等待所有线程执行完成
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
pool.shutdown();
return completeDefects;
}
/**
* 检修卡统计
* @param stationName
* @param type
* @return
*/
@Override
public List<ExamineCardVo> examineCard(String stationName, Integer type) {
// 站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType, type)
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.like(StationEntity::getName,stationName)
);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
}
// 查询检修卡
String startTime = this.getFristDayByYear();
String endTime = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
List<OverEntity> overs = overService.list(Wrappers.<OverEntity>lambdaQuery()
.in(OverEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(OverEntity::getCreateTime,startTime)
.le(OverEntity::getCreateTime,endTime)
);
if(CollectionUtils.isEmpty(overs)){
return new ArrayList<>();
}
List<OverDetailsEntity> overDetails = overDetailsService.list(Wrappers.<OverDetailsEntity>lambdaQuery()
.in(OverDetailsEntity::getOverId,overs.stream().map(OverEntity::getId).collect(Collectors.toList()))
);
return overs.stream().collect(Collectors.groupingBy(OverEntity::getCreateDept)).entrySet().stream().map(entry->{
ExamineCardVo examineCard = new ExamineCardVo();
examineCard.setStationName(stations.stream().filter(station -> station.getRefDept().equals(entry.getKey())).collect(Collectors.toList()).get(0).getName());
examineCard.setCardTotal(entry.getValue().stream().mapToDouble(over-> Double.valueOf(over.getTotalPrice().toString())).sum());
examineCard.setCardCount(overDetails.stream().filter(detail-> detail.getOverId().equals(entry.getKey())).mapToInt(OverDetailsEntity::getQuantity).sum());
return examineCard;
}).collect(Collectors.toList());
}
/**
* 配网设备在线率/Fa投入条数
* @param stationName
* @param type
* @param queryType
* @return
*/
@Override
public List<CompleteOtherVo> completeOther(String stationName, Integer type, Integer queryType) {
// 站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType, type)
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.like(StationEntity::getName,stationName)
);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
}
// 查询设备在线率/Fa投入条数
String startTime = this.getFristDayByYear();
String endTime = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
List<OtherEntity> others = otherService.list(Wrappers.<OtherEntity>lambdaQuery()
.in(OtherEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(OtherEntity::getCreateTime,startTime)
.le(OtherEntity::getCreateTime,endTime)
);
if(CollectionUtils.isEmpty(others)){
return new ArrayList<>();
}
return others.stream().collect(Collectors.groupingBy(OtherEntity::getCreateDept)).entrySet().stream().map(entry -> {
CompleteOtherVo other = new CompleteOtherVo();
other.setStationName(stations.stream().filter(station -> station.getRefDept().equals(entry.getKey())).collect(Collectors.toList()).get(0).getName());
if(CensusConstant.QUERY_TYPE_DEFAULT.equals(0)){
other.setOnlineRate(entry.getValue().stream().mapToDouble(value ->Double.valueOf(value.getOnlineRate())).average().orElse(0.0));
}else{
other.setFaCount(entry.getValue().stream().mapToDouble(OtherEntity::getFaQuantity).sum());
}
return other;
}).collect(Collectors.toList());
}
/**
* 配网消缺
* @param areaName
* @param type
* @return
*/
private List<CompleteDefectVo> getFillDefect(String areaName, Integer type) {
// 站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType, type)
.eq(StationEntity::getServeType,2)
.like(StationEntity::getName,areaName)
);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
}
// 缺陷填报记录
String startTime = this.getFristDayByYear();
String endTime = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
List<SolveEntity> solves = solveService.list(Wrappers.<SolveEntity>lambdaQuery()
.in(SolveEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(SolveEntity::getCreateTime,startTime)
.le(SolveEntity::getCreateTime,endTime)
);
if(CollectionUtils.isEmpty(solves)){
return new ArrayList<>();
}
return solves.stream().collect(Collectors.groupingBy(SolveEntity::getCreateDept)).entrySet().stream().map(entry -> {
CompleteDefectVo defect = new CompleteDefectVo();
defect.setAreaName(stations.stream().filter(station -> station.getRefDept().equals(entry.getKey())).collect(Collectors.toList()).get(0).getName());
defect.setDefectCount(entry.getValue().stream().mapToInt(SolveEntity::getSolveQuantity).sum());
defect.setCompleteCount(entry.getValue().stream().mapToInt(SolveEntity::getSolveSucQuantity).sum());
if (Math.abs(defect.getDefectCount()) <= 0) {
defect.setCompleteRate(0.0);
} else {
defect.setCompleteRate(BigDecimal.valueOf(defect.getCompleteCount() / defect.getDefectCount() * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
return defect;
}).collect(Collectors.toList());
}
/**
* 日常维护统计
* @param param
* @param query
* @param type
* @return
*/
@Override
public R<IPage<OperMaintenanceTaskVO>> routineMaintenance(OperMaintenanceTaskDTO params, Query query, Integer type) {
// 获取区域机构
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE);
if(MapUtils.isEmpty(areas)){
return null;
}
// 查询日常维护任务
params.setDeptIds(areas.entrySet().stream().map(entry->entry.getKey().getId()).collect(Collectors.toList()));
return maintenanceTaskService.list(params,query);
}
/**
* 检修任务统计
* @param params
* @param query
* @param type
* @return
*/
@Override
public R<IPage<OperAccessTaskVO>> examineRepair(OperAccessTaskDTO params, Query query, Integer type) {
// 获取区域机构
Map<Dept, List<StationEntity>> areas = areaService.getAuthArea(null,null,Collections.singletonList(type),HomePageConstant.HYDROPOWER_SERVETYPE);
if(MapUtils.isEmpty(areas)){
return null;
}
// 查询检修任务
params.setDeptIds(areas.keySet().stream().map(key-> key.getId()).collect(Collectors.toList()));
return accessTaskService.list(params,query);
}
/**
* 获取当年的第一天
* @return
*/
private String getFristDayByYear() {
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
return sdf.format(calendar.getTime());
}
}

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

@ -184,6 +184,8 @@ public class SideHustleServiceImpl implements ISideHustleService {
}
Date startDate = this.getDutyStartTime(dutyList.get(0).getDateTime(),dutyList.get(0).getStartTime());
Date endDate = this.getDutyEndTime(dutyList.get(0).getDateTime(),dutyList.get(0).getStartTime(),dutyList.get(0).getEndTime());
areaDutyVo.setStartTimeDuty(DateUtil.format(startDate,DateUtil.PATTERN_DATETIME));
areaDutyVo.setEndTimeDuty(DateUtil.format(endDate,DateUtil.PATTERN_DATETIME));
// 上一班组发电量
this.getUpDutyPower(dutyList,deviceList,key.getId(),value,areaDutyVo);
// 班组实时发电量
@ -681,6 +683,8 @@ public class SideHustleServiceImpl implements ISideHustleService {
LocalDate firstDay = LocalDate.now().withDayOfMonth(1);
LocalDateTime startTime = LocalDateTime.of(firstDay, LocalTime.MIN);
LocalDateTime endTime = LocalDateTime.now();
areaDutyVo.setStartTimeMoth(dtf.format(startTime));
areaDutyVo.setEndTimeMoth(dtf.format(endTime));
//通过线程池异步获取月报各模块内容 主要分为五块内容
ExecutorService exe = Executors.newFixedThreadPool(POOL_QUANTITY);
//监控线程执行完后返回结果
@ -867,7 +871,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
// 有功功率
Map<String, Double> activePowerMap = (Map<String, Double>) redisTemplate.opsForValue().get(active_power_key);
// 设备开关机状态
Map<String, JointRelayVo> deviceStateMap = (Map<String, JointRelayVo>) redisTemplate.opsForValue().get(joint_relay_key);
Map<Long, JointRelayVo> deviceStateMap = (Map<Long, JointRelayVo>) redisTemplate.opsForValue().get(joint_relay_key);
// 获取总发电量
List<String> monList = homePageService.getMonthList(0,12,false);
float sumPower = this.getSumPower(map.values(),powerMap,monList);
@ -1089,21 +1093,21 @@ public class SideHustleServiceImpl implements ISideHustleService {
* 电站利用率
* @return
*/
private double getStationUseRate(List<StationEntity> stationList,Map<String, JointRelayVo> map) {
private double getStationUseRate(List<StationEntity> stationList,Map<Long, JointRelayVo> map) {
if(CollectionUtil.isEmpty(stationList) || MapUtils.isEmpty(map)){
return 0.0;
}
List<String> codeList = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList());
if(CollectionUtil.isEmpty(codeList)){
List<Long> deptIds = stationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
if(CollectionUtil.isEmpty(deptIds)){
return 0.0;
}
// 机组总数
int unitSumCount = map.entrySet().stream().filter(o->codeList.contains(o.getKey())).mapToInt(vo-> vo.getValue().getUnitSum()).sum();
int unitSumCount = map.entrySet().stream().filter(o -> deptIds.contains(o.getKey())).mapToInt(vo-> vo.getValue().getUnitSum()).sum();
if(Math.abs(unitSumCount) <= 0){
return 0.0;
}
// 机组开机总数
int onOffCount = map.entrySet().stream().filter(o->codeList.contains(o.getKey())).mapToInt(vo-> vo.getValue().getStartingUpCount()).sum();
int onOffCount = map.entrySet().stream().filter(o->deptIds.contains(o.getKey())).mapToInt(vo-> vo.getValue().getStartingUpCount()).sum();
return BigDecimal.valueOf(onOffCount / (double)unitSumCount * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WebHomeServiceImpl.java

@ -158,6 +158,7 @@ public class WebHomeServiceImpl implements IWebHomeService {
HydropowerUnitTargetVo targetVo = new HydropowerUnitTargetVo();
targetVo.setDeptId(device.getCreateDept());
targetVo.setDeviceCode(device.getEmCode());
targetVo.setDeviceName(device.getName());
targetVo.setDeptName(device.getName());
// 当年用电量
float powerYear = this.getGenerationPower(device,0);

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

@ -43,6 +43,7 @@ import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.text.DecimalFormat;
import java.time.LocalDate;
@ -112,6 +113,9 @@ public class OperMaintenanceTaskServiceImpl extends BaseServiceImpl<OperMaintena
if (req.getExcludeNullTicket() != null && req.getExcludeNullTicket() == 1) {
isNull(OperMaintenanceTaskEntity::getTicketId);
}
if(!CollectionUtils.isEmpty(req.getDeptIds())){
in(OperMaintenanceTaskEntity::getCreateDept,req.getDeptIds());
}
}};
IPage pages = super.page(Condition.getPage(query), queryWrapper);

39
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java

@ -273,19 +273,42 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
}
// 站点实时功率 key - stationCode,value - sumPower
Map<String,Double> realPowerMap = this.getPowerConversionMap(map);
if(CollectionUtil.isEmpty(realPowerMap)){
return;
}
if(MapUtils.isNotEmpty(realPowerMap)){
redisTemplate.opsForValue().set(active_power_key, realPowerMap);
}
// 站点开关机状态
List<EminfoAndEmParamVo> devices = systemMonitoringService.getEmInfoList();
if(CollectionUtil.isEmpty(devices)){
return;
}
// key->机构编号 value -> 设备集合
Map<Long,List<EminfoAndEmParamVo>> deviceMap = devices.stream().collect(Collectors.groupingBy(EminfoAndEmParamVo::getCreateDept));
Map<Long, JointRelayVo> data = new HashMap<>();
deviceMap.entrySet().forEach(entry -> {
JointRelayVo value = new JointRelayVo();
List<String> relays = entry.getValue().stream().filter(o-> MapUtils.isNotEmpty(o.getPoint()) && !StringUtil.isEmpty(o.getPoint().get(HomePageConstant.JOINT_RELAY))).map(relay-> map.get(relay.getPoint().get(HomePageConstant.JOINT_RELAY))).collect(Collectors.toList());
if(CollectionUtil.isEmpty(relays)){
value.setUnitSum(0);
value.setShutdownCount(0);
value.setStartingUpCount(0);
}else{
value.setUnitSum(relays.size());
Optional<List<String>> off = Optional.ofNullable(relays.stream().filter(relay -> "0".equals(relay)).collect(Collectors.toList()));
value.setShutdownCount(off.map(o->o.size()).orElse(0));
Optional<List<String>> on = Optional.ofNullable(relays.stream().filter(relay -> "1".equals(relay)).collect(Collectors.toList()));
value.setStartingUpCount(on.map(o->o.size()).orElse(0));
}
data.put(entry.getKey(),value);
});
redisTemplate.opsForValue().set(joint_relay_key, data);
/*List<AnalyzeCodeBySignagesVO> jointRelayInfo = alertService.getJointRelayInfo();
List<AnalyzeCodeBySignagesVO> jointRelayInfo = alertService.getJointRelayInfo();
Map<String, JointRelayVo> stationJointRelayMap = new HashMap<>();
//根据站点统计开关机
Map<String, List<AnalyzeCodeBySignagesVO>> jointRelayMap = jointRelayInfo.stream().collect(Collectors.groupingBy(AnalyzeCodeBySignagesVO::getStation));
jointRelayMap.forEach((key, value) -> {
List<String> readIdList = value.stream().map(AnalyzeCodeBySignagesVO::getRealId).collect(Collectors.toList());
JointRelayVo vo = new JointRelayVo();
vo = new JointRelayVo();
readIdList.forEach(iter -> {
String jointRelay = map.get(iter);
if ("0".equals(jointRelay)) {//关机
@ -299,9 +322,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
}
});
stationJointRelayMap.put(key, vo);
});
redisTemplate.opsForValue().set(joint_relay_key, stationJointRelayMap);
});*/
}
/**

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

@ -250,11 +250,11 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/**
*
* @param List<Long> depatList
* @param LocalDateTime firstDateTime
* @param LocalDateTime now
* @return DoublePassRateVO
* 获取双票合格率
* @param depatList
* @param firstDateTime
* @param now
* @return
*/
@Override
public DoublePassRateVO getDoublePassRate(List<Long> depatList, LocalDateTime firstDateTime, LocalDateTime now) {
@ -272,12 +272,15 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
in(WorkTicketInfoEntity::getCreateDept,depatList);
}});
if(CollectionUtil.isEmpty(standardList) && CollectionUtil.isEmpty(workList)){
doublePassRateVO.setDoubleTicketCount(0);
doublePassRateVO.setDoubleTicketPassCount(0);
doublePassRateVO.setDoublePassRate("0");
return doublePassRateVO;
}
List<Long> standardIdList = new ArrayList<>();
standardIdList.addAll(standardList.stream().map(StandardTicketInfoEntity::getId).collect(Collectors.toList()));
standardIdList.addAll(workList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList()));
doublePassRateVO.setDoubleTicketCount(standardIdList.size());
// 查询合格评价
List<TicketInfoEvaluateEntity> evaluateList = ticketInfoEvaluateService.list(new LambdaQueryWrapper<TicketInfoEvaluateEntity>(){{
ge(TicketInfoEvaluateEntity::getCreateTime,firstDateTime);
@ -286,10 +289,12 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
eq(TicketInfoEvaluateEntity::getStatus,TicketConstants.TicketQualifiedEnum.Qualified.getCode());
}});
if(CollectionUtil.isEmpty(evaluateList)){
doublePassRateVO.setDoubleTicketPassCount(0);
doublePassRateVO.setDoublePassRate("0");
return doublePassRateVO;
}
double doublePassRate = new BigDecimal(evaluateList.size() / (double) standardIdList.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
doublePassRateVO.setDoubleTicketPassCount(evaluateList.size());
doublePassRateVO.setDoublePassRate(String.valueOf(doublePassRate));
return doublePassRateVO;
}

Loading…
Cancel
Save