Kaynağa Gözat

```
feat(national-motion-system-biz): 新增微信分账功能支持新增对平台、商户及门店分账比例的支持,通过机构编码获取对应部门及分账配置,
实现更灵活

wzq 3 hafta önce
ebeveyn
işleme
c3e2fa3097

+ 18 - 0
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/pay/routing/WeChatProfitSharingService.java

@@ -8,8 +8,12 @@ import org.jeecg.modules.pay.config.WechatUrlConstants;
 import org.jeecg.modules.pay.entity.ReceiverAddForm;
 import org.jeecg.modules.system.app.entity.AppOrder;
 import org.jeecg.modules.system.app.entity.AppProfitSharingRecords;
+import org.jeecg.modules.system.app.entity.SeparateAccounts;
 import org.jeecg.modules.system.app.mapper.AppOrderMapper;
 import org.jeecg.modules.system.app.mapper.AppProfitSharingRecordsMapper;
+import org.jeecg.modules.system.app.mapper.SeparateAccountsMapper;
+import org.jeecg.modules.system.entity.SysDepart;
+import org.jeecg.modules.system.mapper.SysDepartMapper;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.stereotype.Service;
 
@@ -20,6 +24,7 @@ import javax.crypto.IllegalBlockSizeException;
 import javax.crypto.NoSuchPaddingException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.math.BigDecimal;
 import java.nio.charset.StandardCharsets;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
@@ -39,6 +44,12 @@ public class WeChatProfitSharingService {
     @Resource
     private AppProfitSharingRecordsMapper appProfitSharingRecordsMapper;
 
+    @Resource
+    private SysDepartMapper sysDepartMapper;
+
+    @Resource
+    private SeparateAccountsMapper separateAccountsMapper;
+
     /**
      *  添加分账接收方
      */
@@ -59,6 +70,13 @@ public class WeChatProfitSharingService {
     public JSONObject profitSharing(String orderCode){
         AppOrder appOrder = appOrderMapper.selectOne(Wrappers.lambdaQuery(AppOrder.class).eq(AppOrder::getOrderCode, orderCode).last(
                 "limit 1"));
+        String orgCode = appOrder.getOrgCode();
+        SysDepart depart = sysDepartMapper.selectOne(Wrappers.lambdaQuery(SysDepart.class).eq(SysDepart::getOrgCode, orgCode).last("limit 1"));
+        SeparateAccounts separateAccounts = separateAccountsMapper.selectOne(Wrappers.lambdaQuery(SeparateAccounts.class).eq(SeparateAccounts::getDeptId, depart.getId()));
+        //获取分账比例
+        BigDecimal PT = separateAccounts.getPtSeparateAccounts();
+        BigDecimal SH = separateAccounts.getShSeparateAccounts();
+        BigDecimal MD = separateAccounts.getMdSeparateAccounts();
         //创建分账记录
         AppProfitSharingRecords appProfitSharingRecords = new AppProfitSharingRecords();
         appProfitSharingRecordsMapper.insert(appProfitSharingRecords);