|
|
@@ -1,11 +1,14 @@
|
|
|
package com.cyksj.service.user.impl;
|
|
|
|
|
|
+import com.cyksj.common.EnvCommonService;
|
|
|
+import com.cyksj.common.constant.Constant;
|
|
|
import com.cyksj.mapper.DistributeOrdersDeductPointsRecordMapper;
|
|
|
import com.cyksj.mapper.UserBalanceSourceRecordMapper;
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
import com.cyksj.model.entity.DistributeOrdersDeductPointsRecord;
|
|
|
import com.cyksj.model.entity.User;
|
|
|
import com.cyksj.model.entity.UserBalanceSourceRecord;
|
|
|
+import com.cyksj.service.sms.SmsService;
|
|
|
import com.cyksj.service.user.UserBenefitsService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
|
@@ -28,6 +31,10 @@ public class UserBenefitsServiceImpl implements UserBenefitsService {
|
|
|
|
|
|
private final UserBalanceSourceRecordMapper userBalanceSourceRecordMapper;
|
|
|
|
|
|
+ private final EnvCommonService envCommonService;
|
|
|
+
|
|
|
+ private final SmsService smsService;
|
|
|
+
|
|
|
@Override
|
|
|
public void deductDistributePoints(Long orderId, Long userId, BigDecimal deductPoints) {
|
|
|
if (deductPoints.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
@@ -72,6 +79,16 @@ public class UserBenefitsServiceImpl implements UserBenefitsService {
|
|
|
Integer success = userMapper.addUserBalance(user.getId(), balance, addBalance);
|
|
|
if (success == 1) {
|
|
|
recordBalanceBySource(userId, addBalance, source);
|
|
|
+ if (envCommonService.isPrdEnv()) {
|
|
|
+ if (source != UserBalanceSourceRecord.Source.close && source != UserBalanceSourceRecord.Source.balance) {
|
|
|
+ try {
|
|
|
+ //短信到账提醒
|
|
|
+ String msg = String.format(Constant.BALANCE_NOTIFY_MSG, addBalance.divide(BigDecimal.valueOf(100)));
|
|
|
+ smsService.sendSmsToRelationUser(userId, msg);
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|