Parcourir la source

发送给指定的人短信

everydatestudy il y a 3 ans
Parent
commit
84654966f7

+ 25 - 4
eladmin-system/src/main/java/me/zhengjie/application/admin/service/impl/SmsTemplateServiceImpl.java

@@ -2,10 +2,12 @@ package me.zhengjie.application.admin.service.impl;
 
 import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.ParameterizedTypeReference;
@@ -152,7 +154,8 @@ public class SmsTemplateServiceImpl extends AbstractServiceImpl<ISmsTemplateDao,
 
 	// 1--公证申请提交成功--- 2个公证员
 	public void submitSuccess(String businessNo) {
-		sendNotary(1, businessNo, "公证员");
+
+		sendNotary(1, businessNo, "公证员", sendSmsPhone());
 	}
 
 	// 2--审核通过---1个客户经理
@@ -181,7 +184,22 @@ public class SmsTemplateServiceImpl extends AbstractServiceImpl<ISmsTemplateDao,
 	// 4---开始公证(待公证) -- 2个公证员
 	@Override
 	public void startNotarize(String businessNo) {
-		sendNotary(4, businessNo, "公证员");
+
+		sendNotary(4, businessNo, "公证员", sendSmsPhone());
+	}
+
+	public Set<String> sendSmsPhone() {
+		String value = dictService.getLabelValue("sms_msg", "send_sms_phone");
+		Set<String> sendPhone = new HashSet<>();
+		if (StringUtils.isNoneBlank(value)) {
+			if (value.contains(",")) {
+				List<String> phone = Arrays.asList(value.split(","));
+				sendPhone.addAll(phone);
+			} else {
+				sendPhone.add(value);
+			}
+		}
+		return sendPhone;
 	}
 
 	// 5--提醒审批公证书 2个公证员
@@ -194,7 +212,7 @@ public class SmsTemplateServiceImpl extends AbstractServiceImpl<ISmsTemplateDao,
 		log.eq("order_type", 5);
 		long count = sendLogMapper.selectCount(log);
 		if (count == 0) {
-			sendNotary(5, businessNo, "公证书签发");
+			sendNotary(5, businessNo, "公证书签发", null);
 		}
 	}
 
@@ -256,7 +274,7 @@ public class SmsTemplateServiceImpl extends AbstractServiceImpl<ISmsTemplateDao,
 	 * @param businessNo 业务编号
 	 * @param notaryName 查询公证员
 	 */
-	private void sendNotary(Integer orderType, String businessNo, String notaryName) {
+	private void sendNotary(Integer orderType, String businessNo, String notaryName, Set<String> sendPhone) {
 		Long templateId = getTemplateId(orderType);
 		if (templateId == null) {
 			log.warn("短信模板不存在或者被停用订单类型  {}  ", orderType);
@@ -271,6 +289,9 @@ public class SmsTemplateServiceImpl extends AbstractServiceImpl<ISmsTemplateDao,
 		}
 		param.add(orderEntity.getConsultNo());
 		Set<String> phone = userDao.queryPhone(orderEntity.getBankId(), notaryName);
+		if (CollectionUtils.isNotEmpty(sendPhone)) {
+			phone.addAll(sendPhone);
+		}
 		SmsSendVo smsSend = new SmsSendVo();
 		smsSend.setSetPhoneNumberSet(phone);
 		smsSend.setTemplateId(String.valueOf(templateId));