diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java index 39d2c1b6b..48d9bfd09 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/CardCouponUserMapper.java @@ -47,5 +47,6 @@ public interface CardCouponUserMapper extends BaseMapper { List> selectUserCardVerification(@Param("str") String str); + CardCouponUser selectByOrderId(String orderNo); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml index 4548ace45..18a8aed3b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/mapper/xml/CardCouponUserMapper.xml @@ -71,6 +71,10 @@ AND userCard.STATUS = 0 AND userCard.start_time <= NOW() AND userCard.end_time >= NOW() + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CashierOrderController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CashierOrderController.java index 6f649a1b6..6a708b747 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CashierOrderController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/controller/CashierOrderController.java @@ -33,7 +33,7 @@ public class CashierOrderController extends BaseController { */ @GetMapping("/list") public ResponseObject list(CashierOrder order, - @RequestParam(value = "page[page]",defaultValue = "1") Integer pageNo, + @RequestParam(value = "page",defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){ Page page =new Page(pageNo,pageSize); IPage list = cashierOrderService.selectCashierOrderList(page,order); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java index ba6f63894..0ba428902 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/AllOrderInfoMapper.java @@ -105,4 +105,6 @@ public interface AllOrderInfoMapper extends BaseMapper { IPage queryAllByLimit(Page page, @Param("allOrderInfo") AllOrderInfoUniVo allOrderInfo); Double getCountMemberBalance(@Param("storeId") Integer storeId,@Param("endTime") String endTime); + + AllOrderInfoVo selectByOrderNo(String orderNo); } \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml index 16e3159ef..0aca4f5cc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/mapper/xml/AllOrderInfoMapper.xml @@ -851,6 +851,9 @@ store_id = #{storeId} AND pay_time < #{endTime}; + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java index 2a766ddfa..305842361 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/AllOrderInfoServiceImpl.java @@ -21,6 +21,8 @@ import com.fuint.business.convenienceSore.mapper.LJGoodsMapper; import com.fuint.business.convenienceSore.service.LJGoodsService; import com.fuint.business.convenienceSore.service.StockTrackService; import com.fuint.business.largeSscreen.vo.OrderGoodsVO; +import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser; +import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper; import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService; import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; import com.fuint.business.order.dto.AllOrderInfoDto; @@ -398,6 +400,9 @@ public class AllOrderInfoServiceImpl extends ServiceImpl map) { @@ -465,6 +470,16 @@ public class AllOrderInfoServiceImpl extends ServiceImpl i @Autowired private FleetConsumeRecordService fleetConsumeRecordService; + @Autowired + private CardCouponUserMapper cardCouponUserMapper; + + @Autowired + private AllOrderInfoMapper allOrderInfoMapper; + @Override public IPage selectOilOrderList(Page page, OilOrder order) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); @@ -430,8 +440,8 @@ public class OilOrderServiceImpl extends ServiceImpl i Double activeAmount = Double.valueOf(ObjectUtil.isNotEmpty(map.get("activeAmount")) ? map.get("activeAmount") : "0.0"); // 优惠券 用户 id Integer couponUserId = null; - if (StringUtils.isNotEmpty(map.get("couponUserId"))) { - couponUserId = Integer.valueOf(map.get("couponUserId")); + if (StringUtils.isNotEmpty(map.get("userId"))) { + couponUserId = Integer.valueOf(map.get("userId")); } // 优惠券类型 String couponType = map.get("couponType"); @@ -747,6 +757,16 @@ public class OilOrderServiceImpl extends ServiceImpl i } orders.put("orderNo", orderNo); cashierOrderService.insertCashierOrder(cashierOrder); + + // 下单完成需要更新一下优惠券的状态 当订单退款以后也要调用这样的代码修改优惠券的状态 + if(StringUtils.isNotEmpty(map.get("couponId"))){ + CardCouponUser cardCouponUser = cardCouponUserMapper.selectById(map.get("couponId")); + cardCouponUser.setStatus("1"); + // 查询订单号并赋值 + AllOrderInfoVo allOrderInfoVo = allOrderInfoMapper.selectByOrderNo(orderNo); + cardCouponUser.setOrderId(allOrderInfoVo.getId()); + cardCouponUserMapper.updateById(cardCouponUser); + } return orders; }