From b33f28ba2a45db6bdd7111d519b47a821405e49e Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Tue, 29 Aug 2023 16:36:59 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=96=B0=E5=8C=BA=E5=9F=9F=E5=80=BC=E7=8F=AD?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operational/census/vo/AreaAssetDeviceVo.java | 2 +- .../hzims/operational/census/vo/AreaTimelyVo.java | 12 +++++++ .../census/controller/AreaDutyController.java | 17 +++++++-- .../census/service/AreaDutyService.java | 3 +- .../census/service/impl/AreaDutyServiceImpl.java | 42 +++++++++++++++++++--- 5 files changed, 68 insertions(+), 8 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java index a72d479..fa6f71d 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaAssetDeviceVo.java +++ b/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; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaTimelyVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaTimelyVo.java index 2490ab8..0f5c844 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/AreaTimelyVo.java +++ b/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; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/AreaDutyController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/AreaDutyController.java index 859dd14..bb8f270 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/AreaDutyController.java +++ b/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 timely(@ApiParam(value = "机构Id", required = true) @RequestParam Long deptId) { - return R.data(service.timely(deptId)); + public R> 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); + } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/AreaDutyService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/AreaDutyService.java index 6a4dbfe..83d8ce1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/AreaDutyService.java +++ b/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 timely(Long deptId,Integer type); List asset(Long deptId); + } \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java index d477c31..42e5a1e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/AreaDutyServiceImpl.java +++ b/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 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 devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(),new TypeReference>() {}); // 水电站设备实时数据 List reals = (List) 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<>(); } } + + + } \ No newline at end of file