diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/dto/EmVideoBandingSaveDTO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/dto/EmVideoBandingSaveDTO.java new file mode 100644 index 0000000..b4a98fb --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/dto/EmVideoBandingSaveDTO.java @@ -0,0 +1,37 @@ +package com.hnac.hzims.equipment.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.validator.constraints.Length; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.util.List; + +@EqualsAndHashCode +@Data +@ApiModel(value = "设备-视频点位绑定关系保存对象",description = "设备-视频点位绑定关系保存对象") +public class EmVideoBandingSaveDTO implements Serializable { + + @ApiModelProperty("设备编号") + @NotBlank + @Length(min = 1,max = 50) + private String emCode; + + @ApiModelProperty("设备名称") + @Length(min = 1,max = 80) + @NotBlank + private String emName; + + @Valid + @ApiModelProperty("视频点位列表") + @NotEmpty + @Size(min = 1) + private List videoList; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/dto/VideoDTO.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/dto/VideoDTO.java new file mode 100644 index 0000000..6f27ae4 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/dto/VideoDTO.java @@ -0,0 +1,39 @@ +package com.hnac.hzims.equipment.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serializable; + +@ApiModel(value = "海康视频点位DTO对象",description = "海康视频点位DTO对象") +@Data +@EqualsAndHashCode +public class VideoDTO implements Serializable { + + @ApiModelProperty("视频设备编码") + @NotBlank + @Length(min = 1,max = 100) + private String pointCode; + + @ApiModelProperty("视频名称") + @NotBlank + private String videoName; + + @ApiModelProperty("视频服务器host") + @NotBlank + private String videoHost; + + @ApiModelProperty("运管中心appSecret") + @NotBlank + private String videoAppSecret; + + @ApiModelProperty("运管中心appKey") + @NotBlank + private String videoAppKey; + +} diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmVideoBandingEntity.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmVideoBandingEntity.java new file mode 100644 index 0000000..60eb027 --- /dev/null +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmVideoBandingEntity.java @@ -0,0 +1,44 @@ +package com.hnac.hzims.equipment.entity; + + +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.mp.support.QueryField; +import org.springblade.core.mp.support.SqlCondition; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.io.Serializable; + +@ApiModel("设备视频绑定关系实体类") +@Data +@EqualsAndHashCode +@TableName("hzims_em_video_banding") +public class EmVideoBandingEntity extends TenantEntity implements Serializable { + + @ApiModelProperty("设备编号") + @QueryField(condition = SqlCondition.EQUAL) + private String emCode; + + @ApiModelProperty("设备名称") + private String emName; + + @ApiModelProperty("视频设备编码") + private String pointCode; + + @ApiModelProperty("视频名称") + @QueryField(condition = SqlCondition.LIKE) + private String videoName; + + @ApiModelProperty("视频服务器host") + private String videoHost; + + @ApiModelProperty("运管中心appSecret") + private String videoAppSecret; + + @ApiModelProperty("运管中心appKey") + private String videoAppKey; + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmVideoBandingController.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmVideoBandingController.java new file mode 100644 index 0000000..335b2d0 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmVideoBandingController.java @@ -0,0 +1,53 @@ +package com.hnac.hzims.equipment.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.common.utils.Condition; +import com.hnac.hzims.equipment.dto.EmVideoBandingSaveDTO; +import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; +import com.hnac.hzims.equipment.service.IEmVideoBandingService; +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.tool.api.R; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import java.util.List; + +@RestController +@RequestMapping("/em/video") +@Api(value = "设备视频绑定关系管理",tags = "设备视频绑定关系管理") +@AllArgsConstructor +@Validated +public class EmVideoBandingController extends BladeController { + private final IEmVideoBandingService emVideoBandingService; + + @GetMapping("/getListByEmCode") + @ApiOperation("根据设备编号获取绑定的视频点位列表") + @ApiOperationSupport(order = 1) + public R> getListByEmCode(@RequestParam @ApiParam(value = "设备编号",required = true) @NotBlank String emCode) { + LambdaQueryWrapper wq = Wrappers.lambdaQuery().eq(EmVideoBandingEntity::getEmCode, emCode); + return R.data(emVideoBandingService.list(wq)); + } + + @PostMapping("/banding") + @ApiOperation("设备绑定视频点位") + @ApiOperationSupport(order = 2) + public R banding(@Valid @RequestBody EmVideoBandingSaveDTO req) { + return R.status(emVideoBandingService.banding(req)); + } + + @DeleteMapping("/removeByEmCode") + @ApiOperation("删除设备编号下的绑定视频设备") + @ApiOperationSupport(order = 3) + public R removeByEmCode(@RequestParam @ApiParam(value = "设备编号",required = true) @NotBlank String emCode) { + return R.status(emVideoBandingService.removeByEmCode(emCode)); + } + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmVideoBandingMapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmVideoBandingMapper.java new file mode 100644 index 0000000..a7616db --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmVideoBandingMapper.java @@ -0,0 +1,8 @@ +package com.hnac.hzims.equipment.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; + +public interface EmVideoBandingMapper extends BaseMapper { + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmVideoBandingService.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmVideoBandingService.java new file mode 100644 index 0000000..3522ab7 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmVideoBandingService.java @@ -0,0 +1,27 @@ +package com.hnac.hzims.equipment.service; + +import com.hnac.hzims.equipment.dto.EmVideoBandingSaveDTO; +import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; +import io.swagger.annotations.ApiParam; +import org.springblade.core.mp.base.BaseService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +public interface IEmVideoBandingService extends BaseService { + + /** + * 设备绑定视频点位 + * @param req 绑定请求数据 + * @return 绑定结果 + */ + Boolean banding(EmVideoBandingSaveDTO req); + + /** + * 删除设备编号下的绑定视频设备 + * @param emCode 设备编号 + * @return 删除结果 + */ + Boolean removeByEmCode(String emCode); + +} diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmVideoBandingServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmVideoBandingServiceImpl.java new file mode 100644 index 0000000..bdc92f5 --- /dev/null +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmVideoBandingServiceImpl.java @@ -0,0 +1,52 @@ +package com.hnac.hzims.equipment.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.equipment.dto.EmVideoBandingSaveDTO; +import com.hnac.hzims.equipment.dto.VideoDTO; +import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; +import com.hnac.hzims.equipment.mapper.EmVideoBandingMapper; +import com.hnac.hzims.equipment.service.IEmVideoBandingService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.tool.utils.BeanUtil; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +@Service +@AllArgsConstructor +@Slf4j +public class EmVideoBandingServiceImpl extends BaseServiceImpl implements IEmVideoBandingService { + + @Override + @Transactional + public Boolean banding(EmVideoBandingSaveDTO req) { + List videoList = req.getVideoList(); + // 删除掉所有点位 + LambdaQueryWrapper removeQuery = Wrappers.lambdaQuery() + .eq(EmVideoBandingEntity::getEmCode, req.getEmCode()); + this.remove(removeQuery); + List saveBandingList = videoList.stream().map(video -> { + EmVideoBandingEntity banding = BeanUtil.copy(video, EmVideoBandingEntity.class); + banding.setEmCode(req.getEmCode()); + banding.setEmName(req.getEmName()); + return banding; + }).collect(Collectors.toList()); + return this.saveBatch(saveBandingList); + } + + @Override + public Boolean removeByEmCode(String emCode) { + Map params = new HashMap() {{ + put("emCode", emCode); + }}; + QueryWrapper queryWrapper = Condition.getQueryWrapper(params, EmVideoBandingEntity.class); + return this.remove(queryWrapper); + } +} diff --git a/hzims-service/equipment/src/main/resources/db/1.0.1.sql b/hzims-service/equipment/src/main/resources/db/1.0.1.sql index 1f41725..e6d4742 100644 --- a/hzims-service/equipment/src/main/resources/db/1.0.1.sql +++ b/hzims-service/equipment/src/main/resources/db/1.0.1.sql @@ -48,3 +48,25 @@ CREATE TABLE `hzims_param_backups_detail` ( alter table `HZIMS_PARAM_BACKUPS_DETAIL` add COLUMN `KEEP_FIGURES` INT(11) COMMENT '小数点位数'; alter table `HZIMS_PARAM_BACKUPS_DETAIL` add COLUMN `DESCS` VARCHAR(255) COMMENT '描述'; +-- 设备视频绑定关系表 +CREATE TABLE `hzims_em_video_banding` ( + `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `EM_CODE` varchar(50) NOT NULL COMMENT '设备编号', + `EM_NAME` varchar(80) NOT NULL COMMENT '设备名称', + `POINT_CODE` varchar(100) NOT NULL COMMENT '视频设备编码', + `VIDEO_NAME` varchar(255) NOT NULL COMMENT '视频名称', + `VIDEO_HOST` varchar(100) NOT NULL COMMENT '视频服务器host', + `VIDEO_APP_SECRET` varchar(100) NOT NULL COMMENT '运管中心appSecret', + `VIDEO_APP_KEY` varchar(100) NOT NULL COMMENT '运管中心appKey', + `TENANT_ID` varchar(12) NOT NULL COMMENT '租户ID', + `CREATE_DEPT` bigint(20) DEFAULT NULL COMMENT '创建单位', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_USER` bigint(20) DEFAULT NULL COMMENT '修改人', + `UPDATE_TIME` datetime DEFAULT NULL COMMENT '修改时间', + `STATUS` tinyint(4) DEFAULT NULL COMMENT '业务状态', + `IS_DELETED` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除 0-正常 1-删除', + `DURATION` mediumint(9) DEFAULT NULL COMMENT '多长时间内的推送', + `TIME_UNIT` varchar(50) DEFAULT NULL COMMENT '时间单位', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1533708371949543427 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index 06ca26c..a00ca41 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -6,14 +6,18 @@ import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.config.vo.AlarmHandleMarkVo; +import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import java.util.List; +import java.util.stream.Collectors; /** * @author ysj @@ -38,13 +42,12 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { */ @Override public Boolean save(List alarms) { - - /*// 步骤1.查询告警数据对应站点 + // 步骤1.查询告警数据对应站点 R> result = stationClient.querySatationByCodes(alarms.stream().map(AlarmEntity::getStationId).collect(Collectors.toList())); if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ log.error("alarm query station is null : {}",alarms.stream().map(AlarmEntity::getAlarmId).collect(Collectors.toList())); return false; - }*/ + } // 步骤2.遍历保存告警数据 alarms.forEach(alarm->{ diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java index ebfbd6e..2f59dc8 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java @@ -167,7 +167,12 @@ public class MessageClient extends BladeController implements IMessageClient{ }).collect(Collectors.toList()); boolean saveResult = recordService.saveBatch(pushRecords); if(saveResult) { - return R.status(recordService.sendMailMsgByUsers(pushRecords)); + List appRecords = pushRecords.stream().filter(record -> MessageConstants.APP_PUSH.equals(record.getType())).collect(Collectors.toList()); + // 推送消息 - app + Boolean appFlag = recordService.sendAppMsgByUsers(request, appRecords); + // 推送消息 - web + Boolean wsFlag = recordService.sendWsMsgByUsers(new ArrayList<>(CollectionUtils.subtract(pushRecords, appRecords))); + return R.data(appFlag && wsFlag); } else { return R.data(false); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/ConstructionController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/ConstructionController.java index d8f3950..99bbf37 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/ConstructionController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/controller/ConstructionController.java @@ -72,7 +72,7 @@ public class ConstructionController extends BladeController { public R> list(ConstructionVo construction, Query query) { return R.data(service.pageCondition(Condition.getPage(query), construction)); } - + @GetMapping("/preview") @ApiOperationSupport(order = 6) @ApiOperation(value = "检修施工日志预览", notes = "检修施工日志预览") diff --git a/hzims-service/safeproduct/src/main/resources/db/1.0.2.sql b/hzims-service/safeproduct/src/main/resources/db/1.0.2.sql index 8d9b1b0..56158cc 100644 --- a/hzims-service/safeproduct/src/main/resources/db/1.0.2.sql +++ b/hzims-service/safeproduct/src/main/resources/db/1.0.2.sql @@ -583,4 +583,6 @@ INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_ INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1812297688044677147, 1810401848933404671, 'hazard_type', '6', '环境类', 6, NULL, 0, 0, 1, -1, 'hzims_safeproduct'); INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1812414874722367716, 1810414848933404673, 'hazard_station_type', '3', '水电站', 3, NULL, 0, 0, 1, -1, 'hzims_safeproduct'); INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1812414974824267715, 1810414848933404673, 'hazard_station_type', '2', '闸门', 1, NULL, 0, 0, 1, -1, 'hzims_safeproduct'); -INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1812414974824467714, 1810414848933404673, 'hazard_station_type', '1', '水库', 2, NULL, 0, 0, 1, -1, 'hzims_safeproduct'); \ No newline at end of file +INSERT INTO `bladex`.`blade_dict` (`id`, `parent_id`, `code`, `dict_key`, `dict_value`, `sort`, `remark`, `is_sealed`, `is_deleted`, `dict_type`, `app_id`, `app_code`) VALUES (1812414974824467714, 1810414848933404673, 'hazard_station_type', '1', '水库', 2, NULL, 0, 0, 1, -1, 'hzims_safeproduct'); + +alter table `hzims_inner_danger_info` add COLUMN `task_id` VARCHAR(100) comment '平台任务Id'; \ No newline at end of file