Forráskód Böngészése

Merge remote-tracking branch 'origin/test' into test

Qchen 2 éve
szülő
commit
352954a95e

+ 2 - 10
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java

@@ -46,22 +46,14 @@ import java.util.stream.Collectors;
 public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
     @Resource
     private PtlAgreementProductCostsService ptlAgreementProductCostsService;
-    @Resource
-    private InsOrdersService insOrdersService;
+
     @Resource
     private InsFeeOrderService insFeeOrderService;
     @Resource
     private InsCopyFeeOrderService insCopyFeeOrderService;
     @Resource
     private SysUserService sysUserService;
-    @Resource
-    private SysDeptService sysDeptService;
-    @Resource
-    private EsmRetailService esmRetailService;
-    @Resource
-    private EsmUserReferrerService esmUserReferrerService;
-    @Resource
-    private InsAreaCompanyService insAreaCompanyService;
+
     @Resource
     private PtlAgreementService ptlAgreementService;
     @Resource

+ 31 - 0
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -340,6 +340,37 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
 
         //endregion
 
+        //region 出口费用
+
+        //交强出口手续费比例
+        FeeOrderNewVo.ExportFee jqExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getJqPremium(), insFeeOrderNew.getJqCostsExportProportion(),
+                insFeeOrderNew.getJqCostsProportion(), jqDeptRadio, retailRadio, taxRadio);
+
+        //商业出口手续费比例
+        FeeOrderNewVo.ExportFee syExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getSyPremium(), insFeeOrderNew.getSyCostsExportProportion(),
+                insFeeOrderNew.getSyCostsProportion(), syDeptRadio, retailRadio, taxRadio);
+
+        //交强出口手续费比例
+        FeeOrderNewVo.ExportFee noExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getNoPremium(), insFeeOrderNew.getNoCostsExportProportion(),
+                insFeeOrderNew.getNoCostsProportion(), noDeptRadio, retailRadio, taxRadio);
+
+        //出口手续费用
+        insFeeOrderNew.setJqExportSuperviseCostsPremiums(jqExportFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setSyExportSuperviseCostsPremiums(syExportFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setNoExportSuperviseCostsPremiums(noExportFee.getSuperviseCostsPremiums());
+
+        //出口其他费用比例
+        insFeeOrderNew.setJqExportOtherCostsProportion(jqExportFee.getOtherCostsProportion());
+        insFeeOrderNew.setSyExportOtherCostsProportion(syExportFee.getOtherCostsProportion());
+        insFeeOrderNew.setNoExportOtherCostsProportion(noExportFee.getOtherCostsProportion());
+
+        //出口其他费用
+        insFeeOrderNew.setJqExportOtherCostsPremiums(jqExportFee.getOtherCostsPremiums());
+        insFeeOrderNew.setSyExportOtherCostsPremiums(syExportFee.getOtherCostsPremiums());
+        insFeeOrderNew.setNoExportOtherCostsPremiums(noExportFee.getOtherCostsPremiums());
+
+        //endregion
+
 
         insFeeOrderNewService.saveOrUpdate(insFeeOrderNew);
     }

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

@@ -109,4 +109,14 @@ public class SettlementDocumentaryFeesEntity implements Serializable {
     @TableField("expend_amount")
     private BigDecimal expendAmount;
 
+    @ApiModelProperty("开票id")
+    @TableField("parent_id")
+    private String parentId;
+
+    @ApiModelProperty("是否是手续费")
+    @TableField("handling_fees_status")
+    private String handlingFeesStatus;
+
+
+
 }

+ 13 - 14
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -13,6 +13,7 @@ import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.service.*;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.service.EsmUserReferrerService;
+import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
 import com.ydtech.modules.fnc.dao.FncInsAreaCompanyMapper;
 import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
 import com.ydtech.modules.fnc.entity.InsFeeAudit;
@@ -32,6 +33,8 @@ import com.ydtech.modules.fnc.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsFeeOrder;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.service.InsFeeOrderService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.utils.DateUtil;
@@ -63,8 +66,6 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     private final InsOrdersMapper insOrdersMapper;
     private final InsPlyIncomeMapper insPlyIncomeMapper;
 
-    private final InsFeeOrderService insFeeOrderService;
-
     private final FncInsAreaCompanyMapper insAreaCompanyMapper;
 
     private final InsDeptFeeService insDeptFeeService;
@@ -90,11 +91,13 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     @Autowired
     private InsPlyIncomeService insPlyIncomeService;
 
+    @Autowired
+    private PtlAgreementService ptlAgreementService;
+
 
-    public InsFeeAuditServiceImpl(FncInsAreaCompanyMapper insAreaCompanyMapper, InsOrdersMapper insOrdersMapper, InsFeeOrderService insFeeOrderService,InsDeptFeeService insDeptFeeService,EsmUserReferrerService esmUserReferrerService,SysUserService sysUserService,InsCommissionService insCommissionService,InsCompanyFeeService insCompanyFeeService,InsPlyIncomeMapper insPlyIncomeMapper) {
+    public InsFeeAuditServiceImpl(FncInsAreaCompanyMapper insAreaCompanyMapper, InsOrdersMapper insOrdersMapper, InsDeptFeeService insDeptFeeService,EsmUserReferrerService esmUserReferrerService,SysUserService sysUserService,InsCommissionService insCommissionService,InsCompanyFeeService insCompanyFeeService,InsPlyIncomeMapper insPlyIncomeMapper) {
         this.insAreaCompanyMapper = insAreaCompanyMapper;
         this.insOrdersMapper = insOrdersMapper;
-        this.insFeeOrderService=insFeeOrderService;
         this.insDeptFeeService=insDeptFeeService;
         this.esmUserReferrerService=esmUserReferrerService;
         this.sysUserService=sysUserService;
@@ -413,17 +416,13 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
             if (ObjectUtils.isNotEmpty(insFeeOrderNew) ) {
 //                手续非佣金  =  交强监管费用 + 商业监管费用 + 非车监管费用
 //                非跟单费用  = 交强非跟单费用 + 商业非跟单费用 + 非车非跟单费用
-                //手续费入口费用
-//                BigDecimal jqPremiumAmount = this.zeroBigdecimal(insFeeOrderNew.getJqSuperviseCostsPremiums());//交强监管费
-//                BigDecimal syPremiumAmount = this.zeroBigdecimal(insFeeOrderNew.getSySuperviseCostsPremiums());//商业监管费
-//                BigDecimal noPremiumAmount = this.zeroBigdecimal(insFeeOrderNew.getNoSuperviseCostsPremiums());//非车监管费用
-//                BigDecimal totalPremiumAmount = jqPremiumAmount.add(syPremiumAmount).add(noPremiumAmount);    // 手续非佣金
-//                //其他费用入口费用
-//                BigDecimal jqOtherCostsPremiums  =this.zeroBigdecimal(insFeeOrderNew.getJqOtherCostsPremiums());//交强其他费用
-//                BigDecimal syOtherCostsPremiums  =this.zeroBigdecimal(insFeeOrderNew.getSyOtherCostsPremiums()); //商业其他费用
-//                BigDecimal noOtherCostsProportion = this.zeroBigdecimal(insFeeOrderNew.getNoOtherCostsPremiums());//非车其他费用
-//                BigDecimal totalOtherPremiumAmount = jqOtherCostsPremiums.add(syOtherCostsPremiums).add(noOtherCostsProportion);  //非跟单费用
+                PtlAgreement ptlAgreement = ptlAgreementService.getById(insAreaCompany.getAgreementId());
+                BigDecimal taxRadio = new BigDecimal("1.00");
+                if (ptlAgreement.getWithTax().equals("否")) {
+                    taxRadio = new BigDecimal("1.06");
+                }
 
+                
                 //总机构 交强管理比例
                 BigDecimal sumJqDeptProportion = insFeeOrderNew.getJqDeptProportionLevel1()
                         .add(insFeeOrderNew.getJqDeptProportionLevel2())

+ 61 - 47
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -555,6 +555,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getPartnerCompaniesName())){
             params.put("partnerCompaniesName",insPlyIncomeVo.getPartnerCompaniesName());
         }
+        if(StringUtils.isNotEmpty(insPlyIncomeVo.getDockingPerson())){
+            params.put("dockingPerson",insPlyIncomeVo.getDockingPerson());
+        }
         return params;
     }
 
@@ -687,12 +690,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         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);
+            Integer i=0;
             if(!CollectionUtils.isEmpty(dtoList)){
                 for (InsBxPlyIncomeExcelDto excelItem : dtoList) {
+                    i=i+1;
                     params.clear();
                     if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
                         String licenseno = excelItem.getLicenseno();//车牌号
@@ -711,8 +714,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     params.put("isOther","0");
                     params.put("isNotCar",isNotCar);
                     InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
+                    if(i==dtoList.size()){
+                        resultMap.put("companyId",insPlyIncome.getCompanyId()); // 保险公司id
+                        resultMap.put("partnerCompaniesId",insPlyIncome.getPartnerCompaniesId()); //合作公司id
+                        resultMap.put("agreementId",insPlyIncome.getAgreementId());  //协议id
+                    }
                     if(ObjectUtils.isNotEmpty(insPlyIncome)){  // 比配上汇总金额 未匹配则返回到数据当中
-                        strBuilder.append(insPlyIncome.getId()).append(",");
                         if(  insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
                             totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
                         }
@@ -731,10 +738,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     }
                 }
             }
