Răsfoiți Sursa

私有协议批量修改接口开发

lipf 4 luni în urmă
părinte
comite
761f347fc9

+ 21 - 10
commons/src/main/java/com/jzg/commons/entity/finance/vo/BatchModifyVo.java

@@ -9,6 +9,7 @@ import java.util.List;
 
 /**
  *  批量修改Vo
+ *
  */
 @Data
 @Schema(description = "批量修改Vo")
@@ -23,18 +24,28 @@ public class BatchModifyVo {
     @Schema(description = "商业手续费比例")
     private BigDecimal sySuperviseCostsProportion;
 
-    @Schema(description = "驾意手续费比例")
-    private BigDecimal jySuperviseCostsProportion;
+//    @Schema(description = "驾意手续费比例")
+//    private BigDecimal jySuperviseCostsProportion;
+//
+//    @Schema(description = "交强跟单费比例")
+//    private BigDecimal jqOtherCostsProportion;
+//
+//    @Schema(description = "商业跟单费比例")
+//    private BigDecimal syOtherCostsProportion;
+//
+//    @Schema(description = "驾意跟单费比例")
+//    private BigDecimal jyOtherCostsProportion;
 
-    @Schema(description = "交强跟单费比例")
-    private BigDecimal jqOtherCostsProportion;
+    @Schema(description = "签单时间")
+    private LocalDateTime signingTime;
 
-    @Schema(description = "商业跟单费比例")
-    private BigDecimal syOtherCostsProportion;
+//    @Schema(description = "对接人")
+//    private String contactPerson;
 
-    @Schema(description = "驾意跟单费比例")
-    private BigDecimal jyOtherCostsProportion;
+    @Schema(description = "对接人姓名")
+    private String contractUserName;
+
+    @Schema(description = "对接人手机号")
+    private String contractPhone;
 
-    @Schema(description = "签单时间")
-    private LocalDateTime signingTime;
 }

+ 14 - 5
tenant/organization/src/main/java/com/jzg/organization/controller/ReceivableController.java

@@ -321,11 +321,20 @@ public class ReceivableController {
         return HttpResult.ok(receivableService.deleteInvoiceById(id) ? "删除成功":"删除失败");
     }
 
