2526e61c 张雷

报警短信修改、安环底图问题修改

1 个父辈 913db01c
......@@ -35,4 +35,30 @@ public interface CacheConstant {
*/
public static final String DEPART_IDMODEL_CACHE = "departCache_idmodel";
/**
* 阈值报警模版
*/
public static final String SMS_TEMPLATE_LIMIT = "SMS_474515061";
/**
* 设备报警模版
*/
public static final String SMS_TEMPLATE_EQUIP = "SMS_474510018";
/**
* 修改密码验证码
*/
public static final String SMS_TEMPLATE_UPDATE = "SMS_71850022";
/**
* 用户注册验证码
*/
public static final String SMS_TEMPLATE_REGISTER = "SMS_71850024";
/**
* 登录确认验证码
*/
public static final String SMS_TEMPLATE_LOGIN = "SMS_71850026";
}
......
package com.skua.modules.common.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AliAlarm {
@ApiModelProperty(value = "时间")
private String time;
@ApiModelProperty(value = "机构名称:水厂名称")
private String factory;
@ApiModelProperty(value = "指标名称")
private String alarmParamName;
@ApiModelProperty(value = "指标单位")
private String alarmParamUnit;
@ApiModelProperty(value = "超标值")
private String alarmParamValue;
@ApiModelProperty(value = "指标限值")
private String limitValue;
@ApiModelProperty(value = "超标原因:大于上限,小于下限")
private String alarmParamReason;
@ApiModelProperty(value = "接收手机号,多个手机号逗号隔开")
private String phone;
}
package com.skua.modules.common.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class AliCode {
@ApiModelProperty(value = "验证码")
private String code;
@ApiModelProperty(value = "项目名称")
private String product;
@ApiModelProperty(value = "手机号")
private String phone;
@ApiModelProperty(value = "短信类型 修改密码:update,注册:register,登录:login")
private String type;
}
package com.skua.tool.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.skua.common.constant.CacheConstant;
import com.skua.core.exception.JeecgBootException;
import com.skua.modules.common.vo.AliAlarm;
import com.skua.modules.common.vo.AliCode;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
......@@ -63,18 +67,78 @@ public class AliSmsUtil {
/**
* 发送阈值报警短信
*/
public static void sendLimitAlarmMsg() {
public static void sendLimitAlarmMsg(AliAlarm aliAlarm) {
if(StringUtils.isNotEmpty(aliAlarm.getPhone())){
HashMap<String, Object> message = new HashMap<>();
message.put("time","2024-10-12");
message.put("factory","天长市污水处理厂");
message.put("alarmParamName","进水COD");
message.put("actualAvgValue","130"+"mg/L");
message.put("limit","105"+"mg/L");
message.put("alarmParamUnit","大于上限");
AliSmsUtil.sendMsg("18519526218", "SMS_474510018",message);
message.put("time", aliAlarm.getTime());
message.put("factory", aliAlarm.getFactory());
message.put("alarmParamName", aliAlarm.getAlarmParamName());
message.put("actualAvgValue", aliAlarm.getAlarmParamValue() + aliAlarm.getAlarmParamUnit());
message.put("limit", aliAlarm.getLimitValue() + aliAlarm.getAlarmParamUnit());
message.put("alarmParamUnit", aliAlarm.getAlarmParamReason());
AliSmsUtil.sendMsg(aliAlarm.getPhone(), CacheConstant.SMS_TEMPLATE_LIMIT, message);
}else{
log.info("=======>>>>>>>>>>【阈值报警】接收人手机号未设定!");
}
}
/**
* 发送设备报警短信
*/
public static void sendEquipAlarmMsg(AliAlarm aliAlarm) {
if(StringUtils.isNotEmpty(aliAlarm.getPhone())){
HashMap<String, Object> message = new HashMap<>();
message.put("time", aliAlarm.getTime());
message.put("factory", aliAlarm.getFactory());
message.put("alarmParamName", aliAlarm.getAlarmParamName());
message.put("actualAvgValue", aliAlarm.getAlarmParamValue() + aliAlarm.getAlarmParamUnit());
message.put("limit", aliAlarm.getLimitValue() + aliAlarm.getAlarmParamUnit());
message.put("alarmParamUnit", aliAlarm.getAlarmParamReason());
AliSmsUtil.sendMsg(aliAlarm.getPhone(), CacheConstant.SMS_TEMPLATE_EQUIP, message);
}else{
log.info("=======>>>>>>>>>>【设备报警】接收人手机号未设定!");
}
}
/**
* 发送验证码短信
*/
public static void sendCodeMsg(AliCode aliCode) {
if(StringUtils.isNotEmpty(aliCode.getPhone())){
HashMap<String, Object> message = new HashMap<>();
message.put("code", aliCode.getCode());
message.put("product", aliCode.getProduct());
if("update".equals(aliCode.getType())){
AliSmsUtil.sendMsg(aliCode.getPhone(), CacheConstant.SMS_TEMPLATE_UPDATE, message);
}else if("login".equals(aliCode.getType())){
AliSmsUtil.sendMsg(aliCode.getPhone(), CacheConstant.SMS_TEMPLATE_LOGIN, message);
}else if("register".equals(aliCode.getType())){
AliSmsUtil.sendMsg(aliCode.getPhone(), CacheConstant.SMS_TEMPLATE_REGISTER, message);
}else{
log.info("=======>>>>>>>>>>短信验证码缺少对应模版");
}
}else{
log.info("=======>>>>>>>>>>【验证码】接收人手机号未设定!");
}
}
public static void main(String[] args) {
sendLimitAlarmMsg();
// AliAlarm aliAlarm = new AliAlarm();
// aliAlarm.setPhone("18519526218");
// aliAlarm.setTime("2024-11-01 11:25:29");
// aliAlarm.setFactory("天长市污水处理厂");
// aliAlarm.setAlarmParamName("进水COD");
// aliAlarm.setAlarmParamValue("130");
// aliAlarm.setAlarmParamUnit("mg/L");
// aliAlarm.setLimitValue("100");
// aliAlarm.setAlarmParamReason("大于上限");
// sendLimitAlarmMsg(aliAlarm);
AliCode aliCode = new AliCode();
aliCode.setPhone("18519526218");
aliCode.setCode("889955");
aliCode.setProduct("数字化企业大脑");
aliCode.setType("login");
sendCodeMsg(aliCode);
}
}
......
......@@ -14,6 +14,8 @@ import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import com.skua.modules.common.vo.AliAlarm;
import com.skua.tool.util.AliSmsUtil;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.ProcessEngine;
import org.flowable.engine.ProcessEngines;
......@@ -126,7 +128,6 @@ public class RealTimeAlarmJob implements Job {
if(equipAlarmRuleAndAlarmRuleLevelVOList!=null&&equipAlarmRuleAndAlarmRuleLevelVOList.size()>0) {
allAlarmRuleAndAlarmRuleLevelVOList.addAll(equipAlarmRuleAndAlarmRuleLevelVOList);
}
//查询pg数据超标警报
Map<String, Object> excessAlarmPgList = checkPgExcessAlarm(allAlarmRuleAndAlarmRuleLevelVOList);
sendMessage(excessAlarmPgList);
......@@ -398,11 +399,16 @@ public class RealTimeAlarmJob implements Job {
String alarmRuleLevelName = alarmRuleLevelConfig.getAlarmRuleLevelName();
String alarmRuleLevelConfigId = alarmRuleLevelConfig.getId();
String content = "";
AliAlarm aliAlarm = new AliAlarm();//报警实体
String departName = departNameTemplete.replace("${departName}", alarmRuleAndAlarmRuleLevelVO.getDepartName());
aliAlarm.setFactory(alarmRuleAndAlarmRuleLevelVO.getDepartName());
String unit = "";
if (alarmRuleAndAlarmRuleLevelVO.getAlarmParamUnit() != null) {
unit = alarmRuleAndAlarmRuleLevelVO.getAlarmParamUnit();
}
aliAlarm.setAlarmParamName(alarmParamName);
aliAlarm.setAlarmParamValue(alarmValue.doubleValue()+"");
aliAlarm.setAlarmParamUnit(unit);
if (alarmValue > maxValue) {
//最大值超标
content = contentTemplete.replace("${alarmParamName}", alarmParamName)
......@@ -410,6 +416,8 @@ public class RealTimeAlarmJob implements Job {
.replace("${limit}", ">" + maxValue)
.replace("${alarmParamUnit}", unit);
content = content +"大于上限";
aliAlarm.setLimitValue(maxValue.toString());
aliAlarm.setAlarmParamReason("大于上限");
} else {
//最小值超标
content = contentTemplete.replace("${alarmParamName}", alarmParamName)
......@@ -417,6 +425,8 @@ public class RealTimeAlarmJob implements Job {
.replace("${limit}", "<" + minValue)
.replace("${alarmParamUnit}", unit);
content = content +"小于下限";
aliAlarm.setLimitValue(minValue.toString());
aliAlarm.setAlarmParamReason("小于下限");
}
//查询短信上一条报警是否处理,未处理就不新增报警记录
//TODO 先从数据库中获取,后期优化放redis中
......@@ -568,8 +578,11 @@ public class RealTimeAlarmJob implements Job {
String phone1 = sysUserList.get(i).getPhone();
if (StringUtils.isNotBlank(phone1)) {
phoneStringBuilder.append(phone1);
aliAlarm.setTime(date);
aliAlarm.setPhone(phone1);
//发送短信
HttpSenderMsg.sendMsg(prefix + date + "时" + departName + "采集数据" + content + suffix, phone1);
AliSmsUtil.sendLimitAlarmMsg(aliAlarm);//新版短息发送工具
log.info("短信发送成功手机号:" + phone1 + ",内容:" + content);
}
}
......
......@@ -23,6 +23,12 @@ import com.skua.modules.flow.custombiz.handle.IFlowCustomHandle;
import com.skua.modules.flow.custombiz.vo.FlowProcessFormFieldInfoVO;
import com.skua.modules.flow.support.Kv;
import com.skua.modules.flow.utils.Func;
import com.skua.modules.safe.entity.DangerInspectionRecord;
import com.skua.modules.safe.entity.DangerLevelManage;
import com.skua.modules.safe.entity.DangerLevelManageShare;
import com.skua.modules.safe.mapper.DangerInspectionRecordMapper;
import com.skua.modules.safe.mapper.DangerLevelManageMapper;
import com.skua.modules.safe.mapper.DangerLevelManageShareMapper;
import com.skua.tool.util.UniqIdUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -47,6 +53,12 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
private FlowBusinessService flowBusinessService;
@Autowired
private EmergencyRiskEventMapper emergencyRiskEventMapper;
@Autowired
private DangerLevelManageMapper dangerLevelManageMapper;
@Autowired
private DangerLevelManageShareMapper dangerLevelManageShareMapper;
@Autowired
private DangerInspectionRecordMapper dangerInspectionRecordMapper;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -100,33 +112,66 @@ public class EmergencyRiskEventServiceImpl extends ServiceImpl<EmergencyRiskEven
@Override
public Map<String, Object> getCount(String year) {
Map<String, Object> map = new HashMap<>();
int aqyhTotal = 0;//隐患排查总数
int aqyhYes = 0;//隐患排查处理数
int aqyhNo = 0;//隐患排查未完成数
int fxTotal = 0;//风险库总数
int fxShare = 0;//风险库共享总数
Map<String, Object> aqyhMap = new HashMap<>();
aqyhMap.put("total","9");
aqyhMap.put("yes","5");
aqyhMap.put("no","4");
List<DangerInspectionRecord> inspectionList = dangerInspectionRecordMapper.selectList(new QueryWrapper<>());
if(inspectionList.size() > 0){
aqyhTotal = inspectionList.size();
for (DangerInspectionRecord dangerInspectionRecord : inspectionList) {
if("2".equals(dangerInspectionRecord.getStatus())){
aqyhYes++;
}else{
aqyhNo++;
}
}
}
aqyhMap.put("total", aqyhTotal);
aqyhMap.put("yes", aqyhYes);
aqyhMap.put("no", aqyhNo);
map.put("aqyh",aqyhMap);
Map<String, Object> fxkMap = new HashMap<>();
fxkMap.put("total","9");
fxkMap.put("share","5");
map.put("fxk",fxkMap);
map.put("yhpcyj","6");
List<DangerLevelManage> dangerList = dangerLevelManageMapper.selectList(new QueryWrapper<>());
List<DangerLevelManageShare> dangerShareList = dangerLevelManageShareMapper.selectList(new QueryWrapper<>());
if(dangerList.size() > 0){
fxTotal = dangerList.size();
}
if(dangerList.size() > 0){
fxShare = dangerShareList.size();
}
fxkMap.put("total", fxTotal+fxShare);
fxkMap.put("share", fxShare);
map.put("fxk", fxkMap);
map.put("yhpcyj", aqyhTotal);
return map;
}
@Override
public List<RiskDatabaseResult> getRiskList(String year) {
if(year==null){
year = String.valueOf(DateUtils.getYear());
}
List<RiskDatabaseResult> list = emergencyRiskEventMapper.getRiskList(year);
return list;
}
@Override
public List<DangerDatabaseResult> getDangerList(String year) {
if(year==null){
year = String.valueOf(DateUtils.getYear());
}
List<DangerDatabaseResult> list = emergencyRiskEventMapper.getDangerList(year);
return list;
}
@Override
public List<MapDatabaseResult> getMapData(String year) {
if(year==null){
year = String.valueOf(DateUtils.getYear());
}
List<MapDatabaseResult> list = emergencyRiskEventMapper.getMapData(year);
return list;
}
......
......@@ -654,15 +654,12 @@ public class ScreenDataController {
public Result<List<SysFactoryInfoVO>> getFactoryListByWrapper(SysFactoryInfoVO sysFactoryInfoVO) {
Result<List<SysFactoryInfoVO>> result = new Result<>();
QueryWrapper<SysFactoryInfoVO> queryWrapper = new QueryWrapper<>();
String departType = sysFactoryInfoVO.getDepartType();
if (ConvertUtils.isNotEmpty(departType)) {
queryWrapper.in("d.depart_type", departType.split(","));
}
String dataDepartId = sysFactoryInfoVO.getDepartId();
if (ConvertUtils.isNotEmpty(dataDepartId)) {
queryWrapper.in("d.id", dataDepartId.split(","));
if (ConvertUtils.isNotEmpty(sysFactoryInfoVO.getDepartId())) {
queryWrapper.in("d.id", sysFactoryInfoVO.getDepartId().split(","));
} else{
queryWrapper.in("d.id", BaseContextHandler.getDeparts().split(","));
}
......
......@@ -90,6 +90,7 @@ spring:
datasource:
master:
url: jdbc:mysql://47.104.179.187:6003/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800
# url: jdbc:mysql://113.249.91.27:3306/sk-zhongye?characterEncoding=UTF-8&useUnicode=true&useSSL=false&connectTimeout=60000&socketTimeout=1800
username: root
password: jkauto@123
driver-class-name: com.mysql.jdbc.Driver
......
......@@ -249,6 +249,7 @@ public class EquipmentSparepartController {
.innerJoin(EquipmentSparepartSupplies.class, EquipmentSparepartSupplies.class.getDeclaredField("id"), EquipmentSparepart.class.getDeclaredField("suppliesId"))
.where()
.ge(equipmentSparepartDTO.getNum()>0, "equipment_sparepart.storage_num", equipmentSparepartDTO.getNum())
.eq(StringUtils.isNotEmpty(equipmentSparepartDTO.getDepartId()), "equipment_sparepart_supplies.depart_id", equipmentSparepartDTO.getDepartId())
.like(StringUtils.isNotEmpty(equipmentSparepartDTO.getSparepartCode()), "equipment_sparepart_supplies.sparepart_code", equipmentSparepartDTO.getSparepartCode())
.like(StringUtils.isNotEmpty(equipmentSparepartDTO.getSpecification()), "equipment_sparepart_supplies.specification", equipmentSparepartDTO.getSpecification())
.like(StringUtils.isNotEmpty(equipmentSparepartDTO.getSparepartName()), "equipment_sparepart_supplies.sparepart_name", equipmentSparepartDTO.getSparepartName())
......
......@@ -25,6 +25,7 @@ public class EquipmentSparepartDTO extends EquipmentSparepart {
private String startTime;
private String endTime;
private String warehouseName;
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!