-            if(strBuilder.length() >0){
-                 ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
-            }
-            resultMap.put("ids",ids);
             resultMap.put("totalAmount",totalAmount);
             resultMap.put("resultList",resultList);
             return resultMap;
@@ -750,12 +753,13 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         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 {
+            Integer i=0;
             List<InsBxNoPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxNoPlyIncomeExcelDto.class, 0, 1, 1);
             if(!CollectionUtils.isEmpty(dtoList)){
                 for (InsBxNoPlyIncomeExcelDto excelItem : dtoList) {
+                    i=i+1;
                     params.clear();
                     if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
                         String licenseno = excelItem.getLicenseno();//车牌号
@@ -769,8 +773,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     params.put("isOther","0");
                     params.put("isNotCar",isNotCar);
                     InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
+                    if(i==dtoList.size()){
+                        resultMap.put("companyId",insPlyIncome.getCompanyId()); // 保险公司id
+                        resultMap.put("partnerCompaniesId",insPlyIncome.getPartnerCompaniesId()); //合作公司id
+                        resultMap.put("agreementId",insPlyIncome.getAgreementId());  //协议id
+                    }
                     if(ObjectUtils.isNotEmpty(insPlyIncome)){  // 比配上汇总金额 未匹配则返回到数据当中
-                        strBuilder.append(insPlyIncome.getId()).append(",");
                         if(  insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
                             totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
                         }
@@ -785,10 +793,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                         resultList.add(noMatching);
                     }
                 }
-                if(strBuilder.length() >0){
-                    ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
-                }
-                resultMap.put("ids",ids);
+
                 resultMap.put("totalAmount",totalAmount);
                 resultMap.put("resultList",resultList);
             }
