| @@ -12,7 +12,6 @@ import com.iformall.domain.po.WxPayOrder; | |||||
| import com.iformall.enums.EnumPayStatus; | import com.iformall.enums.EnumPayStatus; | ||||
| import com.iformall.enums.EnumPayWay; | import com.iformall.enums.EnumPayWay; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.WxCouponService; | |||||
| import com.iformall.service.WxOrderService; | import com.iformall.service.WxOrderService; | ||||
| import com.iformall.service.WxPayOrderService; | import com.iformall.service.WxPayOrderService; | ||||
| import com.iformall.utils.IPUtil; | import com.iformall.utils.IPUtil; | ||||
| @@ -44,9 +43,6 @@ public class WxPayOrderController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxOrderService wxOrderService; | private WxOrderService wxOrderService; | ||||
| @Autowired | |||||
| private WxCouponService wxCouponService; | |||||
| @ApiOperation(value = "发起微信小程序支付订单", notes = "{\"orderId\":\"string\"}") | @ApiOperation(value = "发起微信小程序支付订单", notes = "{\"orderId\":\"string\"}") | ||||
| @RequestMapping(value = "/create", method = RequestMethod.POST) | @RequestMapping(value = "/create", method = RequestMethod.POST) | ||||
| public ResultData _create(@RequestBody Map<String, String> paramMap, HttpServletRequest request) throws Exception { | public ResultData _create(@RequestBody Map<String, String> paramMap, HttpServletRequest request) throws Exception { | ||||
| @@ -99,6 +99,9 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| @Autowired | @Autowired | ||||
| WxOrderPressMapper wxOrderPressMapper; | WxOrderPressMapper wxOrderPressMapper; | ||||
| @Autowired | |||||
| WxOrderGroupMapper wxOrderGroupMapper; | |||||
| @Override | @Override | ||||
| public PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxOrderMapper.findList(record)); | ||||
| @@ -354,7 +357,13 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| logger.error("商户不存在, couponId: " + couponIdStr); | logger.error("商户不存在, couponId: " + couponIdStr); | ||||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | ||||
| } | } | ||||
| if (!orderGroupId.equals(0L)) { | |||||
| WxOrderGroup group = wxOrderGroupMapper.selectByPrimaryKey(orderGroupId); | |||||
| if (group.getStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode())) { | |||||
| logger.error("下订单拼团人数已满>>>" + orderGroupId); | |||||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FINISHED); | |||||
| } | |||||
| } | |||||
| // 减库存操作 | // 减库存操作 | ||||
| stockReduce(user, coupon, couponIdStr); | stockReduce(user, coupon, couponIdStr); | ||||
| @@ -123,8 +123,17 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| } | } | ||||
| if (!order.getOrderGroupId().equals(0L) && | if (!order.getOrderGroupId().equals(0L) && | ||||
| order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode())) { | order.getOrderStatus().equals(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode())) { | ||||
| logger.error("支付时拼团已满>>" + order.getOrderGroupId()); | |||||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FINISHED); | throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FINISHED); | ||||
| } | } | ||||
| WxCoupon wxCoupon = wxCouponMapper.selectByPrimaryKey(order.getProductId()); | |||||
| if (wxCoupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode()) && | |||||
| wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) { | |||||
| logger.error("券已经下架了>>>" + order.getProductId()); | |||||
| throw new MallinkException(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF); | |||||
| } | |||||
| if(order.getPressEndDate() == null) { | if(order.getPressEndDate() == null) { | ||||
| // 非砍价券 | // 非砍价券 | ||||
| if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()) { | if (order.getOrderStatus() == EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()) { | ||||
| @@ -233,7 +233,7 @@ | |||||
| from wx_coupon c,wx_order o | from wx_coupon c,wx_order o | ||||
| left join wx_coupon_order co on co.order_id = o.id | left join wx_coupon_order co on co.order_id = o.id | ||||
| left join wx_coupon_action_log cal on cal.coupon_order_id = co.id | left join wx_coupon_action_log cal on cal.coupon_order_id = co.id | ||||
| where o.product_id = c.id | |||||
| where o.product_id = c.id and c.type!=9 | |||||
| <if test="cUserId != null"> | <if test="cUserId != null"> | ||||
| and o.c_user_id = #{cUserId} | and o.c_user_id = #{cUserId} | ||||
| </if> | </if> | ||||