diff --git a/hzims-service-api/alarm-api/pom.xml b/hzims-service-api/alarm-api/pom.xml new file mode 100644 index 0000000..d2a3b9b --- /dev/null +++ b/hzims-service-api/alarm-api/pom.xml @@ -0,0 +1,13 @@ + + + + hzims-service-api + com.hnac.hzims + 4.0.0-SNAPSHOT + + 4.0.0 + alarm-api + jar + diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/constants/AlarmConstants.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/constants/AlarmConstants.java new file mode 100644 index 0000000..190e1d0 --- /dev/null +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/constants/AlarmConstants.java @@ -0,0 +1,9 @@ +package com.hnac.hzims.alarm.constants; + +/** + * @author ysj + */ +public interface AlarmConstants { + + public final static String APP_NAME = "hzims-alarm"; +} diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigDetailEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigDetailEntity.java new file mode 100644 index 0000000..f3106bf --- /dev/null +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigDetailEntity.java @@ -0,0 +1,60 @@ +package com.hnac.hzims.alarm.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; + + +/** + * @author ysj + */ +@Data +@TableName("hzimsalarmconfigdetail") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "站点告警配置详情对象", description = "站点告警配置详情对象") +public class AlarmConfigDetailEntity extends TenantEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "告警配置ID") + private Long strategyId; + + @ApiModelProperty(value = "告警大类") + private String alarmType; + + @ApiModelProperty(value = "告警子类") + private String alarmChiledType; + + @ApiModelProperty(value = "告警内容") + private String alarmContext; + + @ApiModelProperty(value = "告警监测点") + private String alarmPoint; + + @ApiModelProperty(value = "是否集中监控右侧列表展示 : 0-展示 1-不展示") + private Integer isRightTabulation; + + @ApiModelProperty(value = "是否集中监控弹窗展示 : 0-展示 1-不展示") + private Integer isShowAlert; + + @ApiModelProperty(value = "是否集中监控铃铛展示 : 0-展示 1-不展示") + private Integer isSmallBell; + + @ApiModelProperty(value = "是否集中监控遮罩展示 : 0-展示 1-不展示") + private Integer isMask; + + @ApiModelProperty(value = "是否语音播报 : 0-播报 1-不播报") + private Integer isBroadcast; + + @ApiModelProperty(value = "是否进行平台消息推送 : 0-推送 1-不推送") + private Integer isPlatformMessage; + + @ApiModelProperty(value = "是否短信推送 :0-推送 1-不推送") + private Integer isShortMessage; + + @ApiModelProperty(value = "是否微信公众号消息推送 :0-推送 1-不推送") + private Integer isWxMessage; +} \ No newline at end of file diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigEntity.java new file mode 100644 index 0000000..320fef5 --- /dev/null +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmConfigEntity.java @@ -0,0 +1,29 @@ +package com.hnac.hzims.alarm.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; + + +/** + * @author ysj + */ +@Data +@TableName("hzims_alarm_config") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "告警配置对象", description = "告警配置") +public class AlarmConfigEntity extends TenantEntity { + + private static final long serialVersionUID = 1L; + @ApiModelProperty(value = "站点编号") + private String stationId; + + @ApiModelProperty(value = "站点名称") + private String stationName; + + @ApiModelProperty(value = "是否启用 :0-启用 1-不启用") + private Integer isEnable; +} \ No newline at end of file diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmEntity.java new file mode 100644 index 0000000..2e008d1 --- /dev/null +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmEntity.java @@ -0,0 +1,68 @@ +package com.hnac.hzims.alarm.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tenant.mp.TenantEntity; + +import java.util.Date; + + +/** + * @author ysj + */ +@Data +@TableName("hzims_alarm") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "告警对象", description = "各告警数据源保存对象") +public class AlarmEntity extends TenantEntity { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "站点编号") + private String stationId; + + @ApiModelProperty(value = "站点名称") + private String stationName; + + @ApiModelProperty(value = "设备编码") + private String deviceCode; + + @ApiModelProperty(value = "设备名称") + private String deviceName; + + @ApiModelProperty(value = "告警ID") + private String alarmId; + + @ApiModelProperty(value = "告警类型 :0- HZ3000告警 1 -等级告警 2 -条件告警 3-FDP智能预警") + private Integer alarmSource; + + @ApiModelProperty(value = "告警子类") + private Integer alarmType; + + @ApiModelProperty(value = "告警属性标识") + private String alarmSignage; + + @ApiModelProperty(value = "告警内容") + private String alarmContext; + + @ApiModelProperty(value = "告警状态") + private Integer alarmStatus; + + @ApiModelProperty(value = "告警等级") + private Integer alarmLevel; + + @ApiModelProperty(value = "告警动作数值") + private String alarmValue; + + @ApiModelProperty(value = "告警数量") + private Integer alarmCount; + + @ApiModelProperty(value = "告警时间") + private Date alarmTime; + + @ApiModelProperty(value = "监测点") + private Date realId; +} \ No newline at end of file diff --git a/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmHistoryEntity.java b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmHistoryEntity.java new file mode 100644 index 0000000..a8ed19a --- /dev/null +++ b/hzims-service-api/alarm-api/src/main/java/com/hnac/hzims/alarm/entity/AlarmHistoryEntity.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.alarm.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; + + +/** + * @author ysj + */ +@Data +@TableName("hzims_alarm_history") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "告警对象", description = "各告警数据源保存对象") +public class AlarmHistoryEntity extends AlarmEntity { + + private static final long serialVersionUID = 1L; + +} \ No newline at end of file diff --git a/hzims-service-api/pom.xml b/hzims-service-api/pom.xml index 397a172..531ec3f 100644 --- a/hzims-service-api/pom.xml +++ b/hzims-service-api/pom.xml @@ -27,6 +27,7 @@ weather-api common-api middle-api + alarm-api diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java index 881d73b..f1c67a4 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpMonitorServiceImpl.java @@ -640,11 +640,11 @@ public class FdpMonitorServiceImpl extends BaseServiceImpl + + + com.hnac.hzims + hzims-service + 4.0.0-SNAPSHOT + + 4.0.0 + hzims-alarm + jar + + + 1.8 + UTF-8 + UTF-8 + 2.6.13 + 1.9.6 + + + + + org.springblade + blade-common + + + + org.springblade + blade-core-boot + + + org.springblade + blade-starter-redis + + + + + + + org.springblade + blade-starter-redis + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + io.lettuce + lettuce-core + + + + + + + redis.clients + jedis + + + + org.springblade + blade-starter-swagger + + + org.springblade + blade-core-test + test + + + org.springblade + blade-core-auto + provided + + + + + + com.baomidou + mybatis-plus-generator + + + + + org.apache.velocity + velocity-engine-core + 2.2 + + + + + + com.github.xiaoymin + swagger-bootstrap-ui + ${swagger-bootstrap-ui.version} + + + com.hnac.hzims + alarm-api + 4.0.0-SNAPSHOT + compile + + + + + + ${project.name}-${project.version} + + + com.spotify + dockerfile-maven-plugin + + ${docker.username} + ${docker.password} + ${docker.registry.url}/${docker.namespace}/${project.artifactId} + ${project.version} + true + + target/${project.build.finalName}.jar + + false + + + + + diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/AlarmApplication.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/AlarmApplication.java new file mode 100644 index 0000000..9e71d7b --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/AlarmApplication.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.alarm; + +import com.hnac.hzims.alarm.constants.AlarmConstants; +import org.springblade.core.cloud.feign.EnableBladeFeign; +import org.springblade.core.launch.BladeApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.client.SpringCloudApplication; +import org.springframework.context.annotation.ComponentScan; + +import javax.annotation.Resource; + +/** + * @author ysj + */ +@EnableBladeFeign +@SpringCloudApplication +@ComponentScan(basePackages = {"com.hnac.hzims.alarm.*"}) +@Resource +public class AlarmApplication extends SpringBootServletInitializer { + public static void main(String[] args) { + BladeApplication.run(AlarmConstants.APP_NAME, AlarmApplication.class, args); + } + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + return BladeApplication.createSpringApplicationBuilder(builder, AlarmConstants.APP_NAME, AlarmApplication.class); + } + +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigController.java new file mode 100644 index 0000000..cf60b69 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigController.java @@ -0,0 +1,73 @@ +package com.hnac.hzims.alarm.config.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.alarm.entity.AlarmConfigEntity; +import com.hnac.hzims.alarm.config.service.AlarmConfigService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.validation.Valid; +import java.util.Map; + +/** + * @author ysj + */ +@RestController +@AllArgsConstructor +@RequestMapping("/alarm/config") +@Api(value = "告警配置", tags = "告警配置") +public class AlarmConfigController extends BladeController { + + private final AlarmConfigService alarmConfigService; + + @PostMapping("/save") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "新增", notes = "传入AlarmConfigEntity对象") + public R save(@Valid @RequestBody AlarmConfigEntity entity) { + return R.status(alarmConfigService.save(entity)); + } + + @PostMapping("/update") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "修改", notes = "传入AlarmConfigEntity对象") + public R update(@Valid @RequestBody AlarmConfigEntity entity) { + return R.status(alarmConfigService.updateById(entity)); + } + + + @PostMapping("/remove") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "逻辑删除", notes = "传入ids") + public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { + return R.status(alarmConfigService.deleteLogic(Func.toLongList(ids))); + } + + @GetMapping("/list") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "分页", notes = "传入em_model_param") + public R> list(@ApiIgnore @RequestParam Map params, Query query) { + QueryWrapper queryWrapper = Condition.getQueryWrapper( params, AlarmConfigEntity.class); + IPage pages = alarmConfigService.page(Condition.getPage(query), queryWrapper); + return R.data(pages); + } + + @GetMapping("/detail") + @ApiOperationSupport(order = 5) + @ApiOperation(value = "详情", notes = "传入em_model_param") + public R detail(AlarmConfigEntity entity) { + AlarmConfigEntity detail = alarmConfigService.getOne(Condition.getQueryWrapper(entity)); + return R.data(detail); + } + +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java new file mode 100644 index 0000000..959a73d --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java @@ -0,0 +1,73 @@ +package com.hnac.hzims.alarm.config.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity; +import com.hnac.hzims.alarm.config.service.AlarmConfigDetailService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.Func; +import org.springframework.web.bind.annotation.*; +import springfox.documentation.annotations.ApiIgnore; + +import javax.validation.Valid; +import java.util.Map; + +/** + * @author ysj + */ +@RestController +@AllArgsConstructor +@RequestMapping("/alarm/configDetail") +@Api(value = "告警配置", tags = "告警配置") +public class AlarmConfigDetailController extends BladeController { + + private final AlarmConfigDetailService detailService; + + @PostMapping("/save") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "新增", notes = "传入AlarmConfigEntity对象") + public R save(@Valid @RequestBody AlarmConfigDetailEntity entity) { + return R.status(detailService.save(entity)); + } + + @PostMapping("/update") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "修改", notes = "传入AlarmConfigEntity对象") + public R update(@Valid @RequestBody AlarmConfigDetailEntity entity) { + return R.status(detailService.updateById(entity)); + } + + + @PostMapping("/remove") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "逻辑删除", notes = "传入ids") + public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { + return R.status(detailService.deleteLogic(Func.toLongList(ids))); + } + + @GetMapping("/list") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "分页", notes = "传入em_model_param") + public R> list(@ApiIgnore @RequestParam Map params, Query query) { + QueryWrapper queryWrapper = Condition.getQueryWrapper( params, AlarmConfigDetailEntity.class); + IPage pages = detailService.page(Condition.getPage(query), queryWrapper); + return R.data(pages); + } + + @GetMapping("/detail") + @ApiOperationSupport(order = 5) + @ApiOperation(value = "详情", notes = "传入em_model_param") + public R detail(AlarmConfigDetailEntity entity) { + AlarmConfigDetailEntity detail = detailService.getOne(Condition.getQueryWrapper(entity)); + return R.data(detail); + } + +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/mapper/AlarmConfigDetailMapper.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/mapper/AlarmConfigDetailMapper.java new file mode 100644 index 0000000..adc3877 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/mapper/AlarmConfigDetailMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.alarm.config.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity; + +/** + * @author ysj + */ +public interface AlarmConfigDetailMapper extends BaseMapper { + + +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/mapper/AlarmConfigMapper.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/mapper/AlarmConfigMapper.java new file mode 100644 index 0000000..104bbd6 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/mapper/AlarmConfigMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.alarm.config.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.alarm.entity.AlarmConfigEntity; + +/** + * @author ysj + */ +public interface AlarmConfigMapper extends BaseMapper { + + +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java new file mode 100644 index 0000000..f97d9d6 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigDetailService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.alarm.config.service; + +import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface AlarmConfigDetailService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigService.java new file mode 100644 index 0000000..e752cee --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/AlarmConfigService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.alarm.config.service; + +import com.hnac.hzims.alarm.entity.AlarmConfigEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface AlarmConfigService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java new file mode 100644 index 0000000..944a7e5 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.alarm.config.service.impl; + +import com.hnac.hzims.alarm.config.mapper.AlarmConfigDetailMapper; +import com.hnac.hzims.alarm.config.service.AlarmConfigDetailService; +import com.hnac.hzims.alarm.entity.AlarmConfigDetailEntity; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@AllArgsConstructor +@Service +@Slf4j +public class AlarmConfigDetailServiceImpl extends BaseServiceImpl implements AlarmConfigDetailService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java new file mode 100644 index 0000000..5943ecb --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.alarm.config.service.impl; + +import com.hnac.hzims.alarm.config.mapper.AlarmConfigMapper; +import com.hnac.hzims.alarm.config.service.AlarmConfigService; +import com.hnac.hzims.alarm.entity.AlarmConfigEntity; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@AllArgsConstructor +@Service +@Slf4j +public class AlarmConfigServiceImpl extends BaseServiceImpl implements AlarmConfigService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHistoryMapper.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHistoryMapper.java new file mode 100644 index 0000000..5745262 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmHistoryMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.alarm.show.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.alarm.entity.AlarmHistoryEntity; + +/** + * @author ysj + */ +public interface AlarmHistoryMapper extends BaseMapper { + + +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java new file mode 100644 index 0000000..7e9d343 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/mapper/AlarmMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.alarm.show.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.alarm.entity.AlarmEntity; + +/** + * @author ysj + */ +public interface AlarmMapper extends BaseMapper { + + +} diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHistoryService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHistoryService.java new file mode 100644 index 0000000..fe78e50 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHistoryService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.alarm.show.service; + +import com.hnac.hzims.alarm.entity.AlarmHistoryEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface AlarmHistoryService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java new file mode 100644 index 0000000..79c04e2 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.alarm.show.service; + +import com.hnac.hzims.alarm.entity.AlarmEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface AlarmService extends BaseService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHistoryServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHistoryServiceImpl.java new file mode 100644 index 0000000..166a41f --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHistoryServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.alarm.show.service.impl; + +import com.hnac.hzims.alarm.entity.AlarmHistoryEntity; +import com.hnac.hzims.alarm.show.mapper.AlarmHistoryMapper; +import com.hnac.hzims.alarm.show.service.AlarmHistoryService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@AllArgsConstructor +@Service +@Slf4j +public class AlarmHistoryServiceImpl extends BaseServiceImpl implements AlarmHistoryService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java new file mode 100644 index 0000000..3d87951 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.alarm.show.service.impl; + +import com.hnac.hzims.alarm.entity.AlarmEntity; +import com.hnac.hzims.alarm.show.mapper.AlarmMapper; +import com.hnac.hzims.alarm.show.service.AlarmService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@AllArgsConstructor +@Service +@Slf4j +public class AlarmServiceImpl extends BaseServiceImpl implements AlarmService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/resources/application.yml b/hzims-service/hzims-alarm/src/main/resources/application.yml new file mode 100644 index 0000000..180d5d3 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/resources/application.yml @@ -0,0 +1,41 @@ +#服务器端口 +server: + port: 8400 + + +#数据源配置 +spring: + main: + allow-bean-definition-overriding: true + #排除DruidDataSourceAutoConfigure + autoconfigure: + exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure + datasource: + url: jdbc:mysql://192.168.1.20:3576/dev_hzims_middle?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true + username: root + password: 123 + + +#mybatis-plus配置 +mybatis-plus: + mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.hnac.hzims.**.entity + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + +#swagger扫描路径配置 +swagger: + base-packages: + - org.springbalde + - com.hnac + +blade: + data-scope: + enabled: false + lock: + enabled: true + address: redis://192.168.1.20:3577 + password: 1qaz2WSX@redis + database: 0 + ssl: false diff --git a/hzims-service/hzims-alarm/src/main/resources/bootstrap.yml b/hzims-service/hzims-alarm/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..0abf99a --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/resources/bootstrap.yml @@ -0,0 +1,7 @@ +spring: + cloud: + nacos: + discovery: + server-addr: 175.6.40.67:10042 + + diff --git a/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmConfigDetatilMapper.xml b/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmConfigDetatilMapper.xml new file mode 100644 index 0000000..7604d5f --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmConfigDetatilMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmConfigMapper.xml b/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmConfigMapper.xml new file mode 100644 index 0000000..93ea6b4 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmConfigMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmHistoryMapper.xml b/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmHistoryMapper.xml new file mode 100644 index 0000000..6d4fd62 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmHistoryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmMapper.xml b/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmMapper.xml new file mode 100644 index 0000000..3fd4b39 --- /dev/null +++ b/hzims-service/hzims-alarm/src/main/resources/mapper/AlarmMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-alarm/src/test/java/com/hnac/hzims/alarm/MiddleApplicationTests.java b/hzims-service/hzims-alarm/src/test/java/com/hnac/hzims/alarm/MiddleApplicationTests.java new file mode 100644 index 0000000..ffa0e00 --- /dev/null +++ b/hzims-service/hzims-alarm/src/test/java/com/hnac/hzims/alarm/MiddleApplicationTests.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.alarm; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest(classes = AlarmApplication.class) +class AlarmApplicationTests { + + @Test + void contextLoads() { + + System.out.println("1"); + } + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index fc5b1be..72f3c2f 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -23,6 +23,7 @@ import com.hnac.hzims.scheduled.service.operation.station.StationAttributeServic import com.hnac.hzims.scheduled.service.operation.station.StationService; import com.hnac.hzims.scheduled.service.operation.plate.DataService; import com.hnac.hzinfo.datasearch.PointData; +import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; @@ -37,6 +38,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.MapUtils; import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; @@ -81,6 +83,8 @@ public class RealTargetServiceImpl implements RealTargetService { private final IHistoryDataSearchClient historyDataSearchClient; + private final IAnalyseDataSearchClient analyseDataSearchClient; + @Value("${hzims.equipment.emInfo.emInfoList}") public String device_cache_cofig_final; @@ -374,6 +378,15 @@ public class RealTargetServiceImpl implements RealTargetService { } List list = new ArrayList<>(); modelList.forEach(item -> { + List multiAnalyzeCodePOList = new ArrayList<>(); + MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); + multiAnalyzeCodePO.setDeviceCode(item.getInstanceCode()); + multiAnalyzeCodePO.setSignages(Collections.singletonList(HomePageConstant.FRONT_WATER_LEVEL)); + multiAnalyzeCodePOList.add(multiAnalyzeCodePO); + R> result = analyseDataSearchClient.getAnalyzeCodeBySignages(multiAnalyzeCodePOList); + if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ + return; + } WaterLevelVo waterLevelVo = new WaterLevelVo(); waterLevelVo.setStationCode(item.getStationId()); // 前水位 @@ -382,6 +395,9 @@ public class RealTargetServiceImpl implements RealTargetService { // 后水位 double rearWaterLevel = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.REAR_WATER_LEVEL); waterLevelVo.setRearWaterLevel(rearWaterLevel); + // 下泄流量 + double dischargeFlow = this.getWaterLevel(item.getInstanceCode(),HomePageConstant.DISCHARGE_FLOW); + waterLevelVo.setDischargeFlow(dischargeFlow); // 前水位当日曲线 Map frontCurveMap = this.getWaterLevelMap(item.getInstanceCode(),HomePageConstant.FRONT_WATER_LEVEL); waterLevelVo.setFrontCurveMap(frontCurveMap); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java index 34e318e..cd4979d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java @@ -39,6 +39,7 @@ import java.util.List; @RequestMapping("/abnormal/alarm") public class AbnormalAlarmController extends BladeController { + private final HistoryAbnormalAlarmService service; /** * 统计通讯中断时间 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java index b1be623..dd0c672 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java @@ -73,7 +73,7 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl historys = historyAbnormalAlarmService.list(Wrappers.lambdaQuery() .in(HistoryAbnormalAlarmEntity::getAlarmId,list.stream().map(SoeData::getId).collect(Collectors.toList())) ); - Set explainSet = new HashSet<>(); - list.forEach(item->{ + List explains = new ArrayList<>(); + for(SoeData item: list){ if(CollectionUtil.isNotEmpty(historys) && historys.stream().map(HistoryAbnormalAlarmEntity::getAlarmId).collect(Collectors.toList()).contains(item.getId())){ return; } - if(explainSet.contains(item.getSoeExplain())){ - return; - } HistoryAbnormalAlarmEntity entity = new HistoryAbnormalAlarmEntity(); String stationName = Optional.ofNullable(stations.stream().filter(o-> o.getCode().equals(item.getStation())).collect(Collectors.toList())).map(o->o.get(0).getName()).orElse(null); entity.setAlarmId(item.getId()); entity.setStationId(item.getStation()); entity.setStationName(stationName); entity.setRealId(item.getRealId()); - entity.setSoeExplain(item.getSoeExplain()); + if(AbnormalAlarmConstant.INTERRUPT_LIST.contains(entity.getType())){ + entity.setSoeExplain(stationName+ ":" + item.getSoeExplain()); + }else{ + entity.setSoeExplain(item.getSoeExplain()); + } entity.setType(item.getSoeType()); entity.setStartTime(item.getTs()); if(AbnormalAlarmConstant.ABNORMAL_STATUS.equals(item.getSoeAlarmType())){ entity.setStatus(1); }else{ - entity.setStatus(1); + entity.setStatus(0); } this.historyAbnormalAlarmService.save(entity); - // 相同告警只允许添加一次,发送一次消息 - explainSet.add(item.getSoeExplain()); + if(explains.contains(entity.getSoeExplain())){ + continue; + }else{ + // 相同告警只允许添加一次,发送一次消息 + explains.add(item.getSoeExplain()); + } // 发送消息 - this.sendAlarmMessage(Collections.singletonList(entity),stations); + this.sendAlarmMessage(entity,stations); // 推送短信: 只推送拥有项目经理角色用户 - - }); + }; } /** * 告警消息推送 - * @param entitys + * @param entity */ - private void sendAlarmMessage(List entitys,List stations) { - if(CollectionUtil.isEmpty(entitys)){ + private void sendAlarmMessage(HistoryAbnormalAlarmEntity entity,List stations) { + if(StringUtil.isEmpty(entity.getStationId())){ return; } - // 告警等级 :事故、数据中断 - List alarms = entitys.stream().filter(entity -> AbnormalAlarmConstant.SEND_MESSSAGE_TYPE_LIST.contains(entity.getType())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(alarms)){ + List depts = stations.stream().filter(station -> station.getCode().equals(entity.getStationId())).map(StationEntity::getRefDept).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(depts)){ return; } - // 查询站点用户 - entitys.forEach(entity->{ - if(StringUtil.isEmpty(entity.getStationId())){ - return; - } - List depts = stations.stream().filter(station -> station.getCode().equals(entity.getStationId())).map(StationEntity::getRefDept).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(depts)){ - return; - } - List users = this.parentAuthUser(depts.get(0)); - if(CollectionUtil.isEmpty(users)){ - log.error("alarmmessagestation {} user is null",entity.getStationId()); - return; - } - BusinessMessageDTO message = new BusinessMessageDTO(); - message.setDeptId(depts.get(0)); - message.setBusinessClassify("warning"); - message.setUserIds(users.stream().map(o->String.valueOf(o.getId())).distinct().collect(Collectors.joining(","))); - message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); - message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); - message.setTaskId(entity.getId()); - message.setTenantId("200000"); - message.setContent(entity.getSoeExplain()); - R deptName = sysClient.getDeptName(depts.get(0)); - if (deptName.isSuccess()) { - message.setDeptName(deptName.getData()); - } - User admin = userClient.userByAccount("200000", "admin").getData(); - message.setCreateUser(admin.getId()); - messageClient.sendAppAndWsMsgByUsers(message); - }); + List users = this.parentAuthUser(depts.get(0)); + if(CollectionUtil.isEmpty(users)){ + log.error("alarmmessagestation {} user is null",entity.getStationId()); + return; + } + BusinessMessageDTO message = new BusinessMessageDTO(); + message.setDeptId(depts.get(0)); + message.setBusinessClassify("warning"); + message.setUserIds(users.stream().map(o->String.valueOf(o.getId())).distinct().collect(Collectors.joining(","))); + message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); + message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); + message.setTaskId(entity.getId()); + message.setTenantId("200000"); + message.setContent(entity.getSoeExplain()); + R deptName = sysClient.getDeptName(depts.get(0)); + if (deptName.isSuccess()) { + message.setDeptName(deptName.getData()); + } + User admin = userClient.userByAccount("200000", "admin").getData(); + message.setCreateUser(admin.getId()); + messageClient.sendAppAndWsMsgByUsers(message); } /** diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java index 27e4d92..97411f8 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java @@ -733,7 +733,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl()); + String result = fdpMonitorClient.getFaultList(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); if(StringUtil.isEmpty(result)){ return null; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java index 158390e..ddd00d1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java @@ -2,6 +2,7 @@ package com.hnac.hzims.operational.ecology.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; import com.hnac.hzims.operational.ecology.entity.EcologyFlowDataEntity; import com.hnac.hzims.operational.ecology.entity.EcologyFlowStationEntity; @@ -12,6 +13,7 @@ import com.hnac.hzims.operational.ecology.vo.*; import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.service.IAnalyseDataService; import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; +import com.hnac.hzims.operational.main.vo.GenerationPowerVo; import com.hnac.hzims.operational.main.vo.HydropowerUnitRealVo; import com.hnac.hzims.operational.main.vo.HydropowerUnitTargetVo; import com.hnac.hzims.operational.main.vo.WaterLevelVo; @@ -187,7 +189,6 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl targetList = (List) redisTemplate.opsForValue().get(load_hydropower_unit_target_key); // 所有设备 - List deviceList = maintenanceTaskService.getEmInfoList(); return stations.stream().map(item -> { StationVo station = new StationVo(); station.setStationId(item.getCode()); @@ -243,7 +244,6 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl validRealList = realList.stream().filter(o-> null != station.getRefDept() && station.getRefDept().equals(o.getDeptId())).collect(Collectors.toList()); // 有效站点机组指标数据 - List validTargetList = targetList.stream().filter(o-> null != station.getRefDept() && station.getRefDept().equals(o.getDeptId())).collect(Collectors.toList()); List list = new ArrayList<>(); for(HydropowerUnitRealVo real : validRealList){ DeviceVo device= new DeviceVo(); diff --git a/hzims-service/pom.xml b/hzims-service/pom.xml index e61f072..9b2d8ca 100644 --- a/hzims-service/pom.xml +++ b/hzims-service/pom.xml @@ -16,8 +16,7 @@ assets - - + topvision equipment safeproduct operational @@ -27,6 +26,7 @@ weather hzims-middle hzims-scheduled + hzims-alarm