Browse Source

[调整]添加积分时校验手机号

release_toaliyun_real
Burce 6 years ago
parent
commit
6cb6863553
4 changed files with 17 additions and 2 deletions
  1. +1
    -0
      mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java
  2. +6
    -0
      mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java
  3. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java
  4. +9
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java

+ 1
- 0
mallinkBApi/src/main/java/com/iformall/controller/WxCreditHistoryController.java View File

@@ -102,6 +102,7 @@ public class WxCreditHistoryController extends BaseController {
//B端操作用户 //B端操作用户
wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode()); wxCreditHistory.setOperatorType(EnumUserType.BUSER.getCode());
try { try {
wxCreditHistoryService.check(wxCreditHistory.getCUserId());
WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory); WxCreditHistory credit = wxCreditHistoryService.saveOrUpdate(wxCreditHistory);
return new ResultData(Result.SUCCESS, "操作成功", credit); return new ResultData(Result.SUCCESS, "操作成功", credit);
} catch (MallinkException e) { } catch (MallinkException e) {


+ 6
- 0
mallinkService/src/main/java/com/iformall/service/WxCreditHistoryService.java View File

@@ -38,6 +38,12 @@ public interface WxCreditHistoryService {
* @return * @return
*/ */
WxCreditHistory getById(Long id); WxCreditHistory getById(Long id);

/**
* 校验用户是否存在
* @param cUserId
*/
void check(Long cUserId) ;
/** /**
* 保存或更新实体 * 保存或更新实体


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java View File

@@ -607,6 +607,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
if (Objects.isNull(cu)) { if (Objects.isNull(cu)) {
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL); throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL);
} }
// 1002 ,11012,2020 ,2000,2022,2021,3005,3999,1050,3000


WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(cu.getId()); WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(cu.getId());
if (Objects.isNull(wxCUserBasicInfo)) { if (Objects.isNull(wxCUserBasicInfo)) {


+ 9
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxCreditHistoryServiceImpl.java View File

@@ -194,15 +194,22 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService {
return wxCreditHistoryMapper.selectByPrimaryKey(id); return wxCreditHistoryMapper.selectByPrimaryKey(id);
} }


public void check(Long cUserId) {
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(cUserId);
if (wxCUserBasicInfo == null) {
throw new MallinkException(ErrorCode.USER_NOT_AUTH_PHONE);
}
}

@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public WxCreditHistory saveOrUpdate(WxCreditHistory record) { public WxCreditHistory saveOrUpdate(WxCreditHistory record) {
WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(record.getCUserId()); WxCUser wxCUser = wxCUserMapper.selectByPrimaryKey(record.getCUserId());
if (wxCUser == null) {
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId());
if (wxCUser == null && wxCUserBasicInfo == null) {
//验证此用户是否存在 //验证此用户是否存在
throw new MallinkException(ErrorCode.USER_IS_EMPTY); throw new MallinkException(ErrorCode.USER_IS_EMPTY);
} }
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(record.getCUserId());
if (StringUtils.isNotEmpty(record.getSpendStr())) { if (StringUtils.isNotEmpty(record.getSpendStr())) {
record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue()); record.setSpend(new BigDecimal(record.getSpendStr()).multiply(new BigDecimal(100)).intValue());
} }


Loading…
Cancel
Save