Ver código fonte

1.结算逻辑调整2.0

wuhp 2 anos atrás
pai
commit
88dd01672e

+ 9 - 5
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -158,8 +158,8 @@ public class InsPlyIncomeController extends BaseController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
     })
-    public HttpResult bxImportData(@RequestParam MultipartFile multipartFile) {
-        HashMap<String, Object> result= insPlyIncomeService.bxImportData(multipartFile);
+    public HttpResult<HashMap<String, Object>> bxImportData(@RequestParam MultipartFile multipartFile,@RequestParam("isNotCar")  String isNotCar) {
+        HashMap<String, Object> result= insPlyIncomeService.bxImportData(multipartFile,isNotCar);
         return HttpResult.ok(result);
     }
     @PostMapping("/bxImportNoData")
@@ -167,8 +167,8 @@ public class InsPlyIncomeController extends BaseController {
     @ApiImplicitParams({
     @ApiImplicitParam(name = "file", value = "excel文件", required = true, dataType = "__file")
     })
-    public HttpResult bxImportNoData(@RequestParam MultipartFile multipartFile) {
-        HashMap<String, Object> result= insPlyIncomeService.bxImportNoData(multipartFile);
+    public HttpResult<HashMap<String, Object>> bxImportNoData(@RequestParam MultipartFile multipartFile,@RequestParam("isNotCar")  String isNotCar) {
+        HashMap<String, Object> result= insPlyIncomeService.bxImportNoData(multipartFile,isNotCar);
         return HttpResult.ok(result);
     }
 
@@ -272,7 +272,11 @@ public class InsPlyIncomeController extends BaseController {
         return insPlyIncomeService.bxNoOtherDetailsExcel(insPlyIncomeVo, request, response);
     }
 
-
+    @PostMapping("/otherSettldetail")
+    @ApiOperation(value = "非跟单明细查询")
+    public HttpResult<List<HashMap<String,Object>>>   otherSettldetail (@RequestBody  InsPlyIncomeVo insPlyIncomeVo){
+        return  insPlyIncomeService.otherSettldetail(insPlyIncomeVo);
+    }
 
 }
 

+ 7 - 1
src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryFeesMapper.java

@@ -6,6 +6,7 @@ import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
 import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
 import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.HashMap;
 import java.util.List;
@@ -15,6 +16,11 @@ public interface SettlementDocumentaryFeesMapper  extends BaseMapper<SettlementD
 
     List<SettlementDocumentaryFeesEntity> querySettle(HashMap<String, Object> params);
 
-
+    /**
+     *
+     * @param invoiceIds   开票id
+     * @return   总金额  开票号  开票时间
+     */
+    List<HashMap<String, Object>> getOtherSettldetail(@Param("invoiceIds") String[] invoiceIds);
 
 }

+ 8 - 0
src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java

@@ -85,6 +85,14 @@ public class SettlementDocumentaryFeesEntity implements Serializable {
     @TableField("settlement_status")
     private String settlementStatus;
 
+    @ApiModelProperty("开票号")
+    @TableField("invoice_id")
+    private String invoiceId;
+
+    @ApiModelProperty("是否是非车")
+    @TableField("is_not_car")
+    private String isNotCar;
+
 
 
 

+ 15 - 2
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -83,9 +83,15 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
 
     InsPlyIncome bxTotalAmount(InsPlyIncomeVo insPlyIncomeVo);
 
-    HashMap<String, Object> bxImportData(MultipartFile multipartFile);
+    /**
+     *
+     * @param multipartFile
+     * @param isNotCar    是否是非车
+     * @return  返回总金额 以及未匹配的数据
+     */
+    HashMap<String, Object> bxImportData(MultipartFile multipartFile ,String isNotCar);
 
-    HashMap<String, Object> bxImportNoData(MultipartFile multipartFile);
+    HashMap<String, Object> bxImportNoData(MultipartFile multipartFile,String isNotCar);
 
     /**
      *
@@ -104,4 +110,11 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
     HttpResult<List<HashMap<String,Object>>> invicdetail(InsPlyIncomeVo insPlyIncomeVo);
 
     HttpResult bxNoOtherDetailsExcel(InsPlyIncomeVo insPlyIncomeVo, HttpServletRequest request, HttpServletResponse response);
+
+    /**
+     *
+     * @param incomeIds  开票ids
+     * @return  通过开票id分组查出的金额总和
+     */
+    HttpResult<List<HashMap<String,Object>>> otherSettldetail(InsPlyIncomeVo insPlyIncomeVo);
 }

+ 3 - 0
src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java

@@ -6,8 +6,10 @@ import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
 import com.ydtech.modules.order.entity.BasePageResult;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.HashMap;
+import java.util.List;
 
 public interface SettlementDocumentaryFeesService extends IService<SettlementDocumentaryFeesEntity> {
     HttpResult<BasePageResult<SettlementDocumentaryFeesEntity>>  querySettle(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo);
@@ -17,4 +19,5 @@ public interface SettlementDocumentaryFeesService extends IService<SettlementDoc
 
     HttpResult documentarySettle(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo);
 
+    List<HashMap<String, Object>> getOtherSettldetail(@Param("incomeIds") String incomeIds);
 }

+ 187 - 42
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -629,38 +629,60 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         }
     }
 
