Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
ty 12 months ago
parent
commit
aaa2d748e2
  1. 37
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/dto/EmVideoBandingSaveDTO.java
  2. 39
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/dto/VideoDTO.java
  3. 44
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/entity/EmVideoBandingEntity.java
  4. 53
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/controller/EmVideoBandingController.java
  5. 8
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/EmVideoBandingMapper.java
  6. 27
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IEmVideoBandingService.java
  7. 52
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmVideoBandingServiceImpl.java
  8. 22
      hzims-service/equipment/src/main/resources/db/1.0.1.sql
  9. 9
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java
  10. 7
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
  11. 2
      hzims-service/safeproduct/src/main/resources/db/1.0.2.sql

37
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<VideoDTO> videoList;
}

39
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;
}

44
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;
}

53
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<List<EmVideoBandingEntity>> getListByEmCode(@RequestParam @ApiParam(value = "设备编号",required = true) @NotBlank String emCode) {
LambdaQueryWrapper<EmVideoBandingEntity> wq = Wrappers.<EmVideoBandingEntity>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));
}
}

8
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<EmVideoBandingEntity> {
}

27
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<EmVideoBandingEntity> {
/**
* 设备绑定视频点位
* @param req 绑定请求数据
* @return 绑定结果
*/
Boolean banding(EmVideoBandingSaveDTO req);
/**
* 删除设备编号下的绑定视频设备
* @param emCode 设备编号
* @return 删除结果
*/
Boolean removeByEmCode(String emCode);
}

52
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<EmVideoBandingMapper, EmVideoBandingEntity> implements IEmVideoBandingService {
@Override
@Transactional
public Boolean banding(EmVideoBandingSaveDTO req) {
List<VideoDTO> videoList = req.getVideoList();
// 删除掉所有点位
LambdaQueryWrapper<EmVideoBandingEntity> removeQuery = Wrappers.<EmVideoBandingEntity>lambdaQuery()
.eq(EmVideoBandingEntity::getEmCode, req.getEmCode());
this.remove(removeQuery);
List<EmVideoBandingEntity> 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<String, Object> params = new HashMap<String, Object>() {{
put("emCode", emCode);
}};
QueryWrapper<EmVideoBandingEntity> queryWrapper = Condition.getQueryWrapper(params, EmVideoBandingEntity.class);
return this.remove(queryWrapper);
}
}

22
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;

9
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<AlarmEntity> alarms) {
/*// 步骤1.查询告警数据对应站点
// 步骤1.查询告警数据对应站点
R<List<StationEntity>> 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->{

7
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<MessagePushRecordEntity> 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);

2
hzims-service/safeproduct/src/main/resources/db/1.0.2.sql

@ -584,3 +584,5 @@ 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 (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');
alter table `hzims_inner_danger_info` add COLUMN `task_id` VARCHAR(100) comment '平台任务Id';
Loading…
Cancel
Save