bug修复
This commit is contained in:
parent
e6deadd6fe
commit
bc25c79962
@ -120,6 +120,42 @@ public interface HighFormworkSupport {
|
|||||||
* 测点状态3
|
* 测点状态3
|
||||||
*/
|
*/
|
||||||
public static final String GZ_ZT3 = "GZ_ZT3";
|
public static final String GZ_ZT3 = "GZ_ZT3";
|
||||||
|
/**
|
||||||
|
* 测点编号4
|
||||||
|
*/
|
||||||
|
public static final String GZ_CJ4 = "GZ_CJ4";
|
||||||
|
/**
|
||||||
|
* 测点数据4
|
||||||
|
*/
|
||||||
|
public static final String GZ_DS4 = "GZ_DS4";
|
||||||
|
/**
|
||||||
|
* 测点状态4
|
||||||
|
*/
|
||||||
|
public static final String GZ_ZT4 = "GZ_ZT4";
|
||||||
|
/**
|
||||||
|
* 测点编号5
|
||||||
|
*/
|
||||||
|
public static final String GZ_CJ5 = "GZ_CJ5";
|
||||||
|
/**
|
||||||
|
* 测点数据5
|
||||||
|
*/
|
||||||
|
public static final String GZ_DS5 = "GZ_DS5";
|
||||||
|
/**
|
||||||
|
* 测点状态5
|
||||||
|
*/
|
||||||
|
public static final String GZ_ZT5 = "GZ_ZT5";
|
||||||
|
/**
|
||||||
|
* 测点编号6
|
||||||
|
*/
|
||||||
|
public static final String GZ_CJ6 = "GZ_CJ6";
|
||||||
|
/**
|
||||||
|
* 测点数据6
|
||||||
|
*/
|
||||||
|
public static final String GZ_DS6 = "GZ_DS6";
|
||||||
|
/**
|
||||||
|
* 测点状态6
|
||||||
|
*/
|
||||||
|
public static final String GZ_ZT6 = "GZ_ZT6";
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -190,7 +190,10 @@ public class HighFormworkSupportService {
|
|||||||
String no = dataMap.get(HighFormworkSupport.GZ_CJ1);
|
String no = dataMap.get(HighFormworkSupport.GZ_CJ1);
|
||||||
String no2 = dataMap.get(HighFormworkSupport.GZ_CJ2);
|
String no2 = dataMap.get(HighFormworkSupport.GZ_CJ2);
|
||||||
String no3 = dataMap.get(HighFormworkSupport.GZ_CJ3);
|
String no3 = dataMap.get(HighFormworkSupport.GZ_CJ3);
|
||||||
List<String> list = Stream.of(no, no2, no3).filter(Objects::nonNull).collect(Collectors.toList());
|
String no4 = dataMap.get(HighFormworkSupport.GZ_CJ4);
|
||||||
|
String no5 = dataMap.get(HighFormworkSupport.GZ_CJ5);
|
||||||
|
String no6 = dataMap.get(HighFormworkSupport.GZ_CJ6);
|
||||||
|
List<String> list = Stream.of(no, no2, no3, no4, no5, no6).filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
//保存设备
|
//保存设备
|
||||||
Map<String, String> noMap = list.stream().collect(Collectors.toMap(x -> x, x -> x));
|
Map<String, String> noMap = list.stream().collect(Collectors.toMap(x -> x, x -> x));
|
||||||
if (noMap.size() != existDevices.size() || !existDevices.stream().allMatch(key -> {
|
if (noMap.size() != existDevices.size() || !existDevices.stream().allMatch(key -> {
|
||||||
@ -208,7 +211,7 @@ public class HighFormworkSupportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HighFormworkMeasureCurrentData currentData = getAndSaveHighFormworkMeasureCurrentData(dataMap, no, no2, no3, point);
|
HighFormworkMeasureCurrentData currentData = getAndSaveHighFormworkMeasureCurrentData(dataMap, no, no2, no3, no4, no5, no6, point);
|
||||||
|
|
||||||
//插入报警/预警数据
|
//插入报警/预警数据
|
||||||
addAlarmData(point, currentData);
|
addAlarmData(point, currentData);
|
||||||
@ -234,7 +237,7 @@ public class HighFormworkSupportService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private HighFormworkMeasureCurrentData getAndSaveHighFormworkMeasureCurrentData(HashMap<String, String> dataMap, String no, String no2, String no3, HighFormworkMeasurePoint point) {
|
private HighFormworkMeasureCurrentData getAndSaveHighFormworkMeasureCurrentData(HashMap<String, String> dataMap, String no, String no2, String no3, String no4, String no5, String no6, HighFormworkMeasurePoint point) {
|
||||||
//测点编号后缀为测点类型识别:F-立杆轴力(单位为牛)、H-水平位移(单位为mm)、V-模板沉降(单位为mm)、L-立杆倾斜(单位为°)、D-地基沉降;,例如测点 0001L表示测点类型为立杆倾斜;
|
//测点编号后缀为测点类型识别:F-立杆轴力(单位为牛)、H-水平位移(单位为mm)、V-模板沉降(单位为mm)、L-立杆倾斜(单位为°)、D-地基沉降;,例如测点 0001L表示测点类型为立杆倾斜;
|
||||||
HighFormworkMeasureCurrentData currentData = new HighFormworkMeasureCurrentData();
|
HighFormworkMeasureCurrentData currentData = new HighFormworkMeasureCurrentData();
|
||||||
currentData.setMeasurePointNumber(point.getMeasurePointNumber());
|
currentData.setMeasurePointNumber(point.getMeasurePointNumber());
|
||||||
@ -251,6 +254,9 @@ public class HighFormworkSupportService {
|
|||||||
|
|
||||||
//测点3类型
|
//测点3类型
|
||||||
setCurrentData(no3, currentData, dataMap, HighFormworkSupport.GZ_DS3);
|
setCurrentData(no3, currentData, dataMap, HighFormworkSupport.GZ_DS3);
|
||||||
|
setCurrentData(no4, currentData, dataMap, HighFormworkSupport.GZ_DS4);
|
||||||
|
setCurrentData(no5, currentData, dataMap, HighFormworkSupport.GZ_DS5);
|
||||||
|
setCurrentData(no6, currentData, dataMap, HighFormworkSupport.GZ_DS6);
|
||||||
|
|
||||||
//设置报警状态
|
//设置报警状态
|
||||||
setAlarmStatus(dataMap, currentData);
|
setAlarmStatus(dataMap, currentData);
|
||||||
|
|||||||
@ -1,13 +1,8 @@
|
|||||||
package com.zhgd.xmgl.async;
|
package com.zhgd.xmgl.async;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.zhgd.mqtt.bean.PushPayload;
|
import com.zhgd.mqtt.bean.PushPayload;
|
||||||
import com.zhgd.mqtt.server.IMqttSender;
|
import com.zhgd.mqtt.server.IMqttSender;
|
||||||
import com.zhgd.xmgl.call.TencentCloudMessageCall;
|
|
||||||
import com.zhgd.xmgl.call.YunPianMessageCall;
|
|
||||||
import com.zhgd.xmgl.call.api.MessageManufacturer;
|
import com.zhgd.xmgl.call.api.MessageManufacturer;
|
||||||
import com.zhgd.xmgl.call.factory.MessageManufacturerFactory;
|
import com.zhgd.xmgl.call.factory.MessageManufacturerFactory;
|
||||||
import com.zhgd.xmgl.constant.Cts;
|
import com.zhgd.xmgl.constant.Cts;
|
||||||
@ -21,9 +16,7 @@ import com.zhgd.xmgl.modules.basicdata.service.ICompanyConfigService;
|
|||||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.impl.DictionaryItemServiceImpl;
|
import com.zhgd.xmgl.modules.basicdata.service.impl.DictionaryItemServiceImpl;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.impl.NoticeServiceImpl;
|
import com.zhgd.xmgl.modules.basicdata.service.impl.NoticeServiceImpl;
|
||||||
import com.zhgd.xmgl.modules.project.service.IMessageConfigV2Service;
|
|
||||||
import com.zhgd.xmgl.modules.video.entity.AiAnalyseHardWareAlarmRecord;
|
import com.zhgd.xmgl.modules.video.entity.AiAnalyseHardWareAlarmRecord;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
|
||||||
import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
||||||
import com.zhgd.xmgl.push.service.UniPushService;
|
import com.zhgd.xmgl.push.service.UniPushService;
|
||||||
import com.zhgd.xmgl.util.MapBuilder;
|
import com.zhgd.xmgl.util.MapBuilder;
|
||||||
@ -129,7 +122,7 @@ public class AsyncAiAnalyse {
|
|||||||
templateParams.add(location);
|
templateParams.add(location);
|
||||||
String text = StrUtil.format("【{}】AI警报!{},位置{}",
|
String text = StrUtil.format("【{}】AI警报!{},位置{}",
|
||||||
messageManufacturer.getConfig().getSignature(), typeName, location);
|
messageManufacturer.getConfig().getSignature(), typeName, location);
|
||||||
messageManufacturer.sendMsgByConfig(phoneNums, 2, templateParams, text);
|
messageManufacturer.sendMsgByConfig(phoneNums, "", templateParams, text);
|
||||||
}
|
}
|
||||||
}, threadPoolTaskExecutor);
|
}, threadPoolTaskExecutor);
|
||||||
}
|
}
|
||||||
|
|||||||
68
src/main/java/com/zhgd/xmgl/call/TencentCloudDevSmsCall.java
Normal file
68
src/main/java/com/zhgd/xmgl/call/TencentCloudDevSmsCall.java
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package com.zhgd.xmgl.call;
|
||||||
|
|
||||||
|
import com.gexin.fastjson.JSON;
|
||||||
|
import com.tencentcloudapi.common.Credential;
|
||||||
|
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||||
|
import com.tencentcloudapi.sms.v20210111.SmsClient;
|
||||||
|
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
|
||||||
|
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
|
||||||
|
import com.zhgd.xmgl.call.api.DevSmsManufacturer;
|
||||||
|
import com.zhgd.xmgl.modules.project.entity.DevMessageConfig;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 腾讯云短信
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class TencentCloudDevSmsCall implements DevSmsManufacturer {
|
||||||
|
private DevMessageConfig config;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DevMessageConfig getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConfig(DevMessageConfig config) {
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMsg(List<String> phoneNums, String templateId, List<String> templateParams, String text) {
|
||||||
|
try {
|
||||||
|
doSendMsg(phoneNums, templateId, templateParams.toArray(new String[]{}));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("按短信配置发送短信异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送短信
|
||||||
|
*
|
||||||
|
* @param phoneNums 手机号码
|
||||||
|
* @param templateId 短信模板id
|
||||||
|
* @param templateParamSet 短信模板参数
|
||||||
|
* @throws TencentCloudSDKException
|
||||||
|
*/
|
||||||
|
private void doSendMsg(List<String> phoneNums, String templateId, String[] templateParamSet) throws TencentCloudSDKException {
|
||||||
|
Credential credential = new Credential(config.getSecretId(), config.getSecretKey());
|
||||||
|
SmsClient smsClient = new SmsClient(credential, "ap-singapore");
|
||||||
|
SendSmsRequest req = new SendSmsRequest();
|
||||||
|
req.setPhoneNumberSet(phoneNums.stream().map(s -> "+86" + s).collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
|
req.setSmsSdkAppId(config.getSmsSdkAppId());
|
||||||
|
req.setTemplateId(templateId);
|
||||||
|
req.setTemplateParamSet(templateParamSet);
|
||||||
|
SendSmsResponse response = smsClient.SendSms(req);
|
||||||
|
log.info("腾讯云发送短信结果:{}", JSON.toJSONString(response));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -37,16 +37,9 @@ public class TencentCloudMessageCall implements MessageManufacturer {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMsgByConfig(List<String> phoneNums, int pushFunctionType, List<String> templateParams, String text) {
|
public void sendMsgByConfig(List<String> phoneNums, String templateId, List<String> templateParams, String text) {
|
||||||
try {
|
try {
|
||||||
// if (pushFunctionType == 1 && config.getEnableDustSend() == 1) {
|
doSendMsg(phoneNums, templateId, templateParams.toArray(new String[]{}));
|
||||||
//报警类型,报警名称,设备名称,报警值,阈值,超标时间,超标量
|
|
||||||
// doSendMsg(phoneNums, config.getDustTemplateId(), templateParams.toArray(new String[]{}));
|
|
||||||
// } else if (pushFunctionType == 2 && config.getEnableAiSend() == 1) {
|
|
||||||
// doSendMsg(phoneNums, config.getAiTemplateId(), templateParams.toArray(new String[]{}));
|
|
||||||
// } else if (pushFunctionType == 3 && config.getEnableLoginSend() == 1) {
|
|
||||||
// doSendMsg(phoneNums, config.getLoginTemplateId(), templateParams.toArray(new String[]{}));
|
|
||||||
// }
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("按短信配置发送短信异常", e);
|
log.error("按短信配置发送短信异常", e);
|
||||||
}
|
}
|
||||||
|
|||||||
54
src/main/java/com/zhgd/xmgl/call/YunPianDevSmsCall.java
Normal file
54
src/main/java/com/zhgd/xmgl/call/YunPianDevSmsCall.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package com.zhgd.xmgl.call;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.gexin.fastjson.JSON;
|
||||||
|
import com.zhgd.xmgl.call.api.DevSmsManufacturer;
|
||||||
|
import com.zhgd.xmgl.modules.project.entity.DevMessageConfig;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云片短信
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||||
|
public class YunPianDevSmsCall implements DevSmsManufacturer {
|
||||||
|
private DevMessageConfig config;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DevMessageConfig getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConfig(DevMessageConfig config) {
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMsg(List<String> phoneNums, String templateId, List<String> templateParams, String text) {
|
||||||
|
try {
|
||||||
|
for (String phoneNum : phoneNums) {
|
||||||
|
HashMap<String, Object> formMap = new HashMap<>();
|
||||||
|
formMap.put("apikey", config.getApiKey());
|
||||||
|
formMap.put("mobile", phoneNum);
|
||||||
|
formMap.put("text", StrUtil.format("【{}】{}", config.getSignature(), text));
|
||||||
|
String url = "https://sms.yunpian.com/v2/sms/single_send.json";
|
||||||
|
log.info("云片短信按短信配置发送短信,url:{},body:{}", url, JSON.toJSONString(formMap));
|
||||||
|
String body = HttpRequest.post(url).form(formMap).execute().body();
|
||||||
|
log.info("云片短信按短信配置发送短信,结果:{}", body);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("云片短信按短信配置发送短信异常", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -32,7 +32,7 @@ public class YunPianMessageCall implements MessageManufacturer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMsgByConfig(List<String> phoneNums, int pushFunctionType, List<String> templateParams, String text) {
|
public void sendMsgByConfig(List<String> phoneNums, String templateId, List<String> templateParams, String text) {
|
||||||
try {
|
try {
|
||||||
for (String phoneNum : phoneNums) {
|
for (String phoneNum : phoneNums) {
|
||||||
HashMap<String, Object> formMap = new HashMap<>();
|
HashMap<String, Object> formMap = new HashMap<>();
|
||||||
|
|||||||
25
src/main/java/com/zhgd/xmgl/call/api/DevSmsManufacturer.java
Normal file
25
src/main/java/com/zhgd/xmgl/call/api/DevSmsManufacturer.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package com.zhgd.xmgl.call.api;
|
||||||
|
|
||||||
|
import com.zhgd.xmgl.modules.project.entity.DevMessageConfig;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信接口
|
||||||
|
*/
|
||||||
|
public interface DevSmsManufacturer {
|
||||||
|
|
||||||
|
DevMessageConfig getConfig();
|
||||||
|
|
||||||
|
void setConfig(DevMessageConfig config);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送短信
|
||||||
|
*
|
||||||
|
* @param phoneNums 手机号码
|
||||||
|
* @param templateId 模板ID(腾讯云)
|
||||||
|
* @param templateParams 模板参数(腾讯云)
|
||||||
|
* @param text 消息(云片)
|
||||||
|
*/
|
||||||
|
void sendMsg(List<String> phoneNums, String templateId, List<String> templateParams, String text);
|
||||||
|
}
|
||||||
@ -1,10 +1,7 @@
|
|||||||
package com.zhgd.xmgl.call.api;
|
package com.zhgd.xmgl.call.api;
|
||||||
|
|
||||||
import com.zhgd.xmgl.modules.car.entity.CarInfo;
|
|
||||||
import com.zhgd.xmgl.modules.car.entity.ProjectCarCameraConfig;
|
|
||||||
import com.zhgd.xmgl.modules.project.entity.MessageConfigV2;
|
import com.zhgd.xmgl.modules.project.entity.MessageConfigV2;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,12 +12,14 @@ public interface MessageManufacturer {
|
|||||||
MessageConfigV2 getConfig();
|
MessageConfigV2 getConfig();
|
||||||
|
|
||||||
void setConfig(MessageConfigV2 config);
|
void setConfig(MessageConfigV2 config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按配置发送短信
|
* 按配置发送短信
|
||||||
|
*
|
||||||
* @param phoneNums
|
* @param phoneNums
|
||||||
* @param pushFunctionType 1:扬尘;2:AI报警;3:登录;
|
* @param templateId 模板ID(腾讯云)
|
||||||
* @param templateParams
|
* @param templateParams 模板参数(腾讯云)
|
||||||
* @param text 消息(云片选择)
|
* @param text 消息(云片)
|
||||||
*/
|
*/
|
||||||
void sendMsgByConfig(List<String> phoneNums, int pushFunctionType, List<String> templateParams, String text);
|
void sendMsgByConfig(List<String> phoneNums, String templateId, List<String> templateParams, String text);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,41 @@
|
|||||||
|
package com.zhgd.xmgl.call.factory;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.zhgd.jeecg.common.util.SpringContextUtils;
|
||||||
|
import com.zhgd.xmgl.call.TencentCloudDevSmsCall;
|
||||||
|
import com.zhgd.xmgl.call.YunPianDevSmsCall;
|
||||||
|
import com.zhgd.xmgl.call.api.DevSmsManufacturer;
|
||||||
|
import com.zhgd.xmgl.modules.project.entity.DevMessageConfig;
|
||||||
|
import com.zhgd.xmgl.modules.project.service.IDevMessageConfigService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class DevSmsManufacturerFactory {
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IDevMessageConfigService configService;
|
||||||
|
|
||||||
|
public DevSmsManufacturer getMessageManufacturer(String projectSn) {
|
||||||
|
DevMessageConfig config = configService.getOne(new LambdaQueryWrapper<DevMessageConfig>()
|
||||||
|
.eq(DevMessageConfig::getProjectSn, projectSn)
|
||||||
|
);
|
||||||
|
if (config == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
DevSmsManufacturer manufacturer = null;
|
||||||
|
if (Objects.equals(config.getMessageManufacturerType(), 1)) {
|
||||||
|
manufacturer = SpringContextUtils.getBean(TencentCloudDevSmsCall.class);
|
||||||
|
manufacturer.setConfig(config);
|
||||||
|
} else if (Objects.equals(config.getMessageManufacturerType(), 2)) {
|
||||||
|
manufacturer = SpringContextUtils.getBean(YunPianDevSmsCall.class);
|
||||||
|
manufacturer.setConfig(config);
|
||||||
|
}
|
||||||
|
return manufacturer;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -259,7 +259,7 @@ public class LoginController {
|
|||||||
messageManufacturer.getConfig().getSignature(), randomNum);
|
messageManufacturer.getConfig().getSignature(), randomNum);
|
||||||
List<String> phoneNums = new ArrayList<>();
|
List<String> phoneNums = new ArrayList<>();
|
||||||
phoneNums.add(user.getUserTel());
|
phoneNums.add(user.getUserTel());
|
||||||
messageManufacturer.sendMsgByConfig(phoneNums, 3, templateParams, text);
|
messageManufacturer.sendMsgByConfig(phoneNums, messageManufacturer.getConfig().getSecretId(), templateParams, text);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
} else {
|
} else {
|
||||||
throw new OpenAlertException("短信没配置或没启动短信登录");
|
throw new OpenAlertException("短信没配置或没启动短信登录");
|
||||||
@ -288,7 +288,7 @@ public class LoginController {
|
|||||||
if (hashValue == null) {
|
if (hashValue == null) {
|
||||||
throw new OpenAlertException("短信验证码已过期");
|
throw new OpenAlertException("短信验证码已过期");
|
||||||
} else {
|
} else {
|
||||||
if (!hashValue.get("num").toString().equals(MapUtils.getString(map,"verificationCode"))) {
|
if (!hashValue.get("num").toString().equals(MapUtils.getString(map, "verificationCode"))) {
|
||||||
throw new OpenAlertException("短信验证码不正确");
|
throw new OpenAlertException("短信验证码不正确");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.zhgd.xmgl.modules.basicdata.entity.bo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息提示音
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class NoticeMessagePromptTone {
|
||||||
|
/**
|
||||||
|
* 消息提示音配置
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "消息提示音配置")
|
||||||
|
private java.lang.String messagePromptToneConfig;
|
||||||
|
/**
|
||||||
|
* 播放频率
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "播放频率")
|
||||||
|
private java.lang.Integer playbackFrequency;
|
||||||
|
|
||||||
|
public NoticeMessagePromptTone() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoticeMessagePromptTone(String messagePromptToneConfig, Integer playbackFrequency) {
|
||||||
|
this.messagePromptToneConfig = messagePromptToneConfig;
|
||||||
|
this.playbackFrequency = playbackFrequency;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -831,7 +831,7 @@ public class EnvironmentAlarmServiceImpl extends ServiceImpl<EnvironmentAlarmMap
|
|||||||
templateParams.add(environmentAlarm.getExceed() + "");
|
templateParams.add(environmentAlarm.getExceed() + "");
|
||||||
String text = StrUtil.format("【{}】扬尘超标警报!报警类型:{},报警名称:{},设备名称:{},报警值:{},阈值:{},超标时间:{},超标量:{}",
|
String text = StrUtil.format("【{}】扬尘超标警报!报警类型:{},报警名称:{},设备名称:{},报警值:{},阈值:{},超标时间:{},超标量:{}",
|
||||||
messageManufacturer.getConfig().getSignature(), alarmType, alarmName, devname, environmentAlarm.getAlarmValue() + "", threshold, time, environmentAlarm.getExceed() + "");
|
messageManufacturer.getConfig().getSignature(), alarmType, alarmName, devname, environmentAlarm.getAlarmValue() + "", threshold, time, environmentAlarm.getExceed() + "");
|
||||||
messageManufacturer.sendMsgByConfig(phoneNums, 1, templateParams, text);
|
messageManufacturer.sendMsgByConfig(phoneNums, "", templateParams, text);
|
||||||
}
|
}
|
||||||
}, threadPoolTaskExecutor);
|
}, threadPoolTaskExecutor);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,11 +183,11 @@ public class EnableMessageDevController {
|
|||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
list.addAll(list2);
|
list.addAll(list2);
|
||||||
List<MessageDevListVo> vos = BeanUtil.copyToList(ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(list)), "id", "parentId", "children"), MessageDevListVo.class);
|
|
||||||
String name = MapUtils.getString(param, "name");
|
String name = MapUtils.getString(param, "name");
|
||||||
if (StrUtil.isNotBlank(name)) {
|
if (StrUtil.isNotBlank(name)) {
|
||||||
vos = vos.stream().filter(vo -> vo.getName().contains(name)).collect(Collectors.toList());
|
list = list.stream().filter(vo -> vo.getName().contains(name)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
List<MessageDevListVo> vos = BeanUtil.copyToList(ListUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(list)), "id", "parentId", "children"), MessageDevListVo.class);
|
||||||
return Result.success(vos);
|
return Result.success(vos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ public class EnableMessageDevController {
|
|||||||
@ApiImplicitParam(name = "monitoringModule", value = "监测模块:1:扬尘监测;2:AI监测", paramType = "body", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "monitoringModule", value = "监测模块:1:扬尘监测;2:AI监测", paramType = "body", required = true, dataType = "String"),
|
||||||
})
|
})
|
||||||
@PostMapping(value = "/editStatus")
|
@PostMapping(value = "/editStatus")
|
||||||
@DistributedLock(keyPrefix = "enable_message_dev_controller:", key = "#param.projectSn", tryLok = true, lockTime = 0)
|
@DistributedLock(keyPrefix = "enable_message_dev_controller:", key = "#param['projectSn']", tryLok = true, lockTime = 0)
|
||||||
public Result editStatus(@RequestBody Map<String, Object> param) {
|
public Result editStatus(@RequestBody Map<String, Object> param) {
|
||||||
String projectSn = MapUtils.getString(param, "projectSn");
|
String projectSn = MapUtils.getString(param, "projectSn");
|
||||||
Integer isEnable = MapUtils.getInteger(param, "isEnable");
|
Integer isEnable = MapUtils.getInteger(param, "isEnable");
|
||||||
|
|||||||
@ -155,22 +155,22 @@ public class EnableMessageDevRuleController {
|
|||||||
Map<String, Map<String, Map<String, EnableMessageDevRule>>> module2param2levelMap = enableMessageDevRuleService.queryList(param).stream().collect(Collectors.groupingBy(EnableMessageDevRule::getMonitoringModuleName,
|
Map<String, Map<String, Map<String, EnableMessageDevRule>>> module2param2levelMap = enableMessageDevRuleService.queryList(param).stream().collect(Collectors.groupingBy(EnableMessageDevRule::getMonitoringModuleName,
|
||||||
Collectors.groupingBy(EnableMessageDevRule::getMonitoringParameterName,
|
Collectors.groupingBy(EnableMessageDevRule::getMonitoringParameterName,
|
||||||
Collectors.toMap(EnableMessageDevRule::getMonitoringLevelName, Function.identity(), (existing, replacement) -> existing))));
|
Collectors.toMap(EnableMessageDevRule::getMonitoringLevelName, Function.identity(), (existing, replacement) -> existing))));
|
||||||
if (Objects.equals(monitoringModule, ParamEnum.MessageModuleNameEnum.YCJC.getValue() + "")) {
|
if (Objects.equals(monitoringModule, ParamEnum.MessageModuleNameEnum.YCJC.getValue())) {
|
||||||
List<EnvironmentAlarmType> alarmTypes = environmentAlarmTypeService.list();
|
List<EnvironmentAlarmType> alarmTypes = environmentAlarmTypeService.list();
|
||||||
for (EnvironmentAlarmType alarmType : alarmTypes) {
|
for (EnvironmentAlarmType alarmType : alarmTypes) {
|
||||||
String bj = "报警";
|
String bj = "报警";
|
||||||
String yj = "预警";
|
String yj = "预警";
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, "扬尘监测", alarmType.getAlarmType(), bj));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.YCJC.getDesc(), alarmType.getAlarmType(), bj));
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, "扬尘监测", alarmType.getAlarmType(), yj));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.YCJC.getDesc(), alarmType.getAlarmType(), yj));
|
||||||
}
|
}
|
||||||
} else if (Objects.equals(monitoringModule, ParamEnum.MessageModuleNameEnum.AIJC.getValue() + "")) {
|
} else if (Objects.equals(monitoringModule, ParamEnum.MessageModuleNameEnum.AIJC.getValue())) {
|
||||||
List<DictionaryItem> dictList = dictionaryItemService.getDictList(DictionaryConstant.AI_ANALYSE_HARD_WARE_ALARM_RECORD_TYPE, projectSn);
|
List<DictionaryItem> dictList = dictionaryItemService.getDictList(DictionaryConstant.AI_ANALYSE_HARD_WARE_ALARM_RECORD_TYPE, projectSn);
|
||||||
for (DictionaryItem item : dictList) {
|
for (DictionaryItem item : dictList) {
|
||||||
//问题等级,1一级,2二级,3三级,4四级
|
//问题等级,1一级,2二级,3三级,4四级
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, "AI监测", item.getName(), "一级"));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "一级"));
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, "AI监测", item.getName(), "二级"));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "二级"));
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, "AI监测", item.getName(), "三级"));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "三级"));
|
||||||
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, "AI监测", item.getName(), "四级"));
|
rtList.add(getEnableMessageDevRuleVo(module2param2levelMap, ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), item.getName(), "四级"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Integer enableSmsNotification = MapUtils.getInteger(param, "enableSmsNotification");
|
Integer enableSmsNotification = MapUtils.getInteger(param, "enableSmsNotification");
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import lombok.Data;
|
|||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 通知设备规则
|
* @Description: 通知设备规则
|
||||||
@ -83,12 +84,12 @@ public class EnableMessageDevRule implements Serializable {
|
|||||||
* 短信推送时间开始
|
* 短信推送时间开始
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "短信推送时间开始")
|
@ApiModelProperty(value = "短信推送时间开始")
|
||||||
private java.util.Date smsPushTimeBegin;
|
private LocalTime smsPushTimeBegin;
|
||||||
/**
|
/**
|
||||||
* 短信推送时间结束
|
* 短信推送时间结束
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "短信推送时间结束")
|
@ApiModelProperty(value = "短信推送时间结束")
|
||||||
private java.util.Date smsPushTimeEnd;
|
private LocalTime smsPushTimeEnd;
|
||||||
/**
|
/**
|
||||||
* 是否启用系统站内消息推送,1是,0否
|
* 是否启用系统站内消息推送,1是,0否
|
||||||
*/
|
*/
|
||||||
@ -100,14 +101,19 @@ public class EnableMessageDevRule implements Serializable {
|
|||||||
@ApiModelProperty(value = "消息推送频率,0:实时,1:1小时")
|
@ApiModelProperty(value = "消息推送频率,0:实时,1:1小时")
|
||||||
private java.lang.Integer messagePushFrequency;
|
private java.lang.Integer messagePushFrequency;
|
||||||
/**
|
/**
|
||||||
* 消息推送时间
|
* 系统消息推送时间开始
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "消息推送时间")
|
@ApiModelProperty(value = "系统消息推送时间开始")
|
||||||
private java.util.Date messagePushTime;
|
private LocalTime messagePushTimeBegin;
|
||||||
/**
|
/**
|
||||||
* 消息模板内容
|
* 系统消息推送时间结束
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "消息模板内容")
|
@ApiModelProperty(value = "系统消息推送时间结束")
|
||||||
|
private LocalTime messagePushTimeEnd;
|
||||||
|
/**
|
||||||
|
* 系统消息模板内容
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "系统消息模板内容")
|
||||||
private java.lang.String messageTemplateContent;
|
private java.lang.String messageTemplateContent;
|
||||||
/**
|
/**
|
||||||
* 是否启用系统站内消息提示音,1是,0否
|
* 是否启用系统站内消息提示音,1是,0否
|
||||||
@ -125,9 +131,9 @@ public class EnableMessageDevRule implements Serializable {
|
|||||||
@ApiModelProperty(value = "播放频率")
|
@ApiModelProperty(value = "播放频率")
|
||||||
private java.lang.Integer playbackFrequency;
|
private java.lang.Integer playbackFrequency;
|
||||||
/**
|
/**
|
||||||
* 告警接收人ids(多个,分割)
|
* 系统告警接收人ids(多个,分割)
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "告警接收人ids(多个,分割)")
|
@ApiModelProperty(value = "系统告警接收人ids(多个,分割)")
|
||||||
private java.lang.String alarmRecipientIds;
|
private java.lang.String alarmRecipientIds;
|
||||||
/**
|
/**
|
||||||
* 是否启用现场智能广播通知,1是,0否
|
* 是否启用现场智能广播通知,1是,0否
|
||||||
@ -158,4 +164,9 @@ public class EnableMessageDevRule implements Serializable {
|
|||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@ApiModelProperty(value = "更新时间")
|
@ApiModelProperty(value = "更新时间")
|
||||||
private java.util.Date updateTime;
|
private java.util.Date updateTime;
|
||||||
|
/**
|
||||||
|
* 短信告警接收人ids(多个,分割)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "短信告警接收人ids(多个,分割)")
|
||||||
|
private java.lang.String smsAlarmRecipientIds;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,5 +88,9 @@ public class MessageConfigV2 implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "1短信登录推送配置发送短信0不发送")
|
@ApiModelProperty(value = "1短信登录推送配置发送短信0不发送")
|
||||||
private java.lang.Integer enableLoginSend;
|
private java.lang.Integer enableLoginSend;
|
||||||
|
/**
|
||||||
|
* 登录短信模板id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "登录短信模板id")
|
||||||
|
private java.lang.String loginTemplateId;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,11 +134,12 @@ public class WorkerInfoAuditRecordController {
|
|||||||
@OperLog(operModul = "劳务管理",operType = "劳务人员审核通过",operDesc = "劳务人员审核通过")
|
@OperLog(operModul = "劳务管理",operType = "劳务人员审核通过",operDesc = "劳务人员审核通过")
|
||||||
@ApiOperation(value = "审核通过", notes = "审核通过" , httpMethod="POST")
|
@ApiOperation(value = "审核通过", notes = "审核通过" , httpMethod="POST")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "id", value = "劳务人员-审核表ID", paramType = "body", required = true, dataType = "Integer"),
|
@ApiImplicitParam(name = "id", value = "劳务人员-审核表ID", paramType = "body", required = true, dataType = "Integer"),
|
||||||
@ApiImplicitParam(name = "registerType", value = "登记方式,1PC录入,2手机端录入", paramType = "body", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "registerType", value = "登记方式,1PC录入,2手机端录入", paramType = "body", required = false, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "accountType", value = "账号类型,1管理,2普通人员", paramType = "body", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "accountType", value = "账号类型,1管理,2普通人员", paramType = "body", required = false, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "ufaceDevId", value = "人脸设备表ID", paramType = "body", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "ufaceDevId", value = "人脸设备表ID", paramType = "body", required = false, dataType = "String"),
|
||||||
})
|
@ApiImplicitParam(name = "attendanceGroupV2Id", value = "考勤组id", paramType = "body", required = false, dataType = "String"),
|
||||||
|
})
|
||||||
@PostMapping(value = "/adoptWorkerInfo")
|
@PostMapping(value = "/adoptWorkerInfo")
|
||||||
public Result<WorkerInfoAuditRecord> adoptWorkerInfo(@RequestBody Map<String,Object> map) {
|
public Result<WorkerInfoAuditRecord> adoptWorkerInfo(@RequestBody Map<String,Object> map) {
|
||||||
workerInfoAuditRecordService.adoptWorkerInfo(map);
|
workerInfoAuditRecordService.adoptWorkerInfo(map);
|
||||||
|
|||||||
@ -52,4 +52,10 @@ public class WorkerAttendanceGroupV2 implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "更新时间")
|
@ApiModelProperty(value = "更新时间")
|
||||||
private java.util.Date updateDate;
|
private java.util.Date updateDate;
|
||||||
|
/**
|
||||||
|
* 1默认0不默认
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "1默认0不默认")
|
||||||
|
private Integer isDefault;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import com.zhgd.redis.lock.redisson.DistributedLock;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendanceGroupV2;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendanceGroupV2;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendanceRuleV2;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendanceRuleV2;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||||
@ -28,6 +29,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,18 +86,31 @@ public class WorkerAttendanceGroupV2ServiceImpl extends ServiceImpl<WorkerAttend
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(WorkerAttendanceGroupV2Dto workerAttendanceGroupV2Dto) {
|
@DistributedLock(keyPrefix = "worker_attendance_group_v2_dto:", key = "#dto.projectSn", tryLok = true, lockTime = 0)
|
||||||
workerAttendanceGroupV2Dto.setId(null);
|
public void add(WorkerAttendanceGroupV2Dto dto) {
|
||||||
baseMapper.insert(workerAttendanceGroupV2Dto);
|
dto.setId(null);
|
||||||
|
setIsNotDefault(dto);
|
||||||
|
baseMapper.insert(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setIsNotDefault(WorkerAttendanceGroupV2Dto dto) {
|
||||||
|
if (Objects.equals(dto.getIsDefault(), 1)) {
|
||||||
|
this.update(null, new LambdaUpdateWrapper<WorkerAttendanceGroupV2>()
|
||||||
|
.set(WorkerAttendanceGroupV2::getIsDefault, 0)
|
||||||
|
.eq(WorkerAttendanceGroupV2::getProjectSn, dto.getProjectSn())
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void edit(WorkerAttendanceGroupV2Dto workerAttendanceGroupV2Dto) {
|
@DistributedLock(keyPrefix = "worker_attendance_group_v2_dto:", key = "#dto.projectSn", tryLok = true, lockTime = 0)
|
||||||
WorkerAttendanceGroupV2 oldWorkerAttendanceGroupV2 = baseMapper.selectById(workerAttendanceGroupV2Dto.getId());
|
public void edit(WorkerAttendanceGroupV2Dto dto) {
|
||||||
|
WorkerAttendanceGroupV2 oldWorkerAttendanceGroupV2 = baseMapper.selectById(dto.getId());
|
||||||
if (oldWorkerAttendanceGroupV2 == null) {
|
if (oldWorkerAttendanceGroupV2 == null) {
|
||||||
throw new OpenAlertException("未找到对应实体");
|
throw new OpenAlertException("未找到对应实体");
|
||||||
}
|
}
|
||||||
baseMapper.updateById(workerAttendanceGroupV2Dto);
|
setIsNotDefault(dto);
|
||||||
|
baseMapper.updateById(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -123,7 +138,7 @@ public class WorkerAttendanceGroupV2ServiceImpl extends ServiceImpl<WorkerAttend
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWithWorkerList(WorkerAttendanceGroupV2Dto workerAttendanceGroupV2Dto) {
|
public void addWithWorkerList(WorkerAttendanceGroupV2Dto workerAttendanceGroupV2Dto) {
|
||||||
this.save(workerAttendanceGroupV2Dto);
|
this.add(workerAttendanceGroupV2Dto);
|
||||||
this.addWorkerList(workerAttendanceGroupV2Dto);
|
this.addWorkerList(workerAttendanceGroupV2Dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -130,6 +130,7 @@ public class WorkerInfoAuditRecordServiceImpl extends ServiceImpl<WorkerInfoAudi
|
|||||||
workerInfo.setAccountType(MapUtils.getInteger(map, "accountType"));
|
workerInfo.setAccountType(MapUtils.getInteger(map, "accountType"));
|
||||||
workerInfo.setUfaceDevId(MapUtils.getString(map, "ufaceDevId"));
|
workerInfo.setUfaceDevId(MapUtils.getString(map, "ufaceDevId"));
|
||||||
workerInfo.setInserviceType(1);
|
workerInfo.setInserviceType(1);
|
||||||
|
workerInfo.setAttendanceGroupV2Id(MapUtils.getLong(map, "attendanceGroupV2Id"));
|
||||||
|
|
||||||
//调用向正式表添加接口并下发设备
|
//调用向正式表添加接口并下发设备
|
||||||
WorkerInfo workerInfo1 = new WorkerInfo();
|
WorkerInfo workerInfo1 = new WorkerInfo();
|
||||||
|
|||||||
@ -317,6 +317,15 @@ public class XzSecurityQualityInspectionRecordController {
|
|||||||
return Result.success(qualityInspectionRecordService.selectQualityStatisticsNum(map));
|
return Result.success(qualityInspectionRecordService.selectQualityStatisticsNum(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "安全问题统计我的待办", notes = "安全问题统计我的待办", httpMethod = "POST")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
|
||||||
|
})
|
||||||
|
@PostMapping(value = "/countMyTodo")
|
||||||
|
public Result<XzSecurityQualityInspectionRecordCountMyTodoVo> countMyTodo(@RequestBody Map<String, Object> map) {
|
||||||
|
return Result.success(qualityInspectionRecordService.countMyTodo(map));
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "安全问题统计具体数量列表", notes = "安全问题统计具体数量列表", httpMethod = "POST")
|
@ApiOperation(value = "安全问题统计具体数量列表", notes = "安全问题统计具体数量列表", httpMethod = "POST")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.zhgd.xmgl.modules.xz.security.entity.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class XzSecurityQualityInspectionRecordCountMyTodoVo {
|
||||||
|
@ApiModelProperty("未(待)整改数")
|
||||||
|
private Integer rectificationNum;
|
||||||
|
@ApiModelProperty("待(未)复查")
|
||||||
|
private Integer reviewNum;
|
||||||
|
@ApiModelProperty("待(未)核验")
|
||||||
|
private Integer verificationNum;
|
||||||
|
}
|
||||||
@ -266,4 +266,6 @@ public interface XzSecurityQualityInspectionRecordMapper extends BaseMapper<XzSe
|
|||||||
List<ChartItemBo> countBigByDutyMajor(Map<String, Object> map);
|
List<ChartItemBo> countBigByDutyMajor(Map<String, Object> map);
|
||||||
|
|
||||||
List<ChartItemBo> countSmallByMonth(Map<String, Object> map);
|
List<ChartItemBo> countSmallByMonth(Map<String, Object> map);
|
||||||
|
|
||||||
|
XzSecurityQualityInspectionRecordCountMyTodoVo countMyTodo(@Param("param") Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1180,4 +1180,17 @@
|
|||||||
</if>
|
</if>
|
||||||
group by x_name
|
group by x_name
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countMyTodo"
|
||||||
|
resultType="com.zhgd.xmgl.modules.xz.security.entity.vo.XzSecurityQualityInspectionRecordCountMyTodoVo">
|
||||||
|
SELECT
|
||||||
|
IFNULL(SUM((CASE WHEN t.status = 2 and t.change_id = #{param.userId} THEN 1 ELSE 0 END)), 0) rectificationNum,
|
||||||
|
IFNULL(SUM((CASE WHEN t.status = 3 and r.review_id = #{param.userId} THEN 1 ELSE 0 END)), 0) reviewNum,
|
||||||
|
IFNULL(SUM((CASE WHEN t.status = 4 and v.verify_id = #{param.userId} THEN 1 ELSE 0 END)), 0) verificationNum
|
||||||
|
from xz_security_quality_inspection_record t
|
||||||
|
left join xz_security_quality_inspection_review r on r.inspection_id=t.id and t.review_id = #{param.userId}
|
||||||
|
left join xz_security_quality_inspection_verify v on v.inspection_id=t.id and v.verify_id = #{param.userId}
|
||||||
|
WHERE t.project_sn = #{param.projectSn}
|
||||||
|
and t.status != 6
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -340,4 +340,6 @@ public interface IXzSecurityQualityInspectionRecordService extends IService<XzSe
|
|||||||
ChartDataVo countBigByDutyMajor(Map<String, Object> map);
|
ChartDataVo countBigByDutyMajor(Map<String, Object> map);
|
||||||
|
|
||||||
ChartDataVo countSmallByMonth(Map<String, Object> map);
|
ChartDataVo countSmallByMonth(Map<String, Object> map);
|
||||||
|
|
||||||
|
XzSecurityQualityInspectionRecordCountMyTodoVo countMyTodo(Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1379,6 +1379,12 @@ public class XzSecurityQualityInspectionRecordServiceImpl extends ServiceImpl<Xz
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XzSecurityQualityInspectionRecordCountMyTodoVo countMyTodo(Map<String, Object> map) {
|
||||||
|
map.put("userId", SecurityUtils.getUser().getUserId());
|
||||||
|
return baseMapper.countMyTodo(map);
|
||||||
|
}
|
||||||
|
|
||||||
private void recoverScore(XzSecurityQualityInspectionRecord hiddenDangerInspectRecord) {
|
private void recoverScore(XzSecurityQualityInspectionRecord hiddenDangerInspectRecord) {
|
||||||
if (hiddenDangerInspectRecord.getRecordType() == null || Objects.equals(hiddenDangerInspectRecord.getRecordType(), XzSecurityQualityInspectionRecordRecordTypeEnum.RECORD.getValue())) {
|
if (hiddenDangerInspectRecord.getRecordType() == null || Objects.equals(hiddenDangerInspectRecord.getRecordType(), XzSecurityQualityInspectionRecordRecordTypeEnum.RECORD.getValue())) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -1,28 +1,235 @@
|
|||||||
package com.zhgd.xmgl.task;
|
package com.zhgd.xmgl.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.zhgd.xmgl.call.api.DevSmsManufacturer;
|
||||||
|
import com.zhgd.xmgl.call.factory.DevSmsManufacturerFactory;
|
||||||
|
import com.zhgd.xmgl.enums.ParamEnum;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.constant.DictionaryConstant;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.entity.bo.NoticeMessagePromptTone;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.service.impl.DictionaryItemServiceImpl;
|
||||||
|
import com.zhgd.xmgl.modules.basicdata.service.impl.NoticeServiceImpl;
|
||||||
|
import com.zhgd.xmgl.modules.environment.entity.EnvironmentAlarm;
|
||||||
|
import com.zhgd.xmgl.modules.environment.entity.EnvironmentAlarmType;
|
||||||
|
import com.zhgd.xmgl.modules.environment.service.IEnvironmentAlarmService;
|
||||||
|
import com.zhgd.xmgl.modules.environment.service.IEnvironmentAlarmTypeService;
|
||||||
|
import com.zhgd.xmgl.modules.project.entity.EnableMessageDevRule;
|
||||||
|
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||||
|
import com.zhgd.xmgl.modules.project.service.IEnableMessageDevRuleService;
|
||||||
|
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||||
|
import com.zhgd.xmgl.modules.video.entity.AiAnalyseHardWareAlarmRecord;
|
||||||
|
import com.zhgd.xmgl.modules.video.service.IAiAnalyseHardWareAlarmRecordService;
|
||||||
|
import com.zhgd.xmgl.modules.xz.entity.XzAiDeductRule;
|
||||||
|
import com.zhgd.xmgl.modules.xz.service.IXzAiDeductRuleService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("xmgl/task")
|
@RequestMapping("xmgl/task")
|
||||||
public class MessageDevRuleTask {
|
public class MessageDevRuleTask {
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
ISystemUserService systemUserService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private DevSmsManufacturerFactory devSmsManufacturerFactory;
|
||||||
|
@Lazy
|
||||||
|
@Resource
|
||||||
|
private IEnvironmentAlarmService environmentAlarmService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IEnableMessageDevRuleService enableMessageDevRuleService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IEnvironmentAlarmTypeService environmentAlarmTypeService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private NoticeServiceImpl noticeService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IAiAnalyseHardWareAlarmRecordService aiAnalyseHardWareAlarmRecordService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private DictionaryItemServiceImpl dictionaryItemService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IProjectService projectService;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IXzAiDeductRuleService xzAiDeductRuleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送设备的报警通知
|
||||||
|
*/
|
||||||
|
@SchedulerLock(name = "sendDevMessage", lockAtMostFor = 1000 * 60 * 60, lockAtLeastFor = 1000 * 60 * 5)
|
||||||
|
@Scheduled(cron = "0 0 */1 * * ?")
|
||||||
|
@RequestMapping("sendDevMessage")
|
||||||
|
public void sendDevMessage() {
|
||||||
|
try {
|
||||||
|
Map<Long, EnvironmentAlarmType> environmentTypeMap = environmentAlarmTypeService.list().stream().collect(Collectors.toMap(EnvironmentAlarmType::getId, Function.identity(), (o1, o2) -> o1));
|
||||||
|
List<Project> projects = projectService.list(new LambdaQueryWrapper<Project>());
|
||||||
|
Map<String, Map<String, Map<String, List<EnvironmentAlarm>>>> devSn2Parameter2LevelEnvironmentAlarmMap = environmentAlarmService.list(new LambdaQueryWrapper<EnvironmentAlarm>()
|
||||||
|
.ge(EnvironmentAlarm::getAlarmTime, DateUtil.formatDateTime(DateUtil.offsetDay(new Date(), -1)))
|
||||||
|
.le(EnvironmentAlarm::getAlarmTime, new Date())
|
||||||
|
).stream().collect(Collectors.groupingBy(EnvironmentAlarm::getDeviceId,
|
||||||
|
Collectors.groupingBy(ea -> environmentTypeMap.get(ea.getAlarmTypeId()).getAlarmType(),
|
||||||
|
Collectors.groupingBy(ea -> Objects.equals(ea.getType(), 0) ? "报警" : "预警"))));
|
||||||
|
List<EnableMessageDevRule> ruleList = enableMessageDevRuleService.list(new LambdaQueryWrapper<EnableMessageDevRule>().eq(EnableMessageDevRule::getIsEnabled, 1));
|
||||||
|
Map<Long, SystemUser> userMap = systemUserService.list(new LambdaQueryWrapper<SystemUser>()).stream().collect(Collectors.toMap(SystemUser::getUserId, Function.identity(), (o1, o2) -> o1));
|
||||||
|
Map<String, List<EnableMessageDevRule>> moduleMap = ruleList.stream().collect(Collectors.groupingBy(EnableMessageDevRule::getMonitoringModuleName));
|
||||||
|
for (Project project : projects) {
|
||||||
|
List<DictionaryItem> dictList = dictionaryItemService.getDictList(DictionaryConstant.AI_ANALYSE_HARD_WARE_ALARM_RECORD_TYPE, project.getProjectSn());
|
||||||
|
Map<String, DictionaryItem> dictDataMap = dictList.stream().collect(Collectors.toMap(DictionaryItem::getData, Function.identity(), (o1, o2) -> o1));
|
||||||
|
Map<Long, XzAiDeductRule> dicIdMap = xzAiDeductRuleService.list(new LambdaQueryWrapper<XzAiDeductRule>()
|
||||||
|
.eq(XzAiDeductRule::getProjectSn, project.getProjectSn())).stream().collect(Collectors.toMap(XzAiDeductRule::getDictionaryItemId, Function.identity(), (o1, o2) -> o1));
|
||||||
|
Map<String, Map<String, Map<String, List<AiAnalyseHardWareAlarmRecord>>>> devSn2Parameter2LevelAiMap = aiAnalyseHardWareAlarmRecordService.list(new LambdaQueryWrapper<AiAnalyseHardWareAlarmRecord>()
|
||||||
|
.ge(AiAnalyseHardWareAlarmRecord::getCreateTime, DateUtil.formatDateTime(DateUtil.offsetDay(new Date(), -1)))
|
||||||
|
.le(AiAnalyseHardWareAlarmRecord::getCreateTime, new Date())
|
||||||
|
).stream().filter(r -> {
|
||||||
|
return Objects.nonNull(Optional.ofNullable(dictDataMap.get(Convert.toStr(r.getAlarmType()))).map(m -> dicIdMap.get(m.getId())).map(XzAiDeductRule::getLevel).orElse(null));
|
||||||
|
}).collect(Collectors.groupingBy(AiAnalyseHardWareAlarmRecord::getHardwareId,
|
||||||
|
Collectors.groupingBy(r1 -> dictDataMap.get(Convert.toStr(r1.getAlarmType())).getName(),
|
||||||
|
Collectors.groupingBy(r -> Optional.of(dictDataMap.get(Convert.toStr(r.getAlarmType()))).map(m -> dicIdMap.get(m.getId())).map(r1 -> {
|
||||||
|
if (Objects.equals(r1.getLevel(), 1)) {
|
||||||
|
return "一级";
|
||||||
|
} else if (Objects.equals(r1.getLevel(), 2)) {
|
||||||
|
return "二级";
|
||||||
|
} else if (Objects.equals(r1.getLevel(), 3)) {
|
||||||
|
return "三级";
|
||||||
|
} else {
|
||||||
|
return "四级";
|
||||||
|
}
|
||||||
|
}).orElse(null)))));
|
||||||
|
for (Map.Entry<String, List<EnableMessageDevRule>> moduleEntry : moduleMap.entrySet()) {
|
||||||
|
List<EnableMessageDevRule> entryRules = moduleEntry.getValue();
|
||||||
|
for (EnableMessageDevRule rule : entryRules) {
|
||||||
|
//扬尘
|
||||||
|
if (Objects.equals(ParamEnum.MessageModuleNameEnum.YCJC.getDesc(), moduleEntry.getKey())) {
|
||||||
|
List<EnvironmentAlarm> filterAlarms = Optional.ofNullable(devSn2Parameter2LevelEnvironmentAlarmMap.get(rule.getDevSn()))
|
||||||
|
.map(m -> m.get(rule.getMonitoringParameterName())).map(m -> m.get(rule.getMonitoringLevelName())).orElse(new ArrayList<>());
|
||||||
|
filterAlarms = filterAlarms.stream().filter(alarm ->
|
||||||
|
DateUtil.compare(alarm.getAlarmTime(), DateUtil.offsetHour(new Date(), rule.getSmsPushFrequency() * -1)) >= 0
|
||||||
|
&& DateUtil.compare(alarm.getAlarmTime(), new Date()) <= 0).collect(Collectors.toList());
|
||||||
|
//sms
|
||||||
|
if (CollUtil.isNotEmpty(filterAlarms)) {
|
||||||
|
sendNotice(rule, filterAlarms.size(), userMap, "7");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//AI
|
||||||
|
if (Objects.equals(ParamEnum.MessageModuleNameEnum.AIJC.getDesc(), moduleEntry.getKey())) {
|
||||||
|
List<AiAnalyseHardWareAlarmRecord> filterAlarms = Optional.ofNullable(devSn2Parameter2LevelAiMap.get(rule.getDevSn()))
|
||||||
|
.map(m -> m.get(rule.getMonitoringParameterName())).map(m -> m.get(rule.getMonitoringLevelName())).orElse(new ArrayList<>());
|
||||||
|
filterAlarms = filterAlarms.stream().filter(alarm ->
|
||||||
|
DateUtil.compare(DateUtil.parse(alarm.getCreateTime()), DateUtil.offsetHour(new Date(), rule.getSmsPushFrequency() * -1)) >= 0
|
||||||
|
&& DateUtil.compare(DateUtil.parse(alarm.getCreateTime()), new Date()) <= 0).collect(Collectors.toList());
|
||||||
|
//sms
|
||||||
|
if (CollUtil.isNotEmpty(filterAlarms)) {
|
||||||
|
sendNotice(rule, filterAlarms.size(), userMap, "8");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("发送设备的报警通知", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送通知
|
* 发送通知
|
||||||
|
*
|
||||||
|
* @param rule
|
||||||
|
* @param filterAlarms
|
||||||
|
* @param userMap
|
||||||
|
* @param type
|
||||||
*/
|
*/
|
||||||
@SchedulerLock(name = "sendMessage", lockAtMostFor = 1000 * 60 * 60, lockAtLeastFor = 1000 * 60 * 5)
|
private void sendNotice(EnableMessageDevRule rule, int filterAlarms, Map<Long, SystemUser> userMap, String type) {
|
||||||
@Scheduled(cron = "0 0 */1 * * ?")
|
if (Objects.equals(rule.getEnableSmsNotification(), 1) && isSmsSendTime(rule)) {
|
||||||
@RequestMapping("sendMessage")
|
DevSmsManufacturer messageManufacturer = devSmsManufacturerFactory.getMessageManufacturer(rule.getProjectSn());
|
||||||
public void sendMessage() {
|
if (messageManufacturer != null) {
|
||||||
// List<EnvironmentAlarm> environmentAlarms;
|
String text = StrUtil.format("{}{}{}异常,近{}小时累计报警{}次!",
|
||||||
// List<EnableMessageDevRule> ruleList;
|
rule.getMonitoringModuleName(), rule.getMonitoringParameterName(), rule.getMonitoringLevelName(), rule.getSmsPushFrequency(), filterAlarms);
|
||||||
// Map<String, List<EnableMessageDevRule>> moduleMap = ruleList.stream().collect(Collectors.groupingBy(EnableMessageDevRule::getMonitoringModuleName));
|
List<String> phoneNums = getPhoneNums(rule.getSmsAlarmRecipientIds(), userMap);
|
||||||
|
if (CollUtil.isNotEmpty(phoneNums)) {
|
||||||
|
messageManufacturer.sendMsg(phoneNums, rule.getNotificationSmsTemplateId(), null, text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//系统站内
|
||||||
|
if (Objects.equals(rule.getEnableSystemMessagePush(), 1) && isSystemSendTime(rule)) {
|
||||||
|
if (StrUtil.isNotBlank(rule.getAlarmRecipientIds())) {
|
||||||
|
List<Long> ids = StrUtil.split(rule.getAlarmRecipientIds(), ",").stream().map(Convert::toLong).collect(Collectors.toList());
|
||||||
|
NoticeMessagePromptTone tone = null;
|
||||||
|
//系统站内声音提示
|
||||||
|
if (Objects.equals(rule.getEnableSystemMessagePromptTone(), 1)) {
|
||||||
|
tone = new NoticeMessagePromptTone(rule.getMessagePromptToneConfig(), rule.getPlaybackFrequency());
|
||||||
|
}
|
||||||
|
for (Long id : ids) {
|
||||||
|
noticeService.addUserNoticeAndApp(id, "设备报警通知", rule.getMessageTemplateContent(), type, tone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是需要发送的时间了
|
||||||
|
*
|
||||||
|
* @param rule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isSystemSendTime(EnableMessageDevRule rule) {
|
||||||
|
int hour = DateUtil.hour(new Date(), true);
|
||||||
|
return Objects.nonNull(rule.getMessagePushFrequency()) && Objects.nonNull(rule.getMessagePushTimeBegin()) && Objects.nonNull(rule.getMessagePushTimeEnd())
|
||||||
|
&& !Objects.equals(rule.getMessagePushFrequency(), 0) && hour % rule.getMessagePushFrequency() == 0
|
||||||
|
&& rule.getMessagePushTimeBegin().getHour() <= hour && rule.getMessagePushTimeEnd().getHour() >= hour;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是需要发送的时间了
|
||||||
|
*
|
||||||
|
* @param rule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isSmsSendTime(EnableMessageDevRule rule) {
|
||||||
|
int hour = DateUtil.hour(new Date(), true);
|
||||||
|
return Objects.nonNull(rule.getSmsPushFrequency()) && Objects.nonNull(rule.getSmsPushTimeBegin()) && Objects.nonNull(rule.getSmsPushTimeEnd())
|
||||||
|
&& !Objects.equals(rule.getSmsPushFrequency(), 0) && hour % rule.getSmsPushFrequency() == 0
|
||||||
|
&& rule.getSmsPushTimeBegin().getHour() <= hour && rule.getSmsPushTimeEnd().getHour() >= hour;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取发送短信的号码
|
||||||
|
*
|
||||||
|
* @param smsAlarmRecipientIds
|
||||||
|
* @param userMap
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<String> getPhoneNums(String smsAlarmRecipientIds, Map<Long, SystemUser> userMap) {
|
||||||
|
if (StrUtil.isBlank(smsAlarmRecipientIds)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return StrUtil.split(smsAlarmRecipientIds, ",").stream().filter(id -> userMap.containsKey(Convert.toLong(id))).map(id -> userMap.get(Convert.toLong(id)).getUserTel())
|
||||||
|
.filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user