@@ -835,9 +840,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Override
     public HttpResult<List<HashMap<String,Object>>> invicdetail(InsPlyIncomeVo insPlyIncomeVo) {
         HashMap<String, Object> params = new HashMap<>();
-        params= this.saveParams(insPlyIncomeVo,params);
-        List<HashMap<String,Object>>  result= this.baseMapper.groupByInvoic(params);
-        return HttpResult.ok(result);
+        params =this.saveParams(insPlyIncomeVo,params);
+        List<HashMap<String, Object>> resultList = settlementDocumentaryFeesService.getOtherSettldetail(params);
+        if (resultList.size() > 0) {
+            return HttpResult.ok(resultList);
+        }
+        return HttpResult.ok();
     }
 
     /***
@@ -887,7 +895,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if (resultList.size() > 0) {
             return HttpResult.ok(resultList);
         }
-
         return HttpResult.ok();
     }
 
@@ -1210,8 +1217,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod());  //开票方式
         settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints());  //税点
         settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getExpendAmount()); //税点支出
+        settlementDocumentaryFeesVo.setHandlingFeesStatus(insPlyIncomeVo.getHandlingFeesStatus());
         settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());
         settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
+        settlementDocumentaryFeesVo.setParentId(insPlyIncomeVo.getId());
         settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
         return HttpResult.ok();
     }
@@ -1257,21 +1266,21 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         }
     }
 
+    /**
+     *
+     * @param insPlyIncomeVo
+     * @return   保险手续费改成多次结算
+     */
     @Override
     @Transactional
     public HttpResult<Object> batchInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
