|
@@ -318,16 +318,8 @@ public class WeChatPayService {
|
|
|
SHAppProfitSharingInfo.setMchName(depart.getMchName());
|
|
|
SHAppProfitSharingInfo.setType(1);
|
|
|
SHAppProfitSharingInfo.setRatio(SH);
|
|
|
- List<AppProfitSharingInfo> list = appProfitSharingInfoMapper.selectList(
|
|
|
- Wrappers.<AppProfitSharingInfo>lambdaQuery()
|
|
|
- .eq(AppProfitSharingInfo::getOrgCode, orgCode)
|
|
|
- );
|
|
|
- int cumulativeSum = 0;
|
|
|
- for (AppProfitSharingInfo item : list) {
|
|
|
- cumulativeSum = cumulativeSum + item.getPreAmount();
|
|
|
- }
|
|
|
- SHAppProfitSharingInfo.setCumulative(cumulativeSum);
|
|
|
SHAppProfitSharingInfo.setPreAmount(RatiosUtil.amount_fee(allocate[0]));
|
|
|
+ SHAppProfitSharingInfo.setCumulative(addProfitSharingInfos(SHAppProfitSharingInfo.getOrgCode()));
|
|
|
appProfitSharingInfoMapper.insert(SHAppProfitSharingInfo);
|
|
|
|
|
|
//平台所得金额(金额*比例-微信手续费)
|
|
@@ -337,6 +329,7 @@ public class WeChatPayService {
|
|
|
PTAppProfitSharingInfo.setAmount(RatiosUtil.amount_fee(BigDecimal.ZERO));
|
|
|
PTAppProfitSharingInfo.setDescription("分账金额为0,请自行处理");
|
|
|
}
|
|
|
+ PTAppProfitSharingInfo.setCumulative(addProfitSharingInfos(PTAppProfitSharingInfo.getOrgCode()));
|
|
|
appProfitSharingInfoMapper.insert(PTAppProfitSharingInfo);
|
|
|
}
|
|
|
//门店(分账给平台及商户)
|
|
@@ -351,6 +344,7 @@ public class WeChatPayService {
|
|
|
MDAppProfitSharingInfo.setType(1);
|
|
|
MDAppProfitSharingInfo.setRatio(MD);
|
|
|
MDAppProfitSharingInfo.setPreAmount(RatiosUtil.amount_fee(allocate[0]));
|
|
|
+ MDAppProfitSharingInfo.setCumulative(addProfitSharingInfos(MDAppProfitSharingInfo.getOrgCode()));
|
|
|
appProfitSharingInfoMapper.insert(MDAppProfitSharingInfo);
|
|
|
//商户所得金额
|
|
|
|
|
@@ -366,6 +360,7 @@ public class WeChatPayService {
|
|
|
SHAppProfitSharingInfo.setAmount(RatiosUtil.amount_fee(BigDecimal.ZERO));
|
|
|
SHAppProfitSharingInfo.setDescription("分账金额为0,请自行处理");
|
|
|
}
|
|
|
+ SHAppProfitSharingInfo.setCumulative(addProfitSharingInfos(SHAppProfitSharingInfo.getOrgCode()));
|
|
|
appProfitSharingInfoMapper.insert(SHAppProfitSharingInfo);
|
|
|
|
|
|
//平台所得金额(金额*比例-微信手续费)
|
|
@@ -375,11 +370,28 @@ public class WeChatPayService {
|
|
|
PTAppProfitSharingInfo.setAmount(RatiosUtil.amount_fee(BigDecimal.ZERO));
|
|
|
PTAppProfitSharingInfo.setDescription("分账金额为0,请自行处理");
|
|
|
}
|
|
|
+ PTAppProfitSharingInfo.setCumulative(addProfitSharingInfos(PTAppProfitSharingInfo.getOrgCode()));
|
|
|
appProfitSharingInfoMapper.insert(PTAppProfitSharingInfo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * <p>添加累计分账</p>
|
|
|
+ * @author SheepHy
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public int addProfitSharingInfos(String orgCode) {
|
|
|
+ List<AppProfitSharingInfo> success = appProfitSharingInfoMapper.selectList(Wrappers.<AppProfitSharingInfo>lambdaQuery()
|
|
|
+ .eq(AppProfitSharingInfo::getOrgCode, orgCode)
|
|
|
+ .eq(AppProfitSharingInfo::getStatus, "SUCCESS"));
|
|
|
+ int cumulativeSum = 0;
|
|
|
+ for (AppProfitSharingInfo item : success) {
|
|
|
+ cumulativeSum = cumulativeSum + item.getPreAmount();
|
|
|
+ }
|
|
|
+ return cumulativeSum;
|
|
|
+ }
|
|
|
+
|
|
|
@NotNull
|
|
|
private static AppProfitSharingInfo getPtAppProfitSharingInfo(AppOrder appOrder, BigDecimal PT, Integer procedureFee, BigDecimal insurePrice) {
|
|
|
AppProfitSharingInfo PTAppProfitSharingInfo = new AppProfitSharingInfo();
|