parent
1c9cc632d3
commit
cbafca9aab
|
|
@ -1,9 +1,9 @@
|
|||
package com.engine.salary.entity.taxapiflow.dto;
|
||||
|
||||
import com.engine.salary.annotation.TableTitle;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
|
@ -23,20 +23,23 @@ import net.minidev.json.annotate.JsonIgnore;
|
|||
@ApiModel("智能算税-流量提醒对象")
|
||||
|
||||
public class TaxDeclarationApiFlowWarnReceiverListDTO {
|
||||
//id")
|
||||
//id
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
//提醒对象")
|
||||
//提醒对象
|
||||
@TableTitle(title = "提醒对象",key = "employeeName",dataIndex = "employeeName")
|
||||
private String employeeName;
|
||||
|
||||
@JsonIgnore
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long employeeId;
|
||||
|
||||
//手机号")
|
||||
//手机号
|
||||
@TableTitle(title = "手机号",key = "mobile",dataIndex = "mobile")
|
||||
private String mobile;
|
||||
|
||||
//邮箱")
|
||||
//邮箱
|
||||
@TableTitle(title = "邮箱",key = "email",dataIndex = "email")
|
||||
private String email;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.cloudstore.dev.api.bean.MessageBean;
|
||||
import com.cloudstore.dev.api.bean.MessageType;
|
||||
import com.cloudstore.dev.api.util.Util_Message;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.common.OptionDTO;
|
||||
|
|
@ -19,7 +22,10 @@ import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
|
|||
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
|
||||
import com.engine.salary.mapper.taxapiflow.TaxDeclarationApiFlowWarnConfigMapper;
|
||||
import com.engine.salary.mapper.taxapiflow.TaxDeclarationApiFlowWarnReceiverMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
import com.engine.salary.service.TaxAgentService;
|
||||
import com.engine.salary.service.TaxDeclarationApiFlowStatisticService;
|
||||
import com.engine.salary.service.TaxDeclarationApiFlowWarnService;
|
||||
import com.engine.salary.util.SalaryAssert;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
|
|
@ -28,8 +34,10 @@ import dm.jdbc.util.IdGenerator;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import weaver.email.EmailWorkRunnable;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -228,15 +236,45 @@ public class TaxDeclarationApiFlowWarnServiceImpl extends Service implements Tax
|
|||
log.info("warnReceiverList is empty, send msg fail");
|
||||
return;
|
||||
}
|
||||
//todo 消息
|
||||
// List<UserEntity> receivers = warnReceiverList.stream().map(e ->
|
||||
// new UserEntity(e.getEmployeeId(), updateWrapper.getTenantKey())
|
||||
// .setEmail(e.getEmail()).setPhone(e.getMobile()).setLanguage(6)
|
||||
// ).collect(Collectors.toList());
|
||||
// // 组装消息对象
|
||||
// SendMessageEntity smg = TaxApiFlowBO.buildSendMessageEntity(warnConfig, receivers, updateWrapper);
|
||||
// // 发送消息
|
||||
// WeaResult<Long> weaResult = asyncSystemMessageRest.sendMsg(smg);
|
||||
// SalaryAssert.isTrue(weaResult.isStatus(), SalaryI18nUtil.getI18nLabel(184009, "流量不足提醒发送失败"));
|
||||
String title = "流量不足提醒";
|
||||
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());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件
|
||||
* @param receiver
|
||||
* @param title
|
||||
* @param context
|
||||
*/
|
||||
private void sendEmail(Long receiver, String title, String context) {
|
||||
EmailWorkRunnable.threadModeReminder(receiver.toString(), title, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送Em消息
|
||||
* @param receiver
|
||||
* @param title
|
||||
* @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 必填
|
||||
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需要修改消息为已处理等状态时传入
|
||||
Util_Message.store(messageBean);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue