Explorar el Código

fengji 关闭邮件,短信发送

yanite hace 3 años
padre
commit
2743ccbcae

+ 24 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.dao.TenantOrderRecordDao;
 import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.dal.enums.TenantOrderRecordEnum;
 import com.ym.mec.biz.service.*;
@@ -16,6 +17,7 @@ import com.ym.mec.common.page.PageUtil;
 import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.adapay.Payment;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.joda.time.LocalDateTime;
@@ -54,7 +56,8 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
     private TenantAssetsInfoService assetsInfoService;
     @Autowired
     private TenantConfigService tenantConfigService;
-
+    @Autowired
+    private SysMessageService sysMessageService;
     //订单不存在
     private static final String PAYMENT_ID_NOT_EXISTS = "payment_id_not_exists";
 
@@ -263,6 +266,26 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
         // 更新 tenantAssetsInfo
         log.info("checkRechargeCheck  updateAmount>>>>>");
         int ret = assetsInfoService.updateAmount(record.getTenantId(), record.getExpectAmount());
+        // 取余额
+        TenantAssetsInfo assets = assetsInfoService.getOne(new WrapperUtil<TenantAssetsInfo>().hasEq("tenant_id_", record.getTenantId()).queryWrapper());
+        TenantInfo tenantInfo = tenantInfoService.getOne(new WrapperUtil<TenantInfo>().hasEq("tenant_id_", record.getTenantId()).queryWrapper());
+        Integer receiveUserId = tenantInfo.getUserId();
+        String email = tenantInfo.getEmail();
+
+
+        Object[] objs = {tenantInfo.getName(), record.getActualAmount(), assets.getBalance()};
+
+        // 发邮件, 发短信
+        Map<Integer, String> sendPar = new HashMap<>();
+        sendPar.put(receiveUserId, email);
+        log.info("platformSendToAll>>> receiveUserId {} email {} objs {} sendPar {}", receiveUserId, email, objs, sendPar);
+        sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.SMS_TENANT_RECHARGE, sendPar, null, 0, null, "SYSTEM", objs);
+
+        Map<Integer, String> sendPar2 = new HashMap<>();
+        sendPar2.put(receiveUserId, email);
+        log.info("platformSendToAll>>> receiveUserId {} email {} objs {} sendPar {}", receiveUserId, email, objs, sendPar2);
+        sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.EMAIL, MessageTypeEnum.EMAIL_TENANT_RECHARGE, sendPar2, null, 0, null, "SYSTEM", objs);
+
         if (ret != 1) {
             throw new Exception("更新支付失败");
         }

+ 14 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/message/provider/CommEmailPlugin.java

@@ -90,6 +90,20 @@ public class CommEmailPlugin implements MessageSenderPlugin, InitializingBean {
 		return true;
 	}
 
+	public static void main(String[] args) throws Exception {
+		CommEmailPlugin cep = new CommEmailPlugin();
+		cep.setUserName("lexiaoyavip@163.com");
+		cep.setHostName("smtp.163.com");
+		cep.setSmtpPort(465);
+		cep.setPassword("HMBJPGYXFOLEBGIP");
+		cep.setFrom("lexiaoyavip@163.com");
+		cep.setFromName("乐小雅");
+		cep.send("测试邮件",
+				 "<b style='color:red'>测试邮件内容</b>",
+				 "yanite1234@sina.com",
+				 null, null, null, null);
+	}
+
 	@Override
 	public boolean send(String subject, String content, String receiver, String url, String jpushType, String sound, String channelId) throws Exception {
 		if (hostName == null || hostName.equals("")) {