流量不足提醒
This commit is contained in:
parent
8564f2e6d6
commit
f7f1a85441
|
|
@ -0,0 +1 @@
|
|||
flowNoticeMessageType=2022060951
|
||||
|
|
@ -35,7 +35,9 @@ import dm.jdbc.util.IdGenerator;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import weaver.common.MessageUtil;
|
||||
import weaver.email.EmailWorkRunnable;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -248,22 +250,16 @@ public class TaxDeclarationApiFlowWarnServiceImpl extends Service implements Tax
|
|||
String context = String.format(SalaryI18nUtil.getI18nLabel(111, "智能算薪流量已不足%s,请及时采购续费,避免次月无法使用。"), warnConfig.getThreshold());
|
||||
warnReceiverList.forEach(e -> {
|
||||
Long receiver = e.getEmployeeId();
|
||||
sendEmail(receiver, title, context);
|
||||
sendMsg(receiver, title, context, warnConfig.getBusinessId());
|
||||
sendEmail(e.getEmail(), title, context);
|
||||
sendSMS(e.getMobile(), context);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件
|
||||
*
|
||||
* @param receiver
|
||||
* @param title
|
||||
* @param context
|
||||
*/
|
||||
private void sendEmail(Long receiver, String title, String context) {
|
||||
EmailWorkRunnable.threadModeReminder(receiver.toString(), title, context);
|
||||
}
|
||||
//提醒的消息类型
|
||||
BaseBean bb = new BaseBean();
|
||||
private final String flowNoticeMessageType = bb.getPropValue("hrmSalaryCustom", "flowNoticeMessageType");
|
||||
|
||||
/**
|
||||
* 发送Em消息
|
||||
|
|
@ -273,18 +269,48 @@ public class TaxDeclarationApiFlowWarnServiceImpl extends Service implements Tax
|
|||
* @param context
|
||||
* @param businessId
|
||||
*/
|
||||
public static void sendMsg(Long receiver, String title, String context, Long businessId) {
|
||||
MessageType messageType = MessageType.newInstance(499); // 消息来源(见文档第四点补充 必填)
|
||||
Set<String> userIdList = new HashSet<>(); // 接收人id 必填
|
||||
public void sendMsg(Long receiver, String title, String context, Long businessId) {
|
||||
if (StringUtils.isBlank(flowNoticeMessageType)) {
|
||||
return;
|
||||
}
|
||||
MessageType messageType = MessageType.newInstance(Integer.parseInt(flowNoticeMessageType));
|
||||
Set<String> userIdList = new HashSet<>();
|
||||
userIdList.add(receiver.toString());
|
||||
try {
|
||||
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, "", "");
|
||||
messageBean.setCreater(1);// 创建人id
|
||||
messageBean.setBizState("0");// 需要修改消息为已处理等状态时传入,表示消息最初状态为待处理
|
||||
messageBean.setTargetId("499|" + businessId); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
|
||||
messageBean.setTargetId(flowNoticeMessageType + "|" + businessId); //消息来源code +“|”+业务id需要修改消息为已处理等状态时传入
|
||||
Util_Message.store(messageBean);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件
|
||||
*
|
||||
* @param email
|
||||
* @param title
|
||||
* @param context
|
||||
*/
|
||||
private void sendEmail(String email, String title, String context) {
|
||||
if (MessageUtil.checkSendEmail()) {
|
||||
EmailWorkRunnable.threadModeReminder(email, title, context);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送短信
|
||||
*
|
||||
* @param mobile
|
||||
* @param context
|
||||
*/
|
||||
private void sendSMS(String mobile, String context) {
|
||||
if (MessageUtil.checkSendSMS()) {
|
||||
MessageUtil.sendSMS(mobile, context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue