From b5f071cff939d57fd89541b99a5f6b3962813b02 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 12 Jul 2024 17:59:48 +0800 Subject: [PATCH] =?UTF-8?q?#master=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/equipment/feign/IEmInfoClient.java | 5 + .../hzims/equipment/feign/IEmInfoClientBack.java | 5 + .../operational/report/vo/GenerationDeviceVo.java | 24 ++++ .../report/vo/GenerationReportTimeVo.java | 19 +++ .../operational/report/vo/GenerationReportVo.java | 24 ++++ .../station/entity/StationRelation.java | 127 +++++++++++++++++++++ .../hzinfo/inspect/ai/vo/RemoteControlDTO.java | 31 +++++ .../hzinfo/inspect/task/entity/TaskEntity.java | 8 ++ .../process/constant/TicketProcessConstant.java | 5 + .../strategy/abstracts/ProcessAbstractService.java | 4 - .../inspect/ai/controller/RobotController.java | 22 ++-- .../hzinfo/inspect/ai/service/IRobotService.java | 6 +- .../inspect/ai/service/impl/RobotServiceImpl.java | 73 +++++++++--- .../controller/GenerationReportController.java | 2 - .../report/service/IGenerationReportService.java | 1 - .../controller/StationRelationController.java | 4 +- .../controller/StationVideoTypeController.java | 3 - .../station/mapper/StationRelationMapper.java | 3 + .../station/service/IStationVideoTypeService.java | 10 +- .../service/impl/StationVideoTypeServiceImpl.java | 18 +-- 20 files changed, 333 insertions(+), 61 deletions(-) create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationDeviceVo.java create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportTimeVo.java create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportVo.java create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationRelation.java create mode 100644 hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RemoteControlDTO.java diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java index 2cbeb99..b60f2ae 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java @@ -87,6 +87,8 @@ public interface IEmInfoClient { String RIDE_DEVICES = API_PREFIX + "/rideDevices"; + String CREWS_DEVICES = API_PREFIX + "/crewsDevices"; + @PostMapping(DETAIL) EmInfoEntity getByCode(@RequestParam("code") String id); @@ -176,4 +178,7 @@ public interface IEmInfoClient { @GetMapping(RIDE_DEVICES) List rideDevices(@RequestParam("deptIds") List deptIds); + + @GetMapping(CREWS_DEVICES) + List crewsDevices(@RequestParam("refDept") Long refDept); } diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java index 104d494..c84c6eb 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java @@ -120,4 +120,9 @@ public class IEmInfoClientBack implements IEmInfoClient { public List rideDevices(List longs) { return new ArrayList<>(); } + + @Override + public List crewsDevices(Long refDept) { + return new ArrayList<>(); + } } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationDeviceVo.java new file mode 100644 index 0000000..736f7ce --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationDeviceVo.java @@ -0,0 +1,24 @@ +package com.hnac.hzims.operational.report.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author ysj + */ +@Data +@ApiModel("发电量报表") +public class GenerationDeviceVo { + + @ApiModelProperty("设备编号") + private String deviceCode; + + @ApiModelProperty("设备名称") + private String deviceName; + + @ApiModelProperty("属性时间范围统计数据") + private List attributes; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportTimeVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportTimeVo.java new file mode 100644 index 0000000..1540fae --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportTimeVo.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.operational.report.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author ysj + */ +@Data +@ApiModel("发电量报表") +public class GenerationReportTimeVo { + + @ApiModelProperty("时间") + private String time; + + @ApiModelProperty("值") + private Double value; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportVo.java new file mode 100644 index 0000000..13847b5 --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/GenerationReportVo.java @@ -0,0 +1,24 @@ +package com.hnac.hzims.operational.report.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author ysj + */ +@Data +@ApiModel("发电量报表") +public class GenerationReportVo { + + @ApiModelProperty("属性") + private String attribute; + + @ApiModelProperty("属性名称") + private String attributeName; + + @ApiModelProperty("属性时间范围统计数据") + private List times; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationRelation.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationRelation.java new file mode 100644 index 0000000..5b983f7 --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationRelation.java @@ -0,0 +1,127 @@ +package com.hnac.hzims.operational.station.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * 站点和霍山生态流量电站的关联关系表 + * @author tanghaihao + * @date 2023年10月08日 13:58 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("station_relation") +public class StationRelation implements Serializable { + private static final long serialVersionUID=1L; + + /** + * ID + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 站点编码 + */ + @TableField("station_code") + private String stationCode; + + /** + * 站点名称 + */ + @TableField(exist = false) + private String stationName; + + /** + * 设备编码 + */ + @TableField("device_code") + private String deviceCode; + + /** + * 设备名称 + */ + @TableField(exist = false) + private String deviceName; + + /** + * 核定流量 + */ + @TableField("flow_value") + private String flowValue; + + /** + * 低级告警负责人id + */ + @TableField("low_soe_user_id") + private String lowSoeUserId; + + /** + * 低级告警电话号码 + */ + @TableField("low_soe_phone") + private String lowSoePhone; + + /** + * 中级告警负责人id + */ + @TableField("middle_soe_user_id") + private String middleSoeUserId; + + /** + * 中级告警电话号码 + */ + @TableField("middle_soe_phone") + private String middleSoePhone; + + /** + * 高级告警负责人id + */ + @TableField("high_soe_user_id") + private String highSoeUserId; + + /** + * 高级告警电话号码 + */ + @TableField("high_soe_phone") + private String highSoePhone; + + /** + * 当日是否发送预警 + */ + @TableField("send_warning") + private Integer sendWarning; + + /** + * 当日是否发送告警 + */ + @TableField("send_soe") + private Integer sendSoe; + + /** + * 创建时间 + */ + @TableField("create_time") + private LocalDateTime createTime; + + /** + * 更新时间 + */ + @TableField("update_time") + private LocalDateTime updateTime; + + /** + * 逻辑删除 + */ + @TableField("is_deleted") + private Integer isDeleted; +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RemoteControlDTO.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RemoteControlDTO.java new file mode 100644 index 0000000..4c5cc15 --- /dev/null +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/ai/vo/RemoteControlDTO.java @@ -0,0 +1,31 @@ +package com.hnac.hzinfo.inspect.ai.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.Map; + +@Data +public class RemoteControlDTO { + + @ApiModelProperty("站点编号") + @NotBlank + private String stationCode; + + @ApiModelProperty("设备编码") + @NotBlank + private String deviceCode; + + @ApiModelProperty("功能标识") + @NotBlank + private String signage; + + @ApiModelProperty("参数列表") + @NotBlank + private Map params; + + @ApiModelProperty("机器码") + @NotBlank + private String machineCode; +} diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java index df18dbe..6cd2907 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java @@ -48,6 +48,14 @@ public class TaskEntity extends TenantEntity { @ApiModelProperty(value = "计划名称") @QueryField(condition = SqlCondition.LIKE) private String planName; + + /** + * 路线名称 + */ + @ApiModelProperty(value = "路线名称") + @QueryField(condition = SqlCondition.LIKE) + private String routeName; + /** * 任务批次号 */ diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java index 37b03b0..4dfcdc3 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java @@ -74,6 +74,11 @@ public class TicketProcessConstant { * 风险排查标识 */ public static final String HAZARD_RISK = "hazard_risk"; + /** + * 线下操作票标识 + */ + public static final String OFFLINE_OPERATION_TICKET = "OperationTicketOffline"; + /**项目经理**/ public static final String PROJECT_MANAGER = "projectManager"; } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java index 8c75ea7..b39b9f9 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java @@ -3,8 +3,6 @@ package com.hnac.hzims.middle.processflow.strategy.abstracts; import com.hnac.hzims.middle.processflow.entity.ProcessDict; import com.hnac.hzims.middle.processflow.service.ProcessDictService; import com.hnac.hzims.middle.processflow.strategy.service.ProcessService; -import com.hnac.hzims.operational.access.constants.AccessConstants; -import com.hnac.hzims.operational.duty.constant.DutyRecProcessConstant; import lombok.extern.slf4j.Slf4j; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; @@ -18,13 +16,11 @@ import org.springblade.system.feign.ISysClient; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.DEAL_ALARM; import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.PROJECT_MANAGER; /** diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java index d7f3a3b..c9de8b2 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/controller/RobotController.java @@ -1,32 +1,28 @@ package com.hnac.hzinfo.inspect.ai.controller; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzinfo.inspect.Constants; import com.hnac.hzinfo.inspect.ai.dto.robot.RobotInstanceDTO; +import com.hnac.hzinfo.inspect.ai.entity.RobotEntity; +import com.hnac.hzinfo.inspect.ai.service.IRobotService; import com.hnac.hzinfo.inspect.ai.vo.RemoteControlDTO; -import com.hnac.hzinfo.inspect.ai.vo.robot.RobotAiReturnData; import com.hnac.hzinfo.inspect.ai.vo.robot.RobotRealDataVO; -import com.hnac.hzinfo.inspect.ai.vo.robot.RobotServerTaskParam; import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; import com.hnac.hzinfo.log.annotation.Business; import com.hnac.hzinfo.log.annotation.Operate; import com.hnac.hzinfo.log.contants.BusinessType; import com.hnac.hzinfo.log.contants.Risk; -import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; -import com.hnac.hzinfo.sdk.v5.device.vo.VirtualDeviceDTO; -import io.swagger.annotations.*; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; -import javax.validation.Valid; - import lombok.SneakyThrows; import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.log.exception.ServiceException; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; -import org.springblade.core.oss.OssTemplate; import org.springblade.core.oss.model.BladeFile; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; @@ -35,12 +31,10 @@ import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.web.multipart.MultipartFile; import springfox.documentation.annotations.ApiIgnore; -import com.hnac.hzinfo.inspect.ai.entity.RobotEntity; -import com.hnac.hzinfo.inspect.ai.service.IRobotService; +import javax.validation.Valid; import java.util.List; import java.util.Map; import java.util.Optional; diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java index 9539e9e..72d4fcf 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/IRobotService.java @@ -1,16 +1,12 @@ package com.hnac.hzinfo.inspect.ai.service; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; -import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.inspect.ai.dto.robot.RobotInstanceDTO; +import com.hnac.hzinfo.inspect.ai.entity.RobotEntity; import com.hnac.hzinfo.inspect.ai.vo.RemoteControlDTO; import com.hnac.hzinfo.inspect.ai.vo.RobotVO; import com.hnac.hzinfo.inspect.ai.vo.robot.RobotRealDataVO; -import com.hnac.hzinfo.sdk.v5.device.vo.VirtualDeviceDTO; - -import com.hnac.hzinfo.inspect.ai.entity.RobotEntity; import org.springblade.core.mp.support.Query; import java.util.List; diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java index a2b4499..71b87f0 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java @@ -1,46 +1,48 @@ package com.hnac.hzinfo.inspect.ai.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; -import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.inspect.ai.dto.robot.RobotInstanceDTO; +import com.hnac.hzinfo.inspect.ai.entity.RobotEntity; +import com.hnac.hzinfo.inspect.ai.mapper.RobotMapper; +import com.hnac.hzinfo.inspect.ai.service.IRobotService; +import com.hnac.hzinfo.inspect.ai.vo.RemoteControlDTO; import com.hnac.hzinfo.inspect.ai.vo.RobotVO; import com.hnac.hzinfo.inspect.ai.vo.robot.RobotRealDataVO; import com.hnac.hzinfo.inspect.ai.wrapper.RobotWrapper; import com.hnac.hzinfo.inspect.constants.ParamConstants; +import com.hnac.hzinfo.inspect.task.TaskContants; +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import com.hnac.hzinfo.inspect.task.service.ITaskService; import com.hnac.hzinfo.sdk.core.response.Result; +import com.hnac.hzinfo.sdk.v5.control.ControlClient; +import com.hnac.hzinfo.sdk.v5.control.dto.ControlDTO; import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; import com.hnac.hzinfo.sdk.v5.device.po.DeviceRealDataPO; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; import com.hnac.hzinfo.sdk.v5.device.vo.RealDataRedisVO; import com.hnac.hzinfo.sdk.v5.device.vo.VirtualDeviceDTO; +import com.hnac.hzinfo.sdk.v5.project.ProjectClient; +import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.hnac.hzinfo.inspect.ai.entity.RobotEntity; -import com.hnac.hzinfo.inspect.ai.mapper.RobotMapper; -import com.hnac.hzinfo.inspect.ai.service.IRobotService; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.BeanUtil; -import org.springblade.core.tool.utils.Func; -import org.springblade.core.tool.utils.ObjectUtil; -import org.springblade.core.tool.utils.StringUtil; +import org.springblade.core.tool.utils.*; import org.springblade.system.cache.ParamCache; import org.springframework.stereotype.Service; import org.springframework.util.Assert; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.function.Function; +import java.util.*; import java.util.stream.Collectors; /** @@ -54,8 +56,9 @@ import java.util.stream.Collectors; public class RobotServiceImpl extends ServiceImpl implements IRobotService { private final DeviceClient deviceClient; - private final IAnalyseDataSearchClient analyseDataSearchClient; private final DeviceDataClient deviceDataClient; + private final ControlClient controlClient; + private final ProjectClient projectClient; /** * 根据用户id 获取 机器人信息 @@ -75,10 +78,19 @@ public class RobotServiceImpl extends ServiceImpl impl @Override public Boolean generateDeviceInstance(RobotInstanceDTO device) { - if(deviceClient.isDeviceCodeExist(device.getDeviceCode()).isSuccess()) { + // fixme 响应接口变化了 + if("true".equals(deviceClient.isDeviceCodeExist(device.getDeviceCode()).getData())) { throw new ServiceException("该机器人已经创建过设备实例,无需再创建!"); } else { + Result> projectVOResult = projectClient.getProjectIds(Collections.singletonList(device.getStationCode())); + Assert.isTrue(projectVOResult.isSuccess(),() -> { + throw new ServiceException("获取站点信息失败!"); + }); + List projectVOList = projectVOResult.getData(); + if (projectVOList==null||projectVOList.isEmpty()){ + throw new ServiceException("数据平台不存在该站点信息!"); + } String modelSignage = ParamCache.getValue(ParamConstants.ROBOT_MODEL_CODE); device.setModelSignage(Func.isNotEmpty(device.getModelSignage()) ? device.getModelSignage() : modelSignage); VirtualDeviceDTO req = BeanUtil.copy(device, VirtualDeviceDTO.class); @@ -118,6 +130,7 @@ public class RobotServiceImpl extends ServiceImpl impl Optional attrOptional = paramDeviceAttrR.getData().stream().filter(deviceAttr -> k.getValue().getN().equals(deviceAttr.getName())).findFirst(); data.setModelClassifyId(attrOptional.get().getModelClassifyId()); data.setModelClassifyName(attrOptional.get().getModelClassifyName()); + data.setUnits(attrOptional.get().getUnits()); return data; })).collect(Collectors.toList()); return result.stream().collect(Collectors.groupingBy(RobotRealDataVO::getModelClassifyName)); @@ -134,7 +147,7 @@ public class RobotServiceImpl extends ServiceImpl impl Result> deviceSoeDataResult = deviceDataClient.getDeviceSoeData(robot.getStationCode(), 1, robotCode, null, startTime, endTime, true, query.getCurrent(), query.getSize()); Assert.isTrue(deviceSoeDataResult.isSuccess(), () -> { - throw new ServiceException("获取机器人告警信息失败!"); + throw new ServiceException(deviceSoeDataResult.getMsg()); }); Map deviceSoeData = deviceSoeDataResult.getData(); IPage result = Condition.getPage(query); @@ -143,5 +156,31 @@ public class RobotServiceImpl extends ServiceImpl impl return result; } + @Override + public Object remoteControl(RemoteControlDTO dto) { + ControlDTO controlDTO=new ControlDTO(); + BeanUtil.copy(dto,controlDTO); + controlDTO.setProjectId(dto.getStationCode()); + controlDTO.setOperator(String.valueOf(AuthUtil.getUserId())); + Result result = controlClient.sendToDevice(controlDTO); + Assert.isTrue(result.isSuccess(),()->{ + throw new ServiceException("修改遥控失败!"); + }); + + RobotEntity robotEntity = this.getOne(new LambdaQueryWrapper().eq(RobotEntity::getCode, dto.getDeviceCode())); + + //机器人停机任务置为未完成 + List taskStatus = Arrays.asList(TaskContants.TaskStatusEnum.INIT_STATUS.getStatus(), TaskContants.TaskStatusEnum.UNDERWAY_STATUS.getStatus(), TaskContants.TaskStatusEnum.PAUSE_STATUS.getStatus()); + ITaskService taskService = SpringUtil.getBean(ITaskService.class); + List robotTaskEntities=taskService.getListByUserIdAndStatus(robotEntity.getUserId(),taskStatus,DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); + if (!robotTaskEntities.isEmpty()){ + robotTaskEntities.forEach(item->item.setStatus(Integer.valueOf(TaskContants.TaskStatusEnum.UNFINISH_STATUS.getStatus()))); + taskService.saveOrUpdateBatch(robotTaskEntities); + } + return result.getData(); + } + + + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/GenerationReportController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/GenerationReportController.java index b462792..4fad2e9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/GenerationReportController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/controller/GenerationReportController.java @@ -2,8 +2,6 @@ package com.hnac.hzims.operational.report.controller; import com.hnac.hzims.operational.report.service.IGenerationReportService; import com.hnac.hzims.operational.report.vo.GenerationDeviceVo; -import com.hnac.hzims.operational.report.vo.GenerationReportTimeVo; -import com.hnac.hzims.operational.report.vo.GenerationReportVo; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.boot.ctrl.BladeController; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IGenerationReportService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IGenerationReportService.java index ec40e5a..100ae7e 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IGenerationReportService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/IGenerationReportService.java @@ -1,7 +1,6 @@ package com.hnac.hzims.operational.report.service; import com.hnac.hzims.operational.report.vo.GenerationDeviceVo; -import com.hnac.hzims.operational.report.vo.GenerationReportVo; import java.util.List; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationRelationController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationRelationController.java index 0241dbd..2e66edb 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationRelationController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationRelationController.java @@ -84,7 +84,7 @@ public class StationRelationController { wrapper.and(item -> item.eq(StationRelation::getStationCode, stationRelation.getStationCode()) .or().eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode())); wrapper.eq(StationRelation::getIsDeleted, 0); - int count = stationRelationService.count(wrapper); + long count = stationRelationService.count(wrapper); if (count > 0) { return R.fail("站点关联关系已存在"); } @@ -100,7 +100,7 @@ public class StationRelationController { .or().eq(StationRelation::getDeviceCode, stationRelation.getDeviceCode())); wrapper.eq(StationRelation::getIsDeleted, 0); wrapper.ne(StationRelation::getId, stationRelation.getId()); - int count = stationRelationService.count(wrapper); + long count = stationRelationService.count(wrapper); if (count > 0) { return R.fail("站点关联关系已存在"); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java index a4ed69d..c6fed19 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java @@ -1,6 +1,5 @@ package com.hnac.hzims.operational.station.controller; -import cn.hutool.core.collection.CollectionUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -31,7 +30,6 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; - import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; @@ -44,7 +42,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationRelationMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationRelationMapper.java index e08e69e..9274385 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationRelationMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/mapper/StationRelationMapper.java @@ -3,6 +3,9 @@ package com.hnac.hzims.operational.station.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hnac.hzims.operational.station.entity.StationRelation; +/** + * @author ysj + */ public interface StationRelationMapper extends BaseMapper { } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java index 52fb4a4..619386a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java @@ -11,12 +11,8 @@ import com.hnac.hzims.operational.station.response.HikMonitorResp; import com.hnac.hzims.operational.station.vo.HikVideoAreaTreeVO; import com.hnac.hzims.operational.station.vo.StationVideoTypeVO; import com.hnac.hzims.operational.station.vo.VideoMonitorVO; -import org.apache.ibatis.annotations.Param; - import org.springblade.core.mp.support.Query; -import org.springframework.web.bind.annotation.RequestParam; -import java.sql.Wrapper; import java.util.List; import java.util.Map; @@ -78,11 +74,13 @@ public interface IStationVideoTypeService extends IService getWsUrlByPointCode(String pointCodes,String host,String appKey,String appSecret,Integer streamType); - List getHikVideoAreaTree(); - Map getVideoPointByRegion(Long refDept,String regionCode); List stationVideos(StationVideoTypeDTO param); List videoTypes(StationVideoTypeEntity param); + + List getHikVideoAreaTree(Long platformId); + + List getVideoByPointCodes(String pointCodes); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java index ff52d61..61749bc 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java @@ -2,13 +2,13 @@ package com.hnac.hzims.operational.station.service.impl; import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.utils.HiKUtil; import com.hnac.hzims.operational.config.HikPathConfiguration; import com.hnac.hzims.operational.station.StationConstants; @@ -29,8 +29,6 @@ import com.hnac.hzims.operational.station.wrapper.StationVideoTypeWrapper; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -44,7 +42,6 @@ import org.springframework.util.Assert; import javax.servlet.http.HttpServletResponse; import java.util.*; -import java.util.function.Function; import java.util.stream.Collectors; /** @@ -204,7 +201,6 @@ public class StationVideoTypeServiceImpl extends ServiceImpl monitorList = JSONArray.parseArray(response.body(), HikMonitorResp.class); - log.info("HikVideo:monitor:info",JSON.toJSONString(monitorList)); return monitorList.stream().collect(Collectors.groupingBy(HikMonitorResp::getDevice)); } @@ -241,14 +237,15 @@ public class StationVideoTypeServiceImpl extends ServiceImpl getHikVideoAreaTree() { - List hikVideoAreaList = hikVideoService.nodesByParams(null); + public List getHikVideoAreaTree(Long platformId) { + List hikVideoAreaList = hikVideoService.nodesByParams(platformId,null); Map> videoAreaMapByParent = hikVideoAreaList.stream().collect(Collectors.groupingBy(HikVideoAreaVO::getParentIndexCode)); List firstLevelArea = videoAreaMapByParent.get("-1"); List result = firstLevelArea.stream().map(area -> this.generateAreaTree(videoAreaMapByParent, area)).collect(Collectors.toList()); return result; } + @Override public Map getVideoPointByRegion(Long refDept, String regionCode) { LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery().select(StationVideoTypeEntity::getPointCode,StationVideoTypeEntity::getCreateDept).eq(StationVideoTypeEntity::getDeptId, refDept); @@ -372,4 +369,11 @@ public class StationVideoTypeServiceImpl extends ServiceImpl getVideoByPointCodes(String pointCodes) { + List pointCodeList = Func.toStrList(",", pointCodes); + LambdaQueryWrapper qw = Wrappers.lambdaQuery().in(StationVideoTypeEntity::getPointCode, pointCodeList); + return this.list(qw); + } }