10.24-现金支付时优惠券bug测试及修复

This commit is contained in:
ds 2024-10-25 11:41:50 +08:00
parent 6d672850da
commit 5541b75d61
6 changed files with 47 additions and 2 deletions

View File

@ -47,5 +47,6 @@ public interface CardCouponUserMapper extends BaseMapper<CardCouponUser> {
List<Map<String, Object>> selectUserCardVerification(@Param("str") String str);
CardCouponUser selectByOrderId(String orderNo);
}

View File

@ -71,6 +71,10 @@
AND userCard.STATUS = 0
AND userCard.start_time &lt;= NOW() AND userCard.end_time &gt;= NOW()
</select>
<select id="selectByOrderId"
resultType="com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser">
select * from card_coupon_user where order_id = #{orderId}
</select>
</mapper>

View File

@ -105,4 +105,6 @@ public interface AllOrderInfoMapper extends BaseMapper<AllOrderInfo> {
IPage<AllOrderInfoUniVo> queryAllByLimit(Page page, @Param("allOrderInfo") AllOrderInfoUniVo allOrderInfo);
Double getCountMemberBalance(@Param("storeId") Integer storeId,@Param("endTime") String endTime);
AllOrderInfoVo selectByOrderNo(String orderNo);
}

View File

@ -851,6 +851,9 @@
store_id = #{storeId}
AND pay_time &lt; #{endTime};
</select>
<select id="selectByOrderNo" resultType="com.fuint.business.order.vo.AllOrderInfoVo">
select * from all_order_info where order_no = #{orderNo}
</select>
<!-- <where>-->
<!-- store_id = #{order.storeId}-->

View File

@ -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<AllOrderInfoMapper, All
@Resource
GrowthValueChangeService growthValueChangeService;
@Resource
private CardCouponUserMapper cardCouponUserMapper;
@Override
@Transactional
public int refund(Map<String, String> map) {
@ -465,6 +470,16 @@ public class AllOrderInfoServiceImpl extends ServiceImpl<AllOrderInfoMapper, All
allOrderInfo.setRefOrderNo(map.get("refundOrderNo"));
allOrderInfo.setRefBy(nowAccountInfo.getStaffId().toString());
baseMapper.updateById(allOrderInfo);
// 退回优惠卷
AllOrderInfoVo allOrderInfoVo = allOrderInfoMapper.selectByOrderNo(map.get("orderNo"));
CardCouponUser cardCouponUser = cardCouponUserMapper.selectByOrderId(String.valueOf(allOrderInfoVo.getId()));
// 如果有优惠券信息 再做退回优惠券操作
if (ObjectUtil.isNotEmpty(cardCouponUser)){
cardCouponUser.setStatus("0");
cardCouponUserMapper.updateById(cardCouponUser);
}
// 处理油品订单
OilOrder oilOrder = new OilOrder();
if (ObjectUtil.isNotEmpty(map.get("isOil")) && "true".equals(map.get("isOil"))) {

View File

@ -34,6 +34,8 @@ import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO;
import com.fuint.business.marketingActivity.activeExchange.vo.PaymentActiveVO;
import com.fuint.business.marketingActivity.activeFullminus.service.ActiveFullminusService;
import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusVO;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
@ -51,10 +53,12 @@ import com.fuint.business.marketingActivity.favorableRecords.entity.FavorableRec
import com.fuint.business.marketingActivity.favorableRecords.service.FavorableRecordsService;
import com.fuint.business.member.mapper.LJStaffMapper;
import com.fuint.business.order.entity.*;
import com.fuint.business.order.mapper.AllOrderInfoMapper;
import com.fuint.business.order.mapper.LJOrderMapper;
import com.fuint.business.order.mapper.OilOrderMapper;
import com.fuint.business.order.service.*;
import com.fuint.business.order.vo.AllOrderInfoUniVo;
import com.fuint.business.order.vo.AllOrderInfoVo;
import com.fuint.business.order.vo.Excel.OilOrderExcel;
import com.fuint.business.order.vo.OilOrderVo;
import com.fuint.business.petrolStationManagement.entity.*;
@ -211,6 +215,12 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
@Autowired
private FleetConsumeRecordService fleetConsumeRecordService;
@Autowired
private CardCouponUserMapper cardCouponUserMapper;
@Autowired
private AllOrderInfoMapper allOrderInfoMapper;
@Override
public IPage<OilOrder> selectOilOrderList(Page page, OilOrder order) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
@ -430,8 +440,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> 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<OilOrderMapper, OilOrder> 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;
}