|
|
@@ -1,11 +1,13 @@ |
|
|
package com.iformall.service.msg.impl; |
|
|
package com.iformall.service.msg.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.iformall.common.ErrorCode; |
|
|
import com.iformall.domain.po.WxCUser; |
|
|
import com.iformall.domain.po.WxCUser; |
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
import com.iformall.domain.po.WxOrder; |
|
|
import com.iformall.domain.po.WxOrder; |
|
|
import com.iformall.domain.po.msg.BaseMsg; |
|
|
import com.iformall.domain.po.msg.BaseMsg; |
|
|
import com.iformall.domain.po.msg.FmInsideOrderSuccessMsg; |
|
|
import com.iformall.domain.po.msg.FmInsideOrderSuccessMsg; |
|
|
|
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.service.WxCUserService; |
|
|
import com.iformall.service.WxCUserService; |
|
|
import com.iformall.service.WxCouponChannelService; |
|
|
import com.iformall.service.WxCouponChannelService; |
|
|
import com.iformall.service.WxCouponService; |
|
|
import com.iformall.service.WxCouponService; |
|
|
@@ -45,25 +47,31 @@ public class FmInsideOrderSuccessMsgServiceImpl implements MsgSendService { |
|
|
WxOrder record = orderService.getById(msg.getOrderId()); |
|
|
WxOrder record = orderService.getById(msg.getOrderId()); |
|
|
if(record == null) { |
|
|
if(record == null) { |
|
|
logger.error("订单未找到" + msg.getOrderId()); |
|
|
logger.error("订单未找到" + msg.getOrderId()); |
|
|
|
|
|
throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(), "订单未找到" + msg.getOrderId()); |
|
|
} |
|
|
} |
|
|
if(record.getcUserId() != msg.getCUserId()) { |
|
|
if(record.getcUserId() != msg.getCUserId()) { |
|
|
logger.error("订单用户不一致" + msg.getOrderId()); |
|
|
logger.error("订单用户不一致" + msg.getOrderId()); |
|
|
|
|
|
throw new MallinkException(ErrorCode.ORDER_USER_NOT_MATCH.getCode(), "订单用户不一致" + msg.getOrderId()); |
|
|
} |
|
|
} |
|
|
WxCouponChannel couponChannel = couponChannelService.getById(record.getCouponChannelId()); |
|
|
WxCouponChannel couponChannel = couponChannelService.getById(record.getCouponChannelId()); |
|
|
if(couponChannel == null) { |
|
|
if(couponChannel == null) { |
|
|
logger.error("投放渠道未找到" + record.getCouponChannelId()); |
|
|
logger.error("投放渠道未找到" + record.getCouponChannelId()); |
|
|
|
|
|
throw new MallinkException(ErrorCode.ORDER_COUPON_CHANNEL_NOT_MATCH.getCode(), "投放渠道未找到" + record.getCouponChannelId()); |
|
|
} |
|
|
} |
|
|
if(couponChannel.getCouponId() != msg.getCouponId()) { |
|
|
if(couponChannel.getCouponId() != msg.getCouponId()) { |
|
|
logger.error("券ID不一致" + msg.getCouponId()); |
|
|
logger.error("券ID不一致" + msg.getCouponId()); |
|
|
|
|
|
throw new MallinkException(ErrorCode.ORDER_COUPON_NOT_MATCH.getCode(), "订单用户不一致" + msg.getOrderId()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
WxCUser user = userService.getById(msg.getCUserId()); |
|
|
WxCUser user = userService.getById(msg.getCUserId()); |
|
|
if(user == null) { |
|
|
if(user == null) { |
|
|
logger.error("用户未找到" + msg.getCUserId()); |
|
|
logger.error("用户未找到" + msg.getCUserId()); |
|
|
|
|
|
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户未找到" + msg.getCUserId()); |
|
|
} |
|
|
} |
|
|
WxCoupon coupon = couponService.getById(msg.getCouponId()); |
|
|
WxCoupon coupon = couponService.getById(msg.getCouponId()); |
|
|
if(coupon == null) { |
|
|
if(coupon == null) { |
|
|
logger.error("券未找到" + msg.getCouponId()); |
|
|
logger.error("券未找到" + msg.getCouponId()); |
|
|
|
|
|
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL.getCode(), "券未找到" + msg.getCouponId()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 下订单后处理 |
|
|
// 下订单后处理 |
|
|
|