|
@@ -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("更新支付失败");
|
|
|
}
|