瀏覽代碼

1.平台添加批量修改比例功能

wuhp 2 年之前
父節點
當前提交
a81fc41c33

+ 12 - 1
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -30,8 +30,10 @@ import javax.validation.Valid;
 import java.io.IOException;
 import java.io.InputStream;
 import java.time.Period;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -245,6 +247,15 @@ public class InsPlyIncomeController extends BaseController {
         HashMap<String, Object> result = insPlyIncomeService.bxImportOther(multipartFile, isNotCar);
         return HttpResult.ok(result);
     }
+    @PostMapping("/ptImportOther")
+    @ApiOperation(value = "平台批量修改比例(excel)")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
+    })
+    public HttpResult<HashMap<String, Object>> ptImportOther(@RequestParam MultipartFile multipartFile) {
+        HashMap<String, Object> result = insPlyIncomeService.ptImportOther(multipartFile);
+        return HttpResult.ok(result);
+    }
 
     @PostMapping("/noBxImportOther")
     @ApiOperation(value = "非车批量修改比例(excel)")
@@ -462,7 +473,7 @@ public class InsPlyIncomeController extends BaseController {
      */
     @PostMapping("/totalReceivables")
     @ApiModelProperty(value = "平台 私有 应收未收 金额")
-    public HttpResult<HashMap<String,Object>> totalReceivables(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+    public HttpResult<ArrayList<Map<String,Object>>> totalReceivables(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
         return insPlyIncomeService.totalReceivables(insPlyIncomeVo);
     }
 

+ 10 - 1
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -14,8 +14,10 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -161,7 +163,14 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
      * @param insPlyIncomeVo
      * @return  返回私有 平台  应收 已收  未收
      */
-    HttpResult<HashMap<String, Object>> totalReceivables(InsPlyIncomeVo insPlyIncomeVo);
+    HttpResult<ArrayList<Map<String,Object>>> totalReceivables(InsPlyIncomeVo insPlyIncomeVo);
 
     HttpResult<List<HashMap<String,Object>>> monthTotalReceivables(InsPlyIncomeVo insPlyIncomeVo);
+
+    /**
+     *      平台批量修改比例
+     * @param multipartFile  文件
+     * @return
+     */
+    HashMap<String, Object> ptImportOther(MultipartFile multipartFile);
 }

+ 155 - 11
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -2700,6 +2700,137 @@ handlingProportion,
         return resultMap;
     }
 
