Browse Source

#智能生产修改

zhongwei
yang_shj 1 year ago
parent
commit
b726697e56
  1. 7
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java
  2. 7
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClientFallback.java
  3. 26
      hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/ExceedVo.java
  4. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClient.java
  5. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClientFallBack.java
  6. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaTimelyVo.java
  7. 15
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/feign/IInspectTaskClient.java
  8. 5
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/feign/IInspectTaskClientBack.java
  9. 94
      hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java
  10. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpMonitorClient.java
  11. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java
  12. 18
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java
  13. 19
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskClient.java
  14. 21
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/AreaDutyController.java
  15. 216
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java
  16. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

7
hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClient.java

@ -1,6 +1,8 @@
package com.hnac.hzims.spare.feign;
import com.hnac.hzims.operational.census.vo.AreaTimelyVo;
import com.hnac.hzims.spare.entity.*;
import com.hnac.hzims.spare.vo.ExceedVo;
import com.hnac.hzims.spare.vo.WtSpBasicVO;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
@ -19,6 +21,8 @@ public interface ISpareClient {
String API_PREFIX = "/client";
String WAREHOUSEOUT = API_PREFIX+"/warehouseOut";
String EXCEED_LIMIT = API_PREFIX + "/exceedLimit" ;
/**
* 保存工单与出库单关联信息
* @param recordEntity
@ -26,4 +30,7 @@ public interface ISpareClient {
*/
@PostMapping(WAREHOUSEOUT)
Boolean warehouseOut(@RequestBody SpRecordEntity recordEntity);
@PostMapping(EXCEED_LIMIT)
List<AreaTimelyVo> exceedLimit(@RequestParam("deptId") Long deptId);
}

7
hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/feign/ISpareClientFallback.java

@ -1,5 +1,6 @@
package com.hnac.hzims.spare.feign;
import com.hnac.hzims.operational.census.vo.AreaTimelyVo;
import com.hnac.hzims.spare.entity.*;
import com.hnac.hzims.spare.vo.WtSpBasicVO;
import org.springblade.core.tool.api.R;
@ -7,6 +8,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -17,4 +19,9 @@ public class ISpareClientFallback implements ISpareClient {
public Boolean warehouseOut(SpRecordEntity recordEntity) {
return false;
}
@Override
public List<AreaTimelyVo> exceedLimit(Long deptId) {
return new ArrayList<>();
}
}

26
hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/ExceedVo.java

@ -0,0 +1,26 @@
package com.hnac.hzims.spare.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class ExceedVo {
@ApiModelProperty(value = "机构名称")
private String deptName;
@ApiModelProperty(value = "事件Id")
private String eventId;
@ApiModelProperty(value = "事件内容")
private String content;
@ApiModelProperty(value = "事件time")
private String time;
@ApiModelProperty(value = "提醒数量")
private Integer sum;
}

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClient.java

