Browse Source

遂昌版本替换

遂昌项目
liangfan 6 months ago
parent
commit
72e3562fba
  1. 1
      hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/util/ConvertUtil.java
  2. 10
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java
  3. 10
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java
  4. 3
      hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/MessageTypeEnum.java
  5. 3
      hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/TemplateTypeEnum.java
  6. 6
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/BaseInfoApplication.java
  7. 28
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StZvarlBController.java
  8. 2
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/feign/BaseInfoClient.java
  9. 4
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StZvarlBMapper.java
  10. 3
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/StZvarlBService.java
  11. 1
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/PreviewInfoServiceImpl.java
  12. 3
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/ReservoirDataServiceImpl.java
  13. 6
      hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StZvarlBServiceImpl.java
  14. 34
      hzims-service/base-info/src/main/resources/application-dev.yml
  15. 52
      hzims-service/base-info/src/main/resources/application-prod.yml
  16. 8
      hzims-service/base-info/src/main/resources/application.yml
  17. 2
      hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/service/impl/DamSafetyDataServiceImpl.java
  18. 2
      hzims-service/digital-twin-display/src/main/resources/application-dev.yml
  19. 31
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java
  20. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmOreanizationClient.java
  21. 6
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/MessageAlarmCenterApplication.java
  22. 5
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/MessageReceiveInfoController.java
  23. 14
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/PlanParamInfoController.java
  24. 3
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.java
  25. 12
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.xml
  26. 8
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/MessageReceiveInfoMapper.xml
  27. 7
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/IMessageStrategyService.java
  28. 52
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/impl/MessageStrategyServiceImpl.java
  29. 227
      hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/xxljob/MessageMonitorObjJob.java
  30. 2
      hzims-service/message-alarm-service/src/main/resources/application-dev.yml
  31. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/huosan/service/impl/HuoSanTargetServiceImpl.java
  32. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  33. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalEarlyWarningServiceImpl.java
  34. 62
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalServiceImpl.java
  35. 19
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  36. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java
  37. 75
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/ArtemisPostUtils.java
  38. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/CustomCellWriteHandle.java
  39. 2
      hzims-service/safeproduct/src/main/resources/application-dev.yml
  40. 4
      hzims-service/video-image/pom.xml
  41. 15
      hzims-service/video-image/src/main/java/com/hnac/hzims/videoimage/utils/ArtemisPostUtils.java
  42. 2
      hzims-service/water-quality/src/main/resources/application-dev.yml
  43. 2
      hzims-service/water-rain/src/main/resources/application-dev.yml
  44. 2
      hzims-service/weather/src/main/resources/application-dev.yml

1
hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/util/ConvertUtil.java

