From 3ad6d027dc57669cec4a628c386d6998d057d0f5 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 1 Jun 2023 17:53:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bweb/controller/TestController.java | 45 +++++++++++++++++++ .../lakala/LaKaLaTradeSeparateService.java | 6 +-- .../channel/lakala/LaKaLaTradeService.java | 3 +- .../BsTradeOrderProfitSharingServiceImpl.java | 4 +- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/TestController.java b/bweb/src/main/java/com/bweb/controller/TestController.java index 5fc78c4..0a0cb2c 100644 --- a/bweb/src/main/java/com/bweb/controller/TestController.java +++ b/bweb/src/main/java/com/bweb/controller/TestController.java @@ -86,6 +86,51 @@ public class TestController { private BsStoreService storeService; @Resource private LaKaLaLedgerService laKaLaLedgerService; + @Resource + private LaKaLaTradeSeparateService laKaLaTradeSeparateService; + + @RequestMapping(value="/separate",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "separate") + public ResponseData separate(@RequestParam(value = "ProfitSharingOrderNo", required = true) String ProfitSharingOrderNo) { + try { + + return ResponseMsgUtil.success(laKaLaTradeSeparateService.separate(ProfitSharingOrderNo)); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/separateQuery",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "separateQuery") + public ResponseData separateQuery(@RequestParam(value = "ProfitSharingOrderNo", required = true) String ProfitSharingOrderNo) { + try { + + return ResponseMsgUtil.success(laKaLaTradeSeparateService.query(ProfitSharingOrderNo)); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/queryAmt",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "separateQuery") + public ResponseData separateQueryAmt(@RequestParam(value = "ProfitSharingOrderNo", required = true) String ProfitSharingOrderNo) { + try { + + return ResponseMsgUtil.success(laKaLaTradeSeparateService.queryAmt(ProfitSharingOrderNo)); + + } catch (Exception e) { + log.error(e.getMessage(), e); + return ResponseMsgUtil.exception(e); + } + } + @RequestMapping(value="/saas",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "saas") diff --git a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java index ee276aa..7cf0c99 100644 --- a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeSeparateService.java @@ -44,10 +44,10 @@ public class LaKaLaTradeSeparateService { // 交易分账 BsTradeOrderProfitSharing tradeOrderProfitSharing = tradeOrderProfitSharingService.getDetailByProfitSharingOrderNo(profitSharingOrderNo); if (null == tradeOrderProfitSharing) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "未找到交易分账记录"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到交易分账记录"); } if (!tradeOrderProfitSharing.getStatus().equals(ProfitSharingStatusEnum.status0.getNumber())) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "业务不处于待处理状态"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "业务不处于待处理状态"); } // 查询交易详情 BsTradeOrder tradeOrder = tradeOrderService.getOrderByTradeNoId(tradeOrderProfitSharing.getTradeOrderId()); @@ -92,7 +92,7 @@ public class LaKaLaTradeSeparateService { System.out.println("response:" + responseBody.toJSONString()); if (!responseBody.getString("code").equals("SACS0000")) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("retMsg")); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, responseBody.getString("msg")); } JSONObject respData = responseBody.getJSONObject("resp_data"); diff --git a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java index 895bc87..7d78762 100644 --- a/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java +++ b/service/src/main/java/com/hfkj/channel/lakala/LaKaLaTradeService.java @@ -211,6 +211,7 @@ public class LaKaLaTradeService { map.put("total_amount", order.getTradeActualAmount().multiply(new BigDecimal("100")).intValue()); map.put("subject", mer.getMerAbbreviate()); map.put("notify_url", CommonSysConst.getSysConfig().getLkl_micro_pay_ret_url()); + map.put("settle_type", order.getProfitSharingStatus()==true?1:0); Map locationInfo = new HashMap<>(); locationInfo.put("request_ip", "0.0.0.0"); @@ -328,7 +329,7 @@ public class LaKaLaTradeService { if (order.getProfitSharingStatus().equals(true)) { // 查询分账记录 BsTradeOrderProfitSharing tradeOrderProfitSharing = tradeOrderProfitSharingService.getProfitSharingByTradeOrderId(ProfitSharingCmdTypeEnum.CMD_TYPE_1, order.getId()); - if (tradeOrderProfitSharing != null) { + if (tradeOrderProfitSharing != null && tradeOrderProfitSharing.getStatus().equals(ProfitSharingStatusEnum.status3.getNumber())) { laKaLaTradeSeparateService.cancel(tradeOrderProfitSharing.getProfitSharingOrderNo()); } } diff --git a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderProfitSharingServiceImpl.java b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderProfitSharingServiceImpl.java index 8027388..76a8a2b 100644 --- a/service/src/main/java/com/hfkj/service/impl/BsTradeOrderProfitSharingServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/impl/BsTradeOrderProfitSharingServiceImpl.java @@ -203,10 +203,8 @@ public class BsTradeOrderProfitSharingServiceImpl implements BsTradeOrderProfitS surplusProfit = totalProfit; } else if (tradeOrder.getStoreDiscountType().equals(StoreDiscountActivityTypeEnum.type3.getNumber())) { - // 平台交易成本价 - BigDecimal finalCostPrice = tradeOrder.getTradeActualAmount().multiply(tradeOrder.getStoreDiscountFinalCostPrice()).setScale(2, BigDecimal.ROUND_HALF_DOWN); // 实际交易金额 - 平台交易成本价 = 利润 - totalProfit = tradeOrder.getTradeActualAmount().subtract(finalCostPrice); + totalProfit = tradeOrder.getStoreDiscountProfitPrice(); // 剩余利润 surplusProfit = totalProfit; }