@ -32,7 +32,7 @@ public interface IFdpMonitorClient {
R<List<String>> getRealIds();
@GetMapping(GET_FAULT_LIST)
String getFaultList();
String getFaultList(List<String> stations);
@GetMapping(UPDATE_FAULT_STATE)
String updateFaultState(UpdateFaultStateVo state);

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/feign/IFdpMonitorClientFallBack.java

@ -24,7 +24,7 @@ public class IFdpMonitorClientFallBack implements IFdpMonitorClient{
}
@Override
public String getFaultList() {
public String getFaultList(List<String> stations) {
return null;
}

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaTimelyVo.java

@ -11,6 +11,9 @@ import lombok.Data;
@Data
public class AreaTimelyVo {
@ApiModelProperty(value = "机构名称")
private String deptName;
@ApiModelProperty(value = "事件Id")
private String eventId;
@ -22,4 +25,7 @@ public class AreaTimelyVo {
@ApiModelProperty(value = "提醒数量")
private Integer sum;
@ApiModelProperty(value = "字体颜色:1-红色 0-黄色")
private Integer colour;
}

15
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/feign/IInspectTaskClient.java

@ -20,6 +20,8 @@ public interface IInspectTaskClient {
String QUERY_BY_PLAN_START_TIME_AND_DEPT = API_PREFIX + "/queryByPlanStartTimeAndDept";
String GET_INSPECT_TASK_CHECK = API_PREFIX + "/getInspectTaskCheck";
String EXPIRE_INSPECT = API_PREFIX + "/expireInspect";
/**
* 根据创建时间查询巡检任务列表
**/
@ -40,9 +42,20 @@ public interface IInspectTaskClient {
* @param inspectType 查询类型 1为运行人员 2管理及其他人员
* @return
*/
@GetMapping(GET_INSPECT_TASK_CHECK)
@GetMapping(EXPIRE_INSPECT)
R<SafeCheckStatisticVO> getInspectTaskCheck(@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate,
@RequestParam("dept") Long dept,
@RequestParam("inspectType") String inspectType);
/**
* 查询到期巡检
* @param start
* @param end
* @param deptId
* @return
*/
@GetMapping(EXPIRE_INSPECT)
List<TaskEntity> expireInspect(@RequestParam("start") String start, @RequestParam("end") String end,@RequestParam("deptId")Long deptId);
}

5
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/feign/IInspectTaskClientBack.java

@ -28,4 +28,9 @@ public class IInspectTaskClientBack implements IInspectTaskClient {
public R<SafeCheckStatisticVO> getInspectTaskCheck(String startDate, String endDate, Long dept, String inspectType) {
return R.data(new SafeCheckStatisticVO());
}
@Override
public List<TaskEntity> expireInspect(String start, String end, Long deptId) {
return new ArrayList<>();
}
}

94
hzims-service/assets/src/main/java/com/hnac/hzims/spare/feign/SpareClient.java

@ -1,23 +1,26 @@
package com.hnac.hzims.spare.feign;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.operational.census.vo.AreaTimelyVo;
import com.hnac.hzims.spare.entity.*;
import com.hnac.hzims.spare.mapper.SpRecordMapper;
import com.hnac.hzims.spare.mapper.SpWarehouseOutMapper;
import com.hnac.hzims.spare.service.*;
import com.hnac.hzims.spare.vo.WtSpBasicVO;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RequestParam;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.feign.ISysClient;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 备品备件Feign实现类
@ -42,8 +45,17 @@ public class SpareClient implements ISpareClient{
private final IWtSpProviderService providerService;
private final IWtSpTotalService totalService;
private final IWtSpBasicService wtSpBasicService;
private final ISpWarehouseOutService warehouseOutService;
private final IWtSpWarehouseService wtSpWarehouseService;
private final ISysClient sysClient;
@Override
public Boolean warehouseOut(SpRecordEntity recordEntity) {
List<SpRecordEntity> recordEntities = new ArrayList<>();
@ -57,4 +69,72 @@ public class SpareClient implements ISpareClient{
Boolean result = warehouseOutService.save(entity);
return result;
}
/**
* 固定资产越限
* @param deptId
* @return
*/
@Override
public List<AreaTimelyVo> exceedLimit(Long deptId) {
// 查询仓库
List<WtSpWarehouseEntity> warehouses = wtSpWarehouseService.list(Wrappers.<WtSpWarehouseEntity>lambdaQuery()
.like(WtSpWarehouseEntity::getCreateDept,deptId)
);
if(CollectionUtil.isEmpty(warehouses)){
return new ArrayList<>();
}
// 查询库存
List<WtSpTotalEntity> totals = totalService.list(Wrappers.<WtSpTotalEntity>lambdaQuery()
.in(WtSpTotalEntity::getWarehouseId, warehouses.stream().map(WtSpWarehouseEntity::getId).collect(Collectors.toList()))
);
if(CollectionUtil.isEmpty(totals)){
return new ArrayList<>();
}
// 查询限制条件
List<WtSpBasicEntity> basics = wtSpBasicService.list(Wrappers.<WtSpBasicEntity>lambdaQuery()
.in(WtSpBasicEntity::getId,totals.stream().map(WtSpTotalEntity::getSpBasicId).collect(Collectors.toList()))
);
if(CollectionUtil.isEmpty(totals)){
return new ArrayList<>();
}
// 过滤越限记录
List<AreaTimelyVo> exceeds = new ArrayList<>();
for (WtSpTotalEntity total : totals){
WtSpBasicEntity basic = basics.stream().filter(o->o.getId().equals(total.getSpBasicId())).min(Comparator.comparing(WtSpBasicEntity::getId)).get();
if(ObjectUtil.isEmpty(basics)){
continue;
}
if(total.getStock() > basic.getUpperLimit() || total.getStock() < basic.getLowerLimit()){
AreaTimelyVo timely = new AreaTimelyVo();
WtSpWarehouseEntity warehouse = warehouses.stream().filter(o->o.getId().equals(total.getWarehouseId())).min(Comparator.comparing(WtSpWarehouseEntity::getId)).get();
timely.setDeptName(warehouse.getName());
timely.setEventId(String.valueOf(total.getId()));
if(total.getStock() > basic.getUpperLimit()){
timely.setContent(String.format("(%s)已达到上限,目前仓库内的库存为:%s,上限值为:%s。",
basic.getName(),
total.getStock(),
basic.getUpperLimit()));
timely.setSum((int) (total.getStock() - basic.getUpperLimit()));
timely.setColour(0);
if((double) (total.getStock() - basic.getUpperLimit()) / basic.getUpperLimit() > 0.3){
timely.setColour(1);
}
}else{
timely.setContent(String.format("(%s)已达到下限,目前仓库内的库存为:%s,下限值为:%s。",
basic.getName(),
total.getStock(),
basic.getUpperLimit()));
timely.setSum((int) (total.getStock() - basic.getLowerLimit()));
timely.setColour(0);
if((double)(basic.getLowerLimit() - total.getStock()) / basic.getLowerLimit() > 0.3){
timely.setColour(1);
}
}
timely.setTime(DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME));
exceeds.add(timely);
}
}
return exceeds;
}
}

4
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/feign/FdpMonitorClient.java

@ -30,8 +30,8 @@ public class FdpMonitorClient implements IFdpMonitorClient{
@GetMapping(GET_FAULT_LIST)
@Override
public String getFaultList() {
return fdpMonitorService.getFaultList();
public String getFaultList(List<String> stations) {
return fdpMonitorService.getFaultList(stations);
}
@GetMapping(UPDATE_FAULT_STATE)

2
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/IFdpMonitorService.java

@ -159,7 +159,7 @@ public interface IFdpMonitorService extends BaseService<FdpMonitorEntity> {
List<String> getRealIds();
String getFaultList();
String getFaultList(List<String> stations);
String updateFaultState(UpdateFaultStateVo state);
}

18
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java

@ -629,16 +629,20 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl<FdpMonitorMapper, Fdp
}
@Override
public String getFaultList() {
List<String> list = this.baseMapper.selectStationIds();
if (CollectionUtil.isEmpty(list)) {
return null;
}
public String getFaultList(List<String> stations) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("stationIds", list.toArray(new String[0]));
if(CollectionUtil.isEmpty(stations)){
List<String> list = this.baseMapper.selectStationIds();
if (CollectionUtil.isEmpty(list)) {
return null;
}
paramMap.put("stationIds", list.toArray(new String[0]));
}else{
paramMap.put("stationIds", stations);
}
String result = HttpRequestUtil.postCall(paramMap, autoFaultPath, "POST");
if (StringUtil.isBlank(result)) {
return null;
return null;
}
return JSONObject.parseObject(result).get("data").toString();
}

19
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/feign/InspectTaskClient.java

@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -58,6 +59,7 @@ public class InspectTaskClient implements IInspectTaskClient {
return taskService.queryByPlanStartTime(startDate,endDate,depts);
}
/**
* 获取安全检查巡检任务
* @param startDate 开始时间
@ -74,4 +76,21 @@ public class InspectTaskClient implements IInspectTaskClient {
@RequestParam("inspectType") String inspectType) {
return taskService.getInspectTaskCheck(startDate,endDate,dept,inspectType);
}
/**
* 到期巡检任务
* @param start
* @param end
* @param deptId
* @return
*/
@Override
public List<TaskEntity> expireInspect(String start, String end, Long deptId) {
return taskService.list(Wrappers.<TaskEntity>lambdaQuery()
.ge(TaskEntity::getPlanEndTime,start)
.le(TaskEntity::getPlanEndTime,end)
.ne(TaskEntity::getStatus,TaskContants.TaskStatusEnum.FINISH_STATUS)
.like(TaskEntity::getCreateDept,deptId)
);
}
}

21
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/AreaDutyController.java

@ -12,10 +12,7 @@ import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Calendar;
import java.util.List;
@ -35,7 +32,7 @@ public class AreaDutyController {
@ApiLog
@ApiOperation("值班数据")
@PostMapping("/duty")
@GetMapping("/duty")
@ApiOperationSupport(order = 1)
public R<AreaDutyVo> duty(@ApiParam(value = "机构Id", required = true) @RequestParam Long deptId) {
return R.data(service.duty(deptId));
@ -43,25 +40,25 @@ public class AreaDutyController {
@ApiLog
@ApiOperation("资产信息")
@PostMapping("/asset")
@ApiOperationSupport(order = 1)
@GetMapping("/asset")
@ApiOperationSupport(order = 2)
public R<List<AreaAssetVo>> asset(@ApiParam(value = "机构Id", required = true) @RequestParam Long deptId) {
return R.data(service.asset(deptId));
}
@ApiLog
@ApiOperation("及时提醒消息")
@PostMapping("/timely")
@ApiOperationSupport(order = 1)
@GetMapping("/timely")
@ApiOperationSupport(order = 3)
public R<List<AreaTimelyVo>> timely(@ApiParam(value = "机构Id", required = true) @RequestParam Long deptId,
@ApiParam(value = "机构Id", required = true) @RequestParam Integer type) {
@ApiParam(value = "类型", required = true) @RequestParam Integer type) {
return R.data(service.timely(deptId,type));
}
@ApiLog
@ApiOperation("排班数据")
@PostMapping("/scheduling")
@ApiOperationSupport(order = 1)
@GetMapping("/scheduling")
@ApiOperationSupport(order = 4)
public R scheduling(@ApiParam(value = "机构Id", required = true) @RequestParam Long deptId) {
Calendar calendar = Calendar.getInstance();
return dutyMainService.getSchedulingListV2(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH) + 1, deptId);

216
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java

@ -1,34 +1,47 @@
package com.hnac.hzims.operational.census.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.fdp.feign.IFdpMonitorClient;
import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.census.service.AreaDutyService;
import com.hnac.hzims.operational.census.vo.AreaAssetDeviceVo;
import com.hnac.hzims.operational.census.vo.AreaAssetVo;
import com.hnac.hzims.operational.census.vo.AreaTimelyVo;
import com.hnac.hzims.operational.config.vo.FaultVo;
import com.hnac.hzims.operational.main.service.IMainTaskStatisticService;
import com.hnac.hzims.operational.main.vo.AreaDutyVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.maintenance.service.MaintenanceService;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.spare.feign.ISpareClient;
import com.hnac.hzinfo.inspect.task.entity.TaskEntity;
import com.hnac.hzinfo.inspect.task.feign.IInspectTaskClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
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.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -51,10 +64,19 @@ public class AreaDutyServiceImpl implements AreaDutyService {
private final IStationService stationService;
private final IOperMaintenanceTaskService maintenanceService;
private final IOperAccessTaskService accessTaskService;
private final ISysClient sysClient;
private final RedisTemplate redisTemplate;
private final ISpareClient spareClient;
private final IFdpMonitorClient monitorClient;
private final IInspectTaskClient inspectTaskClient;
private final RedisTemplate redisTemplate;
/**
* 区域值班数据
@ -63,7 +85,7 @@ public class AreaDutyServiceImpl implements AreaDutyService {
*/
@Override
public AreaDutyVo duty(Long deptId) {
List<AreaDutyVo> dutys = (List<AreaDutyVo>) redisTemplate.opsForValue().get(area_duty_cache_final);;
List<AreaDutyVo> dutys = (List<AreaDutyVo>) redisTemplate.opsForValue().get(area_duty_cache_final);
if(CollectionUtil.isEmpty(dutys)){
return new AreaDutyVo();
}
@ -77,24 +99,178 @@ public class AreaDutyServiceImpl implements AreaDutyService {
*/
@Override
public List<AreaTimelyVo> timely(Long deptId,Integer type) {
Calendar calendar = Calendar.getInstance();
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
calendar.add(Calendar.DAY_OF_MONTH,1);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
switch (type){
case 1:
break;
return this.early(deptId);
case 2:
break;
return this.inspection(start,end,deptId);
case 3:
break;
return this.overhaul(start,end,deptId);
case 4:
break;
return this.maintenance(start,end,deptId);
case 5:
break;
return this.regular(deptId);
default:
return new ArrayList<>();
}
return new ArrayList<>();
}
/**
* 预警
* @return
*/
private List<AreaTimelyVo> early(Long deptId) {
// 查询子机构
R<List<Dept>> result = sysClient.getDeptChild(deptId);
if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
return new ArrayList<>();
}
// 站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.in(StationEntity::getRefDept,result.getData().stream().map(Dept::getId).collect(Collectors.toList()))
);
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}
// 预警信息查询
String response = monitorClient.getFaultList(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
if (StringUtil.isBlank(response)) {
return new ArrayList<>();
}
List<FaultVo> earlys = JSONArray.parseArray(response,FaultVo.class);
if(CollectionUtil.isEmpty(earlys)){
return new ArrayList<>();
}
// 遍历
return earlys.stream().map(early->{
AreaTimelyVo timely = new AreaTimelyVo();
timely.setEventId(early.getFaultId());
timely.setContent(early.getFinfo());
timely.setDeptName(early.getStation());
timely.setTime(early.getCreateTime());
int sum = this.eventToHours(LocalDateTime.parse(early.getCreateTime(),DateUtil.DATETIME_FORMATTER));
timely.setSum(sum);
timely.setColour(0);
if(sum > 12){
timely.setColour(1);
}
return timely;
}).collect(Collectors.toList());
}
/**
* 巡检
* @param deptId
* @return
*/
private List<AreaTimelyVo> inspection(String start,String end,Long deptId) {
List<TaskEntity> expires = inspectTaskClient.expireInspect(start,end,deptId);
if(CollectionUtil.isEmpty(expires)){
return new ArrayList<>();
}
return expires.stream().map(expire->{
AreaTimelyVo timely = new AreaTimelyVo();
timely.setEventId(String.valueOf(expire.getId()));
timely.setContent(expire.getPlanName());
R<Dept> result = sysClient.getDept(expire.getCreateDept());
if(result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())){
timely.setDeptName(result.getData().getDeptName());
}
timely.setTime(expire.getPlanEndTime().format(DateUtil.DATETIME_FORMATTER));
int sum = this.eventToHours(expire.getPlanEndTime());
timely.setSum(sum);
timely.setColour(0);
if(sum < 12){
timely.setColour(1);
}
return timely;
}).collect(Collectors.toList());
}
/**
* 检修
* @param deptId
* @return
*/
private List<AreaTimelyVo> overhaul(String start,String end,Long deptId) {
List<OperAccessTaskEntity> overhauls = accessTaskService.list(Wrappers.<OperAccessTaskEntity>lambdaQuery()
.ge(OperAccessTaskEntity::getPlanEndTime,start)
.le(OperAccessTaskEntity::getPlanEndTime,end)
.ne(OperAccessTaskEntity::getStatus,4)
.like(OperAccessTaskEntity::getCreateDept,deptId)
);
if(CollectionUtil.isEmpty(overhauls)){
return new ArrayList<>();
}
return overhauls.stream().map(overhaul->{
AreaTimelyVo timely = new AreaTimelyVo();
timely.setEventId(String.valueOf(overhaul.getId()));
timely.setContent(overhaul.getName());
R<Dept> result = sysClient.getDept(overhaul.getCreateDept());
if(result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())){
timely.setDeptName(result.getData().getDeptName());
}
timely.setTime(DateUtil.format(overhaul.getPlanEndTime(),DateUtil.PATTERN_DATETIME));
int sum = this.eventToHours(LocalDateTime.ofInstant(overhaul.getPlanEndTime().toInstant(), ZoneId.systemDefault()));
timely.setSum(sum);
timely.setColour(0);
if(sum < 12){
timely.setColour(1);
}
return timely;
}).collect(Collectors.toList());
}
/**
* 日常维护
* @param deptId
* @return
*/
private List<AreaTimelyVo> maintenance(String start,String end,Long deptId) {
List<OperMaintenanceTaskEntity> maintenances = maintenanceService.list(Wrappers.<OperMaintenanceTaskEntity>lambdaQuery()
.ge(OperMaintenanceTaskEntity::getPlanEndTime,start)
.le(OperMaintenanceTaskEntity::getPlanEndTime,end)
.ne(OperMaintenanceTaskEntity::getFlowTaskName,"结束")
.like(OperMaintenanceTaskEntity::getCreateDept,deptId)
);
if(CollectionUtil.isEmpty(maintenances)){
return new ArrayList<>();
}
return maintenances.stream().map(maintenance -> {
AreaTimelyVo timely = new AreaTimelyVo();
timely.setEventId(String.valueOf(maintenance.getId()));
timely.setContent(maintenance.getTitle());
R<Dept> result = sysClient.getDept(maintenance.getCreateDept());
if(result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())){
timely.setDeptName(result.getData().getDeptName());
}
timely.setTime(DateUtil.format(maintenance.getPlanEndTime(),DateUtil.PATTERN_DATETIME));
int sum = this.eventToHours(maintenance.getPlanEndTime());
timely.setSum(sum);
timely.setColour(0);
if(sum < 12){
timely.setColour(1);
}
return timely;
}).collect(Collectors.toList());
}
/**
* 固定资产
* @param deptId
* @return
*/
private List<AreaTimelyVo> regular(Long deptId) {
return spareClient.exceedLimit(deptId);
}
/**
* 资产信息
* @param deptId
* @return
@ -143,6 +319,14 @@ public class AreaDutyServiceImpl implements AreaDutyService {
}
}
/**
* 事件产生时长
* @param startTime
* @return
*/
private int eventToHours(LocalDateTime startTime) {
// 计算投运时间与当前时间相隔天数
Duration dur = Duration.between(startTime, LocalDateTime.now());
return Math.abs((int) dur.toHours());
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

@ -731,7 +731,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
if(CollectionUtil.isEmpty(stations)){
return null;
}
String result = fdpMonitorClient.getFaultList();
String result = fdpMonitorClient.getFaultList(new ArrayList<>());
if(StringUtil.isEmpty(result)){
return null;
}

Loading…
Cancel
Save