|
@@ -428,14 +428,14 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
|
|
|
SysUserAccount userAccount = null;
|
|
SysUserAccount userAccount = null;
|
|
|
String jzgInfoId = null;
|
|
String jzgInfoId = null;
|
|
|
if(param.getAuditStatus().equals(1)){
|
|
if(param.getAuditStatus().equals(1)){
|
|
|
- List<SysUserAccountChangeLog> incomeLogs = new ArrayList<>();
|
|
|
|
|
StateResult stateFailResult = auditStateListener.statusChange(AuditState.AuditStateEnum.SUCCESS_AUDIT,audit.getAuditStatus()+"");
|
|
StateResult stateFailResult = auditStateListener.statusChange(AuditState.AuditStateEnum.SUCCESS_AUDIT,audit.getAuditStatus()+"");
|
|
|
audit.setAuditStatus(stateFailResult.getCurrentState());
|
|
audit.setAuditStatus(stateFailResult.getCurrentState());
|
|
|
|
|
|
|
|
// 更新用户账户
|
|
// 更新用户账户
|
|
|
feeOrders = feeOrdersService.getById(param.getOrderNo());
|
|
feeOrders = feeOrdersService.getById(param.getOrderNo());
|
|
|
HttpResult<SysUser> sysUserResult = orgClient.getUserOnlyIdByMobile(orders.getRealQuoteUserId());
|
|
HttpResult<SysUser> sysUserResult = orgClient.getUserOnlyIdByMobile(orders.getRealQuoteUserId());
|
|
|
- HttpResult<SysUserAccount> result = orgClient.accountGet(sysUserResult.getData().getId());
|
|
|
|
|
|
|
+ SysUser ywySysUser = sysUserResult.getData();
|
|
|
|
|
+ HttpResult<SysUserAccount> result = orgClient.accountGet(ywySysUser.getId());
|
|
|
AssertionUtils.isFail(result.getCode() != 200,"获取用户账户失败!");
|
|
AssertionUtils.isFail(result.getCode() != 200,"获取用户账户失败!");
|
|
|
userAccount = result.getData();
|
|
userAccount = result.getData();
|
|
|
|
|
|
|
@@ -454,16 +454,24 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
|
|
|
userAccount.setUserId(sysUserResult.getData().getId());
|
|
userAccount.setUserId(sysUserResult.getData().getId());
|
|
|
userAccount.setSystemCode(systemCode);
|
|
userAccount.setSystemCode(systemCode);
|
|
|
}
|
|
}
|
|
|
- BigDecimal sumAmount = userAccount.getSumAmount();
|
|
|
|
|
- BigDecimal amount = feeOrders.getTotalReceivablePremium();
|
|
|
|
|
|
|
+ BigDecimal sumAmountUnpaid = userAccount.getSumAmountUnpaid();
|
|
|
|
|
+ BigDecimal amount = feeOrders.getTotalPayablePremium();
|
|
|
|
|
+ userAccount.setSumAmount(BigDecimalUtil.add(amount,userAccount.getSumAmount()));
|
|
|
|
|
+ userAccount.setSumAmountUnpaid(BigDecimalUtil.add(amount, sumAmountUnpaid));
|
|
|
|
|
+ orgClient.saveOrUpdate(userAccount);
|
|
|
|
|
|
|
|
- SysUserAccountChangeLog changeLog = new SysUserAccountChangeLog(systemCode, userId,jzgInfoId);
|
|
|
|
|
- changeLog.setAmount(amount);
|
|
|
|
|
- changeLog.setAmountBefore(sumAmount);
|
|
|
|
|
|
|
+ // 出口费用
|
|
|
|
|
+ SysUserAccountChangeLog exportChangeLog = new SysUserAccountChangeLog();
|
|
|
|
|
+ exportChangeLog.setRelatedOrderId(param.getOrderNo());
|
|
|
|
|
+ exportChangeLog.setUserId(userAccount.getUserId());
|
|
|
|
|
+ exportChangeLog.setUserName(ywySysUser.getUsername());
|
|
|
|
|
+ exportChangeLog.setAmount(feeOrders.getTotalPayablePremium());
|
|
|
|
|
+ exportChangeLog.setOperType(1);
|
|
|
|
|
+ exportChangeLog.setIsDelete(0);
|
|
|
|
|
+ exportChangeLog.setRemark("订单提成");
|
|
|
|
|
+ exportChangeLog.setAmountBefore(sumAmountUnpaid);
|
|
|
|
|
+ orgClient.addUserAccountChangeLog(exportChangeLog);
|
|
|
|
|
|
|
|
- userAccount.setSumAmount(BigDecimalUtil.add(feeOrders.getTotalReceivablePremium(),userAccount.getSumAmount()));
|
|
|
|
|
- userAccount.setSumAmountUnpaid(BigDecimalUtil.add(feeOrders.getTotalReceivablePremium(), userAccount.getSumAmount()));
|
|
|
|
|
- orgClient.saveOrUpdate(userAccount);
|
|
|
|
|
// 进入应收表
|
|
// 进入应收表
|
|
|
List<String> orderNos = new ArrayList<>();
|
|
List<String> orderNos = new ArrayList<>();
|
|
|
orderNos.add(audit.getOrderNo());
|
|
orderNos.add(audit.getOrderNo());
|
|
@@ -495,9 +503,9 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 分销逻辑处理 (抽取原来的方法)
|
|
* 分销逻辑处理 (抽取原来的方法)
|
|
|
- * 根据分销逻辑更新业务员账户的金额信息
|
|
|
|
|
|
|
+ * 根据分销逻辑更新业务员账户的金额信息
|
|
|
*
|
|
*
|
|
|
- * @param feeOrders 订单费用
|
|
|
|
|
|
|
+ * @param feeOrders 订单费用
|
|
|
* @param userAccount 业务员账户信息
|
|
* @param userAccount 业务员账户信息
|
|
|
* @author lipf
|
|
* @author lipf
|
|
|
* @date 2026/6/6 10:49
|
|
* @date 2026/6/6 10:49
|
|
@@ -652,12 +660,13 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 生成收入明细日志
|
|
* 生成收入明细日志
|
|
|
- * @param orderNo 订单号
|
|
|
|
|
- * @param feeOrders 费用
|
|
|
|
|
- * @param userAccount 分账用户
|
|
|
|
|
- * @param distributor1 1级分销人员
|
|
|
|
|
- * @param distributor2 2级分销人员
|
|
|
|
|
- * @param distributor3 3级分销人员
|
|
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param orderNo 订单号
|
|
|
|
|
+ * @param feeOrders 费用
|
|
|
|
|
+ * @param userAccount 分账用户
|
|
|
|
|
+ * @param distributor1 1级分销人员
|
|
|
|
|
+ * @param distributor2 2级分销人员
|
|
|
|
|
+ * @param distributor3 3级分销人员
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
private List<SysUserAccountChangeLog> builderIncomeLog(String orderNo,
|
|
private List<SysUserAccountChangeLog> builderIncomeLog(String orderNo,
|
|
@@ -669,23 +678,14 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
|
|
|
log.info("生成收入明细日志:feeOrders=[{}],userAccount=[{}],distributor1=[{}],distributor2=[{}],distributor3=[{}]",
|
|
log.info("生成收入明细日志:feeOrders=[{}],userAccount=[{}],distributor1=[{}],distributor2=[{}],distributor3=[{}]",
|
|
|
JSONUtil.toJsonStr(feeOrders), JSONUtil.toJsonStr(userAccount), JSONUtil.toJsonStr(distributor1), JSONUtil.toJsonStr(distributor2), JSONUtil.toJsonStr(distributor3));
|
|
JSONUtil.toJsonStr(feeOrders), JSONUtil.toJsonStr(userAccount), JSONUtil.toJsonStr(distributor1), JSONUtil.toJsonStr(distributor2), JSONUtil.toJsonStr(distributor3));
|
|
|
List<SysUserAccountChangeLog> incomeLogs = new ArrayList<>();
|
|
List<SysUserAccountChangeLog> incomeLogs = new ArrayList<>();
|
|
|
- // 出口费用
|
|
|
|
|
- SysUserAccountChangeLog exportIncomeLog = new SysUserAccountChangeLog();
|
|
|
|
|
- exportIncomeLog.setRelatedOrderId(orderNo);
|
|
|
|
|
- exportIncomeLog.setUserId(userAccount.getUserId());
|
|
|
|
|
- exportIncomeLog.setAmount(feeOrders.getJqExportPremium().add(feeOrders.getSyExportPremium()).add(feeOrders.getJyExportPremium()));
|
|
|
|
|
- //exportIncomeLog.setProperty(1);
|
|
|
|
|
- exportIncomeLog.setAmountBefore(userAccount.getSumAmount());
|
|
|
|
|
- incomeLogs.add(exportIncomeLog);
|
|
|
|
|
-
|
|
|
|
|
// 1级分销费
|
|
// 1级分销费
|
|
|
if (feeOrders.getFirstDistributorId() != null && feeOrders.getFirstDistributionFee().compareTo(BigDecimal.ZERO) > 0) {
|
|
if (feeOrders.getFirstDistributorId() != null && feeOrders.getFirstDistributionFee().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
SysUserAccountChangeLog distributor1IncomeLog = new SysUserAccountChangeLog();
|
|
SysUserAccountChangeLog distributor1IncomeLog = new SysUserAccountChangeLog();
|
|
|
distributor1IncomeLog.setRelatedOrderId(orderNo);
|
|
distributor1IncomeLog.setRelatedOrderId(orderNo);
|
|
|
distributor1IncomeLog.setUserId(distributor1.getUserId());
|
|
distributor1IncomeLog.setUserId(distributor1.getUserId());
|
|
|
distributor1IncomeLog.setAmount(feeOrders.getFirstDistributionFee());
|
|
distributor1IncomeLog.setAmount(feeOrders.getFirstDistributionFee());
|
|
|
- //distributor1IncomeLog.setProperty(2);
|
|
|
|
|
distributor1IncomeLog.setAmountBefore(userAccount.getSumAmount());
|
|
distributor1IncomeLog.setAmountBefore(userAccount.getSumAmount());
|
|
|
|
|
+ //distributor1IncomeLog.setUserName(); TODO
|
|
|
incomeLogs.add(distributor1IncomeLog);
|
|
incomeLogs.add(distributor1IncomeLog);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -695,8 +695,8 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
|
|
|
distributor2IncomeLog.setRelatedOrderId(orderNo);
|
|
distributor2IncomeLog.setRelatedOrderId(orderNo);
|
|
|
distributor2IncomeLog.setUserId(distributor2.getUserId());
|
|
distributor2IncomeLog.setUserId(distributor2.getUserId());
|
|
|
distributor2IncomeLog.setAmount(feeOrders.getFirstDistributionFee());
|
|
distributor2IncomeLog.setAmount(feeOrders.getFirstDistributionFee());
|
|
|
- //distributor2IncomeLog.setProperty(2);
|
|
|
|
|
distributor2IncomeLog.setAmountBefore(userAccount.getSumAmount());
|
|
distributor2IncomeLog.setAmountBefore(userAccount.getSumAmount());
|
|
|
|
|
+ //distributor2IncomeLog.setUserName(); TODO
|
|
|
incomeLogs.add(distributor2IncomeLog);
|
|
incomeLogs.add(distributor2IncomeLog);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -706,8 +706,8 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
|
|
|
distributor3IncomeLog.setRelatedOrderId(orderNo);
|
|
distributor3IncomeLog.setRelatedOrderId(orderNo);
|
|
|
distributor3IncomeLog.setUserId(distributor3.getUserId());
|
|
distributor3IncomeLog.setUserId(distributor3.getUserId());
|
|
|
distributor3IncomeLog.setAmount(feeOrders.getFirstDistributionFee());
|
|
distributor3IncomeLog.setAmount(feeOrders.getFirstDistributionFee());
|
|
|
- //distributor3IncomeLog.setProperty(2);
|
|
|
|
|
distributor3IncomeLog.setAmountBefore(userAccount.getSumAmount());
|
|
distributor3IncomeLog.setAmountBefore(userAccount.getSumAmount());
|
|
|
|
|
+ //distributor3IncomeLog.setUserName(); TODO
|
|
|
incomeLogs.add(distributor3IncomeLog);
|
|
incomeLogs.add(distributor3IncomeLog);
|
|
|
}
|
|
}
|
|
|
return incomeLogs;
|
|
return incomeLogs;
|