Jelajahi Sumber

A-B-C充值功能,服务费率拦截、取值调整

ZhangWenQiang 5 tahun lalu
induk
melakukan
0b0d78cc22

+ 14 - 1
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgaccount/service/impl/HlgAccountDetailServiceImpl.java

@@ -461,6 +461,19 @@ public class HlgAccountDetailServiceImpl extends ServiceImpl<HlgAccountDetailMap
             result.error500("开心平台配置的该服务商已停用,请联系平台管理员");
             return result;
         }
+        /**
+         * 5_1、拦截条件:服务费率不能小于平台对服务商的服务费率
+         */
+        //平台对服务商的服务费率
+        Double serviceRateB_C = hlgCompanySubcontractor.getServiceRate();
+        //比较double大小
+        BigDecimal data1 = BigDecimal.valueOf(hlgCpAccountDetail.getServiceRate());
+        BigDecimal data2 = BigDecimal.valueOf(serviceRateB_C);
+        //-1小于;0等于;1:大于
+        if (data1.compareTo(data2) == -1) {
+            result.error500("服务费率不能小于平台对服务商的服务费率");
+            return result;
+        }
         //平台支付账户
         HlgCpAccount hlgCpAccount = hlgCpAccountService.getById(hlgCpAccountDetail.getCpAccountId());
         //企业支付账户
@@ -483,7 +496,7 @@ public class HlgAccountDetailServiceImpl extends ServiceImpl<HlgAccountDetailMap
         hlgAccountDetail.setAccountId(hlgAccount.getId());
         hlgAccountDetail.setType(0);
         //注意:此处服务费率为B-C的服务费率
-        hlgAccountDetail.setServiceRate(hlgCompany.getCpServiceRate());
+        hlgAccountDetail.setServiceRate(serviceRateB_C);
         //本地充值金额B-C = amountCp
         hlgAccountDetail.setAmount(amountCp);
         //本地总金额totalAmount