From 8f280f701f0550bf8e3b4081fa2dd273b160c451 Mon Sep 17 00:00:00 2001 From: panshuling321 Date: Tue, 21 Jun 2022 11:31:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B8=85=E5=88=86=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E5=88=86=E5=BC=80=E7=94=B5=E8=B4=B9=E5=92=8C=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E8=B4=B9=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/v2.1.sql | 14 ++++++++++- .../XhpcClearingCheckoutController.java | 7 +++++- .../mapper/XhpcClearingReceiptMapper.java | 5 +--- .../impl/XhpcClearingCheckoutServiceImpl.java | 19 ++++++++++----- .../mapper/XhpcClearingCheckoutMapper.xml | 23 ++++++++++++++----- 5 files changed, 50 insertions(+), 18 deletions(-) diff --git a/sql/v2.1.sql b/sql/v2.1.sql index ea316551..d4f81414 100644 --- a/sql/v2.1.sql +++ b/sql/v2.1.sql @@ -1084,4 +1084,16 @@ CREATE TABLE `xhpc_clearing_receipt` `create_time` datetime DEFAULT NULL COMMENT '上传时间', `create_by` varchar(64) DEFAULT NULL COMMENT '创建人', PRIMARY KEY (`clearing_receipt_id`) -) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='清分银行回执信息表'; \ No newline at end of file +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='清分银行回执信息表'; + + +ALTER TABLE `xhpc_clearing_checkout` + ADD COLUMN `apply_power_amount` decimal(10,2) NULL DEFAULT NULL COMMENT '申请电费金额' AFTER `apply_amount`; +ALTER TABLE `xhpc_clearing_checkout` + ADD COLUMN `apply_service_amount` decimal(10,2) NULL DEFAULT NULL COMMENT '申请服务费金额' AFTER `apply_power_amount`; + + +ALTER TABLE `xhpc_clearing_checkout` + ADD COLUMN `received_power_amount` decimal(10,2) NULL DEFAULT NULL COMMENT '到账电费金额' AFTER `received_amount`; +ALTER TABLE `xhpc_clearing_checkout` + ADD COLUMN `received_service_amount` decimal(10,2) NULL DEFAULT NULL COMMENT '到账服务费金额' AFTER `received_power_amount`; diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcClearingCheckoutController.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcClearingCheckoutController.java index 4e0fea40..eaee6605 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcClearingCheckoutController.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/controller/XhpcClearingCheckoutController.java @@ -82,7 +82,12 @@ public class XhpcClearingCheckoutController extends BaseController { public R getTmpCheckoutData(HttpServletRequest request) { LoginUser loginUser = logUserUtils.getLogUser(request); - return R.ok(checkoutService.getTmpCheckoutData(loginUser.getSysUser().getOperatorId())); + Long operatorId = loginUser.getSysUser().getOperatorId(); + if(operatorId == null || operatorId < 0){ + throw new CustomException("运营商ID错误,请登陆运营商账户再试"); + } + + return R.ok(checkoutService.getTmpCheckoutData(operatorId)); } diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/mapper/XhpcClearingReceiptMapper.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/mapper/XhpcClearingReceiptMapper.java index 11bf2e78..dfd49ca2 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/mapper/XhpcClearingReceiptMapper.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/mapper/XhpcClearingReceiptMapper.java @@ -6,13 +6,10 @@ import org.apache.ibatis.annotations.Param; import java.util.List; public interface XhpcClearingReceiptMapper { - int deleteByPrimaryKey(Long clearingReceiptId); int insert(XhpcClearingReceiptDomain record); XhpcClearingReceiptDomain selectByPrimaryKey(Long clearingReceiptId); - int deleteByCheckoutId(@Param("checkoutId")Long checkoutId); - - int insretBatch(List domainList); + int insretBatch(@Param("domainList") List domainList); } \ No newline at end of file diff --git a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/XhpcClearingCheckoutServiceImpl.java b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/XhpcClearingCheckoutServiceImpl.java index 8e85a512..e9537170 100644 --- a/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/XhpcClearingCheckoutServiceImpl.java +++ b/xhpc-modules/xhpc-activity/src/main/java/com/xhpc/activity/service/impl/XhpcClearingCheckoutServiceImpl.java @@ -85,7 +85,7 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc return checkoutMapper.selectByParams(params); }else{ //查询赋值的场站 - params.put("type", 1); + params.put("type", 2); params.put("logOperatorId",sysUserId); return checkoutMapper.selectByParams(params); } @@ -113,17 +113,24 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc BigDecimal handlingRate = BigDecimal.TEN; Map cashMap = historyOrderMapper.selectCashAmount(operatorId.toString()); - BigDecimal bankFee = new BigDecimal(cashMap.get("amount").toString()).multiply(bankRate).setScale(2, BigDecimal.ROUND_UP); - BigDecimal actAmount = new BigDecimal(cashMap.get("amount").toString()).subtract(handlingRate).subtract(bankFee); + BigDecimal powerAmount = new BigDecimal(cashMap.get("powerAmount").toString()).setScale(2, BigDecimal.ROUND_UP); + BigDecimal serviceAmount = new BigDecimal(cashMap.get("serviceAmount").toString()).setScale(2, BigDecimal.ROUND_UP); + + BigDecimal actAmount = serviceAmount.subtract(handlingRate); + BigDecimal bankFee = actAmount.multiply(bankRate).setScale(2, BigDecimal.ROUND_UP); Map resultMap = new HashMap<>(); resultMap.put("bankNo", bankDomain.getBankNo()); resultMap.put("contactPhone", bankDomain.getContactPhone()); - resultMap.put("applyAmount", cashMap.get("amount")); + resultMap.put("applyAmount", powerAmount.add(serviceAmount)); resultMap.put("clearingOrderIds", cashMap.get("clearingOrderIds")); resultMap.put("handlingFee", handlingRate); resultMap.put("bankFee", bankFee); - resultMap.put("receivedAmount", actAmount.compareTo(BigDecimal.ZERO) >= 0 ? actAmount : BigDecimal.ZERO); + resultMap.put("applyPowerAmount", powerAmount); + resultMap.put("applyServiceAmount", serviceAmount); + resultMap.put("receivedPowerAmount", powerAmount); + resultMap.put("receivedServiceAmount", actAmount.subtract(bankFee)); + resultMap.put("receivedAmount", powerAmount.add(actAmount).subtract(bankFee).compareTo(BigDecimal.ZERO) >= 0 ? powerAmount.add(actAmount).subtract(bankFee) : BigDecimal.ZERO); resultMap.put("clearingBankId", bankDomain.getClearingBankId()); return resultMap; } @@ -285,7 +292,7 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc String checkoutIds = checkoutList.stream().map(CheckoutBankVo::getIndex).collect(Collectors.joining(",")); String unReceiptIds = checkoutMapper.selectIdsByStatusAndIds(checkoutIds, 1); - if (unReceiptIds.length() > 1) { + if (StringUtils.isNotEmpty(unReceiptIds)) { List receiptDomainList = receiptVo.getReceiptList(); for (XhpcClearingReceiptDomain receiptDomain : receiptDomainList) { receiptDomain.setClearingCheckoutIds(unReceiptIds); diff --git a/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcClearingCheckoutMapper.xml b/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcClearingCheckoutMapper.xml index b819d6e2..66143c77 100644 --- a/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcClearingCheckoutMapper.xml +++ b/xhpc-modules/xhpc-activity/src/main/resources/mapper/XhpcClearingCheckoutMapper.xml @@ -5,9 +5,13 @@ + + + + @@ -20,13 +24,14 @@ - cc.clearing_checkout_id, cc.clearing_bank_id, cc.apply_amount, cc.handling_fee, cc.received_amount, cc.bank_fee, cc.del_flag, + cc.clearing_checkout_id, cc.clearing_bank_id, cc.apply_amount, cc.apply_power_amount, cc.apply_service_amount, cc.handling_fee, + cc.received_amount, cc.bank_fee, cc.del_flag, cc.received_power_amount, cc.received_service_amount, cc.`status`, cc.operator_id, cc.tenant_id, cc.create_by, cc.create_time, cc.update_by, cc.update_time, cc.check_by, cc.check_time