-//      开票时生成  记录 用来合计已经开票数据
-        String ids = insPlyIncomeVo.getIds();
-        if(StringUtils.isNotEmpty(ids)){
-            String[] split = ids.split(",");
-            for (String id :  split){
-                InsPlyIncome insPlyIncome = baseMapper.selectById(id);
-                insPlyIncome.setInvoicTime(LocalDate.now());  //开票时间
-                insPlyIncome.setInvoicId(insPlyIncomeVo.getInvoicId()); //开票号
-                insPlyIncome.setHandlingFeesStatus("2");   //2为开票
-                baseMapper.updateById(insPlyIncome);
-            }
-        }
+        insPlyIncomeVo.setNoInvoicCommissionFeevalue(insPlyIncomeVo.getTotalAmount());
+        insPlyIncomeVo.setOtherFeevalue(insPlyIncomeVo.getTotalAmount());
+        insPlyIncomeVo.setHandlingFeesStatus("0");  // 0手续费 1  跟单费
+        insPlyIncomeVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
+        insPlyIncomeVo.setSettlementAmount(insPlyIncomeVo.getTotalAmount());
+        insPlyIncomeVo.setContractId(insPlyIncomeVo.getInvoicId());
+        this.batchInvoic(insPlyIncomeVo);
         return HttpResult.ok();
     }
 
@@ -1288,25 +1297,29 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
     @Override
     public HttpResult<Object> batchBxBalance(InsPlyIncomeVo insPlyIncomeVo) {
-        InsPlyIncome insPlyIncome = new InsPlyIncome();
-
-        if(StringUtils.isNotEmpty(insPlyIncomeVo.getIds())){
-            String[] split = insPlyIncomeVo.getIds().split(",");
-            for(String  id : split){
-                insPlyIncome.setId(id);
-                insPlyIncome.setHandlingFeesStatus("1");
-                insPlyIncome.setSettlementTime(LocalDate.now());
-                baseMapper.updateById(insPlyIncome);
-            }
+//            分批结算
+        SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo();
 
+        if ("0".equals(insPlyIncomeVo.getInvoicingMethod())) {
+            settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getInvoicCommissionFeevalue().multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100)))));
+            settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());   //进账金额
+        } else {
+            settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());   //进账金额
         }
-        SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
-
-        settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getReadyCommissionFeevalue());
-        settlementDocumentaryLogEntity.setIds(insPlyIncomeVo.getIds());
-        settlementDocumentaryLogEntity.setCreateTime(new Date());
-        settlementDocumentaryLogEntity.setCompanyId(insPlyIncomeVo.getCompanyId());
-        settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
+        settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getInvoicId());   //开票号
+        settlementDocumentaryFeesVo.setSettlementTime(insPlyIncomeVo.getSettlementTime());   //结算时间
+        settlementDocumentaryFeesVo.setSettlementStatus("2");   //2为结算状态
+        settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());  // 保险公司id
+        settlementDocumentaryFeesVo.setPartnerCompaniesId(insPlyIncomeVo.getPartnerCompaniesId());  //合作公司id
+        settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar()); // 是否是非车
+        settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod());  //开票方式
+        settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints());  //税点
+        settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getExpendAmount()); //税点支出
+        settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());
+        settlementDocumentaryFeesVo.setHandlingFeesStatus("0");
+        settlementDocumentaryFeesVo.setParentId(insPlyIncomeVo.getId());
+        settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
+        settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
         return HttpResult.ok();
     }
 
@@ -1330,7 +1343,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         List<InsPlyIncome> result = baseMapper.allOtherAmount(params);
         List<HashMap<String, Object>> otherIds = baseMapper.getOtherIds(params);
         List<HashMap<String, Object>> invoicIds = settlementDocumentaryFeesService.getInvoicIds(params);
-        this.splicingOtherIds(result,otherIds,invoicIds);
+        this.splicingOtherIds(result,otherIds,invoicIds );
         return HttpResult.ok(result);
     }
 
@@ -1420,6 +1433,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getContractId())){
             settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getContractId());  //开票号
         }
+        settlementDocumentaryFeesVo.setHandlingFeesStatus(insPlyIncomeVo.getHandlingFeesStatus());
         settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod()); //开票方式
         settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints()); //税点
         //  税点支出

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

