diff --git a/bweb/src/main/java/com/bweb/controller/SecMenuController.java b/bweb/src/main/java/com/bweb/controller/SecMenuController.java index bec13a5..9f68e21 100644 --- a/bweb/src/main/java/com/bweb/controller/SecMenuController.java +++ b/bweb/src/main/java/com/bweb/controller/SecMenuController.java @@ -1,17 +1,12 @@ package com.bweb.controller; import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.SysCode; -import com.hfkj.common.utils.HttpUtils; -import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.entity.SecMenu; import com.hfkj.entity.SecRoleMenuRel; -import com.hfkj.model.MenuTreeModel; import com.hfkj.model.ResponseData; import com.hfkj.service.SecMenuService; import com.hfkj.service.SecRoleMenuRelService; @@ -26,7 +21,6 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.*; -import java.util.function.Function; import java.util.stream.Collectors; /** @@ -174,39 +168,10 @@ public class SecMenuController { try { // 查询角色菜单权限 - Map roleMenu = secMenuService.queryRoleMenu(roleId, SecMenuTypeEnum.type1).stream() - .collect(Collectors.toMap(SecMenu::getId, Function.identity())); + List roleMenuList = secRoleMenuRelService.getRelListByRole(roleId); - // 系统菜单叶节点 - List menuLeafList = new ArrayList<>(); - - // 角色菜单叶节点 - List roleLeafList = new ArrayList<>(); - - // 获取全部菜单 - List menuList = secMenuService.getAllList(); - - // 获取最顶层菜单 - List topLevelMenuList = menuList.stream() - .filter(o -> o.getMenuPSid() == null) - .sorted(Comparator.comparing(SecMenu::getMenuSort)) - .collect(Collectors.toList()); - // 递归获取系统菜单叶子节点 - for (SecMenu topLevelMenu : topLevelMenuList) { - if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { - recursionMenu(menuList, topLevelMenu.getId(), menuLeafList); - } - } - - // 筛选角色菜单叶节点 - for (String leaf : menuLeafList) { - SecMenu menu = roleMenu.get(Long.parseLong(leaf)); - if (menu != null) { - roleLeafList.add(""+menu.getId()); - } - } - - return ResponseMsgUtil.success(roleLeafList); + return ResponseMsgUtil.success(roleMenuList.stream().map(SecRoleMenuRel::getMenuId).collect(Collectors.toList()) + .stream().map(Object::toString).collect(Collectors.toList())); } catch (Exception e) { log.error("error!",e); @@ -247,11 +212,11 @@ public class SecMenuController { for (SecMenu topLevelMenu : topLevelMenuList) { if (topLevelMenu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { - map = new LinkedHashMap<>(); + map = new HashMap<>(); map.put("key", ""+topLevelMenu.getId()); map.put("title", topLevelMenu.getMenuName()); // 获取下级菜单 - map.put("children", recursionMenu(menuList, topLevelMenu.getId(), new ArrayList<>())); + map.put("children", recursionMenu(menuList, topLevelMenu.getId())); mapList.add(map); } } @@ -270,7 +235,7 @@ public class SecMenuController { * @param parentMenuId 父级菜单id * @return */ - public List> recursionMenu(List dataSource, Long parentMenuId, List leaf) { + public List> recursionMenu(List dataSource, Long parentMenuId) { List> mapList = new ArrayList<>(); Map map; @@ -280,13 +245,12 @@ public class SecMenuController { .collect(Collectors.toList()); for (SecMenu menu : collect) { if (menu.getMenuType().equals(SecMenuTypeEnum.type1.getCode())) { - map = new LinkedHashMap<>(); + map = new HashMap<>(); map.put("key", ""+menu.getId()); map.put("title", menu.getMenuName()); // 获取下级菜单 - List> recursioned = recursionMenu(dataSource, menu.getId(), leaf); + List> recursioned = recursionMenu(dataSource, menu.getId()); if (recursioned.isEmpty()) { - leaf.add(""+menu.getId()); map.put("isLeaf", true); } else { map.put("children", recursioned); @@ -297,5 +261,4 @@ public class SecMenuController { return mapList; } - } diff --git a/cweb/src/main/java/com/cweb/controller/CommonController.java b/cweb/src/main/java/com/cweb/controller/CommonController.java index c1c8dea..dc60b0b 100644 --- a/cweb/src/main/java/com/cweb/controller/CommonController.java +++ b/cweb/src/main/java/com/cweb/controller/CommonController.java @@ -12,6 +12,7 @@ import com.hfkj.model.ResponseData; import com.hfkj.qianzhu.channel.QianZhuService; import com.hfkj.service.CommonService; import com.hfkj.service.goods.BsOrderGoodsService; +import com.hfkj.service.hlt.HuiLianTongUnionCardService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; @@ -40,6 +41,28 @@ public class CommonController { @Resource private BsOrderGoodsService bsOrderGoodsService; + @RequestMapping(value = "/test", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "test") + public ResponseData test() { + try { + + JSONObject refundObj = HuiLianTongUnionCardService.refund("R240805090735776", "240803201355633339"); + if (!refundObj.getString("respCode").equals("0000")) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refundObj.getString("respMessage")); + } + JSONObject consumptionResult = HuiLianTongUnionCardService.resolveResponse(refundObj.getString("data")); + if (!(consumptionResult.getBoolean("success") || Objects.equals(consumptionResult.getString("message"), "原交易已撤销,不可再次操作"))) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败!"+consumptionResult.getString("message")); + } + return ResponseMsgUtil.success(consumptionResult); + + } catch (Exception e) { + log.error("HighUserCardController --> oilCardRefund() error!", e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value = "/getAllCity", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询所有城市") diff --git a/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java b/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java index d781a1b..715571a 100644 --- a/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java +++ b/cweb/src/main/java/com/cweb/controller/qianZhu/StarbucksController.java @@ -26,10 +26,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -84,7 +81,7 @@ public class StarbucksController { // 查询产品 Map map = new HashMap<>(); map.put("pageIndex", 1); - map.put("pageSize", 100000); + map.put("pageSize", 200); JSONObject object = StarbucksService.starbucksProducts(map); if (object.getJSONObject("data") != null) { JSONArray jsonArray = object.getJSONObject("data").getJSONArray("items"); @@ -96,29 +93,40 @@ public class StarbucksController { // 中杯售卖价 BigDecimal tallPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesTallPrice")); + List priceList = new ArrayList<>(); // 判断如果卖家 大于 原价 展示原价 if (tallPrice.compareTo(item.getBigDecimal("marketTallPrice")) > 0) { item.put("tallPrice" , item.getBigDecimal("marketTallPrice")); + priceList.add(item.getBigDecimal("marketTallPrice")); } else { item.put("tallPrice" , tallPrice); + priceList.add(tallPrice); } // 大杯销售价 BigDecimal grandePrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesGrandePrice")); if (grandePrice.compareTo(item.getBigDecimal("marketGrandePrice")) > 0) { item.put("grandePrice" , item.getBigDecimal("marketGrandePrice")); + priceList.add(item.getBigDecimal("marketGrandePrice")); } else { item.put("grandePrice" , grandePrice); + priceList.add(grandePrice); } // 超大杯销售价 BigDecimal ventiPrice = StarbucksUtil.calculatePrice(productConfig.getDiscount() , item.getBigDecimal("salesVentiPrice")); if (ventiPrice.compareTo(item.getBigDecimal("marketVentiPrice")) > 0) { item.put("ventiPrice" , item.getBigDecimal("marketVentiPrice")); + priceList.add(item.getBigDecimal("marketVentiPrice")); } else { item.put("ventiPrice" , ventiPrice); + priceList.add(ventiPrice); } + Collections.sort(priceList); + item.put("tallPrice" ,priceList.get(0)); + + List dataList = new ArrayList<>(); JSONObject jsonObject ; diff --git a/order/src/main/java/com/order/controller/OrderController.java b/order/src/main/java/com/order/controller/OrderController.java index b52897f..e1b1536 100644 --- a/order/src/main/java/com/order/controller/OrderController.java +++ b/order/src/main/java/com/order/controller/OrderController.java @@ -57,6 +57,7 @@ public class OrderController { @ApiOperation(value = "创建订单") public ResponseData create(@RequestBody OrderModel body) { try { + System.out.println("body" + body.toString()); // 用户session UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); if (userSession == null) { @@ -86,6 +87,7 @@ public class OrderController { body.setUserName(userSession.getUser().getName()); body.setUserPhone(userSession.getUser().getPhone()); + return ResponseMsgUtil.success(orderService.create(body)); } catch (Exception e) { diff --git a/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java b/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java index 442eef1..f33bbe9 100644 --- a/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java +++ b/order/src/main/java/com/order/controller/business/BsOrderStarbucksController.java @@ -1,18 +1,15 @@ package com.order.controller.business; import com.github.pagehelper.PageInfo; -import com.hfkj.common.security.SessionObject; -import com.hfkj.common.security.UserCenter; + import com.hfkj.common.utils.PageUtil; import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.entity.BsOrderChild; import com.hfkj.entity.BsOrderStarbucks; import com.hfkj.model.ResponseData; -import com.hfkj.model.SecUserSessionObject; import com.hfkj.model.order.OrderStarbucksModel; import com.hfkj.service.goods.BsOrderStarbucksService; import com.hfkj.service.order.BsOrderChildService; -import com.hfkj.sysenum.SecUserObjectTypeEnum; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; @@ -89,7 +86,7 @@ public class BsOrderStarbucksController { starbucksModel.setStoreAddress(starbucks.get(0).getStoreAddress()); starbucksModel.setStoreName(starbucks.get(0).getStoreName()); starbucksModel.setUserPhone(starbucks.get(0).getUserPhone()); - + starbucksModel.setPayType(starbucks.get(0).getPayType()); starbucksModelList.add(starbucksModel); } diff --git a/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java b/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java index 31802fd..fb55d72 100644 --- a/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java +++ b/service/src/main/java/com/hfkj/common/utils/StarbucksUtil.java @@ -36,36 +36,61 @@ public class StarbucksUtil { for (String cup : cpuS) { JSONObject obj = new JSONObject(); - switch (cup) { - case "中杯": - obj.put("cpu", "中杯"); - obj.put("notSelect", tall); - obj.put("select", tallSelect); - obj.put("volume", "355ml"); - obj.put("price", tallPrice); - break; - case "大杯": - obj.put("cpu", "大杯"); - obj.put("notSelect", grande); - obj.put("select", grandeSelect); - obj.put("volume", "473ml"); - obj.put("price", grandePrice); - break; - case "超大杯": - obj.put("cpu", "超大杯"); - obj.put("notSelect", venti); - obj.put("select", ventiSelect); - obj.put("volume", "473ml"); - obj.put("price", ventiPrice); - break; - default: - obj.put("cpu", "特殊杯"); - obj.put("notSelect", venti); - obj.put("select", ventiSelect); - obj.put("volume", "∞ml"); - obj.put("price", ventiPrice); - break; + if (cup.equals("中杯") && tallPrice.compareTo(new BigDecimal(1000)) < 0) { + obj.put("cpu" , "中杯"); + obj.put("notSelect" , tall); + obj.put("select" , tallSelect); + obj.put("volume" , "355ml"); + obj.put("price", tallPrice); + } else if (cup.equals("大杯") && grandePrice.compareTo(new BigDecimal(1000)) < 0) { + obj.put("cpu" , "大杯"); + obj.put("notSelect" , grande); + obj.put("select" , grandeSelect); + obj.put("volume" , "473ml"); + obj.put("price", grandePrice); + } else if (cup.equals("超大杯") && ventiPrice.compareTo(new BigDecimal(1000)) < 0) { + obj.put("cpu" , "超大杯"); + obj.put("notSelect" , venti); + obj.put("select" , ventiSelect); + obj.put("volume" , "592ml"); + obj.put("price", ventiPrice); + } else { + obj.put("cpu" , "特殊杯"); + obj.put("notSelect" , venti); + obj.put("select" , ventiSelect); + obj.put("volume" , "∞ml"); + obj.put("price", ventiPrice); } +// switch (cup) { +// case "中杯": +// obj.put("cpu", "中杯"); +// obj.put("notSelect", tall); +// obj.put("select", tallSelect); +// obj.put("volume", "355ml"); +// obj.put("price", tallPrice); +// break; +// case "大杯": +// obj.put("cpu", "大杯"); +// obj.put("notSelect", grande); +// obj.put("select", grandeSelect); +// obj.put("volume", "473ml"); +// obj.put("price", grandePrice); +// break; +// case "超大杯": +// obj.put("cpu", "超大杯"); +// obj.put("notSelect", venti); +// obj.put("select", ventiSelect); +// obj.put("volume", "592ml"); +// obj.put("price", ventiPrice); +// break; +// default: +// obj.put("cpu", "特殊杯"); +// obj.put("notSelect", venti); +// obj.put("select", ventiSelect); +// obj.put("volume", "∞ml"); +// obj.put("price", ventiPrice); +// break; +// } list.add(obj); } diff --git a/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java b/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java index 56c49b0..e5c03e0 100644 --- a/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java +++ b/service/src/main/java/com/hfkj/model/order/OrderStarbucksModel.java @@ -17,4 +17,6 @@ public class OrderStarbucksModel extends BsOrderChild{ private String storeName; private String userPhone; + + private Integer payType; } diff --git a/service/src/main/java/com/hfkj/qianzhu/channel/StarbucksService.java b/service/src/main/java/com/hfkj/qianzhu/channel/StarbucksService.java index adf7df0..cdca58f 100644 --- a/service/src/main/java/com/hfkj/qianzhu/channel/StarbucksService.java +++ b/service/src/main/java/com/hfkj/qianzhu/channel/StarbucksService.java @@ -103,14 +103,17 @@ public class StarbucksService { * @Author: Sum1Dream * @Date: 2024/8/1 下午2:21 */ - public static JSONObject starbucksOrdersPay(Map map) throws Exception { - - JSONObject object = QianZhuService.requestH5("starbucksOrders.pay" , map); + public static JSONObject starbucksOrdersPay(Map map) { + try { + JSONObject object = QianZhuService.requestH5("starbucksOrders.pay" , map); - if (object.getBoolean("success")) { - return object; - } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询失败!"); + if (object.getBoolean("success")) { + return object; + } else { + return null; + } + } catch (Exception e) { + return null; } } diff --git a/service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java b/service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java index d28f9d8..17bf8b2 100644 --- a/service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/cms/impl/CmsContentServiceImpl.java @@ -63,7 +63,7 @@ public class CmsContentServiceImpl implements CmsContentService { if (StringUtils.isNotBlank(MapUtils.getString(map, "platformCode"))) { criteria.andPlatformCodeEqualTo(MapUtils.getString(map, "platformCode")); } - + example.setOrderByClause("create_time desc"); return cmsContentMapper.selectByExample(example); } } diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index ea20595..90e3703 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -361,7 +361,7 @@ public class OrderCreateService { // 查询星巴克产品 Map map = new HashMap<>(); map.put("pageIndex", 1); - map.put("pageSize", 100000); + map.put("pageSize", 200); JSONObject jsonObject = StarbucksService.starbucksProducts(map); if (jsonObject.getJSONObject("data") == null) { throw ErrorHelp.genException(SysCode.System , ErrorCode.REQ_PARAMS_ERROR ); @@ -445,16 +445,16 @@ public class OrderCreateService { orderChild.setMerId(productConfig.getMerId()); orderChild.setProductName("星巴克"); orderChild.setProductCount(1); - orderChild.setProductSpecName(String.valueOf(productSpecName.toString())); + orderChild.setProductSpecName(productSpecName.toString()); // 星巴克创建订单 // 获取token Map mapToken = new HashMap<>(); mapToken.put("platformUniqueId" , order.getOrderNo()); mapToken.put("nickname" , order.getUserName()); - mapToken.put("mobile" , order.getUserPhone()); + mapToken.put("mobile" , object.getString("phone")); StarbucksService.getTokenV2(mapToken); - // 查询产品 + // 预下单 Map mapOrder = new HashMap<>(); mapOrder.put("storeCode", object.getString("storeCode")); mapOrder.put("customerMobile", object.getString("phone")); diff --git a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java index cb3026c..0260149 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java @@ -76,7 +76,7 @@ public class OrderPaySuccessService { } else if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type3.getCode())) { cinema(order, childOrder); } else if (childOrder.getProductType().equals(OrderChildProductTypeEnum.type4.getCode())) { - starbucks(childOrder); + starbucks(order , childOrder); } } catch (Exception e) { @@ -288,12 +288,21 @@ public class OrderPaySuccessService { } - public void starbucks(BsOrderChild childOrder) throws Exception { + public void starbucks(OrderModel order,BsOrderChild childOrder) { // 推送订单 // 查询星巴克订单 Map map = new HashMap<>(); map.put("orderNo", childOrder.getChannelOrderNo()); StarbucksService.starbucksOrdersPay(map); + + Map params = new HashMap<>(); + params.put("orderNo", childOrder.getOrderNo()); + List orderStarbucks = bsOrderStarbucksService.getList(params); + + for (BsOrderStarbucks bsOrderStarbucks : orderStarbucks) { + bsOrderStarbucks.setPayType(order.getPayType()); + bsOrderStarbucksService.update(bsOrderStarbucks); + } } diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java index 3139569..7f3e170 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java @@ -223,49 +223,64 @@ public class BsOrderServiceImpl implements BsOrderService { BigDecimal payRealPrice = totalPrice.subtract(order.getDeduction().getTotalDeductionPrice()); order.setPayRealPrice(payRealPrice.compareTo(new BigDecimal("0")) > 0 ? payRealPrice : new BigDecimal("0")); order.setOrderStatus(order.getPayRealPrice().compareTo(new BigDecimal("0")) == 0?OrderStatusEnum.status2.getCode():OrderStatusEnum.status1.getCode()); + BigDecimal totalChildDiscountPrice = new BigDecimal("0"); + Long totalIntegralDiscountPrice = 0L; // 订单入库前处理 - for (OrderChildModel childOrder : order.getOrderChildList()) { + for (int i = 0; i < order.getOrderChildList().size();i++) { + OrderChildModel childOrder = order.getOrderChildList().get(i); childOrder.setSurplusRefundCount(childOrder.getProductCount()); // 计算 子订单 在交易订单金额中的占比 BigDecimal ratio = childOrder.getProductTotalPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN); - // 计算子订单退款积分 + // 优惠券优惠 + if (order.getDeduction().getCouponDiscountActualPrice().compareTo(BigDecimal.ZERO) > 0) { + childOrder.setCouponDiscountPrice(order.getDeduction().getCouponDiscountActualPrice().multiply(ratio).setScale(2, BigDecimal.ROUND_DOWN)); + } else { + childOrder.setCouponDiscountPrice(new BigDecimal("0")); + } + totalChildDiscountPrice = totalChildDiscountPrice.add(childOrder.getCouponDiscountPrice()); + + // 积分 if (order.getDeduction().getIntegralDiscountPrice() > 0) { - childOrder.setSurplusRefundIntegral(new BigDecimal(order.getDeduction().getIntegralDiscountPrice().toString()).multiply(ratio).setScale(2).longValue()); + childOrder.setIntegralDiscountPrice(new BigDecimal(order.getDeduction().getIntegralDiscountPrice().toString()).multiply(ratio).setScale(2, BigDecimal.ROUND_DOWN).longValue()); } else { - childOrder.setSurplusRefundIntegral(0L); + childOrder.setIntegralDiscountPrice(0L); } + totalIntegralDiscountPrice = totalIntegralDiscountPrice + childOrder.getIntegralDiscountPrice(); + + // 如果是循环的最后一笔商品订单 + if ((i+1) == order.getOrderChildList().size()) { + // 优惠券差值 + BigDecimal couponDiscountDifference = order.getDeduction().getCouponDiscountActualPrice().subtract(totalChildDiscountPrice); + if (couponDiscountDifference.compareTo(BigDecimal.ZERO) > 0) { + // 大于0 + childOrder.setCouponDiscountPrice(childOrder.getCouponDiscountPrice().add(couponDiscountDifference)); + } else if (couponDiscountDifference.compareTo(BigDecimal.ZERO) < 0) { + // 小于0 + childOrder.setCouponDiscountPrice(childOrder.getCouponDiscountPrice().subtract(couponDiscountDifference)); + } - if (order.getDeduction().getCouponDiscountActualPrice().compareTo(BigDecimal.ZERO) == 1) { - // 计算子订单退款金额。 - if (order.getPayRealPrice().compareTo(BigDecimal.ZERO) == 1) { - // 计算实付金额中的占比 - childOrder.setSurplusRefundPrice(order.getPayRealPrice().multiply(ratio).setScale(2, BigDecimal.ROUND_DOWN)); - } else { - childOrder.setSurplusRefundPrice(new BigDecimal("0")); + // 积分差值 + Long integralDiscountDifference = order.getDeduction().getIntegralDiscountPrice() - totalIntegralDiscountPrice; + if (integralDiscountDifference > 0) { + // 大于0 + childOrder.setIntegralDiscountPrice(childOrder.getIntegralDiscountPrice() + integralDiscountDifference); + } else if (integralDiscountDifference < 0) { + // 小于0 + childOrder.setIntegralDiscountPrice(childOrder.getIntegralDiscountPrice() - integralDiscountDifference); } - } else { - childOrder.setSurplusRefundPrice( - // 商品总金额 - 积分抵扣金额 - childOrder.getProductTotalPrice().subtract( - new BigDecimal(childOrder.getSurplusRefundIntegral().toString()).divide(new BigDecimal("100")) - )); } - childOrder.setIntegralDiscountPrice(childOrder.getSurplusRefundIntegral()); - childOrder.setCouponDiscountPrice( - // 可退款金额大于0 可退款金额+可退款积分=优惠券优惠 - childOrder.getSurplusRefundPrice().compareTo(BigDecimal.ZERO) == 1 - ? childOrder.getProductTotalPrice().subtract( - childOrder.getSurplusRefundPrice().add(new BigDecimal(childOrder.getSurplusRefundIntegral().toString()).divide(new BigDecimal("100")))) - : childOrder.getSurplusRefundPrice()); - - childOrder.setTotalDeductionPrice( - childOrder.getCouponDiscountPrice() - .add(new BigDecimal(childOrder.getIntegralDiscountPrice().toString()).divide(new BigDecimal("100"))) - ); - childOrder.setProductActualPrice(childOrder.getProductTotalPrice().subtract(childOrder.getTotalDeductionPrice())); + // 商品订单总优惠 + childOrder.setTotalDeductionPrice(childOrder.getCouponDiscountPrice().add(new BigDecimal(childOrder.getIntegralDiscountPrice()).divide(new BigDecimal("100")))); + + // 可退款金额 产品总价 - 优惠总价 + childOrder.setSurplusRefundPrice(childOrder.getProductTotalPrice().subtract(childOrder.getTotalDeductionPrice())); + // 可退款积分 积分优惠 + childOrder.setSurplusRefundIntegral(childOrder.getIntegralDiscountPrice()); + // 商品实际价格 + childOrder.setProductActualPrice(childOrder.getSurplusRefundPrice()); orderChildService.editData(childOrder); } diff --git a/service/src/main/resources/dev/commonConfig.properties b/service/src/main/resources/dev/commonConfig.properties index 39d0775..68885ed 100644 --- a/service/src/main/resources/dev/commonConfig.properties +++ b/service/src/main/resources/dev/commonConfig.properties @@ -58,12 +58,12 @@ huiftShopCode=50041b27-f985-dcb0-1cc0-f106b09bf1fe huiftSignSecret=DB4D8069A9AC6DDF9D75667EE5CF182A #QIANZHU -qianZhuUrl=https://live-test.qianzhu8.com -qianzhuH5url=https://nf-test.qianzhu8.com/gateway -qinzhuUrlToken=https://live-test.qianzhu8.com/gateway -qianZhuPlatformId=10376 -qianZhuSecret=ktxb49sh2jfhgn8g -qianZhuCinemaNotify=https://phgcs.dctpay.com/order/cinemaNotify/notify +qianZhuUrl=https://live.qianzhu8.com +qianzhuH5url=https://nf.qianzhu8.com/gateway +qinzhuUrlToken=https://live.qianzhu8.com/gateway +qianZhuPlatformId=10710 +qianZhuSecret=pgmh5j1cbq2brm08 +qianZhuCinemaNotify=https://phg.dctpay.com/order/cinemaNotify/notify #CT ctNotifyUrl = 1