短信发送

This commit is contained in:
钱涛 2023-11-13 16:52:19 +08:00
parent 3dc5cc3a44
commit f3bc735fae
2 changed files with 19 additions and 8 deletions

View File

@ -362,7 +362,9 @@ public class SalaryBillBO {
return data;
}
public static void sendSMS(SalaryBillSendDTO salaryBillSendParam, Long id, Long employeeId) {
public static void sendSMS(Map<String, Object> e, SalaryBillSendDTO salaryBillSendParam) {
System.out.println(111);
// try {
// MessageUtil.sendSMS(mobile, content);

View File

@ -430,15 +430,16 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
List<SalaryAcctResultPO> salaryAcctResultValues = Lists.newArrayList();
//是否需要发送邮件
Boolean isEnableEmail = salaryBillSendParam.getSendChannels().contains(MessageChannelEnum.EMAIL);
boolean isEnableEmail = salaryBillSendParam.getSendChannels().contains(MessageChannelEnum.EMAIL);
boolean isEnableSMS = salaryBillSendParam.getSendChannels().contains(MessageChannelEnum.SMS);
if (CollectionUtils.isNotEmpty(ids)) {
int partSize = 100;// 分片大小,越小进度条跑得越短平快但是总体速度更慢
List<List<Long>> partition = Lists.partition(employeeIds, partSize);
for (List<Long> part : partition) {
// 更新进度
getProgressService(user).getAndAddCalculatedQty(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), part.size());
/** 注意只有邮件才需要加密的核算数据 */
if (isEnableEmail || GEN_PDF) {
/** 注意只有邮件或生成pdf才需要加密的核算数据 */
if (isEnableEmail || isEnableSMS || GEN_PDF) {
List<SalaryAcctEmployeePO> acctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(Collections.singletonList(salarySend.getSalaryAccountingId()), part);
salaryAcctEmployees.addAll(acctEmployees);
salaryAcctResultValues.addAll(getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(SalaryEntityUtil.properties(acctEmployees, SalaryAcctEmployeePO::getId, Collectors.toList())));
@ -446,7 +447,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
}
} else {
/** 注意只有邮件才需要加密的核算数据 */
if (isEnableEmail || GEN_PDF) {
if (isEnableEmail|| isEnableSMS || GEN_PDF) {
salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salarySend.getSalaryAccountingId());
salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singletonList(salarySend.getSalaryAccountingId()));
}
@ -571,12 +572,20 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
SalaryBillBO.sendMsg(salaryBillSendParam, Long.valueOf(e.get("id").toString()), Long.valueOf(e.get("employeeId").toString()));
}
if (sendChannels.contains(MessageChannelEnum.EMAIL) || GEN_PDF) {
if (sendChannels.contains(MessageChannelEnum.EMAIL) || sendChannels.contains(MessageChannelEnum.SMS) || GEN_PDF) {
// 构建发送消息
SalaryBillBO.buildEmployeeInfo(salaryBillSendParam, allEmployeeMap.get(e.get("employeeId").toString()));
SalaryBillBO.sendEmail(e, salaryBillSendParam);
}
//发送邮件
if (sendChannels.contains(MessageChannelEnum.EMAIL)) {
SalaryBillBO.sendEmail(e, salaryBillSendParam);
}
//发送短信
SalaryBillBO.sendSMS(e, salaryBillSendParam);
if (sendChannels.contains(MessageChannelEnum.SMS)) {
}
}
/** 发送工资单 **********************************************************/
sendInfoUpdateList.add(SalarySendInfoPO.builder()