@@ -127,7 +127,7 @@ public class InsPlyIncomeVo implements Serializable {
     private String  ids;
 
     @ApiModelProperty("总手续费")
-    private BigDecimal  totAmount;
+    private BigDecimal  totalAmount;
     @ApiModelProperty("结算金额")
     private BigDecimal settlementAmount;
 

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

@@ -97,4 +97,12 @@ public class SettlementDocumentaryFeesVo implements Serializable {
 
     @ApiModelProperty("结算时间")
     private LocalDate settlementTime;
+
+
+    @ApiModelProperty("开票id")
+    private String parentId;
+
+
+    @ApiModelProperty("是否是手续费")
+    private String handlingFeesStatus;
 }

+ 4 - 2
src/main/java/com/ydtech/modules/order/service/impl/InsUploadFilesServiceImpl.java

@@ -45,6 +45,8 @@ public class InsUploadFilesServiceImpl extends ServiceImpl<InsUploadFilesMapper,
     @Value("${upload.file.url}")
     private String uploadFileUrl;
 
+    private static final int desFileSize = 300;
+
     @Override
     public InsUploadFiles uploadFile(MultipartFile multipartFile, String username, String type) throws IOException {
         String fileMD5 = DigestUtils.md5Hex(multipartFile.getBytes());
@@ -88,9 +90,9 @@ public class InsUploadFilesServiceImpl extends ServiceImpl<InsUploadFilesMapper,
                 byte[] compressPicByte = ImageCompressionUtils.compressPic(multipartFile.getInputStream(), suffix, uploadFilePath);
 
                 if (compressPicByte.length > length) {
-                    bytes = ImageCompressionUtils.compressPicForScale(multipartFile.getBytes(), 100);
+                    bytes = ImageCompressionUtils.compressPicForScale(multipartFile.getBytes(), desFileSize);
                 } else {
-                    bytes = ImageCompressionUtils.compressPicForScale(compressPicByte, 100);
+                    bytes = ImageCompressionUtils.compressPicForScale(compressPicByte, desFileSize);
                 }
 
                 fileOutputStream.write(bytes);

+ 8 - 0
src/main/java/com/ydtech/modules/protocol/controller/PtlAgreementController.java

@@ -6,6 +6,7 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.core.page.PageResult;
 import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.inv.model.InvAccountProfit;
 import com.ydtech.modules.protocol.entity.dto.PltAgreementSchemeSaveDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementUndwrtRulesSaveDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
@@ -24,6 +25,7 @@ import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -193,5 +195,11 @@ public class PtlAgreementController extends BaseController {
     public HttpResult<List<PtlAgreement>> findRelationAgreement(@RequestBody PtlAgreement ptlAgreement){
         return ptlAgreementService.findRelationAgreement(ptlAgreement.getAssociationCompaniesId());
     }
+    @GetMapping("getDockingPersonList")
+    @ApiOperation("获取对接人列表")
+    public HttpResult getDockingPersonList(){
+        List<HashMap<String,Object>>list = ptlAgreementService.getDockingPersonList();
+        return HttpResult.ok(list);
+    }
 
 }

+ 5 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java

@@ -6,6 +6,7 @@ import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import org.apache.ibatis.annotations.Param;
 
 import java.time.LocalDate;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -21,6 +22,10 @@ public interface PtlAgreementMapper extends BaseMapper<PtlAgreement> {
     PtlAgreementInsCompanyDto getAgreementCompanyByCompanyId(@Param("localDate") LocalDate localDate, @Param("deptId") String deptId,@Param("companyId") String companyId);
 
     PtlAgreement getByAgreementIdNew(String agreementId);
+
+    List<HashMap<String, Object>> getDockingPersonList();
+
+
 }
 
 

+ 4 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java

@@ -13,6 +13,7 @@ import com.ydtech.modules.protocol.entity.po.PtlAgreementProductCosts;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementUndwrtRules;
 import com.ydtech.modules.protocol.entity.vo.*;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -222,4 +223,7 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      */
     List<PtlAgreement> getByCompanyCode(String companyCode);
 
+    List<HashMap<String, Object>> getDockingPersonList();
+
+
 }

+ 5 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -733,5 +733,10 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         return baseMapper.selectList(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getPartnerCompaniesId, companyCode));
     }
 
+    @Override
+    public List<HashMap<String, Object>> getDockingPersonList() {
+        return   baseMapper.getDockingPersonList();
+    }
+
 
 }

+ 38 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/InsFeeOrderNew.java