+    /**
+     *
+     * @param multipartFile
+     * @return  resultList   包含总金额  还有 未匹配表中的数据
+     */
 
     @Override
-    public HashMap<String, Object> bxImportData(MultipartFile multipartFile) {
+    public HashMap<String, Object> bxImportData(MultipartFile multipartFile,String isNotCar) {
         BigDecimal totalAmount=BigDecimal.ZERO;
         HashMap<String, Object> params = new HashMap<>();
+        ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
         HashMap<String, Object> resultMap = new HashMap<>();
         StringBuffer strBuilder = new StringBuffer();
         String ids="";
         try {
             List<InsBxPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxPlyIncomeExcelDto.class, 0, 1, 1);
-            for (InsBxPlyIncomeExcelDto excelItem : dtoList) {
-                params.clear();
-                if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
-                    String licenseno = excelItem.getLicenseno();//车牌号
-                    params.put("licenseno",licenseno);
-                }
-                if(StringUtils.isNotEmpty(excelItem.getPolicyno())){
-                    String policyno = excelItem.getPolicyno(); //交强保单号
-                    params.put("policyno",policyno);
-                }
+            if(!CollectionUtils.isEmpty(dtoList)){
+                for (InsBxPlyIncomeExcelDto excelItem : dtoList) {
+                    params.clear();
+                    if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
+                        String licenseno = excelItem.getLicenseno();//车牌号
+                        params.put("licenseno",licenseno);
+                    }
+                    if(StringUtils.isNotEmpty(excelItem.getPolicyno())){
+                        String policyno = excelItem.getPolicyno(); //交强保单号
+                        params.put("policyno",policyno);
+                    }
 
-                if(StringUtils.isNotEmpty(excelItem.getSyPolicyno())){
-                    String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
-                    params.put("syPolicyno",syPolicyno);
-                }
-//                只查手续费
-                params.put("isOther","0");
-                params.put("isNotCar","0");
-                InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
-                strBuilder.append(insPlyIncome.getId()).append(",");
-                if(  insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
-                    totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
+                    if(StringUtils.isNotEmpty(excelItem.getSyPolicyno())){
+                        String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
+                        params.put("syPolicyno",syPolicyno);
+                    }
+//                  只查手续费
+                    params.put("isOther","0");
+                    params.put("isNotCar",isNotCar);
+                    InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
+                    if(ObjectUtils.isNotEmpty(insPlyIncome)){  // 比配上汇总金额 未匹配则返回到数据当中
+                        strBuilder.append(insPlyIncome.getId()).append(",");
+                        if(  insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
+                            totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
+                        }
+                    }else {
+                        HashMap<String, Object> noMatching = new HashMap<>();
+                        if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
+                            noMatching.put("licenseno",excelItem.getLicenseno());
+                        }
+                        if(StringUtils.isNotEmpty(excelItem.getPolicyno())){
+                            noMatching.put("policyno",excelItem.getPolicyno());
+                        }
+                        if(StringUtils.isNotEmpty(excelItem.getSyPolicyno())){
+                            noMatching.put("syPolicyno",excelItem.getSyPolicyno());
+                        }
+                        resultList.add(noMatching);
+                    }
                 }
             }
             if(strBuilder.length() >0){
@@ -668,6 +690,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             }
             resultMap.put("ids",ids);
             resultMap.put("totalAmount",totalAmount);
+            resultMap.put("resultList",resultList);
             return resultMap;
         } catch (IOException e) {
             throw new SystemException("导入失败!");
@@ -676,35 +699,53 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     }
 
     @Override
