|
@@ -29,6 +29,7 @@ import com.jzg.commons.entity.po.InsFeeOrders;
|
|
|
import com.jzg.commons.entity.po.PtlAgreement;
|
|
import com.jzg.commons.entity.po.PtlAgreement;
|
|
|
import com.jzg.commons.entity.po.SysUploadFiles;
|
|
import com.jzg.commons.entity.po.SysUploadFiles;
|
|
|
import com.jzg.commons.entity.quote.vo.orders.InsOrdersVo;
|
|
import com.jzg.commons.entity.quote.vo.orders.InsOrdersVo;
|
|
|
|
|
+import com.jzg.commons.entity.vo.PtlAgreementCostRatioVo;
|
|
|
import com.jzg.commons.exception.ServiceException;
|
|
import com.jzg.commons.exception.ServiceException;
|
|
|
import com.jzg.commons.exception.SystemException;
|
|
import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.commons.util.*;
|
|
import com.jzg.commons.util.*;
|
|
@@ -2298,6 +2299,138 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
throw new ServiceException(result.getMsg());
|
|
throw new ServiceException(result.getMsg());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据不同场景计算入口比例,手续费比例和跟单费比例
|
|
|
|
|
+ *
|
|
|
|
|
+ * 手续费 (只变手续费) 入口-手续费 = 跟单
|
|
|
|
|
+ * 跟单变 (只变跟单费) 手续费+跟单 = 入口
|
|
|
|
|
+ * 手续费+ 跟单费(手续费和跟单费都变) 手续费+跟单 = 入口
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author lipf
|
|
|
|
|
+ * @date 2026/6/24 15:53
|
|
|
|
|
+ */
|
|
|
|
|
+ private void calCommissionAndFollowAndInlet(PtlAgreementCostRatioVo vo, BatchModifyVo batchModifyVo, InsPlyIncome insPlyIncome) {
|
|
|
|
|
+ InsFeeOrders insFeeOrders = insPlyIncome.getInsFeeOrders();
|
|
|
|
|
+ // 设置交强险
|
|
|
|
|
+ BigDecimal jqInletRatio = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal jqCommissionRatio = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal jqFollowRatio = BigDecimal.ZERO;
|
|
|
|
|
+ if(batchModifyVo.getJqSuperviseCostsProportion() != null && batchModifyVo.getJqOtherCostsProportion() == null){
|
|
|
|
|
+ jqInletRatio = insFeeOrders .getJqInletRatio();
|
|
|
|
|
+ jqCommissionRatio = batchModifyVo.getJqSuperviseCostsProportion();
|
|
|
|
|
+ jqFollowRatio = BigDecimalUtil.subtract(jqInletRatio,jqCommissionRatio);
|
|
|
|
|
+ }else if(batchModifyVo.getJqSuperviseCostsProportion() == null && batchModifyVo.getJqOtherCostsProportion() != null){
|
|
|
|
|
+ jqCommissionRatio = BigDecimalUtil.null2Zero(insPlyIncome.getJqSuperviseCostsProportion());
|
|
|
|
|
+ jqFollowRatio = batchModifyVo.getJqOtherCostsProportion();
|
|
|
|
|
+ jqInletRatio = BigDecimalUtil.add(jqCommissionRatio,jqFollowRatio);
|
|
|
|
|
+ }else if(batchModifyVo.getJqSuperviseCostsProportion() != null && batchModifyVo.getJqOtherCostsProportion() != null){
|
|
|
|
|
+ jqCommissionRatio = batchModifyVo.getJqSuperviseCostsProportion();
|
|
|
|
|
+ jqFollowRatio = batchModifyVo.getJqOtherCostsProportion();
|
|
|
|
|
+ jqInletRatio = BigDecimalUtil.add(jqCommissionRatio,jqFollowRatio);
|
|
|
|
|
+ }else if(batchModifyVo.getJqSuperviseCostsProportion() == null && batchModifyVo.getJqOtherCostsProportion() == null){
|
|
|
|
|
+ jqInletRatio = insFeeOrders.getJqInletRatio();
|
|
|
|
|
+ jqCommissionRatio = BigDecimalUtil.null2Zero(insPlyIncome.getJqSuperviseCostsProportion());
|
|
|
|
|
+ jqFollowRatio = BigDecimalUtil.null2Zero(insPlyIncome.getJqOtherCostsProportion());
|
|
|
|
|
+ }
|
|
|
|
|
+ vo.setJqInletRatio(jqInletRatio);
|
|
|
|
|
+ vo.setJqCommissionRatio(jqCommissionRatio);
|
|
|
|
|
+ vo.setJqFollowRatio(jqFollowRatio);
|
|
|
|
|
+
|
|
|
|
|
+ // 设置商业险的比例
|
|
|
|
|
+ BigDecimal syInletRatio = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal syCommissionRatio = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal syFollowRatio = BigDecimal.ZERO;
|
|
|
|
|
+ if(batchModifyVo.getSySuperviseCostsProportion() != null && batchModifyVo.getSyOtherCostsProportion() == null){
|
|
|
|
|
+ syInletRatio = insFeeOrders.getSyInletRatio();
|
|
|
|
|
+ syCommissionRatio = batchModifyVo.getSySuperviseCostsProportion();
|
|
|
|
|
+ syFollowRatio = BigDecimalUtil.subtract(syInletRatio,syCommissionRatio);
|
|
|
|
|
+ }else if(batchModifyVo.getSySuperviseCostsProportion() == null && null != batchModifyVo.getSyOtherCostsProportion()){
|
|
|
|
|
+ syCommissionRatio = BigDecimalUtil.null2Zero(insPlyIncome.getSySuperviseCostsProportion());
|
|
|
|
|
+ syFollowRatio = batchModifyVo.getSyOtherCostsProportion();
|
|
|
|
|
+ syInletRatio = BigDecimalUtil.add(syCommissionRatio,syFollowRatio);
|
|
|
|
|
+ }else if(batchModifyVo.getSySuperviseCostsProportion() != null && batchModifyVo.getSyOtherCostsProportion() != null){
|
|
|
|
|
+ syCommissionRatio = batchModifyVo.getSySuperviseCostsProportion();
|
|
|
|
|
+ syFollowRatio = batchModifyVo.getSyOtherCostsProportion();
|
|
|
|
|
+ syInletRatio = BigDecimalUtil.add(syCommissionRatio,syFollowRatio);
|
|
|
|
|
+ }else if(batchModifyVo.getSySuperviseCostsProportion() == null && batchModifyVo.getSyOtherCostsProportion() == null){
|
|
|
|
|
+ syInletRatio = insFeeOrders.getSyInletRatio();
|
|
|
|
|
+ syCommissionRatio = BigDecimalUtil.null2Zero(insPlyIncome.getSySuperviseCostsProportion());
|
|
|
|
|
+ syFollowRatio = BigDecimalUtil.null2Zero(insPlyIncome.getSyOtherCostsProportion());
|
|
|
|
|
+ }
|
|
|
|
|
+ vo.setSyInletRatio(syInletRatio);
|
|
|
|
|
+ vo.setSyCommissionRatio(syCommissionRatio);
|
|
|
|
|
+ vo.setSyFollowRatio(syFollowRatio);
|
|
|
|
|
+
|
|
|
|
|
+ // 设置驾意险
|
|
|
|
|
+ BigDecimal jyInletRatio = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal jyCommissionRatio = BigDecimal.ZERO;
|
|
|
|
|
+ BigDecimal jyFollowRatio = BigDecimal.ZERO;
|
|
|
|
|
+ if(batchModifyVo.getJySuperviseCostsProportion() != null && batchModifyVo.getJyOtherCostsProportion() == null){
|
|
|
|
|
+ jyInletRatio = insFeeOrders.getJyInletRatio();
|
|
|
|
|
+ jyCommissionRatio = batchModifyVo.getJySuperviseCostsProportion();
|
|
|
|
|
+ jyFollowRatio = BigDecimalUtil.subtract(jyInletRatio,jyCommissionRatio);
|
|
|
|
|
+ }else if(batchModifyVo.getJySuperviseCostsProportion() == null && batchModifyVo.getJyOtherCostsProportion() != null){
|
|
|
|
|
+ jyCommissionRatio = BigDecimalUtil.null2Zero(insPlyIncome.getJySuperviseCostsProportion());
|
|
|
|
|
+ jyFollowRatio = batchModifyVo.getJyOtherCostsProportion();
|
|
|
|
|
+ jyInletRatio = BigDecimalUtil.add(jyCommissionRatio,jyFollowRatio);
|
|
|
|
|
+ }else if(batchModifyVo.getJySuperviseCostsProportion() != null && batchModifyVo.getJyOtherCostsProportion() != null){
|
|
|
|
|
+ jyCommissionRatio = batchModifyVo.getJySuperviseCostsProportion();
|
|
|
|
|
+ jyFollowRatio = batchModifyVo.getJyOtherCostsProportion();
|
|
|
|
|
+ jyInletRatio = BigDecimalUtil.add(jyCommissionRatio,jyFollowRatio);
|
|
|
|
|
+ }else if(batchModifyVo.getJySuperviseCostsProportion() == null && batchModifyVo.getJyOtherCostsProportion() == null){
|
|
|
|
|
+ jyInletRatio = insFeeOrders.getJyInletRatio();
|
|
|
|
|
+ jyCommissionRatio = BigDecimalUtil.null2Zero(insPlyIncome.getJySuperviseCostsProportion());
|
|
|
|
|
+ jyFollowRatio = BigDecimalUtil.null2Zero(insPlyIncome.getJyOtherCostsProportion());
|
|
|
|
|
+ }
|
|
|
|
|
+ vo.setJyInletRatio(jyInletRatio);
|
|
|
|
|
+ vo.setJyCommissionRatio(jyCommissionRatio);
|
|
|
|
|
+ vo.setJyFollowRatio(jyFollowRatio);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("入口比例,手续费比例,跟单比例处理后的结果是:vo=[{}]", JSONUtil.toJsonStr(vo));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 结合原有的费用比例,计算更新后的费用比例
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param insPlyIncome 订单的费用信息
|
|
|
|
|
+ * @param batchModifyVo 批量修改的费用比例
|
|
|
|
|
+ * @author lipf
|
|
|
|
|
+ * @date 2026/6/23 16:35
|
|
|
|
|
+ */
|
|
|
|
|
+ private PtlAgreementCostRatioVo calRatio(InsPlyIncome insPlyIncome, BatchModifyVo batchModifyVo) {
|
|
|
|
|
+ log.info("batchModifyVo.转换百分比之前的数据=【{}】", JSONUtil.toJsonStr(batchModifyVo));
|
|
|
|
|
+ batchModifyVo.divide100();
|
|
|
|
|
+ PtlAgreementCostRatioVo vo = new PtlAgreementCostRatioVo();
|
|
|
|
|
+ vo.setOrderNo(insPlyIncome.getOrderNo());
|
|
|
|
|
+
|
|
|
|
|
+ // 加投费比例
|
|
|
|
|
+// vo.setJqAdditionalRatio(insPlyIncome.getJqAdditionalRatio());
|
|
|
|
|
+// vo.setSyAdditionalRatio(insPlyIncome.getSyAdditionalRatio());
|
|
|
|
|
+// vo.setJyAdditionalRatio(insPlyIncome.getJyAdditionalRatio());
|
|
|
|
|
+
|
|
|
|
|
+ this.calCommissionAndFollowAndInlet(vo, batchModifyVo, insPlyIncome);
|
|
|
|
|
+
|
|
|
|
|
+ // 出口比例
|
|
|
|
|
+// vo.setJqExportRatio(insPlyIncome.getJqExportRatio());
|
|
|
|
|
+// vo.setSyExportRatio(insPlyIncome.getSyExportRatio());
|
|
|
|
|
+// vo.setJyExportRatio(insPlyIncome.getJyExportRatio());
|
|
|
|
|
+
|
|
|
|
|
+ // 留点比例
|
|
|
|
|
+// vo.setJqKeepPointRatio(BigDecimalUtil.subtract(BigDecimalUtil.add(BigDecimalUtil.divide(vo.getJqInletRatio(),taxFactor) , vo.getJqAdditionalRatio()),vo.getJqExportRatio()));
|
|
|
|
|
+// vo.setSyKeepPointRatio(BigDecimalUtil.subtract(BigDecimalUtil.add(BigDecimalUtil.divide(vo.getSyInletRatio(),taxFactor), vo.getSyAdditionalRatio()),vo.getSyExportRatio()));
|
|
|
|
|
+// vo.setJyKeepPointRatio(BigDecimalUtil.subtract(BigDecimalUtil.add(BigDecimalUtil.divide(vo.getJyInletRatio(),taxFactor), vo.getJyAdditionalRatio()),vo.getJyExportRatio()));
|
|
|
|
|
+
|
|
|
|
|
+ // 出口留点比例
|
|
|
|
|
+// vo.setJqExportKeepPointRatio(insPlyIncome.getJqExportKeepPointRatio());
|
|
|
|
|
+// vo.setSyExportKeepPointRatio(insPlyIncome.getSyExportKeepPointRatio());
|
|
|
|
|
+// vo.setJyExportKeepPointRatio(insPlyIncome.getJyExportKeepPointRatio());
|
|
|
|
|
+ log.info("insPlyIncome调整前的比例:fee=[{}]", JSONUtil.toJsonStr(insPlyIncome));
|
|
|
|
|
+ log.info("insPlyIncome调整后的比例信息:vo=[{}]", JSONUtil.toJsonStr(vo));
|
|
|
|
|
+ return vo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 私有协议批量修改
|
|
* 私有协议批量修改
|
|
|
* 修改手续费比例(商业险手续费比例, 交强险手续费比例)
|
|
* 修改手续费比例(商业险手续费比例, 交强险手续费比例)
|
|
@@ -2319,6 +2452,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
// 一次性查询所有需要修改的记录
|
|
// 一次性查询所有需要修改的记录
|
|
|
List<InsPlyIncome> incomeList = baseMapper.selectBatchIds(incomeIds);
|
|
List<InsPlyIncome> incomeList = baseMapper.selectBatchIds(incomeIds);
|
|
|
if (CollUtil.isEmpty(incomeList)) {
|
|
if (CollUtil.isEmpty(incomeList)) {
|
|
|
|
|
+ log.info("未找到需要修改的应收订单. incomeList=[{}]", JSONUtil.toJsonStr(incomeList));
|
|
|
throw new ServiceException("未找到需要修改的应收订单");
|
|
throw new ServiceException("未找到需要修改的应收订单");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2344,27 +2478,44 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
BigDecimal taxRate = taxRateMap.getOrDefault(income.getOrderNo(), BigDecimal.ONE);
|
|
BigDecimal taxRate = taxRateMap.getOrDefault(income.getOrderNo(), BigDecimal.ONE);
|
|
|
InsPlyIncome updateIncome = new InsPlyIncome();
|
|
InsPlyIncome updateIncome = new InsPlyIncome();
|
|
|
updateIncome.setId(income.getId());
|
|
updateIncome.setId(income.getId());
|
|
|
|
|
+ updateIncome.setJqPremium(income.getJqPremium());
|
|
|
|
|
+ updateIncome.setSyPremium(income.getSyPremium());
|
|
|
|
|
+ updateIncome.setJyPremium(income.getJyPremium());
|
|
|
|
|
+ // 因为 实体对象的settlementStatus设置了初始默认值0, 为了避免已经结算的数据被调整未未结算, 这里将settlementStatus设置为null 2026-6-24 14:33:47
|
|
|
|
|
+ updateIncome.setSettlementStatus(null);
|
|
|
|
|
+ // 根据income的order_no查询inss_fee_order
|
|
|
|
|
+ List<InsFeeOrders> insFeeOrderByOrderNo = insFeeOrdersClient.getInsFeeOrderByOrderNo(income.getOrderNo());
|
|
|
|
|
+ if (CollUtil.isNotEmpty(insFeeOrderByOrderNo)){
|
|
|
|
|
+ InsFeeOrders insFeeOrders = CollUtil.getFirst(insFeeOrderByOrderNo);
|
|
|
|
|
+ income.setInsFeeOrders(insFeeOrders);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
boolean hasUpdate = false;
|
|
boolean hasUpdate = false;
|
|
|
String updateFlag = batchModifyVo.getUpdateFlag();
|
|
String updateFlag = batchModifyVo.getUpdateFlag();
|
|
|
|
|
|
|
|
// 根据 updateFlag 处理不同的更新逻辑
|
|
// 根据 updateFlag 处理不同的更新逻辑
|
|
|
- if ("1".equals(updateFlag)) {
|
|
|
|
|
- // 修改手续费
|
|
|
|
|
- hasUpdate = handleSuperviseCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
- } else if ("2".equals(updateFlag)) {
|
|
|
|
|
- // 修改跟单费
|
|
|
|
|
- hasUpdate = handleOtherCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
- } else if ("3".equals(updateFlag)) {
|
|
|
|
|
- // 修改驾意险费用
|
|
|
|
|
- hasUpdate = handleJyCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
- } else if ("4".equals(updateFlag)) {
|
|
|
|
|
- // 修改所有
|
|
|
|
|
- boolean superviseUpdated = handleSuperviseCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
- boolean otherUpdated = handleOtherCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
- boolean jyUpdated = handleJyCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
- hasUpdate = superviseUpdated || otherUpdated || jyUpdated;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if ("1".equals(updateFlag)) {
|
|
|
|
|
+// // 修改手续费
|
|
|
|
|
+// hasUpdate = handleSuperviseCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
+// } else if ("2".equals(updateFlag)) {
|
|
|
|
|
+// // 修改跟单费
|
|
|
|
|
+// hasUpdate = handleOtherCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
+// } else if ("3".equals(updateFlag)) {
|
|
|
|
|
+// // 修改驾意险费用
|
|
|
|
|
+// hasUpdate = handleJyCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
+// } else if ("4".equals(updateFlag)) {
|
|
|
|
|
+// // 修改所有
|
|
|
|
|
+// boolean superviseUpdated = handleSuperviseCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
+// boolean otherUpdated = handleOtherCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
+// boolean jyUpdated = handleJyCosts(updateIncome, income, batchModifyVo, taxRate);
|
|
|
|
|
+// hasUpdate = superviseUpdated || otherUpdated || jyUpdated;
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
|
|
+ // 计算比例
|
|
|
|
|
+ PtlAgreementCostRatioVo ptlAgreementCostRatioVo = this.calRatio(income, batchModifyVo);
|
|
|
|
|
+ // 根据比例计算金额
|
|
|
|
|
+ this.calPremium(updateIncome,ptlAgreementCostRatioVo, taxRate);
|
|
|
|
|
+ hasUpdate = true;
|
|
|
|
|
|
|
|
// 处理公共字段更新
|
|
// 处理公共字段更新
|
|
|
if (batchModifyVo.getSigningTime() != null) {
|
|
if (batchModifyVo.getSigningTime() != null) {
|
|
@@ -2398,6 +2549,60 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据比例计算入口费用,入口手续费,入口跟单费
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author lipf
|
|
|
|
|
+ * @date 2026/6/24 16:36
|
|
|
|
|
+ */
|
|
|
|
|
+ private void calPremium(InsPlyIncome updateIncome, PtlAgreementCostRatioVo ratioVo, BigDecimal taxRate) {
|
|
|
|
|
+ log.info("根据入口比例等比例值计算对应的金额。 ptlAgreementCostRatioVo=[{}], updateIncome=[{}]", JSONUtil.toJsonStr(ratioVo), JSONUtil.toJsonStr(updateIncome));
|
|
|
|
|
+
|
|
|
|
|
+ BigDecimal jqPremium = BigDecimalUtil.null2Zero(updateIncome.getJqPremium());
|
|
|
|
|
+ BigDecimal syPremium = BigDecimalUtil.null2Zero(updateIncome.getSyPremium()) ;
|
|
|
|
|
+ BigDecimal jyPremium = BigDecimalUtil.null2Zero(updateIncome.getJyPremium());
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ BigDecimal jqInletPremium = BigDecimalUtil.divide(BigDecimalUtil.multiply(jqPremium,ratioVo.getJqInletRatio()), taxRate);
|
|
|
|
|
+ BigDecimal syInletPremium = BigDecimalUtil.divide(BigDecimalUtil.multiply(syPremium,ratioVo.getSyInletRatio()), taxRate);
|
|
|
|
|
+ BigDecimal jyInletPremium = BigDecimalUtil.divide(BigDecimalUtil.multiply(jyPremium,ratioVo.getJyInletRatio()), taxRate);
|
|
|
|
|
+
|
|
|
|
|
+ BigDecimal jqCommissionPremium = BigDecimalUtil.divide(BigDecimalUtil.multiply(jqPremium,ratioVo.getJqCommissionRatio()), taxRate);
|
|
|
|
|
+ BigDecimal syCommissionPremium = BigDecimalUtil.divide(BigDecimalUtil.multiply(syPremium,ratioVo.getSyCommissionRatio()), taxRate);
|
|
|
|
|
+ BigDecimal jyCommissionPremium = BigDecimalUtil.divide(BigDecimalUtil.multiply(jyPremium,ratioVo.getJyCommissionRatio()), taxRate);
|
|
|
|
|
+
|
|
|
|
|
+ BigDecimal jqOtherPremium = BigDecimalUtil.subtract(jqInletPremium,jqCommissionPremium);
|
|
|
|
|
+ BigDecimal syOtherPremium = BigDecimalUtil.subtract(syInletPremium,syCommissionPremium);
|
|
|
|
|
+ BigDecimal jyOtherPremium = BigDecimalUtil.subtract(jyInletPremium,jyCommissionPremium);
|
|
|
|
|
+
|
|
|
|
|
+ // 设置应收
|
|
|
|
|
+ updateIncome.setJqReceivablePremium(jqInletPremium.toString());
|
|
|
|
|
+ updateIncome.setSyReceivablePremium(syInletPremium.toString());
|
|
|
|
|
+ updateIncome.setJyReceivablePremium(jyPremium.toString());
|
|
|
|
|
+
|
|
|
|
|
+ // 设置手续费比例
|
|
|
|
|
+ updateIncome.setJqSuperviseCostsProportion(BigDecimalUtil.toString(ratioVo.getJqCommissionRatio()));
|
|
|
|
|
+ updateIncome.setSySuperviseCostsProportion(BigDecimalUtil.toString(ratioVo.getSyCommissionRatio()));
|
|
|
|
|
+ updateIncome.setJySuperviseCostsProportion(BigDecimalUtil.toString(ratioVo.getJyCommissionRatio()));
|
|
|
|
|
+
|
|
|
|
|
+ // 设置手续费
|
|
|
|
|
+ updateIncome.setJqSuperviseCostsPremiums(BigDecimalUtil.toString(jqCommissionPremium));
|
|
|
|
|
+ updateIncome.setSySuperviseCostsPremiums(BigDecimalUtil.toString(syCommissionPremium));
|
|
|
|
|
+ updateIncome.setJySuperviseCostsPremiums(BigDecimalUtil.toString(jyCommissionPremium));
|
|
|
|
|
+
|
|
|
|
|
+ // 设置跟单费比例
|
|
|
|
|
+ updateIncome.setJqOtherCostsProportion(BigDecimalUtil.toString(ratioVo.getJqFollowRatio()));
|
|
|
|
|
+ updateIncome.setSyOtherCostsProportion(BigDecimalUtil.toString(ratioVo.getSyFollowRatio()));
|
|
|
|
|
+ updateIncome.setJyOtherCostsProportion(BigDecimalUtil.toString(ratioVo.getJyFollowRatio()));
|
|
|
|
|
+
|
|
|
|
|
+ // 设置跟单费
|
|
|
|
|
+ updateIncome.setJqOtherCostsPremiums(BigDecimalUtil.toString(jqOtherPremium));
|
|
|
|
|
+ updateIncome.setSyOtherCostsPremiums(BigDecimalUtil.toString(syOtherPremium));
|
|
|
|
|
+ updateIncome.setJyOtherCostsPremiums(BigDecimalUtil.toString(jyOtherPremium));
|
|
|
|
|
+ log.info("根据比例计算得到的金额:updateIncome=[{}]", JSONUtil.toJsonStr(updateIncome));
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 处理手续费更新
|
|
* 处理手续费更新
|
|
|
*/
|
|
*/
|
|
@@ -2523,22 +2728,22 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
if (insFeeOrders != null) {
|
|
if (insFeeOrders != null) {
|
|
|
switch (type) {
|
|
switch (type) {
|
|
|
case "jqFollow":
|
|
case "jqFollow":
|
|
|
- followPremium = BigDecimalUtil.toZero(insFeeOrders.getJqFollowPremium());
|
|
|
|
|
|
|
+ followPremium = BigDecimalUtil.null2Zero(insFeeOrders.getJqFollowPremium());
|
|
|
break;
|
|
break;
|
|
|
case "syFollow":
|
|
case "syFollow":
|
|
|
- followPremium = BigDecimalUtil.toZero(insFeeOrders.getSyFollowPremium());
|
|
|
|
|
|
|
+ followPremium = BigDecimalUtil.null2Zero(insFeeOrders.getSyFollowPremium());
|
|
|
break;
|
|
break;
|
|
|
case "jqCommission":
|
|
case "jqCommission":
|
|
|
- followPremium = BigDecimalUtil.toZero(insFeeOrders.getJqCommissionPremium());
|
|
|
|
|
|
|
+ followPremium = BigDecimalUtil.null2Zero(insFeeOrders.getJqCommissionPremium());
|
|
|
break;
|
|
break;
|
|
|
case "syCommission":
|
|
case "syCommission":
|
|
|
- followPremium = BigDecimalUtil.toZero(insFeeOrders.getSyCommissionPremium());
|
|
|
|
|
|
|
+ followPremium = BigDecimalUtil.null2Zero(insFeeOrders.getSyCommissionPremium());
|
|
|
break;
|
|
break;
|
|
|
case "jyCommission":
|
|
case "jyCommission":
|
|
|
- followPremium = BigDecimalUtil.toZero(insFeeOrders.getJyCommissionPremium());
|
|
|
|
|
|
|
+ followPremium = BigDecimalUtil.null2Zero(insFeeOrders.getJyCommissionPremium());
|
|
|
break;
|
|
break;
|
|
|
case "jyFollow":
|
|
case "jyFollow":
|
|
|
- followPremium = BigDecimalUtil.toZero(insFeeOrders.getJyFollowPremium());
|
|
|
|
|
|
|
+ followPremium = BigDecimalUtil.null2Zero(insFeeOrders.getJyFollowPremium());
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -3298,7 +3503,9 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
@Override
|
|
@Override
|
|
|
public String exportPlatFormReceivable(ReceivableQueryVo receivableQueryVo) {
|
|
public String exportPlatFormReceivable(ReceivableQueryVo receivableQueryVo) {
|
|
|
receivableQueryVo.setSystemCode(baseController.getSystemCode());
|
|
receivableQueryVo.setSystemCode(baseController.getSystemCode());
|
|
|
|
|
+
|
|
|
List<InsPlyIncome> receivableList = baseMapper.getReceivableList(receivableQueryVo);
|
|
List<InsPlyIncome> receivableList = baseMapper.getReceivableList(receivableQueryVo);
|
|
|
|
|
+ receivableList = this.fillOtherInfo(receivableList);
|
|
|
|
|
|
|
|
// 调用动态导出
|
|
// 调用动态导出
|
|
|
return exportBaseService.upLoadFile(
|
|
return exportBaseService.upLoadFile(
|
|
@@ -3630,6 +3837,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
List<CalRes> calRes;
|
|
List<CalRes> calRes;
|
|
|
calRes = baseMapper.queryInvoicedAmount(systemCode, List.of(1, 3), queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType());
|
|
calRes = baseMapper.queryInvoicedAmount(systemCode, List.of(1, 3), queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType());
|
|
|
Map<String, BigDecimal> sxfInvoicedAmountMap = calRes.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getAmount, (o1,o2)->o1));
|
|
Map<String, BigDecimal> sxfInvoicedAmountMap = calRes.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getAmount, (o1,o2)->o1));
|
|
|
|
|
+ Map<String, BigDecimal> sxfOverinflatedAmountMap = calRes.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getOverinflatedAmount, (o1,o2)->o1));
|
|
|
calRes = baseMapper.queryInvoicedAmount(systemCode, List.of(2, 4), queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType());
|
|
calRes = baseMapper.queryInvoicedAmount(systemCode, List.of(2, 4), queryVo.getInvoiceStartTime(), queryVo.getInvoiceEndTime(), queryVo.getAgreementType());
|
|
|
Map<String, BigDecimal> gdfInvoicedAmountMap = calRes.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getAmount, (o1,o2)->o1));
|
|
Map<String, BigDecimal> gdfInvoicedAmountMap = calRes.stream().collect(Collectors.toMap(CalRes::getCompanyId, CalRes::getAmount, (o1,o2)->o1));
|
|
|
|
|
|
|
@@ -3645,6 +3853,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
CompanySuperviseSettlementReportDto companySuperviseSettlementReportDto = companyMap.get(companyId);
|
|
CompanySuperviseSettlementReportDto companySuperviseSettlementReportDto = companyMap.get(companyId);
|
|
|
BigDecimal sxf = sxfInvoicedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
BigDecimal sxf = sxfInvoicedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
|
companySuperviseSettlementReportDto.setSxfInvoicedAmount(Objects.toString(sxf,BigDecimal.ZERO+""));
|
|
companySuperviseSettlementReportDto.setSxfInvoicedAmount(Objects.toString(sxf,BigDecimal.ZERO+""));
|
|
|
|
|
+ BigDecimal sxfOverinflatedAmount = sxfOverinflatedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
|
|
|
+ companySuperviseSettlementReportDto.setTotalOverinflatedAmount(Objects.toString(sxfOverinflatedAmount,BigDecimal.ZERO+""));
|
|
|
BigDecimal gdf = gdfInvoicedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
BigDecimal gdf = gdfInvoicedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
|
companySuperviseSettlementReportDto.setGdfInvoicedAmount(Objects.toString(gdf,BigDecimal.ZERO+""));
|
|
companySuperviseSettlementReportDto.setGdfInvoicedAmount(Objects.toString(gdf,BigDecimal.ZERO+""));
|
|
|
// 平台就没有未结算的,只要结算就是已结算的
|
|
// 平台就没有未结算的,只要结算就是已结算的
|
|
@@ -3658,8 +3868,10 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
|
|
|
|
|
BigDecimal sxfS = sxfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
BigDecimal sxfS = sxfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
|
BigDecimal gdfS = gdfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
BigDecimal gdfS = gdfSettledAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
|
|
|
+ BigDecimal overinflatedAmount = sxfOverinflatedAmountMap.getOrDefault(companyId, BigDecimal.ZERO);
|
|
|
companySuperviseSettlementReportDto.setSxfSettledAmount(Objects.toString(sxfS, BigDecimal.ZERO+""));
|
|
companySuperviseSettlementReportDto.setSxfSettledAmount(Objects.toString(sxfS, BigDecimal.ZERO+""));
|
|
|
companySuperviseSettlementReportDto.setSxfUnSettledAmount(BigDecimalUtil.subtract(sxf,sxfS).toString());
|
|
companySuperviseSettlementReportDto.setSxfUnSettledAmount(BigDecimalUtil.subtract(sxf,sxfS).toString());
|
|
|
|
|
+ companySuperviseSettlementReportDto.setTotalOverinflatedAmount(Objects.toString(overinflatedAmount, BigDecimal.ZERO+""));
|
|
|
|
|
|
|
|
companySuperviseSettlementReportDto.setGdfSettledAmount(Objects.toString(gdfS, BigDecimal.ZERO+""));
|
|
companySuperviseSettlementReportDto.setGdfSettledAmount(Objects.toString(gdfS, BigDecimal.ZERO+""));
|
|
|
companySuperviseSettlementReportDto.setGdfUnSettledAmount(BigDecimalUtil.subtract(gdf,gdfS).toString());
|
|
companySuperviseSettlementReportDto.setGdfUnSettledAmount(BigDecimalUtil.subtract(gdf,gdfS).toString());
|
|
@@ -3781,6 +3993,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
tree.putExtra("sxfUnSettledAmount",dto.getSxfUnSettledAmount());
|
|
tree.putExtra("sxfUnSettledAmount",dto.getSxfUnSettledAmount());
|
|
|
tree.putExtra("gdfSettledAmount",dto.getGdfSettledAmount());
|
|
tree.putExtra("gdfSettledAmount",dto.getGdfSettledAmount());
|
|
|
tree.putExtra("gdfUnSettledAmount",dto.getGdfUnSettledAmount());
|
|
tree.putExtra("gdfUnSettledAmount",dto.getGdfUnSettledAmount());
|
|
|
|
|
+ tree.putExtra("totalOverinflatedAmount",dto.getTotalOverinflatedAmount());
|
|
|
});
|
|
});
|
|
|
log.info("树形结构构建:一级数据[{}]个", CollUtil.size(build));
|
|
log.info("树形结构构建:一级数据[{}]个", CollUtil.size(build));
|
|
|
return build;
|
|
return build;
|