Browse Source

运行月报-智能诊断数据添加;新增历史智能诊断数据

zhongwei
ty 10 months ago
parent
commit
a1f8ee4ef0
  1. 8
      hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/FdpAlarmVo.java
  2. 45
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/dto/FDPFaultTableDTO.java
  3. 110
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/entity/FdpFaultHistoryDataEntity.java
  4. 8
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClient.java
  5. 10
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClientFallBack.java
  6. 29
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultHistoryDataVo.java
  7. 2
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/report/feign/IInspectReportClient.java
  8. 65
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpHistoryDataController.java
  9. 11
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpDiagnoseClient.java
  10. 31
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpHistoryDataService.java
  11. 73
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpHistoryDataServiceImpl.java
  12. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java
  13. 74
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java
  14. BIN
      hzims-service/operational/src/main/resources/template/word/stationMonthReport.docx

8
hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/config/vo/FdpAlarmVo.java

@ -19,6 +19,10 @@ public class FdpAlarmVo {
*/ */
private String faultId; private String faultId;
/** /**
* 故障ID
*/
private String UUID;
/**
* 故障站点 * 故障站点
*/ */
private String station; private String station;
@ -55,6 +59,10 @@ public class FdpAlarmVo {
* 设备名称 * 设备名称
*/ */
private String deviceName; private String deviceName;
/**
* 设备名称
*/
private String deviceCode;
// /** // /**
// * 报警内容 // * 报警内容
// */ // */

45
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/dto/FDPFaultTableDTO.java

@ -0,0 +1,45 @@
package com.hnac.hzims.fdp.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author HX
*/
@Data
public class FDPFaultTableDTO {
@ApiModelProperty("站点ID数组")
private String[] stationIds;
@ApiModelProperty("故障ID")
private String faultId;
@ApiModelProperty("筛选来源,可以为“auto”或“manual”")
private String source;
@ApiModelProperty("故障名称模糊匹配")
private String nameLike;
@ApiModelProperty("筛选故障处理结果,可为“处理中”、“误报”、“处理完成”、“延后处理”")
private String result;
@ApiModelProperty("分页的每页数量,-1则为不限制数量")
private Integer pageSize;
@ApiModelProperty("分页的序号")
private Integer pageIndex;
@ApiModelProperty("排序方式")
private String orderBy;
@ApiModelProperty("升降序方式,“asc”或“desc”")
private String orderKind;
@ApiModelProperty("查询开始时间")
private String createTimeLeft;
@ApiModelProperty("查询结束时间")
private String createTimeRight;
}

110
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/entity/FdpFaultHistoryDataEntity.java

@ -0,0 +1,110 @@
package com.hnac.hzims.fdp.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
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;
/**
* <p>
*
* </p>
*
* @author ty
* @since 2024-02-05
*/
@Data
public class FdpFaultHistoryDataEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("uuid")
@JSONField(name = "ID")
private String id;
@ApiModelProperty(value = "故障ID")
@JSONField(name = "FAULT_ID")
private String faultId;
@ApiModelProperty(value = "站点ID")
@JSONField(name = "STATION")
private String station;
@ApiModelProperty(value = "位置")
@JSONField(name = "ORD")
private String ord;
@ApiModelProperty(value = "名称")
@JSONField(name = "NAME")
private String name;
@ApiModelProperty(value = "故障发生的概率")
@JSONField(name = "STATUS")
private Float status;
@ApiModelProperty(value = "发生故障的时间")
@JSONField(name = "CREATE_TIME")
private String createTime;
@ApiModelProperty(value = "故障结束的时间")
@JSONField(name = "DELETE_TIME")
private String deleteTime;
@ApiModelProperty(value = "故障有效时间")
@JSONField(name = "LIFE_TIME")
private String lifeTime;
@ApiModelProperty(value = "故障优先级,越大优先级越高")
@JSONField(name = "PRIORITY")
private String priority;
@ApiModelProperty(value = "来源")
@JSONField(name = "SOURCE")
private String source;
@ApiModelProperty(value = "故障的其它信息")
@JSONField(name = "INFO")
private String info;
@ApiModelProperty(value = "故障的业务ID")
@JSONField(name = "TASK_ID")
private String taskId;
@ApiModelProperty(value = "故障处理结果,可为“处理中”、“误报”、“处理完成”、“延后处理”")
@JSONField(name = "RESULT")
private String result;
@ApiModelProperty(value = "关于误报、延后处理的其它补充信息")
@JSONField(name = "RESULT_INFO")
private String resultInfo;
@ApiModelProperty(value = "诊断的原因")
@JSONField(name = "DIAG_REASON")
private String diagReason;
@ApiModelProperty(value = "诊断的解决方法")
@JSONField(name = "DIAG_SOLUTION")
private String diagSolution;
@ApiModelProperty(value = "创建故障人")
@JSONField(name = "CREATE_USER")
private String createUser;
@ApiModelProperty(value = "故障结束标记")
@JSONField(name = "IS_DELETED")
private Integer isDeleted;
}

8
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClient.java

@ -1,7 +1,10 @@
package com.hnac.hzims.fdp.feign; package com.hnac.hzims.fdp.feign;
import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.fdp.dto.FDPFaultTableDTO;
import com.hnac.hzims.fdp.dto.StatisticStatusDTO; import com.hnac.hzims.fdp.dto.StatisticStatusDTO;
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity;
import com.hnac.hzims.fdp.vo.FdpFaultHistoryDataVo;
import com.hnac.hzims.fdp.vo.StatisticStatusVO; import com.hnac.hzims.fdp.vo.StatisticStatusVO;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
@ -23,7 +26,10 @@ import java.util.Map;
public interface IFdpDiagnoseClient { public interface IFdpDiagnoseClient {
String API_PREFIX = "/feign/fdp/diagnose"; String API_PREFIX = "/feign/fdp/diagnose";
String GET_STATISTIC_STATUS = API_PREFIX + "/getStatisticStatus"; String GET_STATISTIC_STATUS = API_PREFIX + "/getStatisticStatus";
String GET_HISTORY_DATA = API_PREFIX + "/getHistoryData";
@PostMapping(GET_STATISTIC_STATUS) @PostMapping(GET_STATISTIC_STATUS)
R<Map<String,List<StatisticStatusVO>>> getStatisticStatus(@RequestBody StatisticStatusDTO req); R<Map<String,List<StatisticStatusVO>>> getStatisticStatus(@RequestBody StatisticStatusDTO req);
@PostMapping(GET_HISTORY_DATA)
List<FdpFaultHistoryDataEntity> getHistoryData(@RequestBody FDPFaultTableDTO req);
} }

10
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpDiagnoseClientFallBack.java

@ -1,12 +1,17 @@
package com.hnac.hzims.fdp.feign; package com.hnac.hzims.fdp.feign;
import com.hnac.hzims.fdp.dto.FDPFaultTableDTO;
import com.hnac.hzims.fdp.dto.StatisticStatusDTO; import com.hnac.hzims.fdp.dto.StatisticStatusDTO;
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity;
import com.hnac.hzims.fdp.vo.FdpFaultHistoryDataVo;
import com.hnac.hzims.fdp.vo.StatisticStatusVO; import com.hnac.hzims.fdp.vo.StatisticStatusVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author hx * @author hx
@ -18,4 +23,9 @@ public class IFdpDiagnoseClientFallBack implements IFdpDiagnoseClient {
public R getStatisticStatus(StatisticStatusDTO req) { public R getStatisticStatus(StatisticStatusDTO req) {
return R.fail("调用接口失败"); return R.fail("调用接口失败");
} }
@Override
public List<FdpFaultHistoryDataEntity> getHistoryData(FDPFaultTableDTO req) {
return new ArrayList<>();
}
} }

