|
@@ -425,7 +425,7 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
List<String> ids = payRecords.stream().map(CmPayShopRecord::getShopOrderID).collect(Collectors.toList());
|
|
List<String> ids = payRecords.stream().map(CmPayShopRecord::getShopOrderID).collect(Collectors.toList());
|
|
List<NewShopOrder> csos = new ArrayList<>();
|
|
List<NewShopOrder> csos = new ArrayList<>();
|
|
if (null != ids && ids.size() > 0) {
|
|
if (null != ids && ids.size() > 0) {
|
|
- csos = newShopOrderDao.findByShopOrderIDs(ids,cmPayShop.getId());
|
|
|
|
|
|
+ csos = newShopOrderDao.findByShopOrderIDs(ids, cmPayShop.getId());
|
|
}
|
|
}
|
|
for (NewShopOrder so : csos) {
|
|
for (NewShopOrder so : csos) {
|
|
CmPayShopRecord cmPayShopRecord = payRecords.stream().filter(p -> p.getShopOrderID().equals(so.getShopOrderID().toString())).findAny().get();
|
|
CmPayShopRecord cmPayShopRecord = payRecords.stream().filter(p -> p.getShopOrderID().equals(so.getShopOrderID().toString())).findAny().get();
|
|
@@ -1454,44 +1454,64 @@ public class CmPayShopService extends CrudService<CmPayShopDao, CmPayShop> {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// @Transactional(readOnly = false, rollbackFor = Exception.class)
|
|
|
|
+// public void settlement(String shopOrderId) throws Exception {
|
|
|
|
+// Integer orderId = newOrderDao.findOrderId(Integer.valueOf(shopOrderId));
|
|
|
|
+// Integer identity = newOrderDao.findUserIdentityByOrder(orderId);
|
|
|
|
+// // 结算付供应商
|
|
|
|
+// String format = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
|
|
|
|
+// String substring = format.substring(20);
|
|
|
|
+// String P3_customerNumber = newOrderDao.findSplitCode(shopOrderId);
|
|
|
|
+// Double shopCost = newOrderDao.findShopCost(shopOrderId);
|
|
|
|
+// settleOrder("JSCB" + shopOrderId + substring, shopCost, P3_customerNumber, shopOrderId, 1);
|
|
|
|
+// // 结算佣金 佣金目前分到网络
|
|
|
|
+// Double payAmount = newOrderDao.findPayAmount(shopOrderId);
|
|
|
|
+// if (null != payAmount && payAmount > 0) {
|
|
|
|
+// settleOrder("JSYJ" + shopOrderId + substring, payAmount, Constant.CUSTOMERNUM2, shopOrderId, 2);
|
|
|
|
+// }
|
|
|
|
+// // 有组织佣金/付第三方的情况下,还需要结算组织佣金,付第三方
|
|
|
|
+// Double payOrganize = newOrderDao.findPayOrganize(shopOrderId);
|
|
|
|
+// if (null != payOrganize && payOrganize > 0) {
|
|
|
|
+// String split = null;
|
|
|
|
+// //分销人员分账修改报备记录
|
|
|
|
+// if (identity == 8) {
|
|
|
|
+// CmReportingClub cmReportingClubById = cmReportingClubMapper.getByCmReportingClub(new CmReportingClub().orderId(orderId).orderStatus(1));
|
|
|
|
+// if (null != cmReportingClubById) {
|
|
|
|
+// //分销团队分账号
|
|
|
|
+// split = cmReportingClubById.splitCode();
|
|
|
|
+// cmReportingClubMapper.updateCmReportingClub(new CmReportingClub().id(cmReportingClubById.id()).splitSettleStatus(3).splitSettleTime(new Date()));
|
|
|
|
+// } else {
|
|
|
|
+// logger.info("分销订单分账结算异常,子订单Id:" + shopOrderId + ">>>>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
|
|
+// return;
|
|
|
|
+// }
|
|
|
|
+// } else {
|
|
|
|
+// split = newOrderDao.findOrganizeSplitByShopOrder(shopOrderId);
|
|
|
|
+// }
|
|
|
|
+// settleOrder("JSZZ" + shopOrderId + substring, payOrganize, split, shopOrderId, 3);
|
|
|
|
+// }
|
|
|
|
+// Double payOther = newOrderDao.getOtherPaid(shopOrderId);
|
|
|
|
+// if (null != payOther && payOther > 0) {
|
|
|
|
+// settleOrder("JSDSF" + shopOrderId + substring, payOther, Constant.CUSTOMERNUM3, shopOrderId, 4);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+
|
|
@Transactional(readOnly = false, rollbackFor = Exception.class)
|
|
@Transactional(readOnly = false, rollbackFor = Exception.class)
|
|
public void settlement(String shopOrderId) throws Exception {
|
|
public void settlement(String shopOrderId) throws Exception {
|
|
- Integer orderId = newOrderDao.findOrderId(Integer.valueOf(shopOrderId));
|
|
|
|
- Integer identity = newOrderDao.findUserIdentityByOrder(orderId);
|
|
|
|
// 结算付供应商
|
|
// 结算付供应商
|
|
String format = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
|
|
String format = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS").format(new Date());
|
|
String substring = format.substring(20);
|
|
String substring = format.substring(20);
|
|
- String P3_customerNumber = newOrderDao.findSplitCode(shopOrderId);
|
|
|
|
- Double shopCost = newOrderDao.findShopCost(shopOrderId);
|
|
|
|
- settleOrder("JSCB" + shopOrderId + substring, shopCost, P3_customerNumber, shopOrderId, 1);
|
|
|
|
- // 结算佣金 佣金目前分到网络
|
|
|
|
- Double payAmount = newOrderDao.findPayAmount(shopOrderId);
|
|
|
|
- if (null != payAmount && payAmount > 0) {
|
|
|
|
- settleOrder("JSYJ" + shopOrderId + substring, payAmount, Constant.CUSTOMERNUM2, shopOrderId, 2);
|
|
|
|
- }
|
|
|
|
- // 有组织佣金/付第三方的情况下,还需要结算组织佣金,付第三方
|
|
|
|
- Double payOrganize = newOrderDao.findPayOrganize(shopOrderId);
|
|
|
|
- if (null != payOrganize && payOrganize > 0) {
|
|
|
|
- String split = null;
|
|
|
|
- //分销人员分账修改报备记录
|
|
|
|
- if (identity == 8) {
|
|
|
|
- CmReportingClub cmReportingClubById = cmReportingClubMapper.getByCmReportingClub(new CmReportingClub().orderId(orderId).orderStatus(1));
|
|
|
|
- if (null != cmReportingClubById) {
|
|
|
|
- //分销团队分账号
|
|
|
|
- split = cmReportingClubById.splitCode();
|
|
|
|
- cmReportingClubMapper.updateCmReportingClub(new CmReportingClub().id(cmReportingClubById.id()).splitSettleStatus(3).splitSettleTime(new Date()));
|
|
|
|
- } else {
|
|
|
|
- logger.info("分销订单分账结算异常,子订单Id:" + shopOrderId + ">>>>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- split = newOrderDao.findOrganizeSplitByShopOrder(shopOrderId);
|
|
|
|
|
|
+ List<CmSettleVo> settleVos = newOrderDao.findSplitAccounts(shopOrderId);
|
|
|
|
+
|
|
|
|
+ for (CmSettleVo settleVo : settleVos) {
|
|
|
|
+ if (1 == settleVo.getProductType()) {
|
|
|
|
+ settleOrder("JSCB" + shopOrderId + substring, settleVo.getSplitAccount(), settleVo.getSubUserNo(), shopOrderId, 1);
|
|
|
|
+ }
|
|
|
|
+ if (3 == settleVo.getProductType()) {
|
|
|
|
+ settleOrder("JSYJ" + shopOrderId + substring, settleVo.getSplitAccount(), Constant.CUSTOMERNUM2, shopOrderId, 2);
|
|
|
|
+ }
|
|
|
|
+ if (5 == settleVo.getProductType()) {
|
|
|
|
+ settleOrder("JSZZ" + shopOrderId + substring, settleVo.getSplitAccount(), settleVo.getSubUserNo(), shopOrderId, 3);
|
|
}
|
|
}
|
|
- settleOrder("JSZZ" + shopOrderId + substring, payOrganize, split, shopOrderId, 3);
|
|
|
|
- }
|
|
|
|
- Double payOther = newOrderDao.getOtherPaid(shopOrderId);
|
|
|
|
- if (null != payOther && payOther > 0) {
|
|
|
|
- settleOrder("JSDSF" + shopOrderId + substring, payOther, Constant.CUSTOMERNUM3, shopOrderId, 4);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|