|
|
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo; |
|
|
import com.google.common.collect.Lists; |
|
|
import com.google.common.collect.Lists; |
|
|
import com.iformall.common.ErrorCode; |
|
|
import com.iformall.common.ErrorCode; |
|
|
import com.iformall.common.IdWorker; |
|
|
import com.iformall.common.IdWorker; |
|
|
|
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.domain.po.*; |
|
|
import com.iformall.domain.po.*; |
|
|
import com.iformall.domain.po.msg.AppUniformMsg; |
|
|
import com.iformall.domain.po.msg.AppUniformMsg; |
|
|
import com.iformall.domain.po.msg.MpAppMsg; |
|
|
import com.iformall.domain.po.msg.MpAppMsg; |
|
|
@@ -56,6 +57,8 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
WxCUserMapper wxCUserMapper; |
|
|
WxCUserMapper wxCUserMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
|
|
|
WxCUserBasicInfoMapper wxCUserBasicInfoMapper; |
|
|
|
|
|
@Autowired |
|
|
WxAppinfoService wxAppinfoService; |
|
|
WxAppinfoService wxAppinfoService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
WxAuthorizerInfoMapper authorizerInfoMapper; |
|
|
WxAuthorizerInfoMapper authorizerInfoMapper; |
|
|
@@ -599,17 +602,27 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
@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); |
|
|
List<WxCouponSendVo> couponSendList = wxCouponSendMapper.findListVo(wxCouponSend); |
|
|
if (CollectionUtils.isEmpty(couponSendList)) { |
|
|
if (CollectionUtils.isEmpty(couponSendList)) { |
|
|
throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); |
|
|
throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); |
|
|
} |
|
|
} |
|
|
couponSendList.forEach(cs -> { |
|
|
couponSendList.forEach(cs -> { |
|
|
// 发放免费券 |
|
|
// 发放免费券 |
|
|
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(user.getId(), cs.getCouponId(), cs); |
|
|
|
|
|
|
|
|
WxCouponOrder couponOrder = wxOrderService.sendFreeCouponToUser(cu.getId(), cs.getCouponId(), cs); |
|
|
if (couponOrder != null) { |
|
|
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 { |
|
|
} else { |
|
|
logger.warn("handSel couponOrder is null"); |
|
|
logger.warn("handSel couponOrder is null"); |
|
|
} |
|
|
} |
|
|
|