@ -8,7 +8,6 @@ public class ConvertUtil {
static { static {
convertMap.put("ph","PH"); convertMap.put("ph","PH");
convertMap.put("has","高锰酸盐指数"); convertMap.put("has","高锰酸盐指数");
convertMap.put("dox","溶解氧");
convertMap.put("cu","铜"); convertMap.put("cu","铜");
convertMap.put("zn","锌"); convertMap.put("zn","锌");
convertMap.put("se","硒"); convertMap.put("se","硒");

10
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java

@ -87,7 +87,7 @@ public interface IEmInfoClient {
String GET_STRUCT_TREE_BY_STATION = API_PREFIX + "/getStructTreeByStation"; String GET_STRUCT_TREE_BY_STATION = API_PREFIX + "/getStructTreeByStation";
String DEVICE_BY_TYPE = API_PREFIX + "/deviceByType"; String DEVICE_BY_TYPE = API_PREFIX + "/deviceByTyep";
@PostMapping(DETAIL) @PostMapping(DETAIL)
EmInfoEntity getByCode(@RequestParam("code") String id); EmInfoEntity getByCode(@RequestParam("code") String id);
@ -101,14 +101,6 @@ public interface IEmInfoClient {
@GetMapping(LIST_BY_DEPT_ID) @GetMapping(LIST_BY_DEPT_ID)
List<EmInfoEntity> list(); List<EmInfoEntity> list();
String listByRefOreanization = API_PREFIX + "/listByRefOreanization";
@GetMapping(listByRefOreanization)
R<List<EmInfoEntity>> listByRefOreanization(Long refOreanization);
String getByEquipmentId = API_PREFIX + "/getByEquipmentId";
@GetMapping(getByEquipmentId)
EmInfoVO getByEquipmentId(Long id);
/** /**
* 根据机构ID获取设备Code * 根据机构ID获取设备Code
* *

10
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java

@ -36,16 +36,6 @@ public class IEmInfoClientBack implements IEmInfoClient {
} }
@Override @Override
public R<List<EmInfoEntity>> listByRefOreanization(Long refOreanization) {
return null;
}
@Override
public EmInfoVO getByEquipmentId(Long id) {
return null;
}
@Override
public R<List<String>> getEmCodeByDeptId(Long deptId) { public R<List<String>> getEmCodeByDeptId(Long deptId) {
return R.data(new ArrayList<>()); return R.data(new ArrayList<>());
} }

3
hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/MessageTypeEnum.java

@ -2,7 +2,8 @@ package com.hnac.hzims.message_alarm.enums;
//消息类型 //消息类型
public enum MessageTypeEnum { public enum MessageTypeEnum {
NOTIFY("notify","通知消息"), NOTIFY("notify","通知消息"),
ALARM("alarm","告警消息"); ALARM("alarm","告警消息"),
FLOW_WARN("flowWarn","流量告警消息");
String code; String code;
String name; String name;

3
hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/TemplateTypeEnum.java

@ -4,7 +4,8 @@ public enum TemplateTypeEnum {
REPORT("report","通知消息"), REPORT("report","通知消息"),
NOTIFY("notify","通知消息"), NOTIFY("notify","通知消息"),
SOE("soe","设备soe"), SOE("soe","设备soe"),
ALARM("alarm","告警消息"); ALARM("alarm","告警消息"),
FLOW_WARN("flowWarn","生态流量告警消息");
String code; String code;
String name; String name;

6
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/BaseInfoApplication.java

@ -18,6 +18,12 @@ import org.springframework.scheduling.annotation.EnableScheduling;
public class BaseInfoApplication extends SpringBootServletInitializer { public class BaseInfoApplication extends SpringBootServletInitializer {
public final static String APP_NAME = "base-info"; public final static String APP_NAME = "base-info";
// static {
// System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://43.139.178.151:8848");
// System.setProperty("spring.cloud.nacos.config.server-addr", "http://43.139.178.151:8848");
// System.setProperty("spring.cloud.nacos.username", "nacos");
// System.setProperty("spring.cloud.nacos.password", "nacos");
// }
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(APP_NAME, BaseInfoApplication.class, args); BladeApplication.run(APP_NAME, BaseInfoApplication.class, args);

28
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StZvarlBController.java

@ -1,18 +1,21 @@
package com.hnac.hzims.baseinfo.controller; package com.hnac.hzims.baseinfo.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.baseinfo.entity.StZvarlB; import com.hnac.hzims.baseinfo.entity.StZvarlB;
import com.hnac.hzims.baseinfo.service.StZvarlBService; import com.hnac.hzims.baseinfo.service.StZvarlBService;
import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.common.utils.Condition;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@RestController @RestController
@Api(description = "库(湖)容曲线控制器") @Api(description = "库(湖)容曲线控制器")
@ -22,6 +25,25 @@ public class StZvarlBController {
@Autowired @Autowired
private StZvarlBService stZvarlBService; private StZvarlBService stZvarlBService;
/**
* 列表
*/
@GetMapping("/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "rscd", value = "库(湖)编码", paramType = "query", dataType = "string")
})
@ApiOperationSupport(order = 2)
@ApiOperation(value = "列表", notes = "传入stZvarlB")
public R<List<StZvarlB>> list(@ApiIgnore @RequestParam Map<String, Object> param) {
LambdaQueryWrapper<StZvarlB> wrapper = new LambdaQueryWrapper();
if (param.get("stcd") != null) {
wrapper.like(StZvarlB::getStcd, param.get("stcd"));
}
wrapper.orderByAsc(StZvarlB::getPtno);
List<StZvarlB> list = stZvarlBService.list(wrapper);
return R.data(list);
}
@ApiOperation(notes = "获取库(湖)容曲线列表数据接口", value = "获取库(湖)容曲线列表数据接口") @ApiOperation(notes = "获取库(湖)容曲线列表数据接口", value = "获取库(湖)容曲线列表数据接口")
@RequestMapping(value = "bindStZvarlBs", method = RequestMethod.GET) @RequestMapping(value = "bindStZvarlBs", method = RequestMethod.GET)

2
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/feign/BaseInfoClient.java

@ -72,13 +72,11 @@ public class BaseInfoClient implements IBaseInfoClient {
return R.data(stZvarlBService.getStZvarlBs(stcd)); return R.data(stZvarlBService.getStZvarlBs(stcd));
} }
@Override
public void savePreviewInfo(PreviewInfo previewInfo) { public void savePreviewInfo(PreviewInfo previewInfo) {
log.info("===previewInfo==={}", previewInfo); log.info("===previewInfo==={}", previewInfo);
previewInfoService.save(previewInfo); previewInfoService.save(previewInfo);
} }
@Override
public R<List<Map<String,String>>> getHistoryDataBySignage(String stcd, Date start, Date end, String type, String col){ public R<List<Map<String,String>>> getHistoryDataBySignage(String stcd, Date start, Date end, String type, String col){
return R.data(reservoirDataService.getHistoryDataBySignage(stcd,start,end,type,col)); return R.data(reservoirDataService.getHistoryDataBySignage(stcd,start,end,type,col));
} }

4
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StZvarlBMapper.java

@ -1,12 +1,14 @@
package com.hnac.hzims.baseinfo.mapper; package com.hnac.hzims.baseinfo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.baseinfo.entity.StZvarlB; import com.hnac.hzims.baseinfo.entity.StZvarlB;
import com.hnac.hzims.baseinfo.entity.StZvarlBExample; import com.hnac.hzims.baseinfo.entity.StZvarlBExample;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface StZvarlBMapper { public interface StZvarlBMapper extends BaseMapper<StZvarlB> {
int deleteByPrimaryKey(Integer id); int deleteByPrimaryKey(Integer id);
int insert(StZvarlB record); int insert(StZvarlB record);

3
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/StZvarlBService.java

@ -1,5 +1,6 @@
package com.hnac.hzims.baseinfo.service; package com.hnac.hzims.baseinfo.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.baseinfo.entity.StZvarlB; import com.hnac.hzims.baseinfo.entity.StZvarlB;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -10,6 +11,8 @@ import java.util.List;
public interface StZvarlBService { public interface StZvarlBService {
List<StZvarlB> list(LambdaQueryWrapper<StZvarlB> wrapper);
IPage<StZvarlB> bindStZvarlBs(String stcd, IPage<StZvarlB> page); IPage<StZvarlB> bindStZvarlBs(String stcd, IPage<StZvarlB> page);
R addOrEditStZvarlB(StZvarlB stZvarlB); R addOrEditStZvarlB(StZvarlB stZvarlB);

1
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/PreviewInfoServiceImpl.java

@ -37,7 +37,6 @@ public class PreviewInfoServiceImpl extends ServiceImpl<PreviewInfoMapper, Previ
queryWrapper.eq(StringUtils.isNotBlank(stcd), "a.stcd", stcd); queryWrapper.eq(StringUtils.isNotBlank(stcd), "a.stcd", stcd);
queryWrapper.ge(StringUtils.isNotBlank(createTimeS), "a.create_time", createTimeS); queryWrapper.ge(StringUtils.isNotBlank(createTimeS), "a.create_time", createTimeS);
queryWrapper.le(StringUtils.isNotBlank(createTimeE), "a.create_time", createTimeE); queryWrapper.le(StringUtils.isNotBlank(createTimeE), "a.create_time", createTimeE);
queryWrapper.orderByDesc("a.create_time");
IPage<PreviewInfo> previewInfosPage = previewInfoMapper.queryList(pageParam,queryWrapper); IPage<PreviewInfo> previewInfosPage = previewInfoMapper.queryList(pageParam,queryWrapper);
List<PreviewInfo> previewInfos = previewInfosPage.getRecords(); List<PreviewInfo> previewInfos = previewInfosPage.getRecords();
if (CollectionUtils.isNotEmpty(previewInfos)) { if (CollectionUtils.isNotEmpty(previewInfos)) {

3
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/ReservoirDataServiceImpl.java

@ -73,9 +73,6 @@ public class ReservoirDataServiceImpl implements IReservoirDataService {
} }
po.setSignages(signages); po.setSignages(signages);
Result<List<FieldsData>> result=realDataSearchClient.getRealDataByDeviceCode(po); Result<List<FieldsData>> result=realDataSearchClient.getRealDataByDeviceCode(po);
if(result==null || !result.isSuccess()){
return null;
}
return result.getData(); return result.getData();
} }

6
hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StZvarlBServiceImpl.java

@ -1,7 +1,9 @@
package com.hnac.hzims.baseinfo.service.impl; package com.hnac.hzims.baseinfo.service.impl;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.baseinfo.entity.StZvarlB; import com.hnac.hzims.baseinfo.entity.StZvarlB;
import com.hnac.hzims.baseinfo.mapper.StZvarlBMapper; import com.hnac.hzims.baseinfo.mapper.StZvarlBMapper;
import com.hnac.hzims.baseinfo.service.StZvarlBService; import com.hnac.hzims.baseinfo.service.StZvarlBService;
@ -21,6 +23,10 @@ public class StZvarlBServiceImpl implements StZvarlBService {
@Override @Override
public List<StZvarlB> list(LambdaQueryWrapper<StZvarlB> wrapper) {
return stZvarlBMapper.selectList(wrapper);
}
@Override
public IPage<StZvarlB> bindStZvarlBs(String stcd, IPage<StZvarlB> page) { public IPage<StZvarlB> bindStZvarlBs(String stcd, IPage<StZvarlB> page) {
IPage<StZvarlB> records = stZvarlBMapper.selectByStcd(stcd, page); IPage<StZvarlB> records = stZvarlBMapper.selectByStcd(stcd, page);
return records; return records;

34
hzims-service/base-info/src/main/resources/application-dev.yml

@ -1,4 +1,30 @@
#服务器端口 ##服务器端口
server: #server:
port: 8203 # port: 8200
#
##数据源配置
##spring:
## datasource:
## url: ${blade.datasource.dev.url}
## username: ${blade.datasource.dev.username}
## password: ${blade.datasource.dev.password}
#
#spring:
# #排除DruidDataSourceAutoConfigure
# autoconfigure:
# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
# datasource:
# dynamic:
# #设置默认的数据源或者数据源组,默认值即为master
# primary: master
# datasource:
# master:
# url: jdbc:mysql://127.0.0.1:3306/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
# username: root
# password: 123456
# slave:
# url: jdbc:mysql://127.0.0.1:3306/equipment?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
# username: root
# password: 123456
#demo:
# name: aaa

52
hzims-service/base-info/src/main/resources/application-prod.yml

@ -1,28 +1,28 @@
#服务器端口 ##服务器端口
server: #server:
port: 8200 # port: 8200
#
#数据源配置 ##数据源配置
##spring:
## datasource:
## url: ${blade.datasource.prod.url}
## username: ${blade.datasource.prod.username}
## password: ${blade.datasource.prod.password}
#
#spring: #spring:
# #排除DruidDataSourceAutoConfigure
# autoconfigure:
# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
# datasource: # datasource:
# url: ${blade.datasource.prod.url} # dynamic:
# username: ${blade.datasource.prod.username} # #设置默认的数据源或者数据源组,默认值即为master
# password: ${blade.datasource.prod.password} # primary: master
# datasource:
spring: # master:
#排除DruidDataSourceAutoConfigure # url: ${blade.datasource.demo.master.url}
autoconfigure: # username: ${blade.datasource.demo.master.username}
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # password: ${blade.datasource.demo.master.password}
datasource: # slave:
dynamic: # url: ${blade.datasource.demo.slave.url}
#设置默认的数据源或者数据源组,默认值即为master # username: ${blade.datasource.demo.slave.username}
primary: master # password: ${blade.datasource.demo.slave.password}
datasource:
master:
url: ${blade.datasource.demo.master.url}
username: ${blade.datasource.demo.master.username}
password: ${blade.datasource.demo.master.password}
slave:
url: ${blade.datasource.demo.slave.url}
username: ${blade.datasource.demo.slave.username}
password: ${blade.datasource.demo.slave.password}

8
hzims-service/base-info/src/main/resources/application.yml

@ -1,3 +1,11 @@
spring:
profiles:
active: dev
# datasource:
# url: jdbc:mysql://175.6.40.67:50311/blade_huoshan_business?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
# username: root
# password: 123
# driver-class-name: com.mysql.jdbc.Driver
#mybatis-plus配置 #mybatis-plus配置
mybatis-plus: mybatis-plus:
mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml

2
hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/service/impl/DamSafetyDataServiceImpl.java

@ -812,7 +812,7 @@ public class DamSafetyDataServiceImpl implements IDamSafetyDataService {
AnalyseCodeByAnalyseDataPO analyse = this.analyseParam(device,hydrograph.getAccessRules(),signages.stream().map(AnalyzeInstanceFieldVO::getSignage).collect(Collectors.toList()), hydrograph.getBeginTime(),hydrograph.getEndTime(),hydrograph.getDateType()); AnalyseCodeByAnalyseDataPO analyse = this.analyseParam(device,hydrograph.getAccessRules(),signages.stream().map(AnalyzeInstanceFieldVO::getSignage).collect(Collectors.toList()), hydrograph.getBeginTime(),hydrograph.getEndTime(),hydrograph.getDateType());
// 调用降维接口 // 调用降维接口
Result<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(analyse); Result<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(analyse);
if(result ==null || !result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
continue; continue;
} }
// 结构数据转换 // 结构数据转换

2
hzims-service/digital-twin-display/src/main/resources/application-dev.yml

@ -1,6 +1,6 @@
#服务器端口 #服务器端口
server: server:
port: 8206 port: 8200
#数据源配置 #数据源配置
#spring: #spring:

31
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java

@ -30,11 +30,11 @@ import java.util.stream.Collectors;
@RestController @RestController
public class EmInfoClient implements IEmInfoClient { public class EmInfoClient implements IEmInfoClient {
@Autowired @Autowired
IEmInfoService service; private IEmInfoService service;
@Autowired @Autowired
IEmParamService paramService; private IEmParamService paramService;
@Autowired @Autowired
IEmAttachService attachService; private IEmAttachService attachService;
@RequestMapping(value = DETAIL) @RequestMapping(value = DETAIL)
@ -67,31 +67,6 @@ public class EmInfoClient implements IEmInfoClient {
return service.list(); return service.list();
} }
@Override
public R<List<EmInfoEntity>> listByRefOreanization(Long refOreanization) {
return R.data(service.list(new LambdaQueryWrapper<EmInfoEntity>() {{
eq(EmInfoEntity::getRefOreanization, refOreanization);
}}));
}
@Override
public EmInfoVO getByEquipmentId(Long id) {
EmInfoVO vo=new EmInfoVO();
vo.setInfo(service.getById(id));
LambdaQueryWrapper<EmInfoEntity> wrapper=new LambdaQueryWrapper<>();
wrapper.eq(EmInfoEntity::getGpid,id);
List<EmInfoEntity> child=service.list(wrapper);
vo.setChildren(child);
LambdaQueryWrapper<EmAttachEntity> wrapper1=new LambdaQueryWrapper<>();
wrapper1.eq(EmAttachEntity::getEmId,id);
vo.setAttachs(attachService.list(wrapper1));
LambdaQueryWrapper<EmParamEntity> wrapper2=new LambdaQueryWrapper<>();
wrapper2.eq(EmParamEntity::getInfoId,id);
vo.setParams(paramService.list(wrapper2));
return vo;
}
@GetMapping(value = GET_EM_CODE_BY_DEPT_ID) @GetMapping(value = GET_EM_CODE_BY_DEPT_ID)
@Override @Override
public R<List<String>> getEmCodeByDeptId(Long deptId) { public R<List<String>> getEmCodeByDeptId(Long deptId) {

4
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmOreanizationClient.java

@ -2,7 +2,7 @@ package com.hnac.hzims.equipment.feign;
import com.hnac.hzims.equipment.entity.EmOreanizationEntity; import com.hnac.hzims.equipment.entity.EmOreanizationEntity;
import com.hnac.hzims.equipment.entity.EmTreeNode; import com.hnac.hzims.equipment.entity.EmTreeNode;
import com.hnac.hzims.equipment.service.IEmOrganizationService; import com.hnac.hzims.equipment.service.IEmOreanizationService;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -26,7 +26,7 @@ import java.util.List;
@Slf4j @Slf4j
public class EmOreanizationClient implements IEmOreanizationClient { public class EmOreanizationClient implements IEmOreanizationClient {
private final IEmOrganizationService em_oreanizationService; private final IEmOreanizationService em_oreanizationService;
@Override @Override
@GetMapping(INIT_LOAD) @GetMapping(INIT_LOAD)

6
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/MessageAlarmCenterApplication.java

@ -16,6 +16,12 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@ComponentScan(basePackages = {"com.hnac.hzims.*"}) @ComponentScan(basePackages = {"com.hnac.hzims.*"})
public class MessageAlarmCenterApplication extends SpringBootServletInitializer { public class MessageAlarmCenterApplication extends SpringBootServletInitializer {
static String APP_NAME="message-alarm-center"; static String APP_NAME="message-alarm-center";
// static {
// System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://43.139.178.151:8848");
// System.setProperty("spring.cloud.nacos.config.server-addr", "http://43.139.178.151:8848");
// System.setProperty("spring.cloud.nacos.username", "nacos");
// System.setProperty("spring.cloud.nacos.password", "nacos");
// }
public static void main(String[] args) { public static void main(String[] args) {
// System.setProperty("nacos.standalone", "true"); // System.setProperty("nacos.standalone", "true");
BladeApplication.run(APP_NAME, MessageAlarmCenterApplication.class, args); BladeApplication.run(APP_NAME, MessageAlarmCenterApplication.class, args);

5
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/MessageReceiveInfoController.java

@ -21,6 +21,7 @@ import com.hnac.hzims.message_alarm.util.ParamUtil;
import com.hnac.hzims.message_alarm.vo.MessageReceiveAlarmInfoVo; import com.hnac.hzims.message_alarm.vo.MessageReceiveAlarmInfoVo;
import com.hnac.hzims.message_alarm.vo.MessageReceiveNotifyInfoVo; import com.hnac.hzims.message_alarm.vo.MessageReceiveNotifyInfoVo;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
@ -78,7 +79,9 @@ public class MessageReceiveInfoController extends BladeController implements Cac
param = new HashMap<>(); param = new HashMap<>();
} }
param.put("userId",AuthUtil.getUserId()); param.put("userId",AuthUtil.getUserId());
param.put("messageType", MessageTypeEnum.ALARM.getCode()); if (param.get("messageType") == null || "".equals(param.get("messageType"))) {
param.put("messageType", MessageTypeEnum.ALARM.getCode() + "," + MessageTypeEnum.FLOW_WARN.getCode());
}
if(param.get("title")!=null && !"".equals(param.get("title"))){ if(param.get("title")!=null && !"".equals(param.get("title"))){
param.put("title","%"+param.get("title")+"%"); param.put("title","%"+param.get("title")+"%");
} }

14
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/PlanParamInfoController.java

@ -1,8 +1,13 @@
package com.hnac.hzims.message_alarm.controller; package com.hnac.hzims.message_alarm.controller;
import com.hnac.hzims.message_alarm.xxljob.MessageMonitorObjJob;
import com.xxl.job.core.biz.model.ReturnT;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/** /**
@ -17,5 +22,14 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/planparaminfo") @RequestMapping("/planparaminfo")
public class PlanParamInfoController { public class PlanParamInfoController {
@Autowired
MessageMonitorObjJob messageMonitorObjJob;
@RequestMapping(value = "/test", method = {RequestMethod.GET})
public R test() {
ReturnT<String> stringReturnT = messageMonitorObjJob.flowWarnJob(null);
return R.data(stringReturnT);
}
} }

3
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.java

@ -1,5 +1,6 @@
package com.hnac.hzims.message_alarm.mapper; package com.hnac.hzims.message_alarm.mapper;
import com.hnac.hzims.operational.station.entity.StationEntity;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date; import java.util.Date;
@ -8,4 +9,6 @@ import java.util.Map;
public interface DataDeviceMapper { public interface DataDeviceMapper {
List<String> getCodeByModelId(@Param("modelId") Long modelId); List<String> getCodeByModelId(@Param("modelId") Long modelId);
StationEntity getStationFlowValueByCode(String code);
} }

12
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.xml

@ -8,4 +8,16 @@
and status = 1 and status = 1
and model_id = #{modelId} and model_id = #{modelId}
</select> </select>
<select id="getStationFlowValueByCode" resultType="com.hnac.hzims.operational.station.entity.StationEntity">
SELECT
IFNULL(discharge, '0' ) as discharge,
name
FROM
hzims_operation.`hzims_station`
WHERE
CODE = #{code}
AND IS_DELETED = '0'
</select>
</mapper> </mapper>

8
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/MessageReceiveInfoMapper.xml

@ -24,7 +24,13 @@
receive.* receive.*
from message_receive_info receive from message_receive_info receive
left join message_alarm_info alarm on receive.message_id = alarm.id left join message_alarm_info alarm on receive.message_id = alarm.id
where receive.message_type=#{param.messageType} and receive.receive_user_id=#{param.userId} where receive.receive_user_id=#{param.userId}
<if test=" param.messageType!=null and param.messageType!='' ">
and receive.message_type in
<foreach item="item" index="index" collection="param.messageType.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test=" param.title!=null and param.title!='' "> <if test=" param.title!=null and param.title!='' ">
and alarm.title like #{param.title} and alarm.title like #{param.title}
</if> </if>

7
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/IMessageStrategyService.java

@ -14,10 +14,17 @@ public interface IMessageStrategyService {
Map<Long, User> getPersons(int personSource, String personSourceIds); Map<Long, User> getPersons(int personSource, String personSourceIds);
List<MessageObjTemplateVo> queryMessageObjTemplateVo(Long schemeId,String deviceCode,String templateType); List<MessageObjTemplateVo> queryMessageObjTemplateVo(Long schemeId,String deviceCode,String templateType);
void saveAlarmMessage(MessageSendInfo info,String processInstanceId,String processKey,int alarmLevel,String jsonData); void saveAlarmMessage(MessageSendInfo info,String processInstanceId,String processKey,int alarmLevel,String jsonData);
void saveNotifyMessage(MessageSendInfo info,String jsonData); void saveNotifyMessage(MessageSendInfo info,String jsonData);
void saveFlowWarnMessage(MessageSendInfo info,String processInstanceId,String processKey,int alarmLevel,String jsonData);
MessageSendInfo getSendMessageInfo(MessageObjTemplateVo vo,String message); MessageSendInfo getSendMessageInfo(MessageObjTemplateVo vo,String message);
boolean sendSmsInfo(MessageSendInfo info, MessageResponseData responseData); boolean sendSmsInfo(MessageSendInfo info, MessageResponseData responseData);
boolean sendMessage(MessageDTO messageDTO); boolean sendMessage(MessageDTO messageDTO);
int sendFlowWarnMessage(String message, String phone);
} }

52
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/impl/MessageStrategyServiceImpl.java

@ -12,6 +12,7 @@ import org.springblade.core.sms.model.SmsResponse;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import com.hnac.hzims.message_alarm.enums.*; import com.hnac.hzims.message_alarm.enums.*;
import com.hnac.hzims.message_alarm.service.*; import com.hnac.hzims.message_alarm.service.*;
@ -156,6 +157,25 @@ public class MessageStrategyServiceImpl implements IMessageStrategyService {
} }
return smsResponseR.isSuccess(); return smsResponseR.isSuccess();
} }
@Value("${ecological.SMSTemplate:avg_flow_warning}")
private String flowWarningTemplateCode; // 日均流量告警模板编码
/**
* 发送短信
* @param message 短信内容
* @param phone 负责人电话
*/
@Override
public int sendFlowWarnMessage(String message, String phone) {
// 高板岩一站 电站生态流量预警:核定流量0.02(m³/s),当前日均流量0.017(m³/s),建议生态流量后续9小时的实时流量值不低于0.054(m³/s)
Map<String, Object> params = new HashMap<>();
params.put("message", message);
R<SmsResponse> smsResponseR = smsClient.sendMessage("200000", flowWarningTemplateCode, JSONObject.toJSONString(params), phone);
if (Func.isNotEmpty(smsResponseR) && smsResponseR.isSuccess()) {
return 1;
} else {
return 2;
}
}
@Override @Override
public List<MessageObjTemplateVo> queryMessageObjTemplateVo(Long schemeId,String deviceCode,String templateType) { public List<MessageObjTemplateVo> queryMessageObjTemplateVo(Long schemeId,String deviceCode,String templateType) {
@ -237,6 +257,38 @@ public class MessageStrategyServiceImpl implements IMessageStrategyService {
} }
@Override @Override
public void saveFlowWarnMessage(MessageSendInfo info,String processInstanceId,String processKey,
int alarmLevel,String jsonData) {
//存储告警消息
MessageAlarmInfo alarmInfo=new MessageAlarmInfo();
alarmInfo.setTitle(info.getTitle());//消息标题
alarmInfo.setContent(info.getMessage());//消息内容
alarmInfo.setSchemeId(info.getSchemeId());//消息方案id
alarmInfo.setSendUserName("系统管理员");//发送人姓名
alarmInfo.setSendTime(new Date());
alarmInfo.setDataJson(jsonData);//数据json(mq中的原始数据)
alarmInfo.setProcessInstanceId(processInstanceId);//流程实例id
alarmInfo.setAlarmLevel(alarmLevel);//告警等级(1-5)
alarmInfo.setObjectSource(info.getObjectSource());
alarmInfo.setProcessKey(processKey);
alarmInfo.setObjectCode(info.getObjectCode());
Long messageId=messageAlarmInfoService.insert(alarmInfo);
//存储接收者记录
List<MessageReceiveInfo> receiveInfos=new ArrayList<>();
for (Map.Entry<Long,String> map: info.getPerson().entrySet()){
MessageReceiveInfo receiveInfo=new MessageReceiveInfo();
receiveInfo.setMessageId(messageId);
receiveInfo.setMessageType(MessageTypeEnum.FLOW_WARN.getCode());
receiveInfo.setReceiveUserId(map.getKey());
receiveInfo.setReceiveUserName(map.getValue());
receiveInfo.setStatus(MessageStatusEnum.ZERO.getCode());
receiveInfos.add(receiveInfo);
}
messageReceiveInfoService.batchSave(receiveInfos);
}
@Override
public MessageSendInfo getSendMessageInfo(MessageObjTemplateVo vo,String message) { public MessageSendInfo getSendMessageInfo(MessageObjTemplateVo vo,String message) {
Map<Long, User> userMap=getPersons(vo.getPersonSource(),vo.getPersonSourceIds()); Map<Long, User> userMap=getPersons(vo.getPersonSource(),vo.getPersonSourceIds());
if(userMap==null){ if(userMap==null){

227
hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/xxljob/MessageMonitorObjJob.java

@ -6,6 +6,7 @@ import com.hnac.hzims.baseinfo.entity.ThreeDuty;
import com.hnac.hzims.baseinfo.feign.IBaseInfoClient; import com.hnac.hzims.baseinfo.feign.IBaseInfoClient;
import com.hnac.hzims.damsafety.entity.TBuilding; import com.hnac.hzims.damsafety.entity.TBuilding;
import com.hnac.hzims.damsafety.feign.IWrpSectionBClient; import com.hnac.hzims.damsafety.feign.IWrpSectionBClient;
import com.hnac.hzims.entity.ReportData;
import com.hnac.hzims.message_alarm.dto.MessageDTO; import com.hnac.hzims.message_alarm.dto.MessageDTO;
import com.hnac.hzims.message_alarm.entity.*; import com.hnac.hzims.message_alarm.entity.*;
import com.hnac.hzims.message_alarm.enums.AlarmLevelEnum; import com.hnac.hzims.message_alarm.enums.AlarmLevelEnum;
@ -19,8 +20,14 @@ import com.hnac.hzims.message_alarm.service.IMessageStrategyService;
import com.hnac.hzims.message_alarm.strategy.FactoryRuleStrategy; import com.hnac.hzims.message_alarm.strategy.FactoryRuleStrategy;
import com.hnac.hzims.message_alarm.util.DateUtil; import com.hnac.hzims.message_alarm.util.DateUtil;
import com.hnac.hzims.message_alarm.vo.MessageObjAttrRuleVo; import com.hnac.hzims.message_alarm.vo.MessageObjAttrRuleVo;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.util.CommonUtil;
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO;
import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO;
import com.hnac.hzinfo.sdk.analyse.AnalyseDataSearchClient; import com.hnac.hzinfo.sdk.analyse.AnalyseDataSearchClient;
import com.hnac.hzinfo.sdk.analyse.po.ComputeBaseStrategyPO; import com.hnac.hzinfo.sdk.analyse.po.ComputeBaseStrategyPO;
@ -43,11 +50,13 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
@ -102,6 +111,7 @@ public class MessageMonitorObjJob {
private final static String NOTIFY_TOPIC = "message_alarm_center/handleNotify"; //通知消息主题 private final static String NOTIFY_TOPIC = "message_alarm_center/handleNotify"; //通知消息主题
private final static String ALARM_TOPIC = "message_alarm_center/handleAlarm";//告警消息主题 private final static String ALARM_TOPIC = "message_alarm_center/handleAlarm";//告警消息主题
private final static String FLOW_ALARM_TOPIC = "message_alarm_center/handleFlowWarn";//流量告警消息主题
@Value("${hzims.alarm.rzalarm.level3}") @Value("${hzims.alarm.rzalarm.level3}")
private String level3; private String level3;
@ -442,6 +452,70 @@ public class MessageMonitorObjJob {
return ReturnT.SUCCESS; return ReturnT.SUCCESS;
} }
//流量告警消息
@XxlJob("flowWarnJob")
public ReturnT<String> flowWarnJob(String param) {
XxlJobParam xxlJobParam = JsonUtil.parse(param, XxlJobParam.class);
if (null == xxlJobParam) {
xxlJobParam = new XxlJobParam();
xxlJobParam.setCreateSdf("yyyy-MM-dd HH:mm:ss");
}
logger.info("告警消息执行定时任务开始:" + new Date());
// 获取当前时间 8点 15点 根据现在的生态流量建议接下来的时间的流量
LocalDateTime now = LocalDateTime.now();
LocalDateTime startTime = now.withHour(0).withMinute(0).withSecond(0).withNano(0);
// 判断是否是8点还是15点
int hours = (int) ChronoUnit.HOURS.between(startTime, now);
if (hours != 8 && hours != 15) {
return null;
}
//查询 已启动方案监控的对象 且关联了FLOWALARM模板
List<MessageSchemeObj> schemeObjList = getObjCodes(xxlJobParam.getSchemeId(), TemplateTypeEnum.FLOW_WARN.getCode());
logger.info("schemeObjList:" + schemeObjList);
if (schemeObjList != null && !schemeObjList.isEmpty()) {
//获取对象+属性+规则数据
LambdaQueryWrapper<MessageMonitorObjAttr> wrapper = new LambdaQueryWrapper<>();
List<String> codes = schemeObjList.stream().map(MessageSchemeObj::getObjectCode).distinct().collect(Collectors.toList());
wrapper.in(MessageMonitorObjAttr::getInstanceCode, codes);
List<MessageObjAttrRuleVo> attrRuleVos = messageMonitorObjAttrService.queryMessageObjAttrRuleVo(wrapper);
if (attrRuleVos == null || attrRuleVos.isEmpty()) {
return ReturnT.FAIL;
}
//获取对象属性
List<MessageMonitorObjAttr> attrs = attrRuleVos.stream().map(MessageObjAttrRuleVo::getAttr).distinct().collect(Collectors.toList());
logger.info("attrs:" + attrs);
for (MessageSchemeObj obj : schemeObjList) {
//获取对象对应的属性的实时数据
List<Map<String, Object>> fieldsHistoryDate = getFieldsHistoryDate(attrs, obj, hours, startTime, now);
logger.info("================平均数据res: ===========" + fieldsHistoryDate);
//获取对象属性对应的规则
List<MessageObjAttrRuleVo> rules = getMessageMonitorObjAttrRule(attrRuleVos, obj);
List<Map<String, Object>> jsonList = getFlowAlarmList(obj.getObjectCode(), fieldsHistoryDate, rules, startTime, now);
logger.info("================流量告警数据jsonList: ===========" + jsonList);
//发送mqtt
if (jsonList != null && !jsonList.isEmpty()) {//如果属性中有告警 就发送
Map<String, String> dataMap = new HashMap<>();
dataMap.put("templateType", TemplateTypeEnum.FLOW_WARN.getCode());
dataMap.put("jsonData", JsonUtil.toJson(jsonList));
SimpleDateFormat createSdf = new SimpleDateFormat(xxlJobParam.getCreateSdf());
dataMap.put("createDate", createSdf.format(new Date()));//时间格式
logger.info("================dataMap: ===========" + dataMap);
//发送mqtt
sendMqttMessage(FLOW_ALARM_TOPIC, dataMap, obj);
}
}
}
logger.info("告警消息执行定时任务结束:" + new Date());
return ReturnT.SUCCESS;
}
/** /**
* 查询出该流域下的所有水库通知到所有水库的对应责任人号码 * 查询出该流域下的所有水库通知到所有水库的对应责任人号码
* @param reservoirInfo * @param reservoirInfo
@ -857,5 +931,158 @@ public class MessageMonitorObjJob {
} }
private List<Map<String, Object>> getFieldsHistoryDate(List<MessageMonitorObjAttr> attrs, MessageSchemeObj obj,
Integer timeInterval, LocalDateTime startTime,
LocalDateTime endTime) {
//查询对象已配置的属性值
List<String> signages = attrs.stream().filter(e->e.getInstanceCode().equals(obj.getObjectCode()))
.map(MessageMonitorObjAttr::getAttrCode)
.collect(Collectors.toList());
List<Map<String, Object>> resultList = new ArrayList<>();
for (String signage : signages) {
// accessRules 取数规则:0=最早值、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值)6=最新值")
// SaveTimeType 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时) 3->、d(天) 4->、w(周) 5->、n(自然月)、6->y(自然年)
String stcd = obj.getObjectCode();
List<Map<String, Object>> dataList =
getData(stcd, 3, 2, timeInterval, startTime, endTime, signage);
if (!CollectionUtils.isEmpty(dataList)) {
// 为了处理特殊返回情况 多查出一条数据的问题
if (dataList.size() > 1) {
dataList.remove(0);
}
}
resultList.add(dataList.get(0));
}
return resultList;
}
public List<Map<String, Object>> getData(String stcd, Integer accessRules, Integer saveTimeType, Integer timeInterval,
LocalDateTime startTime, LocalDateTime endTime, String signage) {
List<Map<String, Object>> list = new ArrayList<>();
if (signage == null) {
return null;
}
int count = 0;
List<ReportData> reportDataList =
getDataByDeviceCode(stcd, accessRules, saveTimeType, timeInterval, startTime, endTime, signage);
count = reportDataList.size();
for (int i = 0; i < count; i++) {
Map<String, Object> res = new HashMap<>();
ReportData reportData = reportDataList.get(i);
res.put("tm", reportData.getKeyStr());
res.put(signage, reportData.getVal());
res.put("signage", signage);
list.add(res);
}
return list;
}
List<ReportData> getDataByDeviceCode(String deviceCode, Integer accessRules, Integer saveTimeType, Integer timeInterval,
LocalDateTime start, LocalDateTime end, String col) {
List<ReportData> reportData = new ArrayList<>();
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
po.setDeviceCode(deviceCode);
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO conditionPO = new AnalyzeDataConditionPO();
conditionPO.setBeginTime(start);
conditionPO.setEndTime(end);
conditionPO.setSignages(col);
// conditionPO.setKeepFigures(3);
conditionPO.setAccessRules(accessRules);
conditionPO.setSaveTimeType(saveTimeType);
conditionPO.setTimeInterval(timeInterval);
conditionPO.setFull(1);
signboardConditions.add(conditionPO);
po.setSignboardConditions(signboardConditions);
Result<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (result == null || !result.isSuccess()) {
return reportData;
}
List<AnalyzeDataConditionVO> datas = result.getData();
if (datas == null || datas.isEmpty()) {
return reportData;
}
for (AnalyzeDataConditionVO vo : datas) {
List<AnalyseDataTaosVO> dataTaosVOs = vo.getList();
for (AnalyseDataTaosVO vv : dataTaosVOs) {
if (vo.getSignage().equals(col)) {
ReportData data = new ReportData();
data.setKeyStr(CommonUtil.getKeyBySaveTimeType(vv.getTs(), saveTimeType));
String val = vv.getVal();
data.setStcd(deviceCode);
data.setVal(val);
if (val != null && !"".equals(val)) {
data.setValue(Double.valueOf(vv.getVal()));
} else {
data.setValue(0.0);
}
data.setName(vo.getName());
reportData.add(data);
}
}
}
return reportData;
}
private List<Map<String,Object>> getFlowAlarmList(String objCode,
List<Map<String, Object>> dataList,
List<MessageObjAttrRuleVo> ruleVos,
LocalDateTime startTime,
LocalDateTime now){
List<Map<String,Object>> res=new ArrayList<>();
int level=0;
if(ruleVos == null || ruleVos.isEmpty()){
return null;
}
if(dataList == null || dataList.isEmpty()){
return null;
}
//判断整个对象中是否有属性告警
for (Map<String, Object> fieldsData : dataList) {
String attr = fieldsData.get("signage").toString();
String val = fieldsData.get(attr).toString();
String ts = fieldsData.get("tm").toString();
List<MessageObjAttrRuleVo> filterList = ruleVos.stream().filter(e -> e.getAttr().getAttrCode().equals(attr)).collect(Collectors.toList());
if (filterList != null && !filterList.isEmpty()) {
List<MessageMonitorObjAttrRule> rules = filterList.get(0).getAttrRuleList();
if (CollectionUtils.isEmpty(rules)) {
continue;
}
Map<String, String> param = new HashMap<>();
param.put("objCode", objCode);
param.put("attr", attr);
param.put("val", val);
param.put("ts", ts);
Map<String, Object> messageMap = parseAlarmRule(param, rules);
level = level + Integer.parseInt(messageMap.get("alarmLevel").toString());
// 查询电站核定流量 并计算剩下的时间需要达到多少平均流量
if (Integer.parseInt(messageMap.get("alarmLevel").toString()) > 0) {
StationEntity station = dataDeviceMapper.getStationFlowValueByCode(objCode);
messageMap.put("suggest", "0");
try {
// 高板岩一站 电站生态流量预警:核定流量0.02(m³/s),当前日均流量0.017(m³/s),建议生态流量后续9小时的实时流量值不低于0.054(m³/s)
long seconds = ChronoUnit.SECONDS.between(startTime, now);
long hours = 24 - ChronoUnit.HOURS.between(startTime, now);
BigDecimal sumFlow = station.getDischarge().multiply(new BigDecimal(24 * 60 * 60));
BigDecimal nowFlow = new BigDecimal(val).multiply(new BigDecimal(seconds));
BigDecimal divide = sumFlow.subtract(nowFlow).divide(new BigDecimal(24 * 60 * 60 - seconds), 2, RoundingMode.HALF_UP);
messageMap.put("suggest", station.getName() + "电站生态流量预警:核定流量" + station.getDischarge() +
"(m³/s),当前日均流量" + val + "(m³/s),建议生态流量后续" + hours + "小时的实时流量值不低于" + divide + "(m³/s)");
} catch (Exception e) {
messageMap.put("suggest", "0");
}
}
res.add(messageMap);
}
}
if(level == 0){//告警等级相加大于0就是有告警
return null;
}
return res;
}
} }

2
hzims-service/message-alarm-service/src/main/resources/application-dev.yml

@ -1,6 +1,6 @@
#服务器端口 #服务器端口
server: server:
port: 8201 port: 8200
#数据源配置 #数据源配置
#spring: #spring:

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/huosan/service/impl/HuoSanTargetServiceImpl.java

@ -57,7 +57,7 @@ public class HuoSanTargetServiceImpl implements HuoSanTargetService {
@Override @Override
public KpisVO KPIs(String riverCode) { public KpisVO KPIs(String riverCode) {
LambdaQueryWrapper<StationEntity> lambdaQueryWrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<StationEntity> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(StationEntity::getType, HomePageConstant.HYDROPOWER); // lambdaQueryWrapper.eq(StationEntity::getType, HomePageConstant.HYDROPOWER);
if(!StringUtil.isEmpty(riverCode)){ if(!StringUtil.isEmpty(riverCode)){
lambdaQueryWrapper.eq(StationEntity::getBscd,riverCode); lambdaQueryWrapper.eq(StationEntity::getBscd,riverCode);
} }
@ -132,7 +132,7 @@ public class HuoSanTargetServiceImpl implements HuoSanTargetService {
public StationTargetVO target(String code) { public StationTargetVO target(String code) {
// 站点查询 // 站点查询
StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery() StationEntity station = stationService.getOne(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER) // .eq(StationEntity::getType,HomePageConstant.HYDROPOWER)
.eq(StationEntity::getCode,code)); .eq(StationEntity::getCode,code));
if(ObjectUtil.isEmpty(station)){ if(ObjectUtil.isEmpty(station)){
return new StationTargetVO(); return new StationTargetVO();

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -196,7 +196,7 @@ public class HydropowerServiceImpl implements HydropowerService {
// 水电站站点 // 水电站站点
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery() List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
//.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) //.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER) // .eq(StationEntity::getType,HomePageConstant.HYDROPOWER)
); );
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return; return;

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalEarlyWarningServiceImpl.java

@ -147,7 +147,6 @@ public class EcologicalEarlyWarningServiceImpl extends ServiceImpl<EcologicalEar
LambdaQueryWrapper<EcologicalEarlyWarning> wrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<EcologicalEarlyWarning> wrapper = new LambdaQueryWrapper();
wrapper.ge(EcologicalEarlyWarning::getZoologyTime, vo.getStartTime()); wrapper.ge(EcologicalEarlyWarning::getZoologyTime, vo.getStartTime());
wrapper.lt(EcologicalEarlyWarning::getZoologyTime, vo.getEndTime()); wrapper.lt(EcologicalEarlyWarning::getZoologyTime, vo.getEndTime());
wrapper.eq(EcologicalEarlyWarning::getIsDeleted, 0);
List<EcologicalEarlyWarning> list = this.list(wrapper); List<EcologicalEarlyWarning> list = this.list(wrapper);
Map<String, Map<String, Integer>> stationMap = new HashMap<>(); Map<String, Map<String, Integer>> stationMap = new HashMap<>();

62
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalServiceImpl.java

@ -295,35 +295,35 @@ public class EcologicalServiceImpl implements EcologicalService {
// 建议平均流量 = 差值 / 当日剩余小时数 // 建议平均流量 = 差值 / 当日剩余小时数
BigDecimal suggestFlowValue = difference.divide(new BigDecimal(remainingHour), 3, BigDecimal.ROUND_UP); BigDecimal suggestFlowValue = difference.divide(new BigDecimal(remainingHour), 3, BigDecimal.ROUND_UP);
// 第一次收到未达标数据发送预警(已废弃) // 第一次收到未达标数据发送预警
// if (standardNumber < totalNumber && stationRelation.getSendWarning() == UNSENT) { if (standardNumber < totalNumber && stationRelation.getSendWarning() == UNSENT) {
// EcologicalEarlyWarning warning = new EcologicalEarlyWarning(); EcologicalEarlyWarning warning = new EcologicalEarlyWarning();
// warning.setStationCode(stationRelation.getStationCode()); warning.setStationCode(stationRelation.getStationCode());
// warning.setReach(false); warning.setReach(false);
// warning.setDischarge(min); warning.setDischarge(min);
// warning.setZoologyTime(end); warning.setZoologyTime(end);
// warning.setWarning(EcologicalEarlyWarningService.low_soe); warning.setWarning(EcologicalEarlyWarningService.low_soe);
// warning.setFlowValue(flowValue.toString()); warning.setFlowValue(flowValue.toString());
// warning.setWarningSource(0); warning.setWarningSource(0);
//
// BigDecimal rate = new BigDecimal(String.valueOf(standardRate * 100)); BigDecimal rate = new BigDecimal(String.valueOf(standardRate * 100));
// warning.setStandardRate(rate.setScale(2,BigDecimal.ROUND_HALF_DOWN) + "%"); warning.setStandardRate(rate.setScale(2,BigDecimal.ROUND_HALF_DOWN) + "%");
//
// warning.setDescs("生态流量预警:当前合格数据" + standardNumber + "条,应该合格数据" + totalNumber + "条,达标率" + warning.getStandardRate()); warning.setDescs("生态流量预警:当前合格数据" + standardNumber + "条,应该合格数据" + totalNumber + "条,达标率" + warning.getStandardRate());
// ecologicalEarlyWarningService.save(warning); ecologicalEarlyWarningService.save(warning);
//
// LambdaUpdateWrapper<StationRelation> wrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<StationRelation> wrapper = new LambdaUpdateWrapper<>();
// wrapper.set(StationRelation::getSendWarning, SENT); wrapper.set(StationRelation::getSendWarning, SENT);
// wrapper.eq(StationRelation::getId, stationRelation.getId()); wrapper.eq(StationRelation::getId, stationRelation.getId());
// stationRelationService.update(wrapper); stationRelationService.update(wrapper);
//
// // 发送短信 // 发送短信
//// sendMessage(station.getName(), warning.getDischarge().toString(), averageDaily.getAverageDailyFlow(), remainingHour, suggestFlowValue.toString(), stationRelation.getLowSoePhone()); // sendMessage(station.getName(), warning.getDischarge().toString(), averageDaily.getAverageDailyFlow(), remainingHour, suggestFlowValue.toString(), stationRelation.getLowSoePhone());
// // 发送APP消息推送 // 发送APP消息推送
// String content = station.getName() + "电站生态流量预警:核定流量" + warning.getDischarge() + "(m³/s),当前日均流量" String content = station.getName() + "电站生态流量预警:核定流量" + warning.getDischarge() + "(m³/s),当前日均流量"
// + averageDaily.getAverageDailyFlow() + "(m³/s),建议生态流量后续" + remainingHour + "小时的实时流量值不低于" + suggestFlowValue + "(m³/s)"; + averageDaily.getAverageDailyFlow() + "(m³/s),建议生态流量后续" + remainingHour + "小时的实时流量值不低于" + suggestFlowValue + "(m³/s)";
// sendAppMessage(content, stationRelation.getLowSoeUserId()); sendAppMessage(content, stationRelation.getLowSoeUserId());
// } }
// 第一次未达标数据条数超过15条发送告警 // 第一次未达标数据条数超过15条发送告警
if (totalNumber - standardNumber >= 15 && stationRelation.getSendSoe() == UNSENT) { if (totalNumber - standardNumber >= 15 && stationRelation.getSendSoe() == UNSENT) {
EcologicalEarlyWarning warning = new EcologicalEarlyWarning(); EcologicalEarlyWarning warning = new EcologicalEarlyWarning();
@ -547,9 +547,9 @@ public class EcologicalServiceImpl implements EcologicalService {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("station", station); params.put("station", station);
params.put("discharge", discharge); params.put("discharge", discharge);
params.put("avgVal", avgValue); params.put("avg_value", avgValue);
params.put("number", remainingHour); params.put("number", remainingHour);
params.put("flowVal", flowValue); params.put("flow_value", flowValue);
R<SmsResponse> smsResponseR = smsClient.sendMessage("200000", flowWarningTemplateCode, JSONObject.toJSONString(params), phone); R<SmsResponse> smsResponseR = smsClient.sendMessage("200000", flowWarningTemplateCode, JSONObject.toJSONString(params), phone);
if (Func.isNotEmpty(smsResponseR) && smsResponseR.isSuccess()) { if (Func.isNotEmpty(smsResponseR) && smsResponseR.isSuccess()) {
return SENT; return SENT;

19
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -34,7 +34,6 @@ import com.hnac.hzims.operational.station.entity.*;
import com.hnac.hzims.operational.station.mapper.ControlUsersMapper; import com.hnac.hzims.operational.station.mapper.ControlUsersMapper;
import com.hnac.hzims.operational.station.mapper.StationMapper; import com.hnac.hzims.operational.station.mapper.StationMapper;
import com.hnac.hzims.operational.station.service.*; import com.hnac.hzims.operational.station.service.*;
import com.hnac.hzims.operational.station.strategy.CustomColumnWidthStyleStrategy;
import com.hnac.hzims.operational.station.utils.CustomCellWriteHandle; import com.hnac.hzims.operational.station.utils.CustomCellWriteHandle;
import com.hnac.hzims.operational.station.vo.*; import com.hnac.hzims.operational.station.vo.*;
import com.hnac.hzims.operational.station.wrapper.StationWrapper; import com.hnac.hzims.operational.station.wrapper.StationWrapper;
@ -1172,7 +1171,7 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
WriteCellStyle headWriteCellStyle = new WriteCellStyle(); WriteCellStyle headWriteCellStyle = new WriteCellStyle();
WriteFont writeFont1 = new WriteFont(); WriteFont writeFont1 = new WriteFont();
writeFont1.setFontName("黑体"); writeFont1.setFontName("黑体");
writeFont1.setFontHeightInPoints((short)14); writeFont1.setFontHeightInPoints((short)15);
headWriteCellStyle.setWriteFont(writeFont1); headWriteCellStyle.setWriteFont(writeFont1);
WriteCellStyle blackFontStyle = new WriteCellStyle(); WriteCellStyle blackFontStyle = new WriteCellStyle();
@ -1182,15 +1181,11 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
blackFontStyle.setWriteFont(writeFont2); blackFontStyle.setWriteFont(writeFont2);
blackFontStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); blackFontStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
AverageDailyFlowExportDTO dto = datas.get(0);
List<HydroAverageDailyFlowsDTO> flows = dto.getHydroAverageDailyFlows();
HorizontalCellStyleStrategy writeCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, blackFontStyle); HorizontalCellStyleStrategy writeCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, blackFontStyle);
EasyExcel.write(response.getOutputStream()) EasyExcel.write(response.getOutputStream())
.registerWriteHandler(writeCellStyleStrategy) .registerWriteHandler(writeCellStyleStrategy)
.registerWriteHandler(new CustomColumnWidthStyleStrategy(8,flows.size()+8)) .registerWriteHandler(new SimpleColumnWidthStyleStrategy(10))
.registerWriteHandler(new CustomCellWriteHandle(datas.size()+2)) .registerWriteHandler(new CustomCellWriteHandle(datas.size()+2))
.head(getHead(datas)) .head(getHead(datas))
.autoCloseStream(Boolean.FALSE) .autoCloseStream(Boolean.FALSE)
@ -1220,17 +1215,17 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
head0.add("序号"); head0.add("序号");
head0.add("电站名称"); head0.add("电站名称");
head0.add("管理机构"); head0.add("管理机构");
head0.add("核定流量(m³/s)"); head0.add("核定流量(m³/s)");
AverageDailyFlowExportDTO dto = datas.get(0); AverageDailyFlowExportDTO dto = datas.get(0);
List<HydroAverageDailyFlowsDTO> flows = dto.getHydroAverageDailyFlows(); List<HydroAverageDailyFlowsDTO> flows = dto.getHydroAverageDailyFlows();
flows.stream().forEach(hydroAverageDailyFlow->{ flows.stream().forEach(hydroAverageDailyFlow->{
String time = hydroAverageDailyFlow.getTm(); String time = hydroAverageDailyFlow.getTm();
head0.add(time); head0.add(time);
}); });
head0.add("考核天数(天)"); head0.add("考核天数(天)");
head0.add("免考天数(天)"); head0.add("免考天数");
head0.add("合格天数(天)"); head0.add("合格天数(天)");
head0.add("合格率(%)"); head0.add("合格率(%)");
list.add(head0); list.add(head0);
for (int i = 0; i < datas.size(); i++) { for (int i = 0; i < datas.size(); i++) {

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java

@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.operational.config.HikPathConfiguration; import com.hnac.hzims.operational.config.HikPathConfiguration;
import com.hnac.hzims.operational.station.StationConstants; import com.hnac.hzims.operational.station.StationConstants;
@ -68,10 +67,8 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
stationVideoTypeEntityList.forEach(stationVideoTypeEntity -> { stationVideoTypeEntityList.forEach(stationVideoTypeEntity -> {
if(ObjectUtil.isNotEmpty(stationVideoTypeEntity.getIsHikvideo()) && stationVideoTypeEntity.getIsHikvideo() == 1){ if(ObjectUtil.isNotEmpty(stationVideoTypeEntity.getIsHikvideo()) && stationVideoTypeEntity.getIsHikvideo() == 1){
try{ try{
stationVideoTypeEntity.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewURL(stationVideoTypeEntity.getVideoHost(), stationVideoTypeEntity.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewURL(StationConstants.STATION_VIDEO_HOST,StationConstants.APP_KEY,StationConstants.APP_SECRET
stationVideoTypeEntity.getAppKey(),stationVideoTypeEntity.getAppSecret() ,stationVideoTypeEntity.getPointCode(), DictCache.getValue(StationConstants.STATION_VIDEO_TYPE_CODE,stationVideoTypeEntity.getType()),0));
,stationVideoTypeEntity.getPointCode(), DictCache.getValue(StationConstants.STATION_VIDEO_TYPE_CODE,
stationVideoTypeEntity.getType()),0));
ids.add(stationVideoTypeEntity.getId()); ids.add(stationVideoTypeEntity.getId());
} }
catch (Exception e){ catch (Exception e){
@ -130,9 +127,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
orderBy(true,true,StationVideoTypeEntity::getStationSort); orderBy(true,true,StationVideoTypeEntity::getStationSort);
orderBy(true,true,StationVideoTypeEntity::getSort); orderBy(true,true,StationVideoTypeEntity::getSort);
}}; }};
IPage<StationVideoTypeEntity> result = this.page(Condition.getPage(query),queryWrapper); IPage<StationVideoTypeEntity> result = this.page(Condition.getPage(query),queryWrapper);
if (CollectionUtil.isNotEmpty(result.getRecords())){ if (CollectionUtil.isNotEmpty(result.getRecords())){
for (StationVideoTypeEntity video : result.getRecords()) { for (StationVideoTypeEntity video : result.getRecords()) {
try { try {
@ -143,7 +138,6 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
} }
} }
} }
return result; return result;
} }
@Override @Override
@ -332,7 +326,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
if(CollectionUtil.isNotEmpty(left)){ if(CollectionUtil.isNotEmpty(left)){
video.setLeft(left.stream().peek(item->{ video.setLeft(left.stream().peek(item->{
try { try {
item.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewFlvURL(item.getVideoHost(), item.getAppKey(), item.getAppSecret(), item.getPointCode(), 1)); item.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewFlvURL(ArtemisPostUtils.HOST, ArtemisPostUtils.APP_KEY, ArtemisPostUtils.APP_SECRET, item.getPointCode(), 1));
} }
catch(Exception e) { catch(Exception e) {
log.error("视频点位【"+item.getPointCode()+"】获取地址失败"); log.error("视频点位【"+item.getPointCode()+"】获取地址失败");
@ -345,7 +339,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl<StationVideoTyp
if(CollectionUtil.isNotEmpty(right)){ if(CollectionUtil.isNotEmpty(right)){
video.setRight(right.stream().peek(item->{ video.setRight(right.stream().peek(item->{
try { try {
item.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewFlvURL(item.getVideoHost(), item.getAppKey(), item.getAppSecret(), item.getPointCode(), 1)); item.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewFlvURL(ArtemisPostUtils.HOST, ArtemisPostUtils.APP_KEY, ArtemisPostUtils.APP_SECRET, item.getPointCode(), 1));
} }
catch(Exception e) { catch(Exception e) {
log.error("视频点位【"+item.getPointCode()+"】获取地址失败"); log.error("视频点位【"+item.getPointCode()+"】获取地址失败");

75
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/ArtemisPostUtils.java

@ -1,22 +1,18 @@
package com.hnac.hzims.operational.station.utils; package com.hnac.hzims.operational.station.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.hikvision.artemis.sdk.ArtemisHttpUtil; import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig; import com.hikvision.artemis.sdk.config.ArtemisConfig;
import org.springblade.core.tool.utils.StringUtil;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
public class ArtemisPostUtils { public class ArtemisPostUtils {
static int FINAL_TIME = 1; static int FINAL_TIME = 1;
public static String HOST = "223.214.6.181:4443"; public static String HOST = "172.30.100.204:443";
public static String APP_KEY = "29939497"; public static String APP_KEY = "29939497";
public static String APP_SECRET = "vRIMl4bNXQTy2TBKE9JZ"; public static String APP_SECRET = "vRIMl4bNXQTy2TBKE9JZ";
@ -195,70 +191,12 @@ public class ArtemisPostUtils {
return list; return list;
}*/ }*/
//转换地址内部存储
private static Cache<String, String> loadingCache = Caffeine.newBuilder()
//cache的初始容量
.initialCapacity(5)
//cache最大缓存数
.maximumSize(50)
//设置写缓存后n秒钟过期
.expireAfterWrite(30, TimeUnit.DAYS)
//设置读写缓存后n秒钟过期,实际很少用到,类似于expireAfterWrite
//.expireAfterAccess(17, TimeUnit.SECONDS)
.build();
// public static String getCameraPreviewFlvURL(String host, String appKey, String appSecret, String cameraIndexCode, int streamType) {
//
// String flvUrl=loadingCache.getIfPresent(cameraIndexCode);
// if(StringUtil.isNotBlank(flvUrl)){
// return flvUrl;
// }
//
//
// ArtemisConfig.host = host;
// ArtemisConfig.appKey = appKey;
// ArtemisConfig.appSecret = appSecret;
// String ARTEMIS_PATH = "/artemis";
// String getCamsApi = ARTEMIS_PATH+"/api/video/v2/cameras/previewURLs";
// Map<String, String> path = new HashMap<String, String>(2) {
// {
// this.put("https://", getCamsApi);
// }
// };
// String contentType = "application/json";
// JSONObject jsonBody = new JSONObject();
// jsonBody.put("cameraIndexCode", cameraIndexCode);
// jsonBody.put("streamType", 0);
// jsonBody.put("protocol", "httpflv");
// jsonBody.put("transmode", 1);
//
// String body = jsonBody.toJSONString();
// String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map)null, (String)null, contentType, (Map)null);
// if (null == result && "".equals(result)) {
// return null;
// } else {
// JSONObject json = JSONObject.parseObject(result);
// json = JSONObject.parseObject(json.getString("data"));
// String url = json.getString("url");
// loadingCache.put(cameraIndexCode,url);
// return url;
// }
// }
public static String getCameraPreviewFlvURL(String host, String appKey, String appSecret, String cameraIndexCode, int streamType) { public static String getCameraPreviewFlvURL(String host, String appKey, String appSecret, String cameraIndexCode, int streamType) {
String flvUrl=loadingCache.getIfPresent(cameraIndexCode);
if(StringUtil.isNotBlank(flvUrl)){
return flvUrl;
}
ArtemisConfig.host = host; ArtemisConfig.host = host;
ArtemisConfig.appKey = appKey; ArtemisConfig.appKey = appKey;
ArtemisConfig.appSecret = appSecret; ArtemisConfig.appSecret = appSecret;
String ARTEMIS_PATH = "/artemis"; String ARTEMIS_PATH = "/artemis";
String getCamsApi = ARTEMIS_PATH+"/api/vnsc/mls/v1/preview/openApi/getPreviewParam"; String getCamsApi = ARTEMIS_PATH+"/api/video/v2/cameras/previewURLs";
Map<String, String> path = new HashMap<String, String>(2) { Map<String, String> path = new HashMap<String, String>(2) {
{ {
this.put("https://", getCamsApi); this.put("https://", getCamsApi);
@ -266,12 +204,10 @@ public class ArtemisPostUtils {
}; };
String contentType = "application/json"; String contentType = "application/json";
JSONObject jsonBody = new JSONObject(); JSONObject jsonBody = new JSONObject();
jsonBody.put("indexCode", cameraIndexCode); jsonBody.put("cameraIndexCode", cameraIndexCode);
jsonBody.put("streamType", 0); jsonBody.put("streamType", 0);
jsonBody.put("protocol", "httpflv"); jsonBody.put("protocol", "httpflv");
jsonBody.put("transmode", 1); jsonBody.put("transmode", 1);
jsonBody.put("expireTime", 2592000);
String body = jsonBody.toJSONString(); String body = jsonBody.toJSONString();
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map)null, (String)null, contentType, (Map)null); String result = ArtemisHttpUtil.doPostStringArtemis(path, body, (Map)null, (String)null, contentType, (Map)null);
@ -281,13 +217,8 @@ public class ArtemisPostUtils {
JSONObject json = JSONObject.parseObject(result); JSONObject json = JSONObject.parseObject(result);
json = JSONObject.parseObject(json.getString("data")); json = JSONObject.parseObject(json.getString("data"));
String url = json.getString("url"); String url = json.getString("url");
loadingCache.put(cameraIndexCode,url);
return url; return url;
} }
} }
// public static void main(String[] args) {
// System.out.println(getCameraPreviewURL(HOST,APP_KEY,APP_SECRET,"ffa8e46a79054f699b267eed6031c9ce","rtsp",1));
// }
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/CustomCellWriteHandle.java

@ -43,7 +43,7 @@ public class CustomCellWriteHandle implements CellWriteHandler {
CellStyle cellStyle = cell.getSheet().getWorkbook().createCellStyle(); CellStyle cellStyle = cell.getSheet().getWorkbook().createCellStyle();
Font font = cell.getSheet().getWorkbook().createFont(); Font font = cell.getSheet().getWorkbook().createFont();
font.setFontName("宋体"); font.setFontName("宋体");
font.setFontHeightInPoints((short) 12); font.setFontHeightInPoints((short) 13);
font.setBold(true); font.setBold(true);
cellStyle.setFont(font); cellStyle.setFont(font);
cellStyle.setAlignment(HorizontalAlignment.CENTER); cellStyle.setAlignment(HorizontalAlignment.CENTER);

2
hzims-service/safeproduct/src/main/resources/application-dev.yml

@ -1,6 +1,6 @@
#服务器端口 #服务器端口
server: server:
port: 8202 port: 8200
#数据源配置 #数据源配置
#spring: #spring:

4
hzims-service/video-image/pom.xml

@ -60,9 +60,5 @@
<groupId>com.hnac.hzinfo.data</groupId> <groupId>com.hnac.hzinfo.data</groupId>
<artifactId>hzinfo-data-sdk</artifactId> <artifactId>hzinfo-data-sdk</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

15
hzims-service/video-image/src/main/java/com/hnac/hzims/videoimage/utils/ArtemisPostUtils.java

@ -6,15 +6,11 @@
package com.hnac.hzims.videoimage.utils; package com.hnac.hzims.videoimage.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.hikvision.artemis.sdk.ArtemisHttpUtil; import com.hikvision.artemis.sdk.ArtemisHttpUtil;
import com.hikvision.artemis.sdk.config.ArtemisConfig; import com.hikvision.artemis.sdk.config.ArtemisConfig;
import org.springblade.core.tool.utils.StringUtil;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit;
public class ArtemisPostUtils { public class ArtemisPostUtils {
static int FINAL_TIME = 1; static int FINAL_TIME = 1;
@ -50,9 +46,7 @@ public class ArtemisPostUtils {
} }
} }
public static String getCameraPreviewFlvURL(String host, String appKey, String appSecret, String cameraIndexCode, int streamType) { public static String getCameraPreviewFlvURL(String host, String appKey, String appSecret, String cameraIndexCode, int streamType) {
ArtemisConfig.host = host; ArtemisConfig.host = host;
ArtemisConfig.appKey = appKey; ArtemisConfig.appKey = appKey;
ArtemisConfig.appSecret = appSecret; ArtemisConfig.appSecret = appSecret;
@ -78,12 +72,8 @@ public class ArtemisPostUtils {
JSONObject json = JSONObject.parseObject(result); JSONObject json = JSONObject.parseObject(result);
json = JSONObject.parseObject(json.getString("data")); json = JSONObject.parseObject(json.getString("data"));
if (json != null){ if (json != null){
String url = json.getString("url"); return json.getString("url");
return url;
} }
} }
return null; return null;
} }
@ -92,7 +82,8 @@ public class ArtemisPostUtils {
ArtemisConfig.host = host; ArtemisConfig.host = host;
ArtemisConfig.appKey = appKey; ArtemisConfig.appKey = appKey;
ArtemisConfig.appSecret = appSecret; ArtemisConfig.appSecret = appSecret;
String ARTEMIS_PATH = "/artemis";
String getCamsApi = "/artemis/api/video/v1/ptzs/controlling";
final Map<String, String> path = new HashMap<String, String>(2) { final Map<String, String> path = new HashMap<String, String>(2) {
{ {
this.put("https://", "/artemis/api/video/v1/ptzs/controlling"); this.put("https://", "/artemis/api/video/v1/ptzs/controlling");

2
hzims-service/water-quality/src/main/resources/application-dev.yml

@ -1,6 +1,6 @@
#服务器端口 #服务器端口
server: server:
port: 8205 port: 8200
#数据源配置 #数据源配置
#spring: #spring:

2
hzims-service/water-rain/src/main/resources/application-dev.yml

@ -1,6 +1,6 @@
#服务器端口 #服务器端口
server: server:
port: 8203 port: 8200
#数据源配置 #数据源配置
#spring: #spring:

2
hzims-service/weather/src/main/resources/application-dev.yml

@ -1,6 +1,6 @@
#服务器端口 #服务器端口
server: server:
port: 8300 port: 8200
#数据源配置 #数据源配置
spring: spring:

Loading…
Cancel
Save