Merge pull request !245 from Admin/LTL_20220314
This commit is contained in:
Admin 2022-03-20 17:25:15 +00:00 committed by Gitee
commit 7145ea8c81
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -429,8 +429,6 @@ public class OrderService {
}
}
//得到其它商品的总金额
BigDecimal total_Other = new BigDecimal("0");
//根据productCodes来判断优惠券的类型,空的话就是通用券不是空就是指定类别券
if(SmartStringUtil.isNotBlank(jsonObjectData.getString("productCodes"))){
// BigDecimal total_Coupon = new BigDecimal("0");
@ -453,23 +451,15 @@ public class OrderService {
//得出指定类用完优惠券后的金额
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{//通用类优惠券的实际支付逻辑
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
//ordersEntity = (OrdersEntity) resultMap.get("ordersEntity");
orderDatilListJson = (JSONArray) resultMap.get("orderDetailJson");
orderDatilListJson = (JSONArray) resultMap.get("orderDatilListJson");
//校验当前订单金额小于优惠券金额
if(jsonObjectData.getString("couponAmount") != null ){
BigDecimal couponAmount = new BigDecimal(jsonObjectData.getString("couponAmount"));
BigDecimal orderAmount = new BigDecimal(ordersEntity.getOrderAmount());
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){
if(new BigDecimal(ordersEntity.getOrderAmount()).compareTo(couponAmount) == -1){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
}
@ -480,6 +470,7 @@ public class OrderService {
}
}else{//没有优惠券的计算总价逻辑
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
total_fee = new BigDecimal(ordersEntity.getOrderAmount());
}
ordersEntity.setMemberId(memberId);
@ -548,8 +539,6 @@ public class OrderService {
}
}
//得到其它商品的总金额
BigDecimal total_Other = new BigDecimal("0");
//根据productCodes来判断优惠券的类型,空的话就是通用券不是空就是指定类别券
if(SmartStringUtil.isNotBlank(jsonObjectData.getString("productCodes"))){
// BigDecimal total_Coupon = new BigDecimal("0");
@ -572,23 +561,15 @@ public class OrderService {
//得出指定类用完优惠券后的金额
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{//通用类优惠券的实际支付逻辑
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
//ordersEntity = (OrdersEntity) resultMap.get("ordersEntity");
orderDatilListJson = (JSONArray) resultMap.get("orderDetailJson");
orderDatilListJson = (JSONArray) resultMap.get("orderDatilListJson");
//校验当前订单金额小于优惠券金额
if(jsonObjectData.getString("couponAmount") != null ){
BigDecimal couponAmount = new BigDecimal(jsonObjectData.getString("couponAmount"));
BigDecimal orderAmount = new BigDecimal(ordersEntity.getOrderAmount());
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){
if(new BigDecimal(ordersEntity.getOrderAmount()).compareTo(couponAmount) == -1){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL);
}
}
@ -599,6 +580,7 @@ public class OrderService {
}
}else{//没有优惠券的计算总价逻辑
Map<String, Object> resultMap = addOrdersEntityInfo(ordersEntityList, ordersEntity, couponJson, total_fee);
total_fee = new BigDecimal(ordersEntity.getOrderAmount());
}
ordersEntity.setMemberId(memberId);
@ -676,15 +658,15 @@ public class OrderService {
ordersEntity.setOrderAddress(orderAddress);
ordersEntity.setCouponAmount(ordersEntity.getCouponAmount());
ordersEntity.setOrderAmount(StringUtil.toString(total_fee));
ordersEntity.setBuyCount(buyCount);
ordersEntity.setBasePoint(basePoint);
ordersEntity.setPhoneNumber(mobile);
ordersEntity.setOrderAmount(StringUtil.toString(total_fee));
ordersEntity.setProductCode(productId.substring(0, productId.length()-1));
ordersEntity.setProductName(productName.substring(0, productName.length()-1));
map.put("ordersEntity", ordersEntity);
map.put("orderDetailJson", orderDatilListJson);
map.put("total_Coupon", "total_Coupon");
map.put("orderDatilListJson", orderDatilListJson);
map.put("total_Coupon", total_Coupon);
return map;
}