Przeglądaj źródła

1.掌柜保险手续费 非车手续费 添加批量修改

wuhp 1 rok temu
rodzic
commit
211304b7ed

+ 57 - 0
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -565,6 +565,63 @@ public class InsPlyIncomeController extends BaseController {
             throw new RuntimeException("导入失败");
             throw new RuntimeException("导入失败");
         }
         }
     }
     }
+
+    /**   批量修改 手续费金额
+     *
+     * @param multipartFile
+     * @param isNotCar 是否是非车
+     * @return
+     */
+    @PostMapping("/insuranceHandlingFeeBathImport")
+    @ApiOperation(value = "保险手续费批量修改导入(excel)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
+    })
+    public HttpResult<HashMap<String, Object>> insuranceHandlingFeeBathUpdate(@RequestParam MultipartFile multipartFile, @RequestParam("isNotCar") String isNotCar) {
+        HashMap<String, Object> result = insPlyIncomeService.insuranceHandlingFeeBathUpdate(multipartFile, isNotCar);
+        return HttpResult.ok(result);
+    }
+
+
+    /**
+     * 保险手续费批量修改
+     * @param insPlyIncomeVo
+     */
+    @PutMapping("/insuranceHandlingFeeBathConfirm")
+    @ApiOperation(value = "批量保险修改比例确认")
+    public HttpResult<HashMap<String, Object>> insuranceHandlingFeeBathConfirm(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeService.insuranceHandlingFeeBathConfirm(insPlyIncomeVo);
+        return HttpResult.ok();
+    }
+
+
+    /**   批量修改 手续费金额
+     *
+     * @param multipartFile
+     * @param isNotCar 是否是非车
+     * @return
+     */
+    @PostMapping("/insuranceHandlingFeeBathNotCarImport")
+    @ApiOperation(value = "保险非车手续费批量修改导入(excel)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
+    })
+    public HttpResult<HashMap<String, Object>> insuranceHandlingFeeBathNotCarImport(@RequestParam MultipartFile multipartFile, @RequestParam("isNotCar") String isNotCar) {
+        HashMap<String, Object> result = insPlyIncomeService.insuranceHandlingFeeBathNotCarImport(multipartFile, isNotCar);
+        return HttpResult.ok(result);
+    }
+
+    /**
+     * 保险非车手续费批量修改
+     * @param insPlyIncomeVo
+     */
+    @PutMapping("/insuranceHandlingNotCarFeeBathConfirm")
+    @ApiOperation(value = "批量保险非车修改比例确认")
+    public HttpResult<HashMap<String, Object>> insuranceHandlingNotCarFeeBathConfirm(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeService.insuranceHandlingNotCarFeeBathConfirm(insPlyIncomeVo);
+        return HttpResult.ok();
+    }
+
 }
 }
 
 
 
 

+ 27 - 0
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -251,4 +251,31 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
      * @Description: 导出数据
      * @Description: 导出数据
      */
      */
     void importDataAddType(MultipartFile file, String type) throws Exception;
     void importDataAddType(MultipartFile file, String type) throws Exception;
+    /**   批量修改 手续费金额
+     *
+     * @param multipartFile
+     * @param isNotCar 是否是非车
+     * @return
+     */
+    HashMap<String, Object> insuranceHandlingFeeBathUpdate(MultipartFile multipartFile, String isNotCar);
+
+    /**
+     * 保险手续费批量修改
+     * @param insPlyIncomeVo
+     */
+    void insuranceHandlingFeeBathConfirm(InsPlyIncomeVo insPlyIncomeVo);
+
+    /**   批量修改 手续费金额
+     *
+     * @param multipartFile
+     * @param isNotCar 是否是非车
+     * @return
+     */
+    HashMap<String, Object> insuranceHandlingFeeBathNotCarImport(MultipartFile multipartFile, String isNotCar);
+    /**
+     * 保险非车手续费批量修改
+     * @param insPlyIncomeVo
+     */
+    void insuranceHandlingNotCarFeeBathConfirm(InsPlyIncomeVo insPlyIncomeVo);
+
 }
 }

+ 171 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -3717,6 +3717,177 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         }
         }
 
 
     }
     }