-    public HashMap<String, Object> bxImportNoData(MultipartFile multipartFile) {
+    public HashMap<String, Object> bxImportNoData(MultipartFile multipartFile,String isNotCar) {
         BigDecimal totalAmount=BigDecimal.ZERO;
         HashMap<String, Object> params = new HashMap<>();
         HashMap<String, Object> resultMap = new HashMap<>();
+        ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
         StringBuffer strBuilder = new StringBuffer();
         String ids="";
         try {
             List<InsBxNoPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxNoPlyIncomeExcelDto.class, 0, 1, 1);
-            for (InsBxNoPlyIncomeExcelDto excelItem : dtoList) {
-                params.clear();
-                if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
-                    String licenseno = excelItem.getLicenseno();//车牌号
-                    params.put("licenseno",licenseno);
+            if(!CollectionUtils.isEmpty(dtoList)){
+                for (InsBxNoPlyIncomeExcelDto excelItem : dtoList) {
+                    params.clear();
+                    if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
+                        String licenseno = excelItem.getLicenseno();//车牌号
+                        params.put("licenseno",licenseno);
+                    }
+                    if(StringUtils.isNotEmpty(excelItem.getNoPolicyno())){
+                        String policyno = excelItem.getNoPolicyno(); //非车保单号
+                        params.put("NoPolicyno",policyno);
+                    }
+//                只查手续费
+                    params.put("isOther","0");
+                    params.put("isNotCar",isNotCar);
+                    InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
+                    if(ObjectUtils.isNotEmpty(insPlyIncome)){  // 比配上汇总金额 未匹配则返回到数据当中
+                        strBuilder.append(insPlyIncome.getId()).append(",");
+                        if(  insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
+                            totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
+                        }
+                    }else {
+                        HashMap<String, Object> noMatching = new HashMap<>();
+                        if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
+                            noMatching.put("licenseno",excelItem.getLicenseno());
+                        }
+                        if(StringUtils.isNotEmpty(excelItem.getNoPolicyno())){
+                            noMatching.put("NoPolicyno",excelItem.getNoPolicyno());
+                        }
+                        resultList.add(noMatching);
+                    }
                 }
-                if(StringUtils.isNotEmpty(excelItem.getNoPolicyno())){
-                    String policyno = excelItem.getNoPolicyno(); //非车保单号
-                    params.put("policyno",policyno);
+                if(strBuilder.length() >0){
+                    ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
                 }
-//                只查手续费
-                params.put("isOther","1");
-                InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
-                strBuilder.append(insPlyIncome.getId()).append(",");
-                totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
+                resultMap.put("ids",ids);
+                resultMap.put("totalAmount",totalAmount);
+                resultMap.put("resultList",resultList);
             }
-            if(strBuilder.length() >0){
-                ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
-            }
-            resultMap.put("ids",ids);
-            resultMap.put("totalAmount",totalAmount);
             return resultMap;
         } catch (IOException e) {
             throw new SystemException("导入失败!");
@@ -790,12 +831,30 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         return HttpResult.ok("",uploadUrl + "excel/" + fileName);
     }
 
+    /**
+     *
+     * @param insPlyIncomeVo  开票ids
+     * @return   返回开票号   开票金额  开票时间
+     */
+    @Override
+    public HttpResult<List<HashMap<String, Object>>> otherSettldetail(InsPlyIncomeVo insPlyIncomeVo) {
+        if (StringUtils.isNotEmpty(insPlyIncomeVo.getIncomeIds())) {
+            String incomeIds = insPlyIncomeVo.getIncomeIds();
+            List<HashMap<String, Object>> resultList = settlementDocumentaryFeesService.getOtherSettldetail(incomeIds);
+            if (resultList.size() > 0) {
+                return HttpResult.ok(resultList);
+            }
+        }
+        return HttpResult.ok();
+    }
+
     @Override
     @Transactional
     public void updateByEntity(InsPlyIncomeVo insPlyIncomeVo) {
 //        根据协议   如果是含增值税结算   用保费 *   如果是  不含税保费
         InsPlyIncome insPlyIncome = new InsPlyIncome();
         BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
+        this.amountCalculate(insPlyIncomeVo,insPlyIncome);
         baseMapper.updateById(insPlyIncome);
 
         insPlyIncomeVo.setCrudStatus("2");
@@ -803,6 +862,88 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
     }
 
+    /**
+     *
+     * @param insPlyIncomeVo
+     * @param insPlyIncome
+     *
+     * 重新计算金额  通过比例
+     * 计算逻辑 交强不含税保费* 交强跟单比例 = 交强跟单金额
+     */
+    private void amountCalculate(InsPlyIncomeVo insPlyIncomeVo,InsPlyIncome insPlyIncome) {
+        BigDecimal jqNoTaxPremium = insPlyIncomeVo.getJqNoTaxPremium();// 交强手续费  按照思路  交强不含税保费* 交强手续费比例  =交强手续费
+        BigDecimal syNoTaxPremium = insPlyIncomeVo.getSyNoTaxPremium();// 商业手续费  按照思路  商业不含税保费* 商业手续费比例  =商业手续费
+        BigDecimal noNoTaxPremium = insPlyIncomeVo.getNoNoTaxPremium();// 非车手续费  按照思路  非车不含税保费* 非车手续费比例  =非车手续费
+        if(insPlyIncomeVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
+            BigDecimal  jqhandingFee = jqNoTaxPremium.multiply(insPlyIncomeVo.getJqSuperviseCostsProportion().divide(new BigDecimal(100)));
+            insPlyIncome.setJqSuperviseCostsPremiums(jqhandingFee);
+        }
+
+        if(insPlyIncomeVo.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
+            BigDecimal  syhandingFee = syNoTaxPremium.multiply(insPlyIncomeVo.getSySuperviseCostsProportion().divide(new BigDecimal(100)));
+            insPlyIncome.setSySuperviseCostsPremiums(syhandingFee);
+        }
+
+        if(insPlyIncomeVo.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
+            BigDecimal  nohandingFee = noNoTaxPremium.multiply(insPlyIncomeVo.getSySuperviseCostsProportion().divide(new BigDecimal(100)));
+            insPlyIncome.setNoSuperviseCostsPremiums(nohandingFee);
+        }
+
+        if(insPlyIncomeVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
+            BigDecimal jqother = jqNoTaxPremium.multiply(insPlyIncomeVo.getJqOtherCostsProportion().divide(new BigDecimal(100)));//交强跟单费  按照思路  交强不含税保费* 交强跟单比例 = 交强跟单金额
+            insPlyIncome.setJqOtherCostsPremium(jqother);
+        }
+
+        if(insPlyIncomeVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
+            BigDecimal syother = syNoTaxPremium.multiply(insPlyIncomeVo.getSyOtherCostsProportion().divide(new BigDecimal(100)));//交强跟单费  按照思路  交强不含税保费* 交强跟单比例 = 交强跟单金额
+            insPlyIncome.setJqOtherCostsPremium(syother);
+        }
+
+        if(insPlyIncomeVo.getNoOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
+            BigDecimal syother = syNoTaxPremium.multiply(insPlyIncomeVo.getNoOtherCostsProportion().divide(new BigDecimal(100)));//非车跟单费  按照思路  非车不含税保费* 非车跟单比例 = 非车跟单金额
+            insPlyIncome.setNoOtherCostsPremium(syother);
+        }
+        /**
+             判断是否是平台  如果是平台则 手续费= 交强手续费+ 商业手续费+非车手续费  费单非= 交强跟单费+ 商业跟单费 +非车跟单费费
+         *                如果是保险   保险手续费=  交强手续费+商业跟单费   跟单费为null
+         *                           保险跟单    手续费为null  跟单费=   交强跟单费+商业跟单费
+         *                          非车手续费   =非车手续费
+         *                          非车跟单  =  非车跟单费
+         */
+        if("1".equals(insPlyIncomeVo.getAgreementType())){//保险手续费
+            insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getJqSuperviseCostsProportion(),insPlyIncome.getSySuperviseCostsProportion(),insPlyIncome.getNoSuperviseCostsProportion()));  //手续费比例
+            insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(),insPlyIncome.getSySuperviseCostsPremiums(),insPlyIncome.getNoSuperviseCostsPremiums()));  //手续费金额
+            insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getJqOtherCostsProportion(),insPlyIncome.getSyOtherCostsProportion(),insPlyIncome.getNoOtherCostsProportion()));  //跟单比例
+            insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(),insPlyIncome.getSyOtherCostsPremium(),insPlyIncome.getNoOtherCostsPremium()));//跟单费金额
+            insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),insPlyIncome.getOtherFeevalue(),null)); // 总费用 =  手续费+跟单费
+        }else {
+            if("0".equals(insPlyIncomeVo.getIsNotDocumentary()) && "0".equals(insPlyIncomeVo.getIsNotCar())){  //保险手续费
+                insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getJqSuperviseCostsPremiums(),insPlyIncome.getSySuperviseCostsPremiums(),null)); // 手续费
+                insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getJqSuperviseCostsProportion(),insPlyIncome.getSySuperviseCostsProportion(),null));//手续费比例
+                insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),null,null));//总金额
+            }else { //保险跟单费  交强跟单+商业跟单
+                insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(),insPlyIncome.getSyOtherCostsPremium(),null));
+                insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getJqOtherCostsProportion(),insPlyIncome.getSyOtherCostsProportion(),null));
+                insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getOtherFeevalue(),null,null));//总金额
+
+            }
+            if("0".equals(insPlyIncomeVo.getIsNotDocumentary()) && "1".equals(insPlyIncomeVo.getIsNotCar())){// 非车
+                insPlyIncome.setCommissionFeevalue(this.calculateTotal(insPlyIncome.getNoSuperviseCostsPremiums(),null,null));  // 非车手续费
+                insPlyIncome.setCommissionFeerate(this.calculateTotal(insPlyIncome.getNoSuperviseCostsProportion(),null,null));  //非车比例
+                insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(),null,null));//总金额
+
+
+            }else {   //非车跟单
+                insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getNoOtherCostsPremium(),null,null));  //非车跟单金额
+                insPlyIncome.setOtherFeerate(this.calculateTotal(insPlyIncome.getNoOtherCostsProportion(),null,null)); // 非车跟单比例
+                insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getOtherFeevalue(),null,null));//总金额
+            }
+
+        }
+
+
+    }
+
     private void saveLog(InsPlyIncomeVo insPlyIncomeVo) {
 
         //         添加记录
@@ -971,6 +1112,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getOtherFeevalue().subtract(insPlyIncomeVo.getInvoicCommissionFeevalue())); //未开票金额
         settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());//已开票金额
         settlementDocumentaryFeesVo.setSettlementStatus("2");
