mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-01 17:56:39 +08:00
解决未到生效时间优惠券显示的问题
This commit is contained in:
parent
a3bd3ced1e
commit
cf44fb3cb2
@ -429,8 +429,6 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//得到其它商品的总金额
|
|
||||||
BigDecimal total_Other = new BigDecimal("0");
|
|
||||||
//根据productCodes来判断优惠券的类型,空的话就是通用券,不是空就是指定类别券
|
//根据productCodes来判断优惠券的类型,空的话就是通用券,不是空就是指定类别券
|
||||||
if(SmartStringUtil.isNotBlank(jsonObjectData.getString("productCodes"))){
|
if(SmartStringUtil.isNotBlank(jsonObjectData.getString("productCodes"))){
|
||||||
// BigDecimal total_Coupon = new BigDecimal("0");
|
// BigDecimal total_Coupon = new BigDecimal("0");
|
||||||
@ -453,33 +451,26 @@ public class OrderService {
|
|||||||
//得出指定类用完优惠券后的金额
|
//得出指定类用完优惠券后的金额
|
||||||
total_Coupon = orderService.computeTotal(ordersEntity.getCouponTypeId(), new BigDecimal(ordersEntity.getCouponAmount()), total_Coupon);
|
total_Coupon = orderService.computeTotal(ordersEntity.getCouponTypeId(), new BigDecimal(ordersEntity.getCouponAmount()), total_Coupon);
|
||||||
//得出最终实际的支付金额
|
//得出最终实际的支付金额
|
||||||
total_fee = total_Other.add(total_Coupon);
|
total_fee = new BigDecimal(ordersEntity.getOrderAmount()).add(total_Coupon);
|
||||||
}else{//通用类优惠券的实际支付逻辑
|
}else{//通用类优惠券的实际支付逻辑
|
||||||
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
|
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
|
||||||
//ordersEntity = (OrdersEntity) resultMap.get("ordersEntity");
|
//ordersEntity = (OrdersEntity) resultMap.get("ordersEntity");
|
||||||
orderDatilListJson = (JSONArray) resultMap.get("orderDetailJson");
|
orderDatilListJson = (JSONArray) resultMap.get("orderDatilListJson");
|
||||||
//校验当前订单金额小于优惠券金额
|
//校验当前订单金额小于优惠券金额
|
||||||
if(jsonObjectData.getString("couponAmount") != null ){
|
if(jsonObjectData.getString("couponAmount") != null ){
|
||||||
BigDecimal couponAmount = new BigDecimal(jsonObjectData.getString("couponAmount"));
|
BigDecimal couponAmount = new BigDecimal(jsonObjectData.getString("couponAmount"));
|
||||||
BigDecimal orderAmount = new BigDecimal(ordersEntity.getOrderAmount());
|
if(new BigDecimal(ordersEntity.getOrderAmount()).compareTo(couponAmount) == -1){
|
||||||
if(orderAmount.compareTo(couponAmount) == -1){
|
|
||||||
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//校验当前订单金额小于优惠券金额
|
|
||||||
if(jsonObjectData.getString("couponAmount") != null ){
|
|
||||||
BigDecimal couponAmount = new BigDecimal(jsonObjectData.getString("couponAmount"));
|
|
||||||
if(total_fee.compareTo(couponAmount) == -1){
|
|
||||||
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
|
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//设置ordersEntity的参数
|
//设置ordersEntity的参数
|
||||||
addOrdersEntity(jsonObjectData, ordersEntity);
|
addOrdersEntity(jsonObjectData, ordersEntity);
|
||||||
//total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
|
//total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
|
||||||
total_fee = orderService.computeTotal(ordersEntity.getCouponTypeId(), new BigDecimal(ordersEntity.getCouponAmount()),new BigDecimal(ordersEntity.getOrderAmount()));
|
total_fee = orderService.computeTotal(ordersEntity.getCouponTypeId(), new BigDecimal(ordersEntity.getCouponAmount()), new BigDecimal(ordersEntity.getOrderAmount()));
|
||||||
}
|
}
|
||||||
}else{//没有优惠券的计算总价逻辑
|
}else{//没有优惠券的计算总价逻辑
|
||||||
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
|
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
|
||||||
|
total_fee = new BigDecimal(ordersEntity.getOrderAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
ordersEntity.setMemberId(memberId);
|
ordersEntity.setMemberId(memberId);
|
||||||
@ -548,8 +539,6 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//得到其它商品的总金额
|
|
||||||
BigDecimal total_Other = new BigDecimal("0");
|
|
||||||
//根据productCodes来判断优惠券的类型,空的话就是通用券,不是空就是指定类别券
|
//根据productCodes来判断优惠券的类型,空的话就是通用券,不是空就是指定类别券
|
||||||
if(SmartStringUtil.isNotBlank(jsonObjectData.getString("productCodes"))){
|
if(SmartStringUtil.isNotBlank(jsonObjectData.getString("productCodes"))){
|
||||||
// BigDecimal total_Coupon = new BigDecimal("0");
|
// BigDecimal total_Coupon = new BigDecimal("0");
|
||||||
@ -572,33 +561,26 @@ public class OrderService {
|
|||||||
//得出指定类用完优惠券后的金额
|
//得出指定类用完优惠券后的金额
|
||||||
total_Coupon = orderService.computeTotal(ordersEntity.getCouponTypeId(), new BigDecimal(ordersEntity.getCouponAmount()), total_Coupon);
|
total_Coupon = orderService.computeTotal(ordersEntity.getCouponTypeId(), new BigDecimal(ordersEntity.getCouponAmount()), total_Coupon);
|
||||||
//得出最终实际的支付金额
|
//得出最终实际的支付金额
|
||||||
total_fee = total_Other.add(total_Coupon);
|
total_fee = new BigDecimal(ordersEntity.getOrderAmount()).add(total_Coupon);
|
||||||
}else{//通用类优惠券的实际支付逻辑
|
}else{//通用类优惠券的实际支付逻辑
|
||||||
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
|
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
|
||||||
//ordersEntity = (OrdersEntity) resultMap.get("ordersEntity");
|
//ordersEntity = (OrdersEntity) resultMap.get("ordersEntity");
|
||||||
orderDatilListJson = (JSONArray) resultMap.get("orderDetailJson");
|
orderDatilListJson = (JSONArray) resultMap.get("orderDatilListJson");
|
||||||
//校验当前订单金额小于优惠券金额
|
//校验当前订单金额小于优惠券金额
|
||||||
if(jsonObjectData.getString("couponAmount") != null ){
|
if(jsonObjectData.getString("couponAmount") != null ){
|
||||||
BigDecimal couponAmount = new BigDecimal(jsonObjectData.getString("couponAmount"));
|
BigDecimal couponAmount = new BigDecimal(jsonObjectData.getString("couponAmount"));
|
||||||
BigDecimal orderAmount = new BigDecimal(ordersEntity.getOrderAmount());
|
if(new BigDecimal(ordersEntity.getOrderAmount()).compareTo(couponAmount) == -1){
|
||||||
if(orderAmount.compareTo(couponAmount) == -1){
|
|
||||||
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//校验当前订单金额小于优惠券金额
|
|
||||||
if(jsonObjectData.getString("couponAmount") != null ){
|
|
||||||
BigDecimal couponAmount = new BigDecimal(jsonObjectData.getString("couponAmount"));
|
|
||||||
if(total_fee.compareTo(couponAmount) == -1){
|
|
||||||
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
|
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//设置ordersEntity的参数
|
//设置ordersEntity的参数
|
||||||
addOrdersEntity(jsonObjectData, ordersEntity);
|
addOrdersEntity(jsonObjectData, ordersEntity);
|
||||||
//total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
|
//total_fee = orderService.couponTotal(ordersEntity.getCouponTypeId(), Double.parseDouble(ordersEntity.getCouponAmount()), total_fee);
|
||||||
total_fee = orderService.computeTotal(ordersEntity.getCouponTypeId(), new BigDecimal(ordersEntity.getCouponAmount()),new BigDecimal(ordersEntity.getOrderAmount()));
|
total_fee = orderService.computeTotal(ordersEntity.getCouponTypeId(), new BigDecimal(ordersEntity.getCouponAmount()), new BigDecimal(ordersEntity.getOrderAmount()));
|
||||||
}
|
}
|
||||||
}else{//没有优惠券的计算总价逻辑
|
}else{//没有优惠券的计算总价逻辑
|
||||||
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
|
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
|
||||||
|
total_fee = new BigDecimal(ordersEntity.getOrderAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
ordersEntity.setMemberId(memberId);
|
ordersEntity.setMemberId(memberId);
|
||||||
@ -676,15 +658,15 @@ public class OrderService {
|
|||||||
|
|
||||||
ordersEntity.setOrderAddress(orderAddress);
|
ordersEntity.setOrderAddress(orderAddress);
|
||||||
ordersEntity.setCouponAmount(ordersEntity.getCouponAmount());
|
ordersEntity.setCouponAmount(ordersEntity.getCouponAmount());
|
||||||
ordersEntity.setOrderAmount(StringUtil.toString(total_fee));
|
|
||||||
ordersEntity.setBuyCount(buyCount);
|
ordersEntity.setBuyCount(buyCount);
|
||||||
ordersEntity.setBasePoint(basePoint);
|
ordersEntity.setBasePoint(basePoint);
|
||||||
ordersEntity.setPhoneNumber(mobile);
|
ordersEntity.setPhoneNumber(mobile);
|
||||||
|
ordersEntity.setOrderAmount(StringUtil.toString(total_fee));
|
||||||
ordersEntity.setProductCode(productId.substring(0, productId.length()-1));
|
ordersEntity.setProductCode(productId.substring(0, productId.length()-1));
|
||||||
ordersEntity.setProductName(productName.substring(0, productName.length()-1));
|
ordersEntity.setProductName(productName.substring(0, productName.length()-1));
|
||||||
map.put("ordersEntity", ordersEntity);
|
map.put("ordersEntity", ordersEntity);
|
||||||
map.put("orderDetailJson", orderDatilListJson);
|
map.put("orderDatilListJson", orderDatilListJson);
|
||||||
map.put("total_Coupon", "total_Coupon");
|
map.put("total_Coupon", total_Coupon);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user