29
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/FdpFaultHistoryDataVo.java

@ -0,0 +1,29 @@
package com.hnac.hzims.fdp.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author ty
* @since 2024-02-05
*/
@Data
public class FdpFaultHistoryDataVo {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
@JSONField(name = "totalCount")
private Integer totalCount;
@ApiModelProperty(value = "")
@JSONField(name = "list")
private List<FdpFaultHistoryDataEntity> list;
}

2
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/report/feign/IInspectReportClient.java

@ -23,5 +23,5 @@ public interface IInspectReportClient {
@PostMapping(GET_ALARAM_REPORT) @PostMapping(GET_ALARAM_REPORT)
Map<Long, AlarmRoutReportVO> getAlarmReport(@RequestParam("depts") List<Long> depts, @RequestParam("date") String date); Map<Long, AlarmRoutReportVO> getAlarmReport(@RequestParam("depts") List<Long> depts, @RequestParam("date") String date);
@PostMapping(GET_INSPECT_STATISTCS_BY_NAME) @PostMapping(GET_INSPECT_STATISTCS_BY_NAME)
List<TaskReportVO> getInspectStatisticsByName(@RequestParam("depts") List<Long> depts, @RequestParam("date") String startTime, @RequestParam("date") String endTime); List<TaskReportVO> getInspectStatisticsByName(@RequestParam("depts") List<Long> depts, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
} }