+        settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
+        settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
         settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
         return  settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
     }
@@ -1064,7 +1207,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             for (int i =0; i <split.length ; i++) {
                 String id = split[i];
                 InsPlyIncome insPlyIncome = baseMapper.selectById(id);
-                insPlyIncome.setContractId(insPlyIncomeVo.getContractId()); // 合同id
+                insPlyIncome.setInvoicId(insPlyIncomeVo.getContractId()); // 开票号
                 insPlyIncome.setContractFileId(insPlyIncomeVo.getContractFileId());
                 insPlyIncome.setVoucherNumber(insPlyIncomeVo.getVoucherNumber());
                 insPlyIncome.setSettlementTime(LocalDate.now());
@@ -1091,6 +1234,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
         settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
         settlementDocumentaryFeesVo.setSettlementStatus("1");
+        settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
+        settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getContractId());
         return  settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
     }
 

+ 13 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java

@@ -1,9 +1,11 @@
 package com.ydtech.modules.fnc.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.google.gson.Gson;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.fnc.dao.SettlementDocumentaryFeesMapper;
@@ -106,6 +108,17 @@ public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<Settlement
         return null;
     }
 
+    /**
+     *
+     * @param invoiceIds   结算表的id
+     * @return  返回开票号 开票金额  开票时间
+     */
+    @Override
+    public List<HashMap<String, Object>> getOtherSettldetail(String incomeIds) {
+        String[] invoiceIds = incomeIds.split(",");
+        return baseMapper.getOtherSettldetail(invoiceIds);
+    }
+
     private int compareAmount(BigDecimal settlementAmount, BigDecimal settlementAmount1) {
 
         return settlementAmount.compareTo(settlementAmount1);

+ 6 - 0
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -247,4 +247,10 @@ public class InsPlyIncomeVo implements Serializable {
     @ApiModelProperty("保险公司名称")
     private String companyName;
 
+    @ApiModelProperty("非车手续费比例")
+    private BigDecimal noSuperviseCostsProportion;
+
+    @ApiModelProperty("非车跟单比例")
+    private BigDecimal noOtherCostsProportion;
+
 }

+ 6 - 0
src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java

@@ -70,10 +70,16 @@ public class SettlementDocumentaryFeesVo implements Serializable {
     @ApiModelProperty("结算ids")
     private String ids;
 
+    @ApiModelProperty("结算ids")
+    private String invoiceId;
+
     @ApiModelProperty("年")
     private String year;
     @ApiModelProperty("月")
     private String month;
     @ApiModelProperty("日")
     private String day;
+
+    @ApiModelProperty("是否是非车")
+    private String isNotCar;
 }

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

@@ -779,7 +779,7 @@
             MAX( a.company_name ) AS "companyName",
             MAX( a.partner_companies_name) as "partnerCompaniesName",
             IF(MAX( c.unsettledAmount ) IS NULL , sum( a.other_feevalue ),  MAX( c.unsettledAmount ) ) AS "noInvoicCommissionFeevalue",
-            IF(MAX(c.invoicIds) IS NULL ,  GROUP_CONCAT(a.id),MAX(c.invoicIds) ) as  "incomeIds",
+            MAX(c.invoicIds) as  "incomeIds",
             MAX(COALESCE(c.settleMentAmount, 0) - COALESCE(f.settleMentAmount, 0)) AS "invoicCommissionFeevalue",
             MAX(f.settleMentAmount) as "settleMentAmount",
             GROUP_CONCAT(a.id) as "ids",
@@ -787,9 +787,23 @@
             sum( a.other_feevalue ) AS "otherFeevalue"
         FROM
             ins_ply_income a
-                LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
-                LEFT JOIN ( SELECT a.company_id AS "companyId", MIN( a.unsettled_amount ) AS "unsettledAmount" ,sum( settlement_amount ) AS "settleMentAmount", GROUP_CONCAT(a.id) as "invoicIds" FROM settlement_documentary_fees a WHERE a.settlement_status = '1' GROUP BY company_id ) c ON c.companyId = a.company_id
-                LEFT JOIN ( SELECT a.company_id AS "companyId", MIN( a.unsettled_amount ) AS "unSettledAmount",sum( settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a WHERE a.settlement_status = '2' GROUP BY company_id ) f ON f.companyId = a.company_id
+        LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+        LEFT JOIN ( SELECT a.company_id AS "companyId", MIN( a.unsettled_amount ) AS "unsettledAmount" ,sum(
+        settlement_amount ) AS "settleMentAmount", GROUP_CONCAT(a.id) as "invoicIds" FROM settlement_documentary_fees a
+        WHERE a.settlement_status = '1'
+        <if test="isNotCar !=null  and  isNotCar  !=''">
+            and a.is_not_car =#{isNotCar}
+        </if>
+        GROUP BY company_id
+        ) c ON c.companyId = a.company_id
+        LEFT JOIN ( SELECT a.company_id AS "companyId", MIN( a.unsettled_amount ) AS "unSettledAmount",sum(
+        settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
+        WHERE a.settlement_status = '2'
+        <if test="isNotCar !=null  and  isNotCar  !=''">
+            and a.is_not_car =#{isNotCar}
+        </if>
+        GROUP BY company_id
+        ) f ON f.companyId = a.company_id
        <where>
            1=1
            <if test="agreementType !=null  and agreementType!='' ">

+ 25 - 0
src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml

@@ -18,6 +18,8 @@
         <result column="month" property="month"/>
         <result column="day" property="day"/>
         <result column="agree_ment_id" property="agreeMentId"/>
+        <result column="invoice_id" property="invoiceId"/>
+        <result column="is_not_car" property="isNotCar"/>
     </resultMap>
 
 
@@ -37,6 +39,29 @@
             from  settlement_documentary_fees  a
     </select>
 
+    <select id="getOtherSettldetail" resultType="java.util.HashMap">
+        select
+        sum(a.settlement_amount) as "invoicCommissionFeevalue",
+        max(create_time) as "invoicTime",
+        max(invoice_id) as "invoicId",
+        GROUP_CONCAT(a.id) as "ids"
+        from settlement_documentary_fees a
+
+        <where>
+            a.settlement_status = '1'
+            <if test="invoiceIds !=null and  invoiceIds !=''  and invoiceIds.length>0">
+                and a.id IN
+                <foreach item="item" index="index" collection="invoiceIds" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+        </where>
+
+        GROUP BY a.invoice_id
+
+    </select>
+
 
 
 

BIN
src/main/resources/template/handlingFeeTemplate.xlsx


BIN
src/main/resources/template/noHandlingFeeTemplate.xlsx