短信模板

This commit is contained in:
钱涛 2023-11-16 11:38:21 +08:00
parent d2127cccff
commit 3de1e62f6b
3 changed files with 22 additions and 21 deletions

View File

@ -366,28 +366,30 @@ public class SalaryBillBO {
SalaryTemplateSMSSetDTO smsSetting = salaryBillSendParam.getSmsSetting();
String content = smsSetting != null ? smsSetting.getContent() : "";
content = "";
if (StringUtils.isBlank(content)) {
return;
}
List<SalaryTemplateSMSDTO> items = smsSetting.getItems();
for (int i = 0; i < items.size(); i++) {
SalaryTemplateSMSDTO item = items.get(i);
content = content.replace(item.getItemName(), item.getItemKey())
.replace(item.getItemKey(), e.getOrDefault(item.getItemKey(), "").toString());
for (SalaryTemplateSalaryItemListDTO item : salaryBillSendParam.getEmployeeInformation().getItems()) {
content = content.replace("{" + item.getName() + "}", item.getSalaryItemValue());
}
System.out.println(content);
for (SalaryTemplateSalaryItemSetListDTO salaryTemplateSalaryItemSetListDTO : salaryBillSendParam.getSalaryItemSetList()) {
for (SalaryTemplateSalaryItemListDTO item : salaryTemplateSalaryItemSetListDTO.getItems()) {
if (content.contains("{" + item.getName() + "}")) {
content = content.replace("{" + item.getName() + "}", e.getOrDefault(item.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX, "").toString());
}
}
}
// try {
// MessageUtil.sendSMS(mobile, content);
// } catch (Exception e) {
// kqLog.info("SendSMS error.resourceId:" + resourceId + ">>>>>>mobile>>>>>>" + mobile);
// log.writeLog(e);
// }
try {
log.info("发送短信内容 {}", content);
if (e.get("mobile") != null) {
MessageUtil.sendSMS(e.get("mobile").toString(), content);
}
} catch (Exception ex) {
log.error("发送短信失败", ex);
}
}
// /**

View File

@ -541,7 +541,7 @@
update_time=#{updateTime},
</if>
<if test="creator != null">
creator=#{creator}
creator=#{creator},
</if>
<if test="smsSetting != null">
sms_setting=#{smsSetting}

View File

@ -322,8 +322,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
if (StringUtils.isNotEmpty(salaryTemplate.getTextContent())) {
String yearI18n = SalaryI18nUtil.getI18nLabel(100325, "");
String monthI18n = SalaryI18nUtil.getI18nLabel(100326, "");
salaryTemplate
.setTextContent(salaryTemplate.getTextContent().replace("${salaryMonth}", salaryMonth.getYear() + yearI18n + salaryMonth.getMonth() + monthI18n));
salaryTemplate.setTextContent(salaryTemplate.getTextContent().replace("${salaryMonth}", salaryMonth.getYear() + yearI18n + salaryMonth.getMonth() + monthI18n));
}
// 工资单水印设置
@ -447,7 +446,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
}
} else {
/** 注意只有邮件才需要加密的核算数据 */
if (isEnableEmail|| isEnableSMS || GEN_PDF) {
if (isEnableEmail || isEnableSMS || GEN_PDF) {
salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salarySend.getSalaryAccountingId());
salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singletonList(salarySend.getSalaryAccountingId()));
}
@ -573,7 +572,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
}
if (sendChannels.contains(MessageChannelEnum.EMAIL) || sendChannels.contains(MessageChannelEnum.SMS) || GEN_PDF) {
// 构建发送消
// 构建人员信
SalaryBillBO.buildEmployeeInfo(salaryBillSendParam, allEmployeeMap.get(e.get("employeeId").toString()));
//发送邮件
@ -582,8 +581,8 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
}
//发送短信
SalaryBillBO.sendSMS(e, salaryBillSendParam);
if (sendChannels.contains(MessageChannelEnum.SMS)) {
SalaryBillBO.sendSMS(e, salaryBillSendParam);
}
}