+    @Override
+    public HashMap<String, Object> ptImportOther(MultipartFile multipartFile) {
+        HashMap<String, Object> resultMap = new HashMap<>();
+        List<HashMap<String, Object>> resultList = new ArrayList<>();
+        HashMap<String, Object> params = new HashMap<>();
+        BigDecimal allAmount = BigDecimal.ZERO;
+        try {
+            List<InsPtHandExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsPtHandExcelDto.class, 0, 1, 1);
+            for (InsPtHandExcelDto 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());
+                }
+                if (StringUtils.isNotEmpty(item.getNoPolicyno())) {
+                    params.put("noPolicyno", item.getNoPolicyno());
+                }
+                params.put("handlingFeesStatus", "0");
+//                isOther
+                params.put("isOther", "0");
+                params.put("isNotCar", "0");
+                InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                if (item.getNoOtherCostsProportion() == null) {
+                    item.setNoOtherCostsProportion(BigDecimal.ZERO);
+                }
+                if (item.getJqOtherCostsProportion() == null) {
+                    item.setJqOtherCostsProportion(BigDecimal.ZERO);
+                }
+                if (item.getSyOtherCostsProportion() == null) {
+                    item.setSyOtherCostsProportion(BigDecimal.ZERO);
+                }
+                if (item.getJqSuperviseCostsProportion() == null) {
+                    item.setJqSuperviseCostsProportion(BigDecimal.ZERO);
+                }
+                if (item.getSySuperviseCostsProportion() == null) {
+                    item.setSySuperviseCostsProportion(BigDecimal.ZERO);
+                }
+                if (item.getNoSuperviseCostsProportion() == null) {
+                    item.setNoSuperviseCostsProportion(BigDecimal.ZERO);
+                }
+
+                if (ObjectUtils.isNotEmpty(byBxLicenseno) && (byBxLicenseno.getJqOtherCostsProportion().compareTo(item.getJqOtherCostsProportion()) != 0 || byBxLicenseno.getSyOtherCostsProportion().compareTo(item.getSyOtherCostsProportion()) != 0)) {
+                    InsPlyIncomeLog insPlyIncomeLog = new InsPlyIncomeLog();
+                    BeanUtils.copyProperties(byBxLicenseno,insPlyIncomeLog);
+                    insPlyIncomeLog.setOperationStatus("2");
+                    insPlyIncomeLog.setId(null);
+                    insPlyIncomeLog.setIncomeId(byBxLicenseno.getId());
+                    insPlyIncomeLogService.saveLog(insPlyIncomeLog);  //添加日志
+                    // 如果比例不相等
+                    BigDecimal jqOtherCostsProportion = item.getJqOtherCostsProportion();
+                    BigDecimal syOtherCostsProportion = item.getSyOtherCostsProportion();
+                    BigDecimal noOtherCostsProportion = item.getNoOtherCostsProportion();
+
+                    BigDecimal jqSuperviseCostsProportion = item.getJqSuperviseCostsProportion();
+                    BigDecimal sySuperviseCostsProportion = item.getSySuperviseCostsProportion();
+                    BigDecimal noSuperviseCostsProportion = item.getNoSuperviseCostsProportion();
+
+                    BigDecimal jqOtherAmount  =  algorithmAmount( byBxLicenseno.getJqPremium(),jqOtherCostsProportion);
+                    BigDecimal syOtherAmount =  algorithmAmount( byBxLicenseno.getSyPremium(),syOtherCostsProportion);
+                    BigDecimal noOtherAmount =  algorithmAmount( byBxLicenseno.getNoPremium(),noOtherCostsProportion);
+
+                    BigDecimal jqSuperviseCostsAmount =  algorithmAmount( byBxLicenseno.getJqPremium(),jqSuperviseCostsProportion);
+                    BigDecimal sySuperviseCostsAmount =  algorithmAmount( byBxLicenseno.getSyPremium(),sySuperviseCostsProportion);
+                    BigDecimal noSuperviseCostsAmount =  algorithmAmount( byBxLicenseno.getNoPremium(),noSuperviseCostsProportion);
+
+                    byBxLicenseno.setJqOtherCostsPremium(jqOtherAmount);
+                    byBxLicenseno.setSyOtherCostsPremium(syOtherAmount);
+                    byBxLicenseno.setNoOtherCostsPremium(noOtherAmount);
+
+                    byBxLicenseno.setJqSuperviseCostsPremiums(jqSuperviseCostsAmount);
+                    byBxLicenseno.setSySuperviseCostsPremiums(sySuperviseCostsAmount);
+                    byBxLicenseno.setNoSuperviseCostsPremiums(noSuperviseCostsAmount);
+
+                    byBxLicenseno.setJqOtherCostsProportion(jqOtherCostsProportion);
+                    byBxLicenseno.setSyOtherCostsProportion(syOtherCostsProportion);
+                    byBxLicenseno.setNoOtherCostsProportion(noOtherCostsProportion);
+
+                    byBxLicenseno.setJqSuperviseCostsProportion(jqSuperviseCostsProportion);
+                    byBxLicenseno.setSySuperviseCostsProportion(sySuperviseCostsProportion);
+                    byBxLicenseno.setNoSuperviseCostsProportion(noSuperviseCostsProportion);
+
+                    byBxLicenseno.setOtherFeevalue(this.calculateTotal(jqOtherAmount, syOtherAmount, noOtherAmount));
+                    byBxLicenseno.setOtherFeerate(this.calculateTotal(jqOtherCostsProportion, syOtherCostsProportion, noOtherCostsProportion));
+
+                    byBxLicenseno.setCommissionFeevalue(this.calculateTotal(jqSuperviseCostsAmount, sySuperviseCostsAmount, noSuperviseCostsAmount));
+                    byBxLicenseno.setCommissionFeerate(this.calculateTotal(jqSuperviseCostsProportion,sySuperviseCostsProportion,noSuperviseCostsProportion));
+
+                    byBxLicenseno.setAllFeeValue(this.calculateTotal(byBxLicenseno.getOtherFeevalue(),byBxLicenseno.getCommissionFeevalue(),null));
+
+                    byBxLicenseno.setJqReceivableProportion(this.calculateTotal(jqSuperviseCostsProportion,jqOtherCostsProportion,null));
+                    byBxLicenseno.setSyReceivableProportion(this.calculateTotal(sySuperviseCostsProportion,syOtherCostsProportion,null));
+                    byBxLicenseno.setNoReceivableProportion(this.calculateTotal(noSuperviseCostsProportion,noOtherCostsProportion,null));
+                    byBxLicenseno.setUpdateUserId(BaseController.getUser().getId());
+                    byBxLicenseno.setUpdateUserName(BaseController.getUser().getName());
+                    baseMapper.updateById(byBxLicenseno);
+                    HashMap<String, Object> map = new HashMap<>();
+                    map.put("licenseno", item.getLicenseno());
+                    map.put("policyno", item.getPolicyno());
+                    map.put("syPolicyno", item.getSyPolicyno());
+                    map.put("noPolicyno", item.getNoPolicyno());
+                    map.put("jqOtherCostsPremium", jqOtherAmount);
+                    map.put("syOtherCostsPremium", syOtherAmount);
+                    map.put("noOtherCostsPremium", noOtherAmount);
+                    map.put("jqSuperviseCostsPremiums", jqSuperviseCostsAmount);
+                    map.put("sySuperviseCostsPremiums", sySuperviseCostsAmount);
+                    map.put("noSuperviseCostsPremiums", noSuperviseCostsAmount);
+                    map.put("jqOtherCostsProportion", jqOtherCostsProportion);
+                    map.put("syOtherCostsProportion", syOtherCostsProportion);
+                    map.put("noOtherCostsProportion", noOtherCostsProportion);
+                    map.put("jqSuperviseCostsProportion", jqSuperviseCostsProportion);
+                    map.put("sySuperviseCostsProportion", sySuperviseCostsProportion);
+                    map.put("noSuperviseCostsProportion", noSuperviseCostsProportion);
+                    map.put("otherFeevalue", byBxLicenseno.getOtherFeevalue());
+                    map.put("otherFeerate", byBxLicenseno.getOtherFeerate());
+                    resultList.add(map);
+                    allAmount = allAmount.add(jqOtherAmount).add(syOtherAmount).add(noOtherAmount);
+                }
+            }
+            resultMap.put("allAmount", allAmount);
+            resultMap.put("resultList", resultList);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return resultMap;
+    }
+
+
     @Override
     @Transactional
     public HashMap<String, Object> noBxImportOther(MultipartFile multipartFile, String isNotCar) {
@@ -2921,7 +3052,7 @@ handlingProportion,
      * @return  返回私有 平台  应收 已收  未收
      */
     @Override
-    public HttpResult<HashMap<String, Object>> totalReceivables(InsPlyIncomeVo insPlyIncomeVo) {
+    public HttpResult<ArrayList<Map<String,Object>>> totalReceivables(InsPlyIncomeVo insPlyIncomeVo) {
         ArrayList<Map<String,Object>> resultList = new ArrayList<>();
         BigDecimal bxhandAmount = BigDecimal.ZERO;   //保险手续费应收
         BigDecimal receivedAmount = BigDecimal.ZERO;   //保险手续费应收
@@ -2947,13 +3078,16 @@ handlingProportion,
         for (SettlementDocumentaryFeesEntity invoicInsPlyIncome : invoicInsPlyIncomes) {
             receivedAmount =receivedAmount.add(invoicInsPlyIncome.getSettlementAmount());
         }
+        if(receivedAmount.compareTo(BigDecimal.ZERO)== 0){
+            receivedAmount=bxhandAmount;
+        }
         BigDecimal subtract = bxhandAmount.subtract(receivedAmount);
         privateParams.clear();
         privateParams.put("commissionFeevalue",bxhandAmount);
         privateParams.put("noInvoicCommissionFeevalue",receivedAmount);
         privateParams.put("readyCommissionFeevalue",subtract);
         resultList.add(privateParams);
-        return HttpResult.ok();
+        return HttpResult.ok(resultList);
     }
 
     /**
@@ -2986,11 +3120,15 @@ handlingProportion,
                 ptMap.put(month, commissionFeevalue);
             }
             for (HashMap<String, Object> ptResultListItem : ptResultList) {
-                BigDecimal bigDecimal1 = ptMap.get(ptResultListItem.get("year"));
+                BigDecimal bigDecimal1 = ptMap.get(ptResultListItem.get("month"));
                 ptResultListItem.put("readyCommissionFeevalue", bigDecimal1);
-                BigDecimal commissionFeevalue = BigDecimal.valueOf(Long.valueOf(ptResultListItem.get("commissionFeevalue").toString()));
-                BigDecimal subtract = commissionFeevalue.subtract(bigDecimal1);
-                ptResultListItem.put("noInvoicCommissionFeevalue", subtract);
+                BigDecimal commissionFeevalue = new BigDecimal(ptResultListItem.get("commissionFeevalue").toString());
+                if (bigDecimal1  !=null && bigDecimal1.compareTo(BigDecimal.ZERO) > 0) {
+                    BigDecimal subtract = commissionFeevalue.subtract(bigDecimal1);
+                    ptResultListItem.put("noInvoicCommissionFeevalue", subtract);
+                } else {
+                    ptResultListItem.put("noInvoicCommissionFeevalue", ptResultListItem.get("commissionFeevalue"));
+                }
             }
             return HttpResult.ok(ptResultList);
         } else if ("2".equals(insPlyIncomeVo.getAgreementType())) {
@@ -3014,14 +3152,20 @@ handlingProportion,
                 bxMap.put(month, commissionFeevalue);
             }
             for (HashMap<String, Object> bxResultListItem : bxResultList) {
-                BigDecimal bigDecimal1 = bxMap.get(bxResultListItem.get("year"));
+                BigDecimal bigDecimal1 = bxMap.get(bxResultListItem.get("month"));
                 bxResultListItem.put("readyCommissionFeevalue", bigDecimal1);
-                BigDecimal commissionFeevalue = BigDecimal.valueOf(Long.valueOf(bxResultListItem.get("commissionFeevalue").toString()));
-                BigDecimal subtract = commissionFeevalue.subtract(bigDecimal1);
-                bxResultListItem.put("noInvoicCommissionFeevalue", subtract);
+                BigDecimal commissionFeevalue = new BigDecimal(bxResultListItem.get("commissionFeevalue").toString());
+                if (bigDecimal1  !=null && bigDecimal1.compareTo(BigDecimal.ZERO) > 0) {
+                    BigDecimal subtract = commissionFeevalue.subtract(bigDecimal1);
+                    bxResultListItem.put("noInvoicCommissionFeevalue", subtract);
+                } else {
+                    bxResultListItem.put("noInvoicCommissionFeevalue", bxResultListItem.get("commissionFeevalue"));
+                }
             }
-            return HttpResult.ok(bxReadyCommissionFeevalue);
+            return HttpResult.ok(bxResultList);
         }
         return HttpResult.ok();
     }
+
+
 }

+ 73 - 0
src/main/java/com/ydtech/modules/inv/model/dto/InsPtHandExcelDto.java

@@ -0,0 +1,73 @@
+package com.ydtech.modules.inv.model.dto;
+
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class InsPtHandExcelDto {
+    /**
+     * 车牌号
+     */
+    @Excel(name = "车牌号" , isImportField = "true")
+    private String licenseno;
+
+    /**
+     * 交强保单号
+     */
+    @Excel(name = "交强保单号" , isImportField = "true")
+    private String policyno;
+
+    /**
+     * 商业保单号
+     */
+    @Excel(name =  "商业保单号", isImportField = "true")
+    private String syPolicyno;
+    /**
+     * 非车保单号
+     */
+    @Excel(name =  "非车保单号", isImportField = "true")
+    private String noPolicyno;
+
+    /**
+     * 交强手续费比例
+     */
+    @Excel(name =  "交强手续费比例", isImportField = "true")
+    private BigDecimal jqSuperviseCostsProportion;
+
+
+    /**
+     * 交强跟单比例
+     */
+    @Excel(name =  "交强跟单比例", isImportField = "true")
+    private BigDecimal jqOtherCostsProportion;
+
+    /**
+     * 商业手续费比例
+     */
+    @Excel(name = "商业手续费比例" , isImportField = "true")
+    private BigDecimal sySuperviseCostsProportion;
+
+
+    /**
+     * 商业保单号
+     */
+    @Excel(name = "商业跟单比例" , isImportField = "true")
+    private BigDecimal syOtherCostsProportion;
+
+    /**
+     * 非车手续费比例
+     */
+    @Excel(name = "非车手续费比例" , isImportField = "true")
+    private BigDecimal noSuperviseCostsProportion;
+
+    /**
+     * 非车跟单比例
+     */
+    @Excel(name = "非车跟单比例" , isImportField = "true")
+    private BigDecimal noOtherCostsProportion;
+
+
+}