65
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/controller/FdpHistoryDataController.java

@ -0,0 +1,65 @@
package com.hnac.hzims.fdp.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.fdp.dto.FDPFaultTableDTO;
import com.hnac.hzims.fdp.dto.FdpTaskDTO;
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity;
import com.hnac.hzims.fdp.entity.FdpTaskEntity;
import com.hnac.hzims.fdp.service.IFdpHistoryDataService;
import com.hnac.hzims.fdp.service.IFdpTaskService;
import com.hnac.hzims.fdp.vo.FdpTaskVO;
import com.hnac.hzims.fdp.vo.TaskStatisticsVo;
import com.hnac.hzims.fdp.wrapper.FdpTaskWrapper;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* 故障诊断任务表
*
* @author ty
* @created 2024-02-05
**/
@RestController
@AllArgsConstructor
@RequestMapping("/fdp/history")
@Api(tags = "故障诊断任务表")
public class FdpHistoryDataController extends BladeController {
private final IFdpHistoryDataService service;
/**
* 分页
*/
@ApiLog
@PostMapping("/listPage")
@ApiOperationSupport(order = 50)
@ApiOperation(value = "分页 查询参数:name,emId,faultId,reasonId,satisfaction")
@OperationAnnotation(moduleName = "智能诊断",title = "智能诊断任务",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE,
action = "分页查询智能诊断任务列表")
public R<IPage<FdpFaultHistoryDataEntity>> listPage(@RequestBody FDPFaultTableDTO req) {
return service.getHistoryData(req);
}
}

11
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpDiagnoseClient.java

@ -1,7 +1,11 @@
package com.hnac.hzims.fdp.feign; package com.hnac.hzims.fdp.feign;
import com.hnac.hzims.fdp.dto.FDPFaultTableDTO;
import com.hnac.hzims.fdp.dto.StatisticStatusDTO; import com.hnac.hzims.fdp.dto.StatisticStatusDTO;
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity;
import com.hnac.hzims.fdp.proxy.IDiagnoseProxy; import com.hnac.hzims.fdp.proxy.IDiagnoseProxy;
import com.hnac.hzims.fdp.service.IFdpHistoryDataService;
import com.hnac.hzims.fdp.vo.FdpFaultHistoryDataVo;
import com.hnac.hzims.fdp.vo.StatisticStatusVO; import com.hnac.hzims.fdp.vo.StatisticStatusVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -21,10 +25,17 @@ import java.util.Map;
public class FdpDiagnoseClient implements IFdpDiagnoseClient { public class FdpDiagnoseClient implements IFdpDiagnoseClient {
private final IDiagnoseProxy service; private final IDiagnoseProxy service;
private final IFdpHistoryDataService fdpHistoryDataService;
@Override @Override
@PostMapping(GET_STATISTIC_STATUS) @PostMapping(GET_STATISTIC_STATUS)
public R<Map<String,List<StatisticStatusVO>>> getStatisticStatus(StatisticStatusDTO req) { public R<Map<String,List<StatisticStatusVO>>> getStatisticStatus(StatisticStatusDTO req) {
return service.getStatisticStatus(req); return service.getStatisticStatus(req);
} }
@Override
@PostMapping(GET_HISTORY_DATA)
public List<FdpFaultHistoryDataEntity> getHistoryData(FDPFaultTableDTO req) {
return fdpHistoryDataService.exportHistoryData(req);
}
} }

