|
@@ -14,6 +14,7 @@ import com.jzg.commons.entity.orders.po.InsOrdersCosts;
|
|
|
import com.jzg.commons.entity.po.InsFeeOrders;
|
|
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.vo.PtlAgreementCostRatioVo;
|
|
import com.jzg.commons.entity.vo.PtlAgreementCostRatioVo;
|
|
|
|
|
+import com.jzg.commons.exception.SystemException;
|
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
import com.jzg.commons.util.AssertionUtils;
|
|
|
import com.jzg.commons.util.StringUtils;
|
|
import com.jzg.commons.util.StringUtils;
|
|
|
import com.jzg.quotation.commons.client.OrgClient;
|
|
import com.jzg.quotation.commons.client.OrgClient;
|
|
@@ -380,9 +381,20 @@ public class InsFeeOrdersServiceImpl extends ServiceImpl<InsFeeOrdersMapper, Ins
|
|
|
// 2. 查询订单
|
|
// 2. 查询订单
|
|
|
InsFeeOrders insFeeOrders = getFeeOrderByOrderNo(orderNo);
|
|
InsFeeOrders insFeeOrders = getFeeOrderByOrderNo(orderNo);
|
|
|
AssertionUtils.isFail(insFeeOrders == null, "根据订单号查询订单费用表查无数据,订单号:" + orderNo);
|
|
AssertionUtils.isFail(insFeeOrders == null, "根据订单号查询订单费用表查无数据,订单号:" + orderNo);
|
|
|
-
|
|
|
|
|
- // 3. 更新
|
|
|
|
|
|
|
+ BigDecimal jqExportKeepPointRatio = insFeeOrders.getJqExportKeepPointRatio(); // 交强险出口留点比例
|
|
|
|
|
+ BigDecimal syExportKeepPointRatio = insFeeOrders.getSyExportKeepPointRatio(); // 商业险出口留点比例
|
|
|
|
|
+ BigDecimal jyExportKeepPointRatio = insFeeOrders.getJyExportKeepPointRatio(); // 驾意险出口留点比例
|
|
|
|
|
+ if (jqExportKeepPointRatio.compareTo(BigDecimal.ZERO) != 0 || syExportKeepPointRatio.compareTo(BigDecimal.ZERO) != 0 || jyExportKeepPointRatio.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
|
|
+ throw new SystemException("该订单留点比例不为0,无法修改可用金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 校验修改金额 不能比现在的金额大
|
|
|
|
|
+ AssertionUtils.isFail(availableAmount.compareTo(insFeeOrders.getAvailableAmount()) > 0, "可用金额不能大于当前金额");
|
|
|
|
|
+ // 3. 更新 可用金额
|
|
|
|
|
+ BigDecimal availableAmountBefore = insFeeOrders.getAvailableAmount();
|
|
|
|
|
+ BigDecimal availableAmountAfter = availableAmountBefore.subtract(availableAmount);
|
|
|
insFeeOrders.setAvailableAmount(availableAmount);
|
|
insFeeOrders.setAvailableAmount(availableAmount);
|
|
|
|
|
+ // 修改后 将相差的金额 加到剩余金额中
|
|
|
|
|
+ insFeeOrders.setRemainingAmount(insFeeOrders.getRemainingAmount().add(availableAmountAfter));
|
|
|
int updateCount = insFeeOrdersMapper.updateById(insFeeOrders);
|
|
int updateCount = insFeeOrdersMapper.updateById(insFeeOrders);
|
|
|
AssertionUtils.isFail(updateCount <= 0, "更新失败,订单号:" + orderNo);
|
|
AssertionUtils.isFail(updateCount <= 0, "更新失败,订单号:" + orderNo);
|
|
|
|
|
|