-//    @PostMapping("batchModify")
-//    @Operation(summary = "批量修改")
-//    public HttpResult batchModify(@RequestBody List<SettlementVo> settlementVoList){
-//        return receivableService.batchModify(settlementVoList) ? HttpResult.ok("批量修改成功") : HttpResult.error("批量修改失败");
-//    }
+    /**
+     * 私有协议批量修改
+     *      修改手续费比例(商业险手续费比例, 交强险手续费比例)
+     *      签单时间
+     *      对接人(对接人姓名,手机号)
+     *
+     * @author lipf
+     * @date 2026/5/27 20:25
+     */
+    @PostMapping("batchModify")
+    @Operation(summary = "批量修改")
+    public HttpResult<String> batchModify(@RequestBody BatchModifyVo batchModifyVo){
+        return receivableService.batchModify(batchModifyVo) ? HttpResult.ok("批量修改成功") : HttpResult.error("批量修改失败");
+    }
     @PostMapping("exportSuperviseExcel")
     @Operation(summary = "导出应收手续费excel文件(车险)")
     public void exportSuperviseExcel(@RequestBody ReceivableQueryVo receivableQueryVo) throws IOException {

+ 3 - 2
tenant/organization/src/main/java/com/jzg/organization/service/ReceivableService.java

@@ -160,8 +160,9 @@ public interface ReceivableService extends IService<InsPlyIncome> {
 
     /**
      * 批量修改
-     * @param batchModifyVo
-     * @return
+     *
+     * @param batchModifyVo 要修改的内容
+     * @return boolean 是否修改成功
      */
     boolean batchModify(BatchModifyVo batchModifyVo);
 

+ 67 - 45
tenant/organization/src/main/java/com/jzg/organization/service/impl/ReceivableServiceImpl.java

@@ -23,6 +23,7 @@ import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.entity.po.InsFeeOrders;
 import com.jzg.commons.entity.po.PtlAgreement;
 import com.jzg.commons.entity.po.SysUploadFiles;
+import com.jzg.commons.exception.ServiceException;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.commons.util.AssertionUtils;
 import com.jzg.commons.util.EasyExcelUtils;
@@ -1397,68 +1398,89 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
         return importExcelResultVo;
     }
 
+    /**
+     * 私有协议批量修改
+     *      修改手续费比例(商业险手续费比例, 交强险手续费比例)
+     *      签单时间
+     *      对接人(对接人姓名,手机号)
+     *
+     * @author lipf
+     * @date 2026/5/27 20:25
+     */
     @Override
     @Transactional
     public boolean batchModify(BatchModifyVo batchModifyVo) {
-        List<InsPlyIncome> updateInsPlyIncome = new ArrayList<>();
+        log.info("批量修改应收订单: batchModifyVo=[{}]", JSONUtil.toJsonStr(batchModifyVo));
 
+        List<String> incomeIds = batchModifyVo.getIncomeIds();
+        if(CollUtil.isEmpty(incomeIds)) {
+            throw new ServiceException("请勾选要批量修改的应收订单");
+        }
+        List<InsPlyIncome> updateInsPlyIncome = new ArrayList<>();
         for (String incomeId : batchModifyVo.getIncomeIds()) {
-            InsPlyIncome insPlyIncome = baseMapper.selectById(incomeId);
-            if (Objects.nonNull(insPlyIncome)) {
-                if (Objects.nonNull(batchModifyVo.getJqSuperviseCostsProportion()) && batchModifyVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
-                    BigDecimal superviseReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJqPremium()), batchModifyVo.getJqSuperviseCostsProportion());
-                    insPlyIncome.setJqSuperviseCostsPremiums(superviseReceivablePremium.toString());
-                }
-                if (Objects.nonNull(batchModifyVo.getSySuperviseCostsProportion()) && batchModifyVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) < 0) {
-                    BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getSyPremium()), batchModifyVo.getSySuperviseCostsProportion());
-                    insPlyIncome.setSySuperviseCostsPremiums(otherReceivablePremium.toString());
-                }
-
-                if (Objects.nonNull(batchModifyVo.getJqOtherCostsProportion()) && batchModifyVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
-                    BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJqPremium()), batchModifyVo.getJqOtherCostsProportion());
-                    insPlyIncome.setJqOtherCostsPremiums(otherReceivablePremium.toString());
-                }
-                if (Objects.nonNull(batchModifyVo.getSyOtherCostsProportion()) && batchModifyVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) < 0) {
-                    BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getSyPremium()), batchModifyVo.getSyOtherCostsProportion());
-                    insPlyIncome.setSySuperviseCostsPremiums(otherReceivablePremium.toString());
-                }
-
-                if (Objects.nonNull(batchModifyVo.getJySuperviseCostsProportion()) && batchModifyVo.getJySuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
-                    BigDecimal jySuperviseReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJyPremium()), batchModifyVo.getJySuperviseCostsProportion());
-                    insPlyIncome.setJySuperviseCostsPremiums(jySuperviseReceivablePremium.toString());
-                }
-                if (Objects.nonNull(batchModifyVo.getJySuperviseCostsProportion()) && batchModifyVo.getJySuperviseCostsProportion().compareTo(BigDecimal.ZERO) < 0) {
-                    BigDecimal jyOtherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJyPremium()), batchModifyVo.getJySuperviseCostsProportion());
-                    insPlyIncome.setJyOtherCostsPremiums(jyOtherReceivablePremium.toString());
-                }
+            InsPlyIncome insPlyIncomeSource = baseMapper.selectById(incomeId);
+            if(insPlyIncomeSource == null) {
+                log.info("批量修改应收订单。序号为[{}]的应收订单不存在", incomeId);
+                continue;
+            }
+            InsPlyIncome insPlyIncome = new InsPlyIncome();
+            insPlyIncome.setId(insPlyIncomeSource.getId());
+            if (Objects.nonNull(batchModifyVo.getJqSuperviseCostsProportion()) && batchModifyVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
+                BigDecimal superviseReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJqPremium()), batchModifyVo.getJqSuperviseCostsProportion());
+                insPlyIncome.setJqSuperviseCostsProportion(Objects.toString(batchModifyVo.getJqSuperviseCostsProportion()));
+                insPlyIncome.setJqSuperviseCostsPremiums(superviseReceivablePremium.toString());
+            }
+            if (Objects.nonNull(batchModifyVo.getSySuperviseCostsProportion()) && batchModifyVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
+                BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getSyPremium()), batchModifyVo.getSySuperviseCostsProportion());
+                insPlyIncome.setSySuperviseCostsProportion(Objects.toString(batchModifyVo.getSySuperviseCostsProportion()));
+                insPlyIncome.setSySuperviseCostsPremiums(otherReceivablePremium.toString());
+            }
 