@@ -363,6 +363,44 @@ public class InsFeeOrderNew {
     @TableField(value = "dept_distribution")
     private BigDecimal deptDistribution;
 
+
+    @ApiModelProperty(value = "交强手续费出口金额")
+    @TableField(value = "jq_export_supervise_costs_premiums")
+    private BigDecimal jqExportSuperviseCostsPremiums;
+
+    @ApiModelProperty(value = "商业手续费出口金额")
+    @TableField(value = "sy_export_supervise_costs_premiums")
+    private BigDecimal syExportSuperviseCostsPremiums;
+
+    @ApiModelProperty(value = "非车手续费出口金额")
+    @TableField(value = "no_export_supervise_costs_premiums")
+    private BigDecimal noExportSuperviseCostsPremiums;
+
+    @ApiModelProperty(value = "交强其他费用出口比例")
+    @TableField(value = "jq_export_other_costs_proportion")
+    private BigDecimal jqExportOtherCostsProportion;
+
+    @ApiModelProperty(value = "商业其他费用出口比例")
+    @TableField(value = "sy_export_other_costs_proportion")
+    private BigDecimal  syExportOtherCostsProportion;
+
+    @ApiModelProperty(value = "非车其他费用出口比例")
+    @TableField(value = "no_export_other_costs_proportion")
+    private BigDecimal noExportOtherCostsProportion;
+
+    @ApiModelProperty(value = "交强其他费用出口金额")
+    @TableField(value = "jq_export_other_costs_premiums")
+    private BigDecimal jqExportOtherCostsPremiums;
+
+    @ApiModelProperty(value = "商业其他费用出口金额")
+    @TableField(value = "sy_export_other_costs_premiums")
+    private BigDecimal syExportOtherCostsPremiums;
+
+    @ApiModelProperty(value = "非车其他费用出口金额")
+    @TableField(value = "no_export_other_costs_premiums")
+    private BigDecimal noExportOtherCostsPremiums;
+
+
     @ApiModelProperty(value = "签单日期")
     @TableField(exist = false)
     private LocalDate signingTime;

+ 72 - 40
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -164,6 +164,10 @@
                     and a.handling_fees_status =#{handlingFeesStatus}
                 </if>
 
+                <if test="dockingPerson !=null  and  dockingPerson  !=''">
+                    and  pa.docking_person  =#{dockingPerson}
+                </if>
+
                 <if test="orderno !=null  and  orderno  !=''">
                     and a.orderno =#{orderno}
                 </if>
@@ -726,19 +730,47 @@
 
 
     <select id="totalBxAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
-        select
-        SUM(a.commission_feevalue) AS "commissionFeevalue",
-        a.partner_companies_id  AS  "partnerCompaniesId",
-        MAX(a.agreement_id) AS "agreementId",
-        MAX(a.partner_companies_name) AS "partnerCompaniesName",
+        SELECT
+        a.partner_companies_id AS "partnerCompaniesId",
         MAX( a.company_name ) AS "companyName",
-        SUM(CASE WHEN a.handling_fees_status = '2' THEN a.commission_feevalue ELSE 0 END) AS "invoicCommissionFeevalue",
-        SUM( CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END ) AS "noInvoicCommissionFeevalue",
-        SUM(CASE WHEN a.handling_fees_status = '1' THEN a.commission_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
-        SUM( CASE WHEN ( a.handling_fees_status = '2' or   a.handling_fees_status = '1' ) THEN a.commission_feevalue ELSE 0 END ) AS "allInvoicCommissionFeevalue",
-        SUM( CASE WHEN ( a.handling_fees_status = '2' or   a.handling_fees_status = '0' ) THEN a.commission_feevalue ELSE 0 END ) AS "unSettledAmount"
-        from  ins_ply_income a
-        LEFT JOIN   ptl_agreement  pa  on pa.id= a.agreement_id
+        MAX( a.company_id ) AS "companyId",
+        MAX( a.partner_companies_name ) AS "partnerCompaniesName",
+        IFNULL ( max(c.settleMentAmount),0.00) as  "allInvoicCommissionFeevalue",
+        IFNULL(max(f.settleMentAmount) , 0.00)  as  "readyCommissionFeevalue",
+        IFNULL ( max(d.settleMentAmount),0.00) as "invoicCommissionFeevalue",
+        sum(COALESCE( a.commission_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
+        sum(COALESCE( a.commission_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00)  AS "unSettledAmount",
+        sum( a.commission_feevalue ) AS "commissionFeevalue"
+        FROM
+        ins_ply_income a
+        LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+        LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
+        settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
+        WHERE ( a.settlement_status = '1' or a.settlement_status = '2')
+        and  a.handling_fees_status ='0'
+        <if test="isNotCar !=null  and  isNotCar  !=''">
+            and a.is_not_car =#{isNotCar}
+        </if>
+        GROUP BY partner_companies_id
+        ) c ON c.partnerCompaniesId = a.partner_companies_id
+        LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
+        settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
+        WHERE ( a.settlement_status = '1')
+        and  a.handling_fees_status ='0'
+        <if test="isNotCar !=null  and  isNotCar  !=''">
+            and a.is_not_car =#{isNotCar}
+        </if>
+        GROUP BY partner_companies_id
+        ) d ON d.partnerCompaniesId = a.partner_companies_id
+        LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId",sum(
+        settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
+        WHERE a.settlement_status = '2'
+        and  a.handling_fees_status ='0'
+        <if test="isNotCar !=null  and  isNotCar  !=''">
+            and a.is_not_car =#{isNotCar}
+        </if>
+        GROUP BY partner_companies_id
+        ) f ON f.partnerCompaniesId = a.partner_companies_id
         <where>
             1=1
             <if test="agreementType !=null  and agreementType!='' ">
@@ -753,9 +785,6 @@
             <if test="isNotCar !=null  and  isNotCar  !=''">
                 and a.is_not_car =#{isNotCar}
             </if>
-            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
-                and a.handling_fees_status =#{handlingFeesStatus}
-            </if>
             <if test="month !=null  and  month !=''">
                 AND month(a.signdate) =#{month}
             </if>
@@ -816,6 +845,7 @@
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
         settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
         WHERE ( a.settlement_status = '1' or a.settlement_status = '2')
+        and  a.handling_fees_status ='1'
         <if test="isNotCar !=null  and  isNotCar  !=''">
             and a.is_not_car =#{isNotCar}
         </if>
@@ -824,6 +854,7 @@
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
         settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
         WHERE ( a.settlement_status = '1')
+        and  a.handling_fees_status ='1'
         <if test="isNotCar !=null  and  isNotCar  !=''">
             and a.is_not_car =#{isNotCar}
         </if>
@@ -832,37 +863,38 @@
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId",sum(
         settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
         WHERE a.settlement_status = '2'
+          and  a.handling_fees_status ='1'
         <if test="isNotCar !=null  and  isNotCar  !=''">
             and a.is_not_car =#{isNotCar}
         </if>
         GROUP BY partner_companies_id
         ) f ON f.partnerCompaniesId = a.partner_companies_id
-       <where>
-           1=1
-           <if test="agreementType !=null  and agreementType!='' ">
-               AND pa.agreement_type =#{agreementType}
-           </if>
-           <if test="year !=null  and  year  !=''">
-               AND YEAR(a.signdate) =#{year}
-           </if>
-           <if test="isOther !=null  and  isOther  !=''">
-               and a.is_not_documentary   =#{isOther}
-           </if>
-           <if test="isNotCar !=null  and  isNotCar  !=''">
-               and a.is_not_car =#{isNotCar}
-           </if>
-           <if test="month !=null  and  month !=''">
-               AND month(a.signdate) =#{month}
-           </if>
-           <if test="day !=null  and  day !=''">
-               AND day(a.signdate) =#{day}
-           </if>
-           <if test="documentaryFeesStatus != null  and documentaryFeesStatus != '' ">
-               AND   a.documentary_fees_status = #{documentaryFeesStatus}
-           </if>
-       </where>
+        <where>
+            1=1
+            <if test="agreementType !=null  and agreementType!='' ">
+                AND pa.agreement_type =#{agreementType}
+            </if>
+            <if test="year !=null  and  year  !=''">
+                AND YEAR(a.signdate) =#{year}
+            </if>
+            <if test="isOther !=null  and  isOther  !=''">
+                and a.is_not_documentary   =#{isOther}
+            </if>
+            <if test="isNotCar !=null  and  isNotCar  !=''">
+                and a.is_not_car =#{isNotCar}
+            </if>
+            <if test="month !=null  and  month !=''">
+                AND month(a.signdate) =#{month}
+            </if>
+            <if test="day !=null  and  day !=''">
+                AND day(a.signdate) =#{day}
+            </if>
+            <if test="documentaryFeesStatus != null  and documentaryFeesStatus != '' ">
+                AND   a.documentary_fees_status = #{documentaryFeesStatus}
+            </if>
+        </where>
         GROUP BY
-            a.partner_companies_id
+        a.partner_companies_id
     </select>
 
     <select id="getOtherIds" resultType="java.util.HashMap">

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

@@ -24,6 +24,8 @@
         <result column="invoicing_method" property="invoicingMethod"/>
         <result column="tax_points" property="taxPoints"/>
         <result column="expend_amount" property="expendAmount"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="handling_fees_status" property="handlingFeesStatus"/>
     </resultMap>
 
 
@@ -43,44 +45,38 @@
             a.invoicing_method as "invoicingMethod",
             a.tax_points as "taxPoints",
             a.expend_amount as "expendAmount",
+            a.parent_id as "parentId",
+            a.handling_fees_status as "handlingFeesStatus",
             a.unsettled_amount as "unsettledAmount"
             from  settlement_documentary_fees  a
     </select>
 
     <select id="getOtherSettldetail" resultType="java.util.HashMap">
         SELECT
-        CASE
-        WHEN t.total_settlement_amount_1 = 0 THEN 0
-        ELSE t.total_settlement_amount_1 - t.total_settlement_amount_2
-        END AS "invoicCommissionFeevalue",
-        t.max_create_time AS "invoicTime",
-        t.max_invoice_id AS "invoicId",
-        t.max_tax_points AS "taxPoints",
-        t.max_invoicing_method AS "invoicingMethod",
-        t.ids AS "ids"
-        FROM (
-        SELECT
-        SUM(CASE WHEN a.settlement_status = '1' THEN a.settlement_amount ELSE 0 END) AS total_settlement_amount_1,
-        SUM(CASE WHEN a.settlement_status = '2' THEN a.settlement_amount ELSE 0 END) AS total_settlement_amount_2,
-        MAX(a.create_time) AS max_create_time,
-        MAX(a.invoice_id) AS max_invoice_id,
-        MAX(a.tax_points) AS max_tax_points,
-        MAX(a.invoicing_method) AS max_invoicing_method,
-        GROUP_CONCAT(a.id) AS ids
+        a.id as "id",
+        a.create_time AS "invoicTime",
+        a.invoice_id AS  "invoicId",
+        a.tax_points AS  "taxPoints",
+        a.settlement_amount - COALESCE(b.settlementAmount, 0) AS "invoicCommissionFeevalue",
+        a.invoicing_method AS  "invoicingMethod"
         FROM
         settlement_documentary_fees a
+        left  join  (
+        select a.parent_id as "parentId" ,sum(a.settlement_amount) as "settlementAmount" from
+        settlement_documentary_fees a
+        where  a.settlement_status ='2'  and  a.parent_id is  not  null
+        GROUP BY a.parent_id
+        ) b  on a.id=b.parentId
         <where>
             1=1
-            <if test="settlementStatus !=null and  settlementStatus !=''">
-                and a.settlement_status = =#{settlementStatus}
-            </if>
-            <if test="isNotCar !=null  and  isNotCar  !=''">
-                and a.is_not_car =#{isNotCar}
-            </if>
-
+            and  a.settlement_status  ='1'
+            and a.settlement_amount - COALESCE(b.settlementAmount, 0) &lt;&gt; 0
             <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
                 and a.partner_companies_id =#{partnerCompaniesId}
             </if>
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                and a.handling_fees_status =#{handlingFeesStatus}
+            </if>
             <if test="invoiceIds !=null and  invoiceIds !=''  and invoiceIds.length>0">
                 and a.id IN
                 <foreach item="item" index="index" collection="invoiceIds" open="(" separator="," close=")">
@@ -88,12 +84,6 @@
                 </foreach>
             </if>
         </where>
-        GROUP BY
-        a.invoice_id
-        HAVING
-        SUM(CASE WHEN a.settlement_status = '1' THEN a.settlement_amount ELSE 0 END)  &lt;&gt; 0
-        AND SUM(CASE WHEN a.settlement_status = '1' THEN a.settlement_amount ELSE 0 END) &lt;&gt; SUM(CASE WHEN a.settlement_status = '2' THEN a.settlement_amount ELSE 0 END)
-        ) t;
     </select>
 
     <update id="batchByInvoice" parameterType="java.util.HashMap">
@@ -126,6 +116,10 @@
             <if test="isNotCar !=null  and  isNotCar  !=''">
                 and a.is_not_car =#{isNotCar}
             </if>
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus !=''">
+                a.handling_fees_status=#{handlingFeesStatus}
+
+            </if>
         </where>
     </select>
 

+ 7 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml

@@ -114,4 +114,11 @@
         </where>
     </select>
 
+
+    <select id="getDockingPersonList" resultType="java.util.HashMap">
+        SELECT docking_person
+        FROM `ptl_agreement`
+        GROUP BY docking_person
+    </select>
+
 </mapper>