+    /**   批量修改 手续费金额
+     *
+     * @param multipartFile
+     * @param isNotCar  是否是非车
+     * @return
+     */
+    @Override
+    public HashMap<String, Object> insuranceHandlingFeeBathUpdate(MultipartFile multipartFile, String isNotCar) {
+        HashMap<String, Object> resultMap = new HashMap<>();
+        List<HashMap<String, Object>> resultList = new ArrayList<>();
+        HashMap<String, Object> params = new HashMap<>();
+        BigDecimal allAmount = BigDecimal.ZERO;
+        params.put("isNotCar", isNotCar);
+        try {
+            List<InsBxPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxPlyIncomeExcelDto.class, 0, 1, 1);
+            for (InsBxPlyIncomeExcelDto item : dtoList) {
+                if (StringUtils.isNotEmpty(item.getLicenseno())) {
+                    params.put("licenseno", item.getLicenseno());
+                }
+
+                if (StringUtils.isNotEmpty(item.getPolicyno())) {
+                    params.put("policyno", item.getPolicyno());
+                }
+
+                if (StringUtils.isNotEmpty(item.getSyPolicyno())) {
+                    params.put("syPolicyno", item.getSyPolicyno());
+                }
+                params.put("handlingFeesStatus", "0");
+                params.put("isOther", "0");
+                params.put("isNotCar", "0");
+                InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                if (item.getJqSuperviseCostsProportion() == null) {
+                    item.setJqSuperviseCostsProportion(BigDecimal.ZERO);
+                }
+                if (item.getSySuperviseCostsProportion() == null) {
+                    item.setSySuperviseCostsProportion(BigDecimal.ZERO);
+                }
+                if (ObjectUtils.isNotEmpty(byBxLicenseno) && (byBxLicenseno.getJqOtherCostsProportion().compareTo(item.getJqSuperviseCostsProportion()) != 0 || byBxLicenseno.getSySuperviseCostsProportion().compareTo(item.getSySuperviseCostsProportion()) != 0)) {
+                    // 如果比例不相等
+                    BigDecimal jqSuperviseCostsProportion = item.getJqSuperviseCostsProportion();
+                    BigDecimal sySuperviseCostsProportion = item.getSySuperviseCostsProportion();
+                    BigDecimal jqSupervisePremium =  getBigDecimal( byBxLicenseno.getJqPremium(),jqSuperviseCostsProportion);
+                    BigDecimal sySupervisePremium =  getBigDecimal( byBxLicenseno.getSyPremium(),sySuperviseCostsProportion);
+                    HashMap<String, Object> map = new HashMap<>();
+                    map.put("licenseno", item.getLicenseno());
+                    map.put("policyno", item.getPolicyno());
+                    map.put("syPolicyno", item.getSyPolicyno());
+                    map.put("jqSuperviseCostsPremiums", jqSupervisePremium);
+                    map.put("sySuperviseCostsPremiums", sySupervisePremium);
+                    map.put("jqSuperviseCostsProportion", jqSuperviseCostsProportion);
+                    map.put("sySuperviseCostsProportion", sySuperviseCostsProportion);
+                    map.put("id", byBxLicenseno.getId());
+                    resultList.add(map);
+                    allAmount = allAmount.add(jqSupervisePremium).add(sySupervisePremium);
+                }
+
+            }
+            resultMap.put("allAmount", allAmount);
+            resultMap.put("resultList", resultList);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return resultMap;
+    }
+
+    /**
+     * 保险手续费批量修改
+     * @param insPlyIncomeVo
+     */
+    @Override
+    @Transactional
+    public void insuranceHandlingFeeBathConfirm(InsPlyIncomeVo insPlyIncomeVo) {
+        if (ObjectUtils.isEmpty(insPlyIncomeVo)) {
+            throw new SystemException("请导入文件");
+        }
+        if(CollectionUtils.isEmpty(insPlyIncomeVo.getResultList())){
+            throw new SystemException("请导入文件");
+        }
+        ArrayList<InsPlyIncome> batchUpdateItem = new ArrayList<>();
+        for (InsPlyIncome item : insPlyIncomeVo.getResultList()) {
+            InsPlyIncomeLog insPlyIncomeLog = new InsPlyIncomeLog();
+            insPlyIncomeLog.setIncomeId(item.getId());
+            BeanUtils.copyProperties(item, insPlyIncomeLog);
+            insPlyIncomeLog.setOperationStatus("2");
+            insPlyIncomeLog.setId(null);
+            insPlyIncomeLogService.saveLog(insPlyIncomeLog);  //添加日志
+            item.setAllFeeValue(this.calculateTotal(item.getJqSuperviseCostsPremiums(), item.getSySuperviseCostsPremiums(), null));
+            item.setCommissionFeevalue(this.calculateTotal(item.getJqSuperviseCostsPremiums(), item.getSySuperviseCostsPremiums(), null));
+            item.setCommissionFeerate(this.calculateTotal(item.getJqSuperviseCostsProportion(), item.getSySuperviseCostsProportion(), null));
+            batchUpdateItem.add(item);
+            // baseMapper.updateById(item);
+        }
+        this.saveOrUpdateBatch(batchUpdateItem);
+    }
+
+    @Override
+    public HashMap<String, Object> insuranceHandlingFeeBathNotCarImport(MultipartFile multipartFile, String isNotCar) {
+        HashMap<String, Object> resultMap = new HashMap<>();
+        List<HashMap<String, Object>> resultList = new ArrayList<>();
+        HashMap<String, Object> params = new HashMap<>();
+        BigDecimal allAmount = BigDecimal.ZERO;
+        params.put("isNotCar", isNotCar);
+        try {
+            List<InsBxNoPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxNoPlyIncomeExcelDto.class, 0, 1, 1);
+            for (InsBxNoPlyIncomeExcelDto item : dtoList) {
+                if (StringUtils.isNotEmpty(item.getLicenseno())) {
+                    params.put("licenseno", item.getLicenseno());
+                }
+
+                if (StringUtils.isNotEmpty(item.getNoPolicyno())) {
+                    params.put("noPolicyno", item.getNoPolicyno());
+                }
+                params.put("handlingFeesStatus", "0");
+                params.put("isOther", "0");
+                params.put("isNotCar", "1");
+                InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                if (item.getNoSuperviseCostsProportion() == null) {
+                    item.setNoSuperviseCostsProportion(BigDecimal.ZERO);
+                }
+                if (ObjectUtils.isNotEmpty(byBxLicenseno) && (byBxLicenseno.getNoSuperviseCostsProportion().compareTo(item.getNoSuperviseCostsProportion()) != 0 )) {
+                    // 如果比例不相等
+                    BigDecimal noSuperviseCostsProportion = item.getNoSuperviseCostsProportion();
+                    BigDecimal noSuperviseCostsPremiums =  getBigDecimal(byBxLicenseno.getNoPremium(),noSuperviseCostsProportion);
+                    HashMap<String, Object> map = new HashMap<>();
+                    map.put("licenseno", item.getLicenseno());
+                    map.put("noPolicyno", item.getNoPolicyno());
+                    map.put("noSuperviseCostsPremiums", noSuperviseCostsPremiums);
+                    map.put("noSuperviseCostsProportion", noSuperviseCostsProportion);
+                    map.put("id", byBxLicenseno.getId());
+                    resultList.add(map);
+                    allAmount = allAmount.add(noSuperviseCostsPremiums);
+                }
+            }
+            resultMap.put("allAmount", allAmount);
+            resultMap.put("resultList", resultList);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return resultMap;
+    }
+
+    /**
+     * 保险手续费批量修改
+     * @param insPlyIncomeVo
+     */
+    @Override
+    @Transactional
+    public void insuranceHandlingNotCarFeeBathConfirm(InsPlyIncomeVo insPlyIncomeVo) {
+        if (ObjectUtils.isEmpty(insPlyIncomeVo)) {
+            throw new SystemException("请导入文件");
+        }
+        if(CollectionUtils.isEmpty(insPlyIncomeVo.getResultList())){
+            throw new SystemException("请导入文件");
+        }
+        ArrayList<InsPlyIncome> batchUpdateItem = new ArrayList<>();
+        for (InsPlyIncome item : insPlyIncomeVo.getResultList()) {
+            InsPlyIncomeLog insPlyIncomeLog = new InsPlyIncomeLog();
+            insPlyIncomeLog.setIncomeId(item.getId());
+            BeanUtils.copyProperties(item, insPlyIncomeLog);
+            insPlyIncomeLog.setOperationStatus("2");
+            insPlyIncomeLog.setId(null);
+            insPlyIncomeLogService.saveLog(insPlyIncomeLog);  //添加日志
+            item.setAllFeeValue(this.calculateTotal(item.getNoSuperviseCostsPremiums(), null, null));
+            item.setCommissionFeevalue(this.calculateTotal(item.getNoSuperviseCostsPremiums(), null, null));
+            item.setCommissionFeerate(this.calculateTotal(item.getNoSuperviseCostsProportion(), null, null));
+            batchUpdateItem.add(item);
+            // baseMapper.updateById(item);
+        }
+        this.saveOrUpdateBatch(batchUpdateItem);
+    }
+
 
 
     public  List<InsPlyIncome>   checkData(String type,List<AddTypeCXSXFExcel> cxsxfList,List<AddTypeCXGDExcel> cxgdList, List<AddTypeFCSXFExcel> fcsxfList, List<AddTypeFCGDExcel> fcgdList,List<AddTypePTJSExcel> ptjsList)  throws SystemException{
     public  List<InsPlyIncome>   checkData(String type,List<AddTypeCXSXFExcel> cxsxfList,List<AddTypeCXGDExcel> cxgdList, List<AddTypeFCSXFExcel> fcsxfList, List<AddTypeFCGDExcel> fcgdList,List<AddTypePTJSExcel> ptjsList)  throws SystemException{
         List<InsPlyIncome>  list  =new ArrayList<InsPlyIncome>();
         List<InsPlyIncome>  list  =new ArrayList<InsPlyIncome>();

+ 12 - 4
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -2958,8 +2958,9 @@
                 FROM
                 FROM
                     inv_account_operate a
                     inv_account_operate a
                         left  join  (
                         left  join  (
-                        select a.category as "aCategory",b. category as "bCategory",a.expenditure_details as "expenditureDetails" from  inv_account_expenses a
-                                                                                                                                            left  join  inv_account_expenses  b  on a.parent_id =b.expenses_id
+                        select a.category as "aCategory",b. category as "bCategory",a.expenditure_details as "expenditureDetails"
+                        from  inv_account_expenses a
+                         left  join  inv_account_expenses  b  on a.parent_id =b.expenses_id
                         where   b.category  is  not  null
                         where   b.category  is  not  null
                     )  b on a.fund_use  = b.bCategory  and  a.fund_fen  = b.aCategory
                     )  b on a.fund_use  = b.bCategory  and  a.fund_fen  = b.aCategory
                 <where>
                 <where>
@@ -3044,11 +3045,16 @@
         SELECT
         SELECT
             a.apply_amount as "applyAmount",
             a.apply_amount as "applyAmount",
             a.enter_card_num as "enterCardNum",
             a.enter_card_num as "enterCardNum",
-            a.out_card_num as "outCardNum"
+            a.out_card_num as "outCardNum",
+            b.expensesId as "expensesId",
+            b.category as "category",
+            b.parentId as "parentId"
         FROM
         FROM
             inv_account_operate a
             inv_account_operate a
                 left  join  (
                 left  join  (
-                select a.category as "aCategory",b. category as "bCategory",a.expenditure_details as "expenditureDetails" from  inv_account_expenses a
+                select a.category as "aCategory",b. category as "bCategory",a.expenditure_details as "expenditureDetails" ,
+                a.expenses_id as "expensesId",a.category as "category",a.parent_id  as "parentId"
+                from  inv_account_expenses a
                 left  join  inv_account_expenses  b  on a.parent_id =b.expenses_id
                 left  join  inv_account_expenses  b  on a.parent_id =b.expenses_id
                 where   b.category  is  not  null
                 where   b.category  is  not  null
             )  b on a.fund_use  = b.bCategory  and  a.fund_fen  = b.aCategory
             )  b on a.fund_use  = b.bCategory  and  a.fund_fen  = b.aCategory
@@ -3145,6 +3151,7 @@
                             GROUP BY DATE_FORMAT(a.signdate, '%Y-%m')) c on c.signingTime = a.signingTime
                             GROUP BY DATE_FORMAT(a.signdate, '%Y-%m')) c on c.signingTime = a.signingTime
                             ORDER BY IFNULL( a.signingTime, 0 )
                             ORDER BY IFNULL( a.signingTime, 0 )
     </select>
     </select>
+
     <select id="getPatherId" resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
     <select id="getPatherId" resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
         SELECT
         SELECT
         sa.area_cname as "areaName",
         sa.area_cname as "areaName",
@@ -3174,6 +3181,7 @@
         eic.namesimple,
         eic.namesimple,
         sa.area_cname
         sa.area_cname
     </select>
     </select>
+
     <select id="totalBxAmountNew" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
     <select id="totalBxAmountNew" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
         select
         select
         a.companyId as "companyId",
         a.companyId as "companyId",