Browse Source

#新区域值班数据统计

zhongwei
yang_shj 1 year ago
parent
commit
b33f28ba2a
  1. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java
  2. 12
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaTimelyVo.java
  3. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/AreaDutyController.java
  4. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/AreaDutyService.java
  5. 42
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java

@ -20,5 +20,5 @@ public class AreaAssetDeviceVo {
private String deptName;
@ApiModelProperty(value = "状态")
private String status;
private Integer status;
}

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

@ -1,5 +1,6 @@
package com.hnac.hzims.operational.census.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -10,4 +11,15 @@ import lombok.Data;
@Data
public class AreaTimelyVo {
@ApiModelProperty(value = "事件Id")
private String eventId;
@ApiModelProperty(value = "事件内容")
private String content;
@ApiModelProperty(value = "事件time")
private String time;
@ApiModelProperty(value = "提醒数量")
private Integer sum;
}

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

@ -4,6 +4,7 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.census.service.AreaDutyService;
import com.hnac.hzims.operational.census.vo.AreaAssetVo;
import com.hnac.hzims.operational.census.vo.AreaTimelyVo;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.main.vo.AreaDutyVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Calendar;
import java.util.List;
/**
@ -29,6 +31,8 @@ public class AreaDutyController {
private final AreaDutyService service;
private final IImsDutyMainService dutyMainService;
@ApiLog
@ApiOperation("值班数据")
@PostMapping("/duty")
@ -49,9 +53,18 @@ public class AreaDutyController {
@ApiOperation("及时提醒消息")
@PostMapping("/timely")
@ApiOperationSupport(order = 1)
public R<AreaTimelyVo> timely(@ApiParam(value = "机构Id", required = true) @RequestParam Long deptId) {
return R.data(service.timely(deptId));
public R<List<AreaTimelyVo>> timely(@ApiParam(value = "机构Id", required = true) @RequestParam Long deptId,
@ApiParam(value = "机构Id", required = true) @RequestParam Integer type) {
return R.data(service.timely(deptId,type));
}
@ApiLog
@ApiOperation("排班数据")
@PostMapping("/scheduling")
@ApiOperationSupport(order = 1)
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);
}
}

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/AreaDutyService.java

@ -14,7 +14,8 @@ public interface AreaDutyService {
AreaDutyVo duty(Long deptId);
AreaTimelyVo timely(Long deptId);
List<AreaTimelyVo> timely(Long deptId,Integer type);
List<AreaAssetVo> asset(Long deptId);
}

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

@ -5,6 +5,7 @@ import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
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.main.vo.AreaDutyVo;
@ -13,8 +14,10 @@ import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
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.ObjectUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Value;
@ -73,8 +76,22 @@ public class AreaDutyServiceImpl implements AreaDutyService {
* @return
*/
@Override
public AreaTimelyVo timely(Long deptId) {
return null;
public List<AreaTimelyVo> timely(Long deptId,Integer type) {
switch (type){
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
default:
return new ArrayList<>();
}
return new ArrayList<>();
}
/**
@ -101,9 +118,23 @@ public class AreaDutyServiceImpl implements AreaDutyService {
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});
// 水电站设备实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
return devices.stream().filter(device -> depts.contains(device.getCreateDept())).collect(Collectors.groupingBy(EminfoAndEmParamVo::getCreateDept)).entrySet().stream().map(entry->{
return devices.stream().filter(device -> depts.contains(device.getCreateDept())).collect(Collectors.groupingBy(EminfoAndEmParamVo::getCreateDept)).entrySet().stream().map(entry->{
AreaAssetVo asset = new AreaAssetVo();
asset.setDeptId(entry.getKey());
asset.setDeptName(sysClient.getDeptName(entry.getKey()).getData());
asset.setDevices(entry.getValue().stream().map(value->{
AreaAssetDeviceVo item = new AreaAssetDeviceVo();
item.setDeptId(entry.getKey());
item.setDeptName(asset.getDeptName());
// 状态
HydropowerUnitRealVo real = reals.stream().filter(o->o.getDeviceCode().equals(value.getEmCode())).min(Comparator.comparing(HydropowerUnitRealVo::getDeviceCode)).get();
if(ObjectUtil.isEmpty(real)){
item.setStatus(2);
}else if(Math.abs(real.getActivePower()) > 0){
item.setStatus(1);
}
return item;
}).collect(Collectors.toList()));
return asset;
}).collect(Collectors.toList());
}catch (Exception ex){
@ -111,4 +142,7 @@ public class AreaDutyServiceImpl implements AreaDutyService {
return new ArrayList<>();
}
}
}
Loading…
Cancel
Save