فهرست منبع

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

lixiaolong 1 هفته پیش
والد
کامیت
3d0e49e61c

+ 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);
+        }
+    }
+
     /**
      * 调整费用类型的各项比例
      */