소스 검색

处理批量设置比例出口留点比例大于出口比例的问题

lixiaolong 1 주 전
부모
커밋
3d0e49e61c
1개의 변경된 파일14개의 추가작업 그리고 0개의 파일을 삭제
  1. 14 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java

+ 14 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostServiceImpl.java

@@ -610,6 +610,8 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
             }
 
             if (wasAdjusted) {
+                // 出口留点比例 大于 出口比例 设置 出口留点比例 等于 出口比例
+                clampKeepPointRatios(costType);
                 adjustedCount++;
             }
         }
@@ -624,6 +626,18 @@ public class PtlAgreementCostServiceImpl extends ServiceImpl<PtlAgreementCostMap
         return HttpResult.ok("批量调整成功,共调整 " + adjustedCount + " 条记录");
     }
 
+    /**
+     * 出口留点比例 大于 出口比例 设置 出口留点比例 等于 出口比例
+     */
+    private void clampKeepPointRatios(PtlAgreementCostType costType) {
+        // 出口留点 ≤ 出口比例
+        BigDecimal exportKeep = costType.getExportKeepPointRatio();
+        BigDecimal export = costType.getExport();
+        if (exportKeep != null && export != null && exportKeep.compareTo(export) > 0) {
+            costType.setExportKeepPointRatio(export);
+        }
+    }
+
     /**
      * 调整费用类型的各项比例
      */