31
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpHistoryDataService.java

@ -0,0 +1,31 @@
package com.hnac.hzims.fdp.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.fdp.dto.FDPFaultTableDTO;
import com.hnac.hzims.fdp.dto.FdpTaskDTO;
import com.hnac.hzims.fdp.dto.StatisticStatusDTO;
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity;
import com.hnac.hzims.fdp.entity.FdpTaskEntity;
import com.hnac.hzims.fdp.vo.FdpFaultHistoryDataVo;
import com.hnac.hzims.fdp.vo.FdpTaskVO;
import com.hnac.hzims.fdp.vo.TaskStatisticsVo;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
/**
* 服务类
*
* @author xiashandong
* @created 2021-05-25 17:32
**/
public interface IFdpHistoryDataService{
List<FdpFaultHistoryDataEntity> exportHistoryData(FDPFaultTableDTO req);
R<IPage<FdpFaultHistoryDataEntity>> getHistoryData(FDPFaultTableDTO req);
}

73
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpHistoryDataServiceImpl.java

@ -0,0 +1,73 @@
package com.hnac.hzims.fdp.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.fdp.dto.FDPFaultTableDTO;
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity;
import com.hnac.hzims.fdp.service.IFdpHistoryDataService;
import com.hnac.hzims.fdp.util.HttpRequestUtil;
import com.hnac.hzims.fdp.vo.FdpFaultHistoryDataVo;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
/**
* @author hx
* @version 1.0
* @date 2023/3/6 10:18
*/
@Service
@RequiredArgsConstructor
@Slf4j
public class FdpHistoryDataServiceImpl implements IFdpHistoryDataService {
@Value("${url.getFaultStatusTableData}")
private String getFaultStatusTableData;
@Override
public List<FdpFaultHistoryDataEntity> exportHistoryData(FDPFaultTableDTO req) {
String result = HttpRequestUtil.postCallObjectParam(req, getFaultStatusTableData, "POST");
if (StringUtil.isNotBlank(result)) {
R<FdpFaultHistoryDataVo> fdpFaultHistoryDataVoR = JSONObject.parseObject(result, new TypeReference<R<FdpFaultHistoryDataVo>>() {
});
if (fdpFaultHistoryDataVoR.isSuccess()&&ObjectUtil.isNotEmpty(fdpFaultHistoryDataVoR.getData())){
List<FdpFaultHistoryDataEntity> list = fdpFaultHistoryDataVoR.getData().getList();
return list;
}
}
return new ArrayList<>();
}
@Override
public R<IPage<FdpFaultHistoryDataEntity>> getHistoryData(FDPFaultTableDTO req) {
IPage<FdpFaultHistoryDataEntity> page = new Page<>();
page.setSize(req.getPageSize());
page.setCurrent(req.getPageIndex());
req.setOrderBy("CREATE_TIME");
if (StringUtil.isBlank(req.getSource())){
req.setSource("auto");
}
String result = HttpRequestUtil.postCallObjectParam(req, getFaultStatusTableData, "POST");
if (StringUtil.isNotBlank(result)) {
R<FdpFaultHistoryDataVo> fdpFaultHistoryDataVoR = JSONObject.parseObject(result, new TypeReference<R<FdpFaultHistoryDataVo>>() {
});
if (fdpFaultHistoryDataVoR.isSuccess()&&ObjectUtil.isNotEmpty(fdpFaultHistoryDataVoR.getData())
&&ObjectUtil.isNotEmpty(fdpFaultHistoryDataVoR.getData().getList())){
List<FdpFaultHistoryDataEntity> list = fdpFaultHistoryDataVoR.getData().getList();
page.setTotal(fdpFaultHistoryDataVoR.getData().getTotalCount());
page.setRecords(list);
}
}
return R.data(page);
}
}

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/source/service/impl/FdpAlarmServiceImpl.java

