Browse Source

平台应收 批量修改比例之后,应收金额不会自动计算,还是显示的原来的

lipf 2 tháng trước cách đây
mục cha
commit
0d6444ddc5

+ 7 - 0
commons/src/main/java/com/jzg/commons/util/BigDecimalUtil.java

@@ -159,4 +159,11 @@ public class BigDecimalUtil {
         }
         return new BigDecimal(v);
     }
+
+    public static BigDecimal toZero(BigDecimal amount) {
+        if(amount == null){
+            return BigDecimal.ZERO;
+        }
+        return  amount;
+    }
 }

+ 4 - 5
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/InsFeeOrderController.java

@@ -11,7 +11,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -68,10 +67,10 @@ public class InsFeeOrderController {
      * @author lipf
      * @date 2026/6/4 10:17
      */
-    @PostMapping("/queryAllTotalReceivablePremiumByOrderNo")
-    BigDecimal queryAllTotalReceivablePremiumByOrderNo(@RequestBody List<String> orderNos){
-        return insFeeOrdersService.queryAllTotalReceivablePremiumByOrderNo(orderNos);
-    }
+//    @PostMapping("/queryAllTotalReceivablePremiumByOrderNo")
+//    BigDecimal queryAllTotalReceivablePremiumByOrderNo(@RequestBody List<String> orderNos){
+//        return insFeeOrdersService.queryAllTotalReceivablePremiumByOrderNo(orderNos);
+//    }
 
     @Operation(summary = "修改权益可用金额")
     @PostMapping("updateAvailableAmount")

+ 10 - 10
tenant/organization/src/main/java/com/jzg/organization/client/InsFeeOrdersClient.java

@@ -30,14 +30,14 @@ public interface InsFeeOrdersClient {
     @PostMapping("/supplementOrder/updateOrdersBatch")
     @Operation(summary = "车险报价批量修改联系人等信息")
     HttpResult<String> updateOrdersBatch(@RequestBody BatchModifyVo batchModifyVo);
-
-    /**
-     * 查询指定订单的应收总额
-     *
-     * @param orderNos 订单编号
-     * @author lipf
-     * @date 2026/6/4 10:17
-     */
-    @PostMapping("/insFeeOrder/queryAllTotalReceivablePremiumByOrderNo")
-    BigDecimal queryAllTotalReceivablePremiumByOrderNo(@RequestBody List<String> orderNos);
+//
+//    /**
+//     * 查询指定订单的应收总额
+//     *
+//     * @param orderNos 订单编号
+//     * @author lipf
+//     * @date 2026/6/4 10:17
+//     */
+//    @PostMapping("/insFeeOrder/queryAllTotalReceivablePremiumByOrderNo")
+//    BigDecimal queryAllTotalReceivablePremiumByOrderNo(@RequestBody List<String> orderNos);
 }

+ 9 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/ReceivableMapper.java

@@ -15,6 +15,7 @@ import com.jzg.organization.entity.dto.CalRes;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -72,6 +73,14 @@ public interface ReceivableMapper extends BaseMapper<InsPlyIncome> {
     List<InsPlyIncome> queryIncomeDatasByOrderIds(@Param("orderNos") List<String> orderNos,
                                                   @Param("companyId") String companyId);
 
+    /**
+     * 查询应收总额
+     *
+     * @author lipf
+     * @date 2026/6/4 10:22
+     */
+    BigDecimal queryAllTotalReceivablePremiumByOrderNo(@Param("orders") List<String> orders);
+
     List<InsPlyIncome> getReceivableList(@Param("receivableQueryVo") ReceivableQueryVo receivableQueryVo);
 
     /**

+ 9 - 0
tenant/organization/src/main/java/com/jzg/organization/service/ReceivableService.java

@@ -9,6 +9,7 @@ import com.jzg.commons.entity.finance.po.*;
 import com.jzg.commons.entity.finance.vo.*;
 import com.jzg.commons.entity.orders.po.InsOrderAdjust;
 import com.jzg.commons.entity.po.EsmInsCompany;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
@@ -338,6 +339,14 @@ public interface ReceivableService extends IService<InsPlyIncome> {
      */
     HttpResult<List<InsPlyIncome>> queryIncomeDatas(IncomeDataVO incomeDataVO);
 
+    /**
+     * 查询应收总额
+     *
+     * @author lipf
+     * @date 2026/6/4 10:22
+     */
+    BigDecimal queryAllTotalReceivablePremiumByOrderNo(@Param("orders") List<String> orders);
+
     /**
      * 删除发票信息(便于重新开票)
      *

+ 19 - 3
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -40,6 +40,7 @@ import com.jzg.organization.excel.listener.*;
 import com.jzg.organization.mapper.*;
 import com.jzg.organization.service.ReceivableService;
 import com.jzg.organization.service.SysUserJzgInfoSalesmanService;
+import org.apache.ibatis.annotations.Param;
 import org.jetbrains.annotations.NotNull;
 import org.redisson.api.RBucket;
 import org.redisson.api.RKeys;
@@ -240,6 +241,17 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         return res;
     }
 
+    /**
+     * 查询应收总额
+     *
+     * @author lipf
+     * @date 2026/6/4 10:22
+     */
+    @Override
+    public BigDecimal queryAllTotalReceivablePremiumByOrderNo(@Param("orders") List<String> orders){
+        return baseMapper.queryAllTotalReceivablePremiumByOrderNo(orders);
+    }
+
     /**
      * 应收数据二次过滤
      *
@@ -1502,7 +1514,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
      */
     @Override
     public BigDecimal queryAllTotalReceivablePremium(List<String> orderNos) {
-        return insFeeOrdersClient.queryAllTotalReceivablePremiumByOrderNo(orderNos);
+        return this.queryAllTotalReceivablePremiumByOrderNo(orderNos);
     }
 
     @Override
@@ -2174,18 +2186,22 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
                 // modify by lipf 2026年6月18日09:36:01 转换为百分比
                 BigDecimal jqSuperviseCostsProportion = BigDecimalUtil.divide(batchModifyVo.getJqSuperviseCostsProportion(), new BigDecimal(100)) ;
                 BigDecimal superviseReceivablePremium = BigDecimalUtil.divide(BigDecimalUtil.multiply(new BigDecimal(Objects.toString(insPlyIncomeSource.getJqPremium(),"0") ), jqSuperviseCostsProportion), taxRate) ;
+                BigDecimal jqReceivePremiun = BigDecimalUtil.add(superviseReceivablePremium, BigDecimalUtil.toZero(insPlyIncomeSource.getInsFeeOrders()  == null? null:  insPlyIncomeSource.getInsFeeOrders().getJqFollowPremium()));
                 baseMapper.update(null, new LambdaUpdateWrapper<InsPlyIncome>()
                         .set(InsPlyIncome::getJqSuperviseCostsProportion, jqSuperviseCostsProportion)
                         .set(InsPlyIncome::getJqSuperviseCostsPremiums, superviseReceivablePremium)
+                        .set(InsPlyIncome::getJqReceivablePremium,jqReceivePremiun)
                         .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
             }
             if (Objects.nonNull(batchModifyVo.getSySuperviseCostsProportion()) && batchModifyVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
                 // modify by lipf 2026年6月18日09:36:01 转换为百分比
                 BigDecimal sySuperviseCostsProportion = BigDecimalUtil.divide(batchModifyVo.getSySuperviseCostsProportion(), new BigDecimal(100)) ;
-                BigDecimal otherReceivablePremium = BigDecimalUtil.divide(BigDecimalUtil.multiply(new BigDecimal(Objects.toString(insPlyIncomeSource.getSyPremium(),"0")), sySuperviseCostsProportion), taxRate) ;
+                BigDecimal sySuperviseReceivablePremium = BigDecimalUtil.divide(BigDecimalUtil.multiply(new BigDecimal(Objects.toString(insPlyIncomeSource.getSyPremium(),"0")), sySuperviseCostsProportion), taxRate) ;
+                BigDecimal syReceivePremiun = BigDecimalUtil.add(sySuperviseReceivablePremium, BigDecimalUtil.toZero(insPlyIncomeSource.getInsFeeOrders() != null? insPlyIncomeSource.getInsFeeOrders().getSyFollowPremium() : null));
                 baseMapper.update(null, new LambdaUpdateWrapper<InsPlyIncome>()
                         .set(InsPlyIncome::getSySuperviseCostsProportion, sySuperviseCostsProportion)
-                        .set(InsPlyIncome::getSySuperviseCostsPremiums, otherReceivablePremium)
+                        .set(InsPlyIncome::getSySuperviseCostsPremiums, sySuperviseReceivablePremium)
+                        .set(InsPlyIncome::getSyReceivablePremium,syReceivePremiun)
                         .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
             }
             if (batchModifyVo.getSigningTime() != null){

+ 13 - 0
tenant/organization/src/main/resources/mapper/ReceivableMapper.xml

@@ -280,6 +280,19 @@
             ipi.is_delete  = 0
             -- and ipi.settlement_status = '0'  -- 已经结算的车辆,在应收订单里面,还需要能查询到
     </sql>
+    <!-- 查询应收订单总额 lipf 2026年6月4日10:22:57 -->
+    <select id="queryAllTotalReceivablePremiumByOrderNo" resultType="java.math.BigDecimal">
+        SELECT
+        sum(COALESCE(ipi.jq_receivable_premium, 0) + COALESCE(ipi.sy_receivable_premium, 0) + COALESCE(ipi.jy_receivable_premium, 0) )
+        from
+        ins_ply_income ipi
+        <where>
+            ipi.order_no in
+            <foreach collection="orders" item="order" open="(" separator="," close=")">
+                #{order}
+            </foreach>
+        </where>
+    </select>
 
     <!--根据保司id和订单号进行过滤 2026年5月12日15:06:40  lipf  -->
     <select id="queryIncomeDatasByOrderIds" resultType="com.jzg.commons.entity.finance.po.InsPlyIncome">