-//                if (batchModifyVo.getSigningTime() != null){
-//                    insPlyIncome.setSigningTime(batchModifyVo.getSigningTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
+//                if (Objects.nonNull(batchModifyVo.getJqOtherCostsProportion()) && batchModifyVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
+//                    BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJqPremium()), batchModifyVo.getJqOtherCostsProportion());
+//                    insPlyIncome.setJqOtherCostsPremiums(otherReceivablePremium.toString());
+//                }
+//                if (Objects.nonNull(batchModifyVo.getSyOtherCostsProportion()) && batchModifyVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) < 0) {
+//                    BigDecimal otherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getSyPremium()), batchModifyVo.getSyOtherCostsProportion());
+//                    insPlyIncome.setSySuperviseCostsPremiums(otherReceivablePremium.toString());
+//                }
+//
+//                if (Objects.nonNull(batchModifyVo.getJySuperviseCostsProportion()) && batchModifyVo.getJySuperviseCostsProportion().compareTo(BigDecimal.ZERO) > 0) {
+//                    BigDecimal jySuperviseReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJyPremium()), batchModifyVo.getJySuperviseCostsProportion());
+//                    insPlyIncome.setJySuperviseCostsPremiums(jySuperviseReceivablePremium.toString());
+//                }
+//                if (Objects.nonNull(batchModifyVo.getJySuperviseCostsProportion()) && batchModifyVo.getJySuperviseCostsProportion().compareTo(BigDecimal.ZERO) < 0) {
+//                    BigDecimal jyOtherReceivablePremium = calcReceivableAmount(new BigDecimal(insPlyIncome.getJyPremium()), batchModifyVo.getJySuperviseCostsProportion());
+//                    insPlyIncome.setJyOtherCostsPremiums(jyOtherReceivablePremium.toString());
 //                }
 
-
-                updateInsPlyIncome.add(insPlyIncome);
+            if (batchModifyVo.getSigningTime() != null){
+                insPlyIncome.setSigningTime(batchModifyVo.getSigningTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
             }
-            baseMapper.updateById(updateInsPlyIncome);
-            return true;
+            updateInsPlyIncome.add(insPlyIncome);
         }
+        baseMapper.updateById(updateInsPlyIncome);
+        return true;
 
         // 批量修改
-        baseMapper.update(new InsPlyIncome(), new LambdaUpdateWrapper<InsPlyIncome>()
-                .set(InsPlyIncome::getJqSuperviseCostsProportion, batchModifyVo.getJqSuperviseCostsProportion())
-                .set(InsPlyIncome::getSySuperviseCostsProportion, batchModifyVo.getSySuperviseCostsProportion())
-                .set(InsPlyIncome::getJySuperviseCostsProportion, batchModifyVo.getJySuperviseCostsProportion())
-                .set(InsPlyIncome::getJqOtherCostsProportion, batchModifyVo.getJqOtherCostsProportion())
-                .set(InsPlyIncome::getSyOtherCostsProportion, batchModifyVo.getSyOtherCostsProportion())
-                .set(InsPlyIncome::getJyOtherCostsProportion, batchModifyVo.getJyOtherCostsProportion())
-//                .set(InsPlyIncome::getSigningTime, batchModifyVo.getSigningTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
-                .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
+//        baseMapper.update(new InsPlyIncome(), new LambdaUpdateWrapper<InsPlyIncome>()
+//                .set(InsPlyIncome::getJqSuperviseCostsProportion, batchModifyVo.getJqSuperviseCostsProportion())
+//                .set(InsPlyIncome::getSySuperviseCostsProportion, batchModifyVo.getSySuperviseCostsProportion())
+//                .set(InsPlyIncome::getJySuperviseCostsProportion, batchModifyVo.getJySuperviseCostsProportion())
+//                .set(InsPlyIncome::getJqOtherCostsProportion, batchModifyVo.getJqOtherCostsProportion())
+//                .set(InsPlyIncome::getSyOtherCostsProportion, batchModifyVo.getSyOtherCostsProportion())
+//                .set(InsPlyIncome::getJyOtherCostsProportion, batchModifyVo.getJyOtherCostsProportion())
+////                .set(InsPlyIncome::getSigningTime, batchModifyVo.getSigningTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
+//                .in(InsPlyIncome::getId, batchModifyVo.getIncomeIds()));
 
-        return false;
+//        return false;
     }
 
     @Override
     public BigDecimal calcReceivableAmount(BigDecimal premium, BigDecimal ratio) {
+        if(premium==null||ratio==null) {
+            return BigDecimal.ZERO;
+        }
         return premium.multiply(ratio);
     }