@ -83,10 +83,12 @@ public class FdpAlarmServiceImpl implements FdpAlarmService {
private AlarmEntity getAlarmEntity(FdpAlarmVo item) { private AlarmEntity getAlarmEntity(FdpAlarmVo item) {
AlarmEntity entity = new AlarmEntity(); AlarmEntity entity = new AlarmEntity();
entity.setAlarmId(item.getFaultId()); entity.setAlarmId(item.getUUID());
entity.setRealId(item.getFaultId());
entity.setAlarmTime(item.getCreateTime()); entity.setAlarmTime(item.getCreateTime());
entity.setAlarmContext(item.getFinfo()); entity.setAlarmContext(item.getFinfo());
entity.setAlarmType(EARLY); entity.setAlarmType(EARLY);
entity.setDeviceCode(item.getDeviceCode());
entity.setDeviceName(item.getDeviceName()); entity.setDeviceName(item.getDeviceName());
entity.setAlarmStatus(Integer.valueOf(item.getStatus())); entity.setAlarmStatus(Integer.valueOf(item.getStatus()));
entity.setStationId(item.getStation()); entity.setStationId(item.getStation());

74
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/OperStationMonthReportServiceImpl.java

@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.utils.DateUtil; import com.hnac.hzims.common.utils.DateUtil;
import com.hnac.hzims.fdp.dto.FDPFaultTableDTO;
import com.hnac.hzims.fdp.dto.StatisticStatusDTO; import com.hnac.hzims.fdp.dto.StatisticStatusDTO;
import com.hnac.hzims.fdp.entity.FdpFaultHistoryDataEntity;
import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient; import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient;
import com.hnac.hzims.fdp.vo.StatisticStatusVO; import com.hnac.hzims.fdp.vo.StatisticStatusVO;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService; import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
@ -17,6 +19,7 @@ import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.main.common.ExcelData; import com.hnac.hzims.operational.main.common.ExcelData;
import com.hnac.hzims.operational.main.enums.ColumnEnum; import com.hnac.hzims.operational.main.enums.ColumnEnum;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.report.service.IOperStationMonthReportService; import com.hnac.hzims.operational.report.service.IOperStationMonthReportService;
import com.hnac.hzims.operational.report.vo.*; import com.hnac.hzims.operational.report.vo.*;
@ -457,32 +460,38 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
pool.execute(() -> { pool.execute(() -> {
List<FDPRunReportVO> list=new ArrayList<>(); List<FDPRunReportVO> list=new ArrayList<>();
if (CollectionUtil.isNotEmpty(stationEntityList)) { if (CollectionUtil.isNotEmpty(stationEntityList)) {
StbAnalysisDTO param = new StbAnalysisDTO(); FDPFaultTableDTO fdpFaultTableDTO = new FDPFaultTableDTO();
param.setStartTime(LocalDateTime.parse(fmt.format(startDate)+" 00:00:00", org.springblade.core.tool.utils.DateUtil.DATETIME_FORMATTER)); List<String> stationIds = stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList());
param.setEndTime(LocalDateTime.parse(fmt.format(endDate)+" 23:59:59", org.springblade.core.tool.utils.DateUtil.DATETIME_FORMATTER)); String[] stationIdArray = new String[stationIds.size()];
// param.setStartTime(startDate.atStartOfDay()); stationIds.toArray(stationIdArray);
// param.setEndTime(endDate.at()); fdpFaultTableDTO.setStationIds(stationIdArray);
List<String> collect = stationEntityList.stream().filter(s -> ObjectUtil.isNotEmpty(s.getCode())).map(StationEntity::getCode).collect(Collectors.toList()); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
param.setStations(Arrays.asList("902100000026")); fdpFaultTableDTO.setCreateTimeLeft(formatter.format(LocalDateTime.of(startDate, LocalTime.MIN)));
// param.setPageSize(10); fdpFaultTableDTO.setCreateTimeRight(formatter.format(LocalDateTime.of(endDate, LocalTime.MAX)));
// param.setPage(0); fdpFaultTableDTO.setPageSize(-1);
param.setNeedPage(false); fdpFaultTableDTO.setPageIndex(-1);
Result<HzPage<StbAnalysisVO>> result = soeDataClient.pageStbAnalysis(param); fdpFaultTableDTO.setSource("auto");
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData().getRecords())){ fdpFaultTableDTO.setOrderBy("CREATE_TIME");
List<StbAnalysisVO> data = result.getData().getRecords(); int index=1;
for (int i = 0; i < data.size(); i++) { List<FdpFaultHistoryDataEntity> historyData = diagnoseClient.getHistoryData(fdpFaultTableDTO);
StbAnalysisVO stbAnalysisVO = data.get(i); if (CollectionUtil.isNotEmpty(historyData)) {
Map<String, List<FdpFaultHistoryDataEntity>> listMap = historyData.stream().collect(Collectors.groupingBy(FdpFaultHistoryDataEntity::getFaultId));
for (Map.Entry<String, List<FdpFaultHistoryDataEntity>> stringListEntry : listMap.entrySet()) {
FDPRunReportVO fdpRunReportVO=new FDPRunReportVO(); FDPRunReportVO fdpRunReportVO=new FDPRunReportVO();
fdpRunReportVO.setIndex(i+1); List<FdpFaultHistoryDataEntity> fdpFaultHistoryDataEntities = stringListEntry.getValue();
fdpRunReportVO.setLastBeginTime(stbAnalysisVO.getTs()); FdpFaultHistoryDataEntity fdpFaultHistoryDataEntity = fdpFaultHistoryDataEntities.get(fdpFaultHistoryDataEntities.size() - 1);
fdpRunReportVO.setContent(stbAnalysisVO.getContent()); fdpRunReportVO.setIndex(index);
fdpRunReportVO.setType(stbAnalysisVO.getFtype()); fdpRunReportVO.setLastBeginTime(fdpFaultHistoryDataEntity.getCreateTime());
Long count = data.stream().filter(s -> stbAnalysisVO.equals(s.getFaultid())).count(); fdpRunReportVO.setType("智能预警");
fdpRunReportVO.setNum(count.toString()); fdpRunReportVO.setContent(fdpFaultHistoryDataEntity.getName());
fdpRunReportVO.setReason(stbAnalysisVO.getFinfo()); fdpRunReportVO.setNum(String.valueOf(fdpFaultHistoryDataEntities.size()));
fdpRunReportVO.setReason(fdpFaultHistoryDataEntity.getDiagReason());
fdpRunReportVO.setAdvise(fdpFaultHistoryDataEntity.getDiagSolution());
list.add(fdpRunReportVO); list.add(fdpRunReportVO);
index++;
} }
} }
stationReportAllVo.setFdpRunReportVOList(list);
} }
countDownLatch.countDown(); countDownLatch.countDown();
}); });
@ -498,12 +507,13 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
this.getStationReportConclusionV2(stationReportAllVo, params); this.getStationReportConclusionV2(stationReportAllVo, params);
return stationReportAllVo; return stationReportAllVo;
} }
/** /**
* 导出统计月报 * 导出统计月报
* * @param response
* @param month 月份 * @param stationReportAllVO
* @param stationCode 站点编码 * @param deptId
* @param type 导出类型 * @throws Exception
*/ */
@Override @Override
public void exportStationMonthReport(HttpServletResponse response, StationRunReportAllVO stationReportAllVO,Long deptId) throws Exception { public void exportStationMonthReport(HttpServletResponse response, StationRunReportAllVO stationReportAllVO,Long deptId) throws Exception {
@ -540,6 +550,7 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
private HashMap<String, Object> getHashMap(StationRunReportAllVO stationReportAllVO, Long deptId) throws IllegalAccessException { private HashMap<String, Object> getHashMap(StationRunReportAllVO stationReportAllVO, Long deptId) throws IllegalAccessException {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("deptName", stationReportAllVO.getStationName()); map.put("deptName", stationReportAllVO.getStationName());
map.put("yearMon", stationReportAllVO.getYearMonth());
List<User> userListByRoleAlias = userClient.relationUserListByRoleAlias("200000", deptId, PROJECT_MANAGER).getData(); List<User> userListByRoleAlias = userClient.relationUserListByRoleAlias("200000", deptId, PROJECT_MANAGER).getData();
if (CollectionUtil.isNotEmpty(userListByRoleAlias)){ if (CollectionUtil.isNotEmpty(userListByRoleAlias)){
User user = userListByRoleAlias.get(0); User user = userListByRoleAlias.get(0);
@ -1162,8 +1173,8 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
//巡检任务统计 //巡检任务统计
if (CollectionUtil.isNotEmpty(stationReportAllVo.getInspectReportVOList())) { if (CollectionUtil.isNotEmpty(stationReportAllVo.getInspectReportVOList())) {
List<RunReportVO> inspectReportVOList = stationReportAllVo.getInspectReportVOList(); List<RunReportVO> inspectReportVOList = stationReportAllVo.getInspectReportVOList();
int completeInspectTaskNum = inspectReportVOList.stream().filter(vo -> Func.isNotEmpty(vo.getCompleteNum())).mapToInt(RunReportVO::getCompleteNum).sum(); int completeInspectTaskNum =inspectReportVOList.stream().filter(vo ->"合计".equals(vo.getUserName())).mapToInt(RunReportVO::getCompleteNum).sum();
int incompleteInspectTaskNum = inspectReportVOList.stream().filter(vo -> Func.isNotEmpty(vo.getIncompleteNum())).mapToInt(RunReportVO::getIncompleteNum).sum(); int incompleteInspectTaskNum =inspectReportVOList.stream().filter(vo ->"合计".equals(vo.getUserName())).mapToInt(RunReportVO::getIncompleteNum).sum();
if (completeInspectTaskNum == 0 && incompleteInspectTaskNum == 0) { if (completeInspectTaskNum == 0 && incompleteInspectTaskNum == 0) {
conclusion.append("3、无巡检任务;\r\n"); conclusion.append("3、无巡检任务;\r\n");
} else { } else {
@ -1208,9 +1219,10 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor
} }
// 两票 // 两票
if (CollectionUtil.isNotEmpty(stationReportAllVo.getTicketInfoStatisticVOList())) { if (CollectionUtil.isNotEmpty(stationReportAllVo.getTicketInfoStatisticVOList())) {
int sum = stationReportAllVo.getTicketInfoStatisticVOList().stream().mapToInt(TicketInfoStatisticVO::getTicketInfoNumber).sum(); int sum = stationReportAllVo.getTicketInfoStatisticVOList().stream().filter(s->"合计".equals(s.getTicketInfoType())).mapToInt(TicketInfoStatisticVO::getTicketInfoNumber).sum();
int qualifiedNum = stationReportAllVo.getTicketInfoStatisticVOList().stream().mapToInt(TicketInfoStatisticVO::getTicketInfoQualifiedNum).sum(); int qualifiedNum = stationReportAllVo.getTicketInfoStatisticVOList().stream().filter(s->"合计".equals(s.getTicketInfoType())).mapToInt(TicketInfoStatisticVO::getTicketInfoQualifiedNum).sum();
double ticketInfoProportion = new BigDecimal(qualifiedNum / (double) sum * 100).setScale(2, RoundingMode.HALF_DOWN).doubleValue(); // double ticketInfoProportion = new BigDecimal(qualifiedNum ).divide(sum,2, RoundingMode.HALF_DOWN).doubleValue();
double ticketInfoProportion = new BigDecimal(qualifiedNum ).divide(new BigDecimal(sum*100),2, RoundingMode.HALF_DOWN).doubleValue();
String phenomenonConclusion = "5、本月开票%s张,合格率%s;"; String phenomenonConclusion = "5、本月开票%s张,合格率%s;";
conclusion.append(String.format(phenomenonConclusion,sum,ticketInfoProportion)).append(";\r\n"); conclusion.append(String.format(phenomenonConclusion,sum,ticketInfoProportion)).append(";\r\n");
}else { }else {

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

Binary file not shown.
Loading…
Cancel
Save