Просмотр исходного кода

[调整]商户发券微信手机号授权校验

release_toaliyun_real
Burce 6 лет назад
Родитель
Сommit
16e18dba03
4 измененных файлов: 26 добавлений и 10 удалений
  1. +3
    -5
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java
  2. +1
    -0
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  3. +5
    -1
      mallinkService/src/main/java/com/iformall/service/WxCouponSendService.java
  4. +17
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java

+ 3
- 5
mallinkBApi/src/main/java/com/iformall/controller/WxCouponSendController.java Просмотреть файл

@@ -80,10 +80,8 @@ public class WxCouponSendController extends BaseController {
if (CollectionUtils.isEmpty(params)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
WxCUser cu = wxCUserMapper.selectByPrimaryKey(params.get("cUserId"));
if (Objects.isNull(cu)) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}

Object cUserId = params.get("cUserId") ;

if (!params.containsKey("wxCouponSendIds")) {
return new ResultData(ErrorCode.COUPON_IS_EMPTY);
@@ -100,7 +98,7 @@ public class WxCouponSendController extends BaseController {
wxCouponSend.setSendType(EnumCouponSendSendType.MERCHANT.getCode());
wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode());
try {
wxCouponSendService.handSel(wxCouponSend, cu);
wxCouponSendService.handSel(wxCouponSend, cUserId);
} catch (MallinkException e) {
logger.error("注异常: " + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());


+ 1
- 0
mallinkService/src/main/java/com/iformall/common/ErrorCode.java Просмотреть файл

@@ -236,6 +236,7 @@ public enum ErrorCode{
MP_TEMPLATE_SEND_FAILED(11009, "公众号模板消息发送失败"),
UNIFORM_SEND_FAILED(11010, "小程序统一消息发送失败"),
USER_LOGIN_FAILED(11011, "微信用户未登录或登录有问题"),
USER_NOT_AUTH_PHONE(11011, "用户小程序未授权手机号码"),

/**
* POS


+ 5
- 1
mallinkService/src/main/java/com/iformall/service/WxCouponSendService.java Просмотреть файл

@@ -93,7 +93,11 @@ public interface WxCouponSendService {
*/
void backMerchantRemainInventory(Long id, Integer merchantRemain, Integer merchantSend ,Integer number);

void handSel(WxCouponSend wxCouponSend, WxCUser user) ;
/**
*
* @param wxCouponSend
*/
void handSel(WxCouponSend wxCouponSend,Object cUserId) ;


}

+ 17
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxCouponSendServiceImpl.java Просмотреть файл

@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.iformall.common.ErrorCode;
import com.iformall.common.IdWorker;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.po.msg.AppUniformMsg;
import com.iformall.domain.po.msg.MpAppMsg;
@@ -56,6 +57,8 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {
@Autowired
WxCUserMapper wxCUserMapper;
@Autowired
WxCUserBasicInfoMapper wxCUserBasicInfoMapper;
@Autowired
WxAppinfoService wxAppinfoService;
@Autowired
WxAuthorizerInfoMapper authorizerInfoMapper;
@@ -599,17 +602,27 @@ public class WxCouponSendServiceImpl implements WxCouponSendService {

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
public void handSel(WxCouponSend wxCouponSend, WxCUser user) {
public void handSel(WxCouponSend wxCouponSend, Object cUserId) {
WxCUser cu = wxCUserMapper.selectByPrimaryKey(cUserId);
if (Objects.isNull(cu)) {
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL);
}

WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectByPrimaryKey(cu.getId());
if (Objects.isNull(wxCUserBasicInfo)) {
throw new MallinkException(ErrorCode.USER_NOT_AUTH_PHONE);
}

List<WxCouponSendVo> couponSendList = wxCouponSendMapper.findListVo(wxCouponSend);
if (CollectionUtils.isEmpty(couponSendList)) {
throw new MallinkException(ErrorCode.COUPON_IS_EMPTY);
}
couponSendList.forEach(cs -> {
// 发放免费券
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(user.getId(), cs.getCouponId(), cs);
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs.getCouponId(), cs);
if (couponOrder != null) {
wxCouponActionLogService.addOne(user.getTenantId(), cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId());
sendMsgForSendCoupon(cs.getTenantId(), cs, couponOrder, user);
wxCouponActionLogService.addOne(cu.getTenantId(), cs.getCouponId(), couponOrder.getId(), cs.getSendType(), cs.getId());
sendMsgForSendCoupon(cs.getTenantId(), cs, couponOrder, cu);
} else {
logger.warn("handSel couponOrder is null");
}


Загрузка…
Отмена
Сохранить