提交 c8c03cd2 作者: 17607474349

feat:

1、监测推送:数据存储到预警表,发送处置消息并且记录
上级 2f25667e
......@@ -40,6 +40,12 @@ public class RiskHandlePush extends BasicEntity implements Serializable {
@Serial
private static final long serialVersionUID = 7118854661682647225L;
@Comment("起始预警时间")
Integer timeStart;
@Comment("结束")
Integer timeEnd;
@Comment("风险推送")
@ManyToOne
RiskPush riskPush;
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.domain.risk;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yiring.auth.domain.user.User;
import com.yiring.common.domain.BasicEntity;
import java.io.Serial;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import lombok.*;
import lombok.experimental.FieldDefaults;
import lombok.experimental.FieldNameConstants;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.Comment;
/**
* 处置推送日志
*
* @author LJ-2204
* @date 2022/5/27
*/
@Getter
@Setter
@ToString
@SuperBuilder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldDefaults(level = AccessLevel.PRIVATE)
@Entity
@Table(name = "BS_RISK_HANDLE_PUSH_LOG")
@Comment("处置推送日志")
public class RiskHandlePushLog extends BasicEntity implements Serializable {
@Serial
private static final long serialVersionUID = -4525914994066766232L;
@ManyToOne
@Comment("风险推送")
RiskPush riskPush;
@Comment("通知方式")
String types;
@Comment("接收状态")
Boolean status;
@ManyToOne
@JoinColumn(name = "leader_id")
@JsonIgnore
@Comment("负责人")
User user;
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.domain.risk;
import java.io.Serializable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* 部门信息控制器
*
* @author LJ-2204
* @date 2022/5/27
*/
public interface RiskHandlePushLogRepository
extends JpaRepository<RiskHandlePushLog, Serializable>, JpaSpecificationExecutor<RiskHandlePushLog> {}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.domain.risk;
import com.yiring.app.domain.warningMsg.WarningMessage;
import com.yiring.common.domain.BasicEntity;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import lombok.*;
import lombok.experimental.FieldDefaults;
import lombok.experimental.FieldNameConstants;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.Comment;
/**
* 监测记录
*
* @author LJ-2204
* @date 2022/5/27
*/
@Getter
@Setter
@ToString
@SuperBuilder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldDefaults(level = AccessLevel.PRIVATE)
@Entity
@Table(name = "BS_RISK_METER_DETECT")
@Comment("监测记录表")
public class RiskMeterDetect extends BasicEntity implements Serializable {
@Serial
private static final long serialVersionUID = -1124679497996569631L;
@Comment("点位")
@ManyToOne
RiskWarn riskWarn;
@Comment("预警")
@ManyToOne
WarningMessage warningMessage;
@Comment("最新监测值")
BigDecimal newestMonitor;
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.domain.risk;
import java.io.Serializable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* 监测记录
*
* @author LJ-2204
* @date 2022/5/27
*/
public interface RiskMeterDetectRepository
extends JpaRepository<RiskMeterDetect, Serializable>, JpaSpecificationExecutor<RiskMeterDetect> {}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.domain.warningMsg;
import com.yiring.app.domain.workArea.WorkArea;
import com.yiring.common.domain.BasicEntity;
import java.io.Serial;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import lombok.*;
import lombok.experimental.FieldDefaults;
import lombok.experimental.FieldNameConstants;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.Comment;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/21 16:14
*/
@Getter
@Setter
@ToString
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldDefaults(level = AccessLevel.PRIVATE)
@Entity
@Table(name = "BS_WARNING_MESSAGE")
@Comment("预警信息")
public class WarningMessage extends BasicEntity implements Serializable {
@Serial
private static final long serialVersionUID = 5118710539465436913L;
@OneToOne
@Comment("工区")
WorkArea workArea;
@Comment("位号")
String tagNum;
@Comment("阈值状态")
String thrState;
@Comment("风险等级")
String riskLevel;
@Comment("预警状态")
String status;
@Comment("监测值")
String monitorValue;
@Comment("通知方式")
String notificationMethod;
@Comment("处置接收人")
String noticeRecipient;
@Comment("通知方式")
String notificationInfo;
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.domain.warningMsg;
import java.io.Serializable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
/**
* @author tzl
* 2022/5/21 9:55
*/
@Repository
public interface WarningMessageRepository
extends JpaRepository<WarningMessage, Serializable>, JpaSpecificationExecutor<WarningMessage> {}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.excel.warningMsg;
import com.github.liaochong.myexcel.core.annotation.ExcelColumn;
import com.github.liaochong.myexcel.core.annotation.ExcelModel;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/23 14:51
*/
@ExcelModel
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@FieldDefaults(level = AccessLevel.PRIVATE)
public class WarningMessageExportExcel {
@ExcelColumn(title = "工区名称")
String workAreaName;
@ExcelColumn(title = "负责人")
String personInCharge;
@ExcelColumn(title = "摄像头")
String videoName;
@ExcelColumn(title = "位号")
String tagNum;
@ExcelColumn(title = "阈值状态")
String thrState;
@ExcelColumn(title = "风险等级")
String riskLevel;
@ExcelColumn(title = "预警状态")
String status;
@ExcelColumn(title = "预警时间")
String createTime;
@ExcelColumn(title = "预警更新时间")
String updateTime;
}
......@@ -192,8 +192,8 @@ public class MockPositionMessageJob {
private JSONObject mockMeterDetectMessage(JSONObject extra) {
JSONObject params = new JSONObject();
params.put("locationNum", "4376");
params.put("newestMonitor", 1L);
params.put("locationNum", "AT-4736");
params.put("newestMonitor", 1.5);
params.put("time", LocalDateTime.now());
params.putAll(extra);
......
......@@ -29,6 +29,14 @@ public class RiskHandlePushSaveParam implements Serializable {
@Serial
private static final long serialVersionUID = 830597649929357057L;
@ApiModelProperty(value = "起始预警时间", example = "0", required = true)
@NotNull(message = "起始预警时间不能为空")
Integer timeStart;
@ApiModelProperty(value = "结束预警时间", example = "2", required = true)
@NotNull(message = "结束预警时间不能为空")
Integer timeEnd;
@ApiModelProperty(value = "风险推送id", example = "1", required = true)
@NotNull(message = "风险推送id不能为空")
Long riskPushId;
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.warningMsg;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/23 17:11
*/
@ApiModel("WarningMessageParam")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class WarningMessageAddParam implements Serializable {
@Serial
private static final long serialVersionUID = -7513618738675035368L;
@ApiModelProperty(value = "位号", example = "1")
String tagNum;
@ApiModelProperty(value = "预警时间", example = "2022-05-23 22:22:22")
LocalDateTime createTime;
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.warningMsg;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import javax.validation.constraints.NotEmpty;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/23 13:44
*/
@ApiModel("WarningMessageParam")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class WarningMessageParam implements Serializable {
@Serial
private static final long serialVersionUID = -1213328208483066739L;
@ApiModelProperty(value = "通知方式", example = "1,2")
String notificationMethod;
@ApiModelProperty(value = "处置接收人", example = "1,2")
String noticeRecipient;
@ApiModelProperty(value = "通知内容", example = "去处理", required = true)
@NotEmpty(message = "通知内容不能为空")
String notificationInfo;
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.param.warningMsg;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/23 13:44
*/
@ApiModel("WarningMessageQueryParam")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class WarningMessageQueryParam implements Serializable {
@Serial
private static final long serialVersionUID = 7062498310056412092L;
@ApiModelProperty(value = "工区id", example = "1")
Long workAreaId;
@ApiModelProperty(value = "位号", example = "1")
String tagNum;
@ApiModelProperty(value = "阈值状态", example = "1")
String thrState;
@ApiModelProperty(value = "风险登记", example = "1")
String riskLevel;
@ApiModelProperty(value = "预警状态", example = "1")
String status;
@ApiModelProperty(value = "开始时间", example = "2022-05-23 22:22:22")
LocalDateTime startTime;
@ApiModelProperty(value = "结束时间", example = "2022-05-23 22:22:22")
LocalDateTime endTime;
@ApiModelProperty(value = "每页记录数", example = "10")
Integer pageSize;
@ApiModelProperty(value = "页码", example = "1")
Integer pageNo;
}
......@@ -50,6 +50,7 @@ public class RiskHandlePushServiceImpl implements RiskHandlePushService {
@Resource
UserRepository userRepository;
// todo 预警区间限制
@Override
public Result<String> add(RiskHandlePushSaveParam param) {
Optional<RiskPush> riskPushOptional = riskPushRepository.findById(param.getRiskPushId());
......@@ -110,6 +111,8 @@ public class RiskHandlePushServiceImpl implements RiskHandlePushService {
RiskHandlePush riskHandlePush = riskHandlePushOptional.get();
riskHandlePush.setTypes(param.getTypes());
riskHandlePush.setTimeStart(param.getTimeStart());
riskHandlePush.setTimeEnd(param.getTimeEnd());
Optional<RiskPush> riskPushOptional = riskPushRepository.findById(param.getRiskPushId());
if (riskPushOptional.isEmpty()) {
......
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.service.warningMsg;
import com.yiring.app.param.warningMsg.WarningMessageParam;
import com.yiring.app.param.warningMsg.WarningMessageQueryParam;
import com.yiring.app.vo.warningMsg.WarningMessageCountVo;
import com.yiring.app.vo.warningMsg.WarningMessageRecVo;
import com.yiring.app.vo.warningMsg.WarningMessageVo;
import com.yiring.common.core.Result;
import com.yiring.common.param.IdParam;
import com.yiring.common.param.IndexParam;
import com.yiring.common.vo.PageVo;
import javax.servlet.http.HttpServletResponse;
public interface WarningMessageService {
/**
* 通知处置预警信息
* @author tzl
* @date 2022/5/23 14:06
* @param warningMessageParam WarningMessageParam
* @param idParam IdParam
* @return com.yiring.common.core.Result<java.lang.String>
*/
Result<String> update(WarningMessageParam warningMessageParam, IdParam idParam);
/**
* 删除已处置过的预警信息
* @author tzl
* @date 2022/5/23 14:06
* @param idParam IdParam
* @return com.yiring.common.core.Result<java.lang.String>
*/
Result<String> delete(IdParam idParam);
/**
* 分页查询预警信息
* @author tzl
* @date 2022/5/23 14:07
* @param warningMessageQueryParam WarningMessageQueryParam
* @return com.yiring.common.core.Result<com.yiring.common.vo.PageVo<com.yiring.app.vo.warningMsg.WarningMessageVo>>
*/
Result<PageVo<WarningMessageVo>> page(WarningMessageQueryParam warningMessageQueryParam);
/**
* 导出预警信息
* @author tzl
* @date 2022/5/23 14:49
* @param warningMessageQueryParam WarningMessageQueryParam
* @param httpServletResponse HttpServletResponse
*/
void export(WarningMessageQueryParam warningMessageQueryParam, HttpServletResponse httpServletResponse);
/**
* 根据时间查询统计各个风险预警的数量
* @author tzl
* @date 2022/5/23 16:59
* @param warningMessageQueryParam WarningMessageQueryParam
* @return com.yiring.common.core.Result<com.yiring.common.vo.PageVo<com.yiring.app.vo.warningMsg.WarningMessageCountVo>>
*/
Result<PageVo<WarningMessageCountVo>> list(WarningMessageQueryParam warningMessageQueryParam);
/**
* 根据位号查询预警日志记录
* @author tzl
* @date 2022/5/24 10:52
* @param indexParam IndexParam
* @return com.yiring.common.core.Result<com.yiring.common.vo.PageVo<com.yiring.app.vo.warningMsg.WarningMessageVo>>
*/
Result<PageVo<WarningMessageRecVo>> listRec(IndexParam indexParam);
// /**
// * 导出预警日志记录
// * @author tzl
// * @date 2022/5/25 15:17
// * @param warningMessageQueryParam WarningMessageQueryParam
// * @param httpServletResponse HttpServletResponse
// */
// void exportRec(WarningMessageQueryParam warningMessageQueryParam, HttpServletResponse httpServletResponse);
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.warningMsg;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/23 16:54
*/
@ApiModel("WarningMessageCountVo")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class WarningMessageCountVo implements Serializable {
@Serial
private static final long serialVersionUID = 2381198342541182882L;
@ApiModelProperty(value = "风险等级", example = "1")
String riskLevel;
@ApiModelProperty(value = "数量", example = "1")
String num;
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.warningMsg;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/24 10:50
*/
@ApiModel("WarningMessageRecVo")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class WarningMessageRecVo implements Serializable {
@Serial
private static final long serialVersionUID = -7404330262476396295L;
@ApiModelProperty(value = "监测值", example = "1")
String monitorValue;
@ApiModelProperty(value = "预警时间", example = "1")
String createTime;
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.vo.warningMsg;
import com.yiring.app.domain.workArea.WorkArea;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serial;
import java.io.Serializable;
import lombok.*;
import lombok.experimental.FieldDefaults;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/23 13:50
*/
@ApiModel("WarningMessageVo")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
public class WarningMessageVo implements Serializable {
@Serial
private static final long serialVersionUID = 526816538193243051L;
@ApiModelProperty(value = "主键id", example = "1")
Long id;
@ApiModelProperty(value = "工区信息", example = "WorkArea")
WorkArea workArea;
@ApiModelProperty(value = "位号", example = "1")
String tagNum;
@ApiModelProperty(value = "阈值状态", example = "1")
String thrState;
@ApiModelProperty(value = "风险登记", example = "1")
String riskLevel;
@ApiModelProperty(value = "预警状态", example = "1")
String status;
@ApiModelProperty(value = "监测值", example = "1")
String monitorValue;
@ApiModelProperty(value = "预警时间", example = "2022-02-23 00:00:00")
String createTime;
@ApiModelProperty(value = "修改时间", example = "2022-02-23 00:00:00")
String updateTime;
@ApiModelProperty(value = "通知方式", example = "1,2")
String notificationMethod;
@ApiModelProperty(value = "处置接收人", example = "1,2")
String noticeRecipient;
@ApiModelProperty(value = "通知内容", example = "去处理")
String notificationInfo;
}
/* (C) 2022 YiRing, Inc. */
package com.yiring.app.web.warningMsg;
import com.yiring.app.param.warningMsg.WarningMessageParam;
import com.yiring.app.param.warningMsg.WarningMessageQueryParam;
import com.yiring.app.service.warningMsg.WarningMessageService;
import com.yiring.app.vo.warningMsg.WarningMessageCountVo;
import com.yiring.app.vo.warningMsg.WarningMessageRecVo;
import com.yiring.app.vo.warningMsg.WarningMessageVo;
import com.yiring.common.core.Result;
import com.yiring.common.param.IdParam;
import com.yiring.common.param.IndexParam;
import com.yiring.common.vo.PageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/23 15:02
*/
@Slf4j
@Validated
@SuppressWarnings({ "deprecation" })
@Api(tags = "预警", description = "WarningMessage")
@RestController
@RequestMapping("/warningMessage/")
public class WarningMessageController {
@Resource
WarningMessageService warningMessageService;
@ApiOperation(value = "通知处置预警信息")
@PostMapping("update")
public Result<String> update(@Valid WarningMessageParam warningMessageParam, @Valid IdParam idParam) {
return warningMessageService.update(warningMessageParam, idParam);
}
@ApiOperation(value = "删除预警信息")
@PostMapping("delete")
public Result<String> delete(@Valid IdParam idParam) {
return warningMessageService.delete(idParam);
}
@ApiOperation(value = "查看预警信息")
@GetMapping("page")
public Result<PageVo<WarningMessageVo>> page(@Valid WarningMessageQueryParam warningMessageQueryParam) {
return warningMessageService.page(warningMessageQueryParam);
}
@ApiOperation(value = "统计预警信息")
@GetMapping("list")
public Result<PageVo<WarningMessageCountVo>> list(@Valid WarningMessageQueryParam warningMessageQueryParam) {
return warningMessageService.list(warningMessageQueryParam);
}
@ApiOperation(value = "统计预警信息")
@GetMapping("listRec")
public Result<PageVo<WarningMessageRecVo>> listRec(@Valid IndexParam indexParam) {
return warningMessageService.listRec(indexParam);
}
@ApiOperation(value = "导出预警信息", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
@PostMapping("export")
public void export(HttpServletResponse response, @Valid WarningMessageQueryParam warningMessageQueryParam) {
warningMessageService.export(warningMessageQueryParam, response);
}
}
......@@ -27,15 +27,15 @@ public class UserPhoneParam implements Serializable {
@Serial
private static final long serialVersionUID = -3240552295880947685L;
@ApiModelProperty(value = "手机号码", example = "1888888888")
@ApiModelProperty(value = "手机号码", example = "1888888888", required = true)
@NotEmpty(message = "手机号码不能为空")
String mobile;
@ApiModelProperty(value = "验证码", example = "7758")
@ApiModelProperty(value = "验证码", example = "7758", required = true)
@NotEmpty(message = "验证码不能为空")
String code;
@ApiModelProperty(value = "类型", example = "phone/pwd")
@ApiModelProperty(value = "类型", example = "phone/pwd", required = true)
@NotEmpty(message = "类型不能为空")
String type;
}
......@@ -30,11 +30,11 @@ public class UserPwdParam implements Serializable {
@ApiModelProperty(value = "旧密码", example = "10086")
String oldPassword;
@ApiModelProperty(value = "新密码", example = "10086")
@ApiModelProperty(value = "新密码", example = "10086", required = true)
@NotEmpty(message = "新密码不能为空")
String newPassword;
@ApiModelProperty(value = "确认密码", example = "10086")
@ApiModelProperty(value = "确认密码", example = "10086", required = true)
@NotEmpty(message = "确认密码不能为空")
String confirmPwd;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论