diff --git a/hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/util/ConvertUtil.java b/hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/util/ConvertUtil.java index 2f2c56f..1ccd9a9 100644 --- a/hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/util/ConvertUtil.java +++ b/hzims-service-api/base-info-api/src/main/java/com/hnac/hzims/baseinfo/util/ConvertUtil.java @@ -8,7 +8,6 @@ public class ConvertUtil { static { convertMap.put("ph","PH"); convertMap.put("has","高锰酸盐指数"); - convertMap.put("dox","溶解氧"); convertMap.put("cu","铜"); convertMap.put("zn","锌"); convertMap.put("se","硒"); diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java index 74af894..525b3e3 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClient.java @@ -87,7 +87,7 @@ public interface IEmInfoClient { 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) EmInfoEntity getByCode(@RequestParam("code") String id); @@ -101,14 +101,6 @@ public interface IEmInfoClient { @GetMapping(LIST_BY_DEPT_ID) List list(); - String listByRefOreanization = API_PREFIX + "/listByRefOreanization"; - @GetMapping(listByRefOreanization) - R> listByRefOreanization(Long refOreanization); - - String getByEquipmentId = API_PREFIX + "/getByEquipmentId"; - @GetMapping(getByEquipmentId) - EmInfoVO getByEquipmentId(Long id); - /** * 根据机构ID获取设备Code * diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java index 6e9c4f2..c62b7fb 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IEmInfoClientBack.java @@ -36,16 +36,6 @@ public class IEmInfoClientBack implements IEmInfoClient { } @Override - public R> listByRefOreanization(Long refOreanization) { - return null; - } - - @Override - public EmInfoVO getByEquipmentId(Long id) { - return null; - } - - @Override public R> getEmCodeByDeptId(Long deptId) { return R.data(new ArrayList<>()); } diff --git a/hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/MessageTypeEnum.java b/hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/MessageTypeEnum.java index e02c3f4..8e2f81b 100644 --- a/hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/MessageTypeEnum.java +++ b/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 { NOTIFY("notify","通知消息"), - ALARM("alarm","告警消息"); + ALARM("alarm","告警消息"), + FLOW_WARN("flowWarn","流量告警消息"); String code; String name; diff --git a/hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/TemplateTypeEnum.java b/hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/TemplateTypeEnum.java index 570ac0f..3feaacf 100644 --- a/hzims-service-api/message-alarm-api/src/main/java/com/hnac/hzims/message_alarm/enums/TemplateTypeEnum.java +++ b/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","通知消息"), NOTIFY("notify","通知消息"), SOE("soe","设备soe"), - ALARM("alarm","告警消息"); + ALARM("alarm","告警消息"), + FLOW_WARN("flowWarn","生态流量告警消息"); String code; String name; diff --git a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/BaseInfoApplication.java b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/BaseInfoApplication.java index 6636ec8..2eb559a 100644 --- a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/BaseInfoApplication.java +++ b/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 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) { BladeApplication.run(APP_NAME, BaseInfoApplication.class, args); diff --git a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StZvarlBController.java b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StZvarlBController.java index 8529dda..9520225 100644 --- a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StZvarlBController.java +++ b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/controller/StZvarlBController.java @@ -1,18 +1,21 @@ 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.service.StZvarlBService; import com.hnac.hzims.common.utils.Condition; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.annotations.*; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; import java.math.BigDecimal; +import java.util.List; +import java.util.Map; @RestController @Api(description = "库(湖)容曲线控制器") @@ -22,6 +25,25 @@ public class StZvarlBController { @Autowired private StZvarlBService stZvarlBService; + /** + * 列表 + */ + @GetMapping("/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "rscd", value = "库(湖)编码", paramType = "query", dataType = "string") + }) + @ApiOperationSupport(order = 2) + @ApiOperation(value = "列表", notes = "传入stZvarlB") + public R> list(@ApiIgnore @RequestParam Map param) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); + if (param.get("stcd") != null) { + wrapper.like(StZvarlB::getStcd, param.get("stcd")); + } + wrapper.orderByAsc(StZvarlB::getPtno); + List list = stZvarlBService.list(wrapper); + return R.data(list); + } + @ApiOperation(notes = "获取库(湖)容曲线列表数据接口", value = "获取库(湖)容曲线列表数据接口") @RequestMapping(value = "bindStZvarlBs", method = RequestMethod.GET) diff --git a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/feign/BaseInfoClient.java b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/feign/BaseInfoClient.java index 086ff21..dff21e4 100644 --- a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/feign/BaseInfoClient.java +++ b/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)); } - @Override public void savePreviewInfo(PreviewInfo previewInfo) { log.info("===previewInfo==={}", previewInfo); previewInfoService.save(previewInfo); } - @Override public R>> getHistoryDataBySignage(String stcd, Date start, Date end, String type, String col){ return R.data(reservoirDataService.getHistoryDataBySignage(stcd,start,end,type,col)); } diff --git a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StZvarlBMapper.java b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StZvarlBMapper.java index 33c97af..18c9d74 100644 --- a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StZvarlBMapper.java +++ b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/mapper/StZvarlBMapper.java @@ -1,12 +1,14 @@ package com.hnac.hzims.baseinfo.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.baseinfo.entity.StZvarlB; import com.hnac.hzims.baseinfo.entity.StZvarlBExample; import org.apache.ibatis.annotations.Param; import java.util.List; -public interface StZvarlBMapper { +public interface StZvarlBMapper extends BaseMapper { + int deleteByPrimaryKey(Integer id); int insert(StZvarlB record); diff --git a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/StZvarlBService.java b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/StZvarlBService.java index b886faf..965125c 100644 --- a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/StZvarlBService.java +++ b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/StZvarlBService.java @@ -1,5 +1,6 @@ package com.hnac.hzims.baseinfo.service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.baseinfo.entity.StZvarlB; import org.springblade.core.tool.api.R; @@ -10,6 +11,8 @@ import java.util.List; public interface StZvarlBService { + List list(LambdaQueryWrapper wrapper); + IPage bindStZvarlBs(String stcd, IPage page); R addOrEditStZvarlB(StZvarlB stZvarlB); diff --git a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/PreviewInfoServiceImpl.java b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/PreviewInfoServiceImpl.java index 2858f3f..89e00bd 100644 --- a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/PreviewInfoServiceImpl.java +++ b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/PreviewInfoServiceImpl.java @@ -37,7 +37,6 @@ public class PreviewInfoServiceImpl extends ServiceImpl previewInfosPage = previewInfoMapper.queryList(pageParam,queryWrapper); List previewInfos = previewInfosPage.getRecords(); if (CollectionUtils.isNotEmpty(previewInfos)) { diff --git a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/ReservoirDataServiceImpl.java b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/ReservoirDataServiceImpl.java index e6f8930..afa87b1 100644 --- a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/ReservoirDataServiceImpl.java +++ b/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); Result> result=realDataSearchClient.getRealDataByDeviceCode(po); - if(result==null || !result.isSuccess()){ - return null; - } return result.getData(); } diff --git a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StZvarlBServiceImpl.java b/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StZvarlBServiceImpl.java index c7ca427..ac33f33 100644 --- a/hzims-service/base-info/src/main/java/com/hnac/hzims/baseinfo/service/impl/StZvarlBServiceImpl.java +++ b/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; 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.extension.service.impl.ServiceImpl; import com.hnac.hzims.baseinfo.entity.StZvarlB; import com.hnac.hzims.baseinfo.mapper.StZvarlBMapper; import com.hnac.hzims.baseinfo.service.StZvarlBService; @@ -21,6 +23,10 @@ public class StZvarlBServiceImpl implements StZvarlBService { @Override + public List list(LambdaQueryWrapper wrapper) { + return stZvarlBMapper.selectList(wrapper); + } + @Override public IPage bindStZvarlBs(String stcd, IPage page) { IPage records = stZvarlBMapper.selectByStcd(stcd, page); return records; diff --git a/hzims-service/base-info/src/main/resources/application-dev.yml b/hzims-service/base-info/src/main/resources/application-dev.yml index b9829d6..dfb11e9 100644 --- a/hzims-service/base-info/src/main/resources/application-dev.yml +++ b/hzims-service/base-info/src/main/resources/application-dev.yml @@ -1,4 +1,30 @@ -#服务器端口 -server: - port: 8203 - +##服务器端口 +#server: +# 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 diff --git a/hzims-service/base-info/src/main/resources/application-prod.yml b/hzims-service/base-info/src/main/resources/application-prod.yml index da89262..811224c 100644 --- a/hzims-service/base-info/src/main/resources/application-prod.yml +++ b/hzims-service/base-info/src/main/resources/application-prod.yml @@ -1,28 +1,28 @@ -#服务器端口 -server: - port: 8200 - -#数据源配置 +##服务器端口 +#server: +# port: 8200 +# +##数据源配置 +##spring: +## datasource: +## url: ${blade.datasource.prod.url} +## username: ${blade.datasource.prod.username} +## password: ${blade.datasource.prod.password} +# #spring: +# #排除DruidDataSourceAutoConfigure +# autoconfigure: +# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # datasource: -# url: ${blade.datasource.prod.url} -# username: ${blade.datasource.prod.username} -# password: ${blade.datasource.prod.password} - -spring: - #排除DruidDataSourceAutoConfigure - autoconfigure: - exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure - datasource: - dynamic: - #设置默认的数据源或者数据源组,默认值即为master - primary: master - 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} +# dynamic: +# #设置默认的数据源或者数据源组,默认值即为master +# primary: master +# 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} diff --git a/hzims-service/base-info/src/main/resources/application.yml b/hzims-service/base-info/src/main/resources/application.yml index f9c8222..21819bf 100644 --- a/hzims-service/base-info/src/main/resources/application.yml +++ b/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: mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml diff --git a/hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/service/impl/DamSafetyDataServiceImpl.java b/hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/service/impl/DamSafetyDataServiceImpl.java index 8e677bc..fe5e2c4 100644 --- a/hzims-service/dam-safety/src/main/java/com/hnac/hzims/damsafety/service/impl/DamSafetyDataServiceImpl.java +++ b/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()); // 调用降维接口 Result> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(analyse); - if(result ==null || !result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ + if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ continue; } // 结构数据转换 diff --git a/hzims-service/digital-twin-display/src/main/resources/application-dev.yml b/hzims-service/digital-twin-display/src/main/resources/application-dev.yml index 5b2bf68..50a4ea7 100644 --- a/hzims-service/digital-twin-display/src/main/resources/application-dev.yml +++ b/hzims-service/digital-twin-display/src/main/resources/application-dev.yml @@ -1,6 +1,6 @@ #服务器端口 server: - port: 8206 + port: 8200 #数据源配置 #spring: diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java index cf65860..2cbac9a 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmInfoClient.java @@ -30,11 +30,11 @@ import java.util.stream.Collectors; @RestController public class EmInfoClient implements IEmInfoClient { @Autowired - IEmInfoService service; + private IEmInfoService service; @Autowired - IEmParamService paramService; + private IEmParamService paramService; @Autowired - IEmAttachService attachService; + private IEmAttachService attachService; @RequestMapping(value = DETAIL) @@ -67,31 +67,6 @@ public class EmInfoClient implements IEmInfoClient { return service.list(); } - @Override - public R> listByRefOreanization(Long refOreanization) { - return R.data(service.list(new LambdaQueryWrapper() {{ - eq(EmInfoEntity::getRefOreanization, refOreanization); - }})); - } - - @Override - public EmInfoVO getByEquipmentId(Long id) { - EmInfoVO vo=new EmInfoVO(); - vo.setInfo(service.getById(id)); - LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>(); - wrapper.eq(EmInfoEntity::getGpid,id); - List child=service.list(wrapper); - vo.setChildren(child); - - LambdaQueryWrapper wrapper1=new LambdaQueryWrapper<>(); - wrapper1.eq(EmAttachEntity::getEmId,id); - vo.setAttachs(attachService.list(wrapper1)); - LambdaQueryWrapper wrapper2=new LambdaQueryWrapper<>(); - wrapper2.eq(EmParamEntity::getInfoId,id); - vo.setParams(paramService.list(wrapper2)); - return vo; - } - @GetMapping(value = GET_EM_CODE_BY_DEPT_ID) @Override public R> getEmCodeByDeptId(Long deptId) { diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmOreanizationClient.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmOreanizationClient.java index 02fc72e..f5f0dd1 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/EmOreanizationClient.java +++ b/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.EmTreeNode; -import com.hnac.hzims.equipment.service.IEmOrganizationService; +import com.hnac.hzims.equipment.service.IEmOreanizationService; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -26,7 +26,7 @@ import java.util.List; @Slf4j public class EmOreanizationClient implements IEmOreanizationClient { - private final IEmOrganizationService em_oreanizationService; + private final IEmOreanizationService em_oreanizationService; @Override @GetMapping(INIT_LOAD) diff --git a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/MessageAlarmCenterApplication.java b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/MessageAlarmCenterApplication.java index 8d13f0d..3bb9c90 100644 --- a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/MessageAlarmCenterApplication.java +++ b/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.*"}) public class MessageAlarmCenterApplication extends SpringBootServletInitializer { 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) { // System.setProperty("nacos.standalone", "true"); BladeApplication.run(APP_NAME, MessageAlarmCenterApplication.class, args); diff --git a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/MessageReceiveInfoController.java b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/MessageReceiveInfoController.java index 8891a4b..ba321c2 100644 --- a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/MessageReceiveInfoController.java +++ b/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.MessageReceiveNotifyInfoVo; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -78,7 +79,9 @@ public class MessageReceiveInfoController extends BladeController implements Cac param = new HashMap<>(); } 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"))){ param.put("title","%"+param.get("title")+"%"); } diff --git a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/PlanParamInfoController.java b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/PlanParamInfoController.java index 23843c5..532989b 100644 --- a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/controller/PlanParamInfoController.java +++ b/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; +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.RequestMethod; import org.springframework.web.bind.annotation.RestController; /** @@ -17,5 +22,14 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("/planparaminfo") public class PlanParamInfoController { + @Autowired + MessageMonitorObjJob messageMonitorObjJob; + + @RequestMapping(value = "/test", method = {RequestMethod.GET}) + public R test() { + ReturnT stringReturnT = messageMonitorObjJob.flowWarnJob(null); + return R.data(stringReturnT); + } + } diff --git a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.java b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.java index 7f4e818..36d98d4 100644 --- a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.java +++ b/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; +import com.hnac.hzims.operational.station.entity.StationEntity; import org.apache.ibatis.annotations.Param; import java.util.Date; @@ -8,4 +9,6 @@ import java.util.Map; public interface DataDeviceMapper { List getCodeByModelId(@Param("modelId") Long modelId); + + StationEntity getStationFlowValueByCode(String code); } diff --git a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.xml b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.xml index b3ac0f0..8fa5897 100644 --- a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.xml +++ b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/DataDeviceMapper.xml @@ -8,4 +8,16 @@ and status = 1 and model_id = #{modelId} + + + diff --git a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/MessageReceiveInfoMapper.xml b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/MessageReceiveInfoMapper.xml index 6135c1e..a51dda0 100644 --- a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/MessageReceiveInfoMapper.xml +++ b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/mapper/MessageReceiveInfoMapper.xml @@ -24,7 +24,13 @@ receive.* from message_receive_info receive 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} + + and receive.message_type in + + #{item} + + and alarm.title like #{param.title} diff --git a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/IMessageStrategyService.java b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/IMessageStrategyService.java index af2d7a5..9c9d2c8 100644 --- a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/IMessageStrategyService.java +++ b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/IMessageStrategyService.java @@ -14,10 +14,17 @@ public interface IMessageStrategyService { Map getPersons(int personSource, String personSourceIds); List queryMessageObjTemplateVo(Long schemeId,String deviceCode,String templateType); void saveAlarmMessage(MessageSendInfo info,String processInstanceId,String processKey,int alarmLevel,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); boolean sendSmsInfo(MessageSendInfo info, MessageResponseData responseData); boolean sendMessage(MessageDTO messageDTO); -} + + int sendFlowWarnMessage(String message, String phone); + + } diff --git a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/impl/MessageStrategyServiceImpl.java b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/impl/MessageStrategyServiceImpl.java index a3f1933..009b373 100644 --- a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/service/impl/MessageStrategyServiceImpl.java +++ b/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.jackson.JsonUtil; import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import com.hnac.hzims.message_alarm.enums.*; import com.hnac.hzims.message_alarm.service.*; @@ -156,6 +157,25 @@ public class MessageStrategyServiceImpl implements IMessageStrategyService { } 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 params = new HashMap<>(); + params.put("message", message); + R smsResponseR = smsClient.sendMessage("200000", flowWarningTemplateCode, JSONObject.toJSONString(params), phone); + if (Func.isNotEmpty(smsResponseR) && smsResponseR.isSuccess()) { + return 1; + } else { + return 2; + } + } @Override public List queryMessageObjTemplateVo(Long schemeId,String deviceCode,String templateType) { @@ -237,6 +257,38 @@ public class MessageStrategyServiceImpl implements IMessageStrategyService { } @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 receiveInfos=new ArrayList<>(); + for (Map.Entry 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) { Map userMap=getPersons(vo.getPersonSource(),vo.getPersonSourceIds()); if(userMap==null){ diff --git a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/xxljob/MessageMonitorObjJob.java b/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/xxljob/MessageMonitorObjJob.java index b05f535..961a2ef 100644 --- a/hzims-service/message-alarm-service/src/main/java/com/hnac/hzims/message_alarm/xxljob/MessageMonitorObjJob.java +++ b/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.damsafety.entity.TBuilding; 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.entity.*; 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.util.DateUtil; 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.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.AnalyzeDataConditionVO; +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeInstanceFieldVO; import com.hnac.hzinfo.datasearch.real.po.RealDataSearchPO; import com.hnac.hzinfo.sdk.analyse.AnalyseDataSearchClient; import com.hnac.hzinfo.sdk.analyse.po.ComputeBaseStrategyPO; @@ -43,11 +50,13 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; import java.util.*; import java.util.concurrent.TimeUnit; 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 ALARM_TOPIC = "message_alarm_center/handleAlarm";//告警消息主题 + private final static String FLOW_ALARM_TOPIC = "message_alarm_center/handleFlowWarn";//流量告警消息主题 @Value("${hzims.alarm.rzalarm.level3}") private String level3; @@ -442,6 +452,70 @@ public class MessageMonitorObjJob { return ReturnT.SUCCESS; } + //流量告警消息 + @XxlJob("flowWarnJob") + public ReturnT 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 schemeObjList = getObjCodes(xxlJobParam.getSchemeId(), TemplateTypeEnum.FLOW_WARN.getCode()); + logger.info("schemeObjList:" + schemeObjList); + if (schemeObjList != null && !schemeObjList.isEmpty()) { + //获取对象+属性+规则数据 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + List codes = schemeObjList.stream().map(MessageSchemeObj::getObjectCode).distinct().collect(Collectors.toList()); + wrapper.in(MessageMonitorObjAttr::getInstanceCode, codes); + List attrRuleVos = messageMonitorObjAttrService.queryMessageObjAttrRuleVo(wrapper); + if (attrRuleVos == null || attrRuleVos.isEmpty()) { + return ReturnT.FAIL; + } + + //获取对象属性 + List attrs = attrRuleVos.stream().map(MessageObjAttrRuleVo::getAttr).distinct().collect(Collectors.toList()); + logger.info("attrs:" + attrs); + for (MessageSchemeObj obj : schemeObjList) { + //获取对象对应的属性的实时数据 + List> fieldsHistoryDate = getFieldsHistoryDate(attrs, obj, hours, startTime, now); + + logger.info("================平均数据res: ===========" + fieldsHistoryDate); + + //获取对象属性对应的规则 + List rules = getMessageMonitorObjAttrRule(attrRuleVos, obj); + + List> jsonList = getFlowAlarmList(obj.getObjectCode(), fieldsHistoryDate, rules, startTime, now); + logger.info("================流量告警数据jsonList: ===========" + jsonList); + //发送mqtt + if (jsonList != null && !jsonList.isEmpty()) {//如果属性中有告警 就发送 + Map 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 @@ -857,5 +931,158 @@ public class MessageMonitorObjJob { } + private List> getFieldsHistoryDate(List attrs, MessageSchemeObj obj, + Integer timeInterval, LocalDateTime startTime, + LocalDateTime endTime) { + //查询对象已配置的属性值 + List signages = attrs.stream().filter(e->e.getInstanceCode().equals(obj.getObjectCode())) + .map(MessageMonitorObjAttr::getAttrCode) + .collect(Collectors.toList()); + List> 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> 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> getData(String stcd, Integer accessRules, Integer saveTimeType, Integer timeInterval, + LocalDateTime startTime, LocalDateTime endTime, String signage) { + List> list = new ArrayList<>(); + if (signage == null) { + return null; + } + int count = 0; + List reportDataList = + getDataByDeviceCode(stcd, accessRules, saveTimeType, timeInterval, startTime, endTime, signage); + count = reportDataList.size(); + for (int i = 0; i < count; i++) { + Map 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 getDataByDeviceCode(String deviceCode, Integer accessRules, Integer saveTimeType, Integer timeInterval, + LocalDateTime start, LocalDateTime end, String col) { + List reportData = new ArrayList<>(); + AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); + po.setDeviceCode(deviceCode); + + List 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> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po); + if (result == null || !result.isSuccess()) { + return reportData; + } + List datas = result.getData(); + if (datas == null || datas.isEmpty()) { + return reportData; + } + for (AnalyzeDataConditionVO vo : datas) { + List 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> getFlowAlarmList(String objCode, + List> dataList, + List ruleVos, + LocalDateTime startTime, + LocalDateTime now){ + List> res=new ArrayList<>(); + int level=0; + if(ruleVos == null || ruleVos.isEmpty()){ + return null; + } + + if(dataList == null || dataList.isEmpty()){ + return null; + } + //判断整个对象中是否有属性告警 + for (Map fieldsData : dataList) { + String attr = fieldsData.get("signage").toString(); + String val = fieldsData.get(attr).toString(); + String ts = fieldsData.get("tm").toString(); + List filterList = ruleVos.stream().filter(e -> e.getAttr().getAttrCode().equals(attr)).collect(Collectors.toList()); + if (filterList != null && !filterList.isEmpty()) { + List rules = filterList.get(0).getAttrRuleList(); + if (CollectionUtils.isEmpty(rules)) { + continue; + } + Map param = new HashMap<>(); + param.put("objCode", objCode); + param.put("attr", attr); + param.put("val", val); + param.put("ts", ts); + Map 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; + } } diff --git a/hzims-service/message-alarm-service/src/main/resources/application-dev.yml b/hzims-service/message-alarm-service/src/main/resources/application-dev.yml index 3dafff9..50a4ea7 100644 --- a/hzims-service/message-alarm-service/src/main/resources/application-dev.yml +++ b/hzims-service/message-alarm-service/src/main/resources/application-dev.yml @@ -1,6 +1,6 @@ #服务器端口 server: - port: 8201 + port: 8200 #数据源配置 #spring: diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/huosan/service/impl/HuoSanTargetServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/huosan/service/impl/HuoSanTargetServiceImpl.java index 090bd8a..41b52dd 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/huosan/service/impl/HuoSanTargetServiceImpl.java +++ b/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 public KpisVO KPIs(String riverCode) { LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(StationEntity::getType, HomePageConstant.HYDROPOWER); +// lambdaQueryWrapper.eq(StationEntity::getType, HomePageConstant.HYDROPOWER); if(!StringUtil.isEmpty(riverCode)){ lambdaQueryWrapper.eq(StationEntity::getBscd,riverCode); } @@ -132,7 +132,7 @@ public class HuoSanTargetServiceImpl implements HuoSanTargetService { public StationTargetVO target(String code) { // 站点查询 StationEntity station = stationService.getOne(Wrappers.lambdaQuery() - .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) +// .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) .eq(StationEntity::getCode,code)); if(ObjectUtil.isEmpty(station)){ return new StationTargetVO(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index 06e1ead..f9e8a08 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/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 stations = stationService.list(Wrappers.lambdaQuery() //.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) - .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) +// .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) ); if(CollectionUtil.isEmpty(stations)){ return; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalEarlyWarningServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalEarlyWarningServiceImpl.java index 6cef925..faa5df1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalEarlyWarningServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalEarlyWarningServiceImpl.java @@ -147,7 +147,6 @@ public class EcologicalEarlyWarningServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper(); wrapper.ge(EcologicalEarlyWarning::getZoologyTime, vo.getStartTime()); wrapper.lt(EcologicalEarlyWarning::getZoologyTime, vo.getEndTime()); - wrapper.eq(EcologicalEarlyWarning::getIsDeleted, 0); List list = this.list(wrapper); Map> stationMap = new HashMap<>(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalServiceImpl.java index 1637013..a98d6c4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/EcologicalServiceImpl.java +++ b/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); - // 第一次收到未达标数据发送预警(已废弃) -// if (standardNumber < totalNumber && stationRelation.getSendWarning() == UNSENT) { -// EcologicalEarlyWarning warning = new EcologicalEarlyWarning(); -// warning.setStationCode(stationRelation.getStationCode()); -// warning.setReach(false); -// warning.setDischarge(min); -// warning.setZoologyTime(end); -// warning.setWarning(EcologicalEarlyWarningService.low_soe); -// warning.setFlowValue(flowValue.toString()); -// warning.setWarningSource(0); -// -// BigDecimal rate = new BigDecimal(String.valueOf(standardRate * 100)); -// warning.setStandardRate(rate.setScale(2,BigDecimal.ROUND_HALF_DOWN) + "%"); -// -// warning.setDescs("生态流量预警:当前合格数据" + standardNumber + "条,应该合格数据" + totalNumber + "条,达标率" + warning.getStandardRate()); -// ecologicalEarlyWarningService.save(warning); -// -// LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); -// wrapper.set(StationRelation::getSendWarning, SENT); -// wrapper.eq(StationRelation::getId, stationRelation.getId()); -// stationRelationService.update(wrapper); -// -// // 发送短信 -//// sendMessage(station.getName(), warning.getDischarge().toString(), averageDaily.getAverageDailyFlow(), remainingHour, suggestFlowValue.toString(), stationRelation.getLowSoePhone()); -// // 发送APP消息推送 -// String content = station.getName() + "电站生态流量预警:核定流量" + warning.getDischarge() + "(m³/s),当前日均流量" -// + averageDaily.getAverageDailyFlow() + "(m³/s),建议生态流量后续" + remainingHour + "小时的实时流量值不低于" + suggestFlowValue + "(m³/s)"; -// sendAppMessage(content, stationRelation.getLowSoeUserId()); -// } + // 第一次收到未达标数据发送预警 + if (standardNumber < totalNumber && stationRelation.getSendWarning() == UNSENT) { + EcologicalEarlyWarning warning = new EcologicalEarlyWarning(); + warning.setStationCode(stationRelation.getStationCode()); + warning.setReach(false); + warning.setDischarge(min); + warning.setZoologyTime(end); + warning.setWarning(EcologicalEarlyWarningService.low_soe); + warning.setFlowValue(flowValue.toString()); + warning.setWarningSource(0); + + BigDecimal rate = new BigDecimal(String.valueOf(standardRate * 100)); + warning.setStandardRate(rate.setScale(2,BigDecimal.ROUND_HALF_DOWN) + "%"); + + warning.setDescs("生态流量预警:当前合格数据" + standardNumber + "条,应该合格数据" + totalNumber + "条,达标率" + warning.getStandardRate()); + ecologicalEarlyWarningService.save(warning); + + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); + wrapper.set(StationRelation::getSendWarning, SENT); + wrapper.eq(StationRelation::getId, stationRelation.getId()); + stationRelationService.update(wrapper); + + // 发送短信 +// sendMessage(station.getName(), warning.getDischarge().toString(), averageDaily.getAverageDailyFlow(), remainingHour, suggestFlowValue.toString(), stationRelation.getLowSoePhone()); + // 发送APP消息推送 + String content = station.getName() + "电站生态流量预警:核定流量" + warning.getDischarge() + "(m³/s),当前日均流量" + + averageDaily.getAverageDailyFlow() + "(m³/s),建议生态流量后续" + remainingHour + "小时的实时流量值不低于" + suggestFlowValue + "(m³/s)"; + sendAppMessage(content, stationRelation.getLowSoeUserId()); + } // 第一次未达标数据条数超过15条发送告警 if (totalNumber - standardNumber >= 15 && stationRelation.getSendSoe() == UNSENT) { EcologicalEarlyWarning warning = new EcologicalEarlyWarning(); @@ -547,9 +547,9 @@ public class EcologicalServiceImpl implements EcologicalService { Map params = new HashMap<>(); params.put("station", station); params.put("discharge", discharge); - params.put("avgVal", avgValue); + params.put("avg_value", avgValue); params.put("number", remainingHour); - params.put("flowVal", flowValue); + params.put("flow_value", flowValue); R smsResponseR = smsClient.sendMessage("200000", flowWarningTemplateCode, JSONObject.toJSONString(params), phone); if (Func.isNotEmpty(smsResponseR) && smsResponseR.isSuccess()) { return SENT; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index 5224748..3b75d33 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/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.StationMapper; 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.vo.*; import com.hnac.hzims.operational.station.wrapper.StationWrapper; @@ -1172,7 +1171,7 @@ public class StationServiceImpl extends BaseServiceImpl flows = dto.getHydroAverageDailyFlows(); - HorizontalCellStyleStrategy writeCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, blackFontStyle); EasyExcel.write(response.getOutputStream()) .registerWriteHandler(writeCellStyleStrategy) - .registerWriteHandler(new CustomColumnWidthStyleStrategy(8,flows.size()+8)) + .registerWriteHandler(new SimpleColumnWidthStyleStrategy(10)) .registerWriteHandler(new CustomCellWriteHandle(datas.size()+2)) .head(getHead(datas)) .autoCloseStream(Boolean.FALSE) @@ -1220,17 +1215,17 @@ public class StationServiceImpl extends BaseServiceImpl flows = dto.getHydroAverageDailyFlows(); flows.stream().forEach(hydroAverageDailyFlow->{ String time = hydroAverageDailyFlow.getTm(); head0.add(time); }); - head0.add("考核天数(天)"); - head0.add("免考天数(天)"); - head0.add("合格天数(天)"); - head0.add("合格率(%)"); + head0.add("考核天数(天)"); + head0.add("免考天数"); + head0.add("合格天数(天)"); + head0.add("合格率(%)"); list.add(head0); for (int i = 0; i < datas.size(); i++) { diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java index 6b8ad6a..394dda1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java @@ -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.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Lists; import com.hnac.hzims.operational.config.HikPathConfiguration; import com.hnac.hzims.operational.station.StationConstants; @@ -68,10 +67,8 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl { if(ObjectUtil.isNotEmpty(stationVideoTypeEntity.getIsHikvideo()) && stationVideoTypeEntity.getIsHikvideo() == 1){ try{ - stationVideoTypeEntity.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewURL(stationVideoTypeEntity.getVideoHost(), - stationVideoTypeEntity.getAppKey(),stationVideoTypeEntity.getAppSecret() - ,stationVideoTypeEntity.getPointCode(), DictCache.getValue(StationConstants.STATION_VIDEO_TYPE_CODE, - stationVideoTypeEntity.getType()),0)); + stationVideoTypeEntity.setLiveSourceAddress(ArtemisPostUtils.getCameraPreviewURL(StationConstants.STATION_VIDEO_HOST,StationConstants.APP_KEY,StationConstants.APP_SECRET + ,stationVideoTypeEntity.getPointCode(), DictCache.getValue(StationConstants.STATION_VIDEO_TYPE_CODE,stationVideoTypeEntity.getType()),0)); ids.add(stationVideoTypeEntity.getId()); } catch (Exception e){ @@ -130,9 +127,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl result = this.page(Condition.getPage(query),queryWrapper); - if (CollectionUtil.isNotEmpty(result.getRecords())){ for (StationVideoTypeEntity video : result.getRecords()) { try { @@ -143,7 +138,6 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl{ 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) { log.error("视频点位【"+item.getPointCode()+"】获取地址失败"); @@ -345,7 +339,7 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl{ 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) { log.error("视频点位【"+item.getPointCode()+"】获取地址失败"); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/ArtemisPostUtils.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/ArtemisPostUtils.java index 8452a1c..2d3ea9c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/ArtemisPostUtils.java +++ b/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; 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.config.ArtemisConfig; -import org.springblade.core.tool.utils.StringUtil; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.concurrent.TimeUnit; public class ArtemisPostUtils { 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_SECRET = "vRIMl4bNXQTy2TBKE9JZ"; @@ -195,70 +191,12 @@ public class ArtemisPostUtils { return list; }*/ - //转换地址内部存储 - private static Cache 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 path = new HashMap(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) { - - String flvUrl=loadingCache.getIfPresent(cameraIndexCode); - if(StringUtil.isNotBlank(flvUrl)){ - return flvUrl; - } - - + public static String getCameraPreviewFlvURL(String host, String appKey, String appSecret, String cameraIndexCode, int streamType) { ArtemisConfig.host = host; ArtemisConfig.appKey = appKey; ArtemisConfig.appSecret = appSecret; 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 path = new HashMap(2) { { this.put("https://", getCamsApi); @@ -266,12 +204,10 @@ public class ArtemisPostUtils { }; String contentType = "application/json"; JSONObject jsonBody = new JSONObject(); - jsonBody.put("indexCode", cameraIndexCode); + jsonBody.put("cameraIndexCode", cameraIndexCode); jsonBody.put("streamType", 0); jsonBody.put("protocol", "httpflv"); jsonBody.put("transmode", 1); - jsonBody.put("expireTime", 2592000); - String body = jsonBody.toJSONString(); 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); json = JSONObject.parseObject(json.getString("data")); String url = json.getString("url"); - loadingCache.put(cameraIndexCode,url); return url; } } -// public static void main(String[] args) { -// System.out.println(getCameraPreviewURL(HOST,APP_KEY,APP_SECRET,"ffa8e46a79054f699b267eed6031c9ce","rtsp",1)); -// } - } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/CustomCellWriteHandle.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/CustomCellWriteHandle.java index cdaa661..7b786c4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/utils/CustomCellWriteHandle.java +++ b/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(); Font font = cell.getSheet().getWorkbook().createFont(); font.setFontName("宋体"); - font.setFontHeightInPoints((short) 12); + font.setFontHeightInPoints((short) 13); font.setBold(true); cellStyle.setFont(font); cellStyle.setAlignment(HorizontalAlignment.CENTER); diff --git a/hzims-service/safeproduct/src/main/resources/application-dev.yml b/hzims-service/safeproduct/src/main/resources/application-dev.yml index 5c598c2..9010cbd 100644 --- a/hzims-service/safeproduct/src/main/resources/application-dev.yml +++ b/hzims-service/safeproduct/src/main/resources/application-dev.yml @@ -1,6 +1,6 @@ #服务器端口 server: - port: 8202 + port: 8200 #数据源配置 #spring: diff --git a/hzims-service/video-image/pom.xml b/hzims-service/video-image/pom.xml index 6b55662..c7e85d8 100644 --- a/hzims-service/video-image/pom.xml +++ b/hzims-service/video-image/pom.xml @@ -60,9 +60,5 @@ com.hnac.hzinfo.data hzinfo-data-sdk - - com.github.ben-manes.caffeine - caffeine - \ No newline at end of file diff --git a/hzims-service/video-image/src/main/java/com/hnac/hzims/videoimage/utils/ArtemisPostUtils.java b/hzims-service/video-image/src/main/java/com/hnac/hzims/videoimage/utils/ArtemisPostUtils.java index be13910..29f382e 100644 --- a/hzims-service/video-image/src/main/java/com/hnac/hzims/videoimage/utils/ArtemisPostUtils.java +++ b/hzims-service/video-image/src/main/java/com/hnac/hzims/videoimage/utils/ArtemisPostUtils.java @@ -6,15 +6,11 @@ package com.hnac.hzims.videoimage.utils; 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.config.ArtemisConfig; -import org.springblade.core.tool.utils.StringUtil; import java.util.HashMap; import java.util.Map; -import java.util.concurrent.TimeUnit; public class ArtemisPostUtils { 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) { - ArtemisConfig.host = host; ArtemisConfig.appKey = appKey; ArtemisConfig.appSecret = appSecret; @@ -78,12 +72,8 @@ public class ArtemisPostUtils { JSONObject json = JSONObject.parseObject(result); json = JSONObject.parseObject(json.getString("data")); if (json != null){ - String url = json.getString("url"); - return url; - + return json.getString("url"); } - - } return null; } @@ -92,7 +82,8 @@ public class ArtemisPostUtils { ArtemisConfig.host = host; ArtemisConfig.appKey = appKey; ArtemisConfig.appSecret = appSecret; - + String ARTEMIS_PATH = "/artemis"; + String getCamsApi = "/artemis/api/video/v1/ptzs/controlling"; final Map path = new HashMap(2) { { this.put("https://", "/artemis/api/video/v1/ptzs/controlling"); diff --git a/hzims-service/water-quality/src/main/resources/application-dev.yml b/hzims-service/water-quality/src/main/resources/application-dev.yml index e802fac..50a4ea7 100644 --- a/hzims-service/water-quality/src/main/resources/application-dev.yml +++ b/hzims-service/water-quality/src/main/resources/application-dev.yml @@ -1,6 +1,6 @@ #服务器端口 server: - port: 8205 + port: 8200 #数据源配置 #spring: diff --git a/hzims-service/water-rain/src/main/resources/application-dev.yml b/hzims-service/water-rain/src/main/resources/application-dev.yml index 04c45ad..50a4ea7 100644 --- a/hzims-service/water-rain/src/main/resources/application-dev.yml +++ b/hzims-service/water-rain/src/main/resources/application-dev.yml @@ -1,6 +1,6 @@ #服务器端口 server: - port: 8203 + port: 8200 #数据源配置 #spring: diff --git a/hzims-service/weather/src/main/resources/application-dev.yml b/hzims-service/weather/src/main/resources/application-dev.yml index 3781c00..56b22dd 100644 --- a/hzims-service/weather/src/main/resources/application-dev.yml +++ b/hzims-service/weather/src/main/resources/application-dev.yml @@ -1,6 +1,6 @@ #服务器端口 server: - port: 8300 + port: 8200 #数据源配置 spring: