记得上下班打卡 | git大法好,push需谨慎

Commit 30a0d9ab authored by 胡佳晨's avatar 胡佳晨

订单 券相关入redis

parent a1c9fcdf
...@@ -325,6 +325,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -325,6 +325,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
//券的使用逻辑 //券的使用逻辑
sqls.add(SqlMapping.get("kylin_order_coupon.add")); sqls.add(SqlMapping.get("kylin_order_coupon.add"));
LinkedList<Object[]> sqlsDataE = ObjectUtil.cloneLinkedListObj(); LinkedList<Object[]> sqlsDataE = ObjectUtil.cloneLinkedListObj();
ArrayList<KylinOrderCoupons> couponsList = new ArrayList();
if (advanceMap != null) { if (advanceMap != null) {
BigDecimal priceVoucher = (BigDecimal) advanceMap.get("voucher"); BigDecimal priceVoucher = (BigDecimal) advanceMap.get("voucher");
Integer typeVoucher = (Integer) advanceMap.get("type"); Integer typeVoucher = (Integer) advanceMap.get("type");
...@@ -334,12 +335,13 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -334,12 +335,13 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
couponsAdvance.setCouponType(101); couponsAdvance.setCouponType(101);
couponsAdvance.setCouponPrice(BigDecimal.ZERO); couponsAdvance.setCouponPrice(BigDecimal.ZERO);
couponsAdvance.setCreatedAt(now); couponsAdvance.setCreatedAt(now);
dataUtils.setOrderCoupon(orderTicketId,couponsAdvance); couponsList.add(couponsAdvance);
sqlsDataE.add(new Object[]{ sqlsDataE.add(new Object[]{
orderTicketId, payOrderParam.getVoucherCode(), typeVoucher, priceVoucher, now, now orderTicketId, payOrderParam.getVoucherCode(), typeVoucher, priceVoucher, now, now
}); });
} }
if (payOrderParam.getVoucherCode() != null) { if (payOrderParam.getVoucherCode() != null) {
HashMap<String, Object> hashMap = orderUtils.useCoupon(payOrderParam.getVoucherCode(), content, orderTickets.getPriceTotal()); HashMap<String, Object> hashMap = orderUtils.useCoupon(payOrderParam.getVoucherCode(), content, orderTickets.getPriceTotal());
BigDecimal priceVoucher = (BigDecimal) hashMap.get("voucher"); BigDecimal priceVoucher = (BigDecimal) hashMap.get("voucher");
...@@ -355,13 +357,17 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -355,13 +357,17 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
couponsVoucher.setCouponType(typeVoucher); couponsVoucher.setCouponType(typeVoucher);
couponsVoucher.setCouponPrice(priceVoucher); couponsVoucher.setCouponPrice(priceVoucher);
couponsVoucher.setCreatedAt(now); couponsVoucher.setCreatedAt(now);
dataUtils.setOrderCoupon(orderTicketId,couponsVoucher); couponsList.add(couponsVoucher);
sqlsDataE.add(new Object[]{ sqlsDataE.add(new Object[]{
orderTicketId, payOrderParam.getVoucherCode(), typeVoucher, priceVoucher, now, now orderTicketId, payOrderParam.getVoucherCode(), typeVoucher, priceVoucher, now, now
}); });
} }
if (couponsList.size() > 0) {
dataUtils.setOrderCoupon(orderTicketId, couponsList);
}
orderTickets.setPriceActual(orderTickets.getPriceTotal().subtract(orderTickets.getPriceVoucher())); orderTickets.setPriceActual(orderTickets.getPriceTotal().subtract(orderTickets.getPriceVoucher()));
orderTickets.setPriceExpress(payOrderParam.getIsExpress() == 1 ? ticketData.getPriceExpress() : BigDecimal.valueOf(0)); orderTickets.setPriceExpress(payOrderParam.getIsExpress() == 1 ? ticketData.getPriceExpress() : BigDecimal.valueOf(0));
orderTickets.setPriceRefund(BigDecimal.valueOf(0.0)); orderTickets.setPriceRefund(BigDecimal.valueOf(0.0));
......
...@@ -235,7 +235,7 @@ public class DataUtils { ...@@ -235,7 +235,7 @@ public class DataUtils {
} }
} }
public void setOrderCoupon(String orderId, KylinOrderCoupons bean){ public void setOrderCoupon(String orderId, List<KylinOrderCoupons> bean){
String redisKey = KylinRedisConst.ORDER_COUPON.concat(orderId); String redisKey = KylinRedisConst.ORDER_COUPON.concat(orderId);
redisUtil.set(redisKey,bean); redisUtil.set(redisKey,bean);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment