Ver código fonte

1. 结算调整 bug 调整

wuhp 2 anos atrás
pai
commit
2d861d86a0

+ 98 - 59
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -516,6 +516,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
 
     private HashMap<String, Object> saveParams(InsPlyIncomeVo insPlyIncomeVo, HashMap<String, Object> params) {
+        if(ObjectUtils.isNotEmpty(insPlyIncomeVo.getId())){
+            params.put("id",insPlyIncomeVo.getId());
+        }
         if(ObjectUtils.isNotEmpty(insPlyIncomeVo.getStartDate())){
             params.put("startDate",insPlyIncomeVo.getStartDate().toString());
         }
@@ -1182,33 +1185,34 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             BigDecimal jqNoTaxPremium = insPlyIncomeVo.getJqNoTaxPremium();// 交强手续费  按照思路  交强不含税保费* 交强手续费比例  =交强手续费
             BigDecimal syNoTaxPremium = insPlyIncomeVo.getSyNoTaxPremium();// 商业手续费  按照思路  商业不含税保费* 商业手续费比例  =商业手续费
             BigDecimal noNoTaxPremium = insPlyIncomeVo.getNoNoTaxPremium();// 非车手续费  按照思路  非车不含税保费* 非车手续费比例  =非车手续费
-            if(insPlyIncomeVo.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
+            if( jqNoTaxPremium != null  && insPlyIncomeVo.getJqSuperviseCostsProportion()  !=null  &&   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){
+            if( syNoTaxPremium!= null  &&  insPlyIncomeVo.getSySuperviseCostsProportion()  !=null  && 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){
+            if(noNoTaxPremium!= null  &&  insPlyIncomeVo.getNoSuperviseCostsProportion()  !=null  && insPlyIncomeVo.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO) != 0){
                 BigDecimal  nohandingFee = noNoTaxPremium.multiply(insPlyIncomeVo.getNoSuperviseCostsProportion().divide(new BigDecimal(100)));
                 insPlyIncome.setNoSuperviseCostsPremiums(nohandingFee);
             }
 
-            if(insPlyIncomeVo.getJqOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
+            if( jqNoTaxPremium!= null  &&  insPlyIncomeVo.getJqOtherCostsProportion() !=null &&   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){
+            if( syNoTaxPremium!= null  &&  insPlyIncomeVo.getSyOtherCostsProportion() !=null   &&  insPlyIncomeVo.getSyOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
                 BigDecimal syother = syNoTaxPremium.multiply(insPlyIncomeVo.getSyOtherCostsProportion().divide(new BigDecimal(100)));//交强跟单费  按照思路  交强不含税保费* 交强跟单比例 = 交强跟单金额
                 insPlyIncome.setSyOtherCostsPremium(syother);
             }
 
-            if(insPlyIncomeVo.getNoOtherCostsProportion().compareTo(BigDecimal.ZERO) != 0){
-                BigDecimal syother = syNoTaxPremium.multiply(insPlyIncomeVo.getNoOtherCostsProportion().divide(new BigDecimal(100)));//非车跟单费  按照思路  非车不含税保费* 非车跟单比例 = 非车跟单金额
+            if( noNoTaxPremium!= null  && insPlyIncomeVo.getOtherFeerate() !=null  &&  insPlyIncomeVo.getOtherFeerate().compareTo(BigDecimal.ZERO) != 0){
+                BigDecimal syother = noNoTaxPremium.multiply(insPlyIncomeVo.getOtherFeerate().divide(new BigDecimal(100)));//非车跟单费  按照思路  非车不含税保费* 非车跟单比例 = 非车跟单金额
+                insPlyIncome.setNoOtherCostsProportion(insPlyIncome.getOtherFeerate());
                 insPlyIncome.setNoOtherCostsPremium(syother);
             }
 
@@ -1625,11 +1629,14 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     public HttpResult<Object> batchBxBalance(InsPlyIncomeVo insPlyIncomeVo) {
 
 //         表内总金额
-        BigDecimal settlementAmount = insPlyIncomeVo.getSettlementAmount();  //结算金额
-
         SettlementDocumentaryFeesEntity byIdSettlementDocumentaryFeesEntity = settlementDocumentaryFeesService.getById(insPlyIncomeVo.getId());
         BigDecimal  invoicAmount = byIdSettlementDocumentaryFeesEntity.getTotalAmount();
 
+
+        String taskId = byIdSettlementDocumentaryFeesEntity.getTaskId();
+        List<String> byTaskId = incomeTaskRelationshipService.getByTaskId(taskId);
+
+
         HashMap<String, Object> params = new HashMap<>();
         params.put("id",insPlyIncomeVo.getId());
         params.put("handlingFeesStatus", "0");
@@ -1646,8 +1653,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                 return HttpResult.error("结算金额大于开票金额");
             } else if (invoicAmount.compareTo(insPlyIncomeVo.getSettlementAmount()) ==0) {
                 HashMap<String, Object> incomeParams = new HashMap<>();
-                incomeParams = this.saveParams(insPlyIncomeVo,incomeParams);
-                incomeParams.put("handlingFeesStatus",insPlyIncomeVo.getHandlingFeesStatus());
+                incomeParams.put("incomeIds",byTaskId);
                 List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(incomeParams);
                 for (InsPlyIncome  item : insPlyIncomes){
                         item.setHandlingFeesStatus("1");
@@ -1783,6 +1789,19 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             settlementDocumentaryFeesVo.setSigningTime(signingTime);
 
         }
+        if(insPlyIncomeVo.getOtherFeevalue().compareTo(BigDecimal.ZERO) ==0 ){
+            throw  new SystemException("总金额为0不允许开票");
+        }
+        if(insPlyIncomeVo.getNoInvoicCommissionFeevalue().compareTo(BigDecimal.ZERO) ==0 ){
+            throw  new SystemException("未开票金额为0不允许开票");
+        }
+        if( insPlyIncomeVo.getSettlementAmount()  ==null  ||   insPlyIncomeVo.getSettlementAmount().compareTo(BigDecimal.ZERO) <=0){
+            throw  new SystemException("开票金额错误不允许开票");
+        }
+        if(insPlyIncomeVo.getNoInvoicCommissionFeevalue().compareTo(insPlyIncomeVo.getSettlementAmount()) <0){
+            throw  new SystemException("开票金额必须小于未开票金额 不允许开票");
+        }
+
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
             settlementDocumentaryFeesVo.setYear(insPlyIncomeVo.getYear());
         }
@@ -1795,7 +1814,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
         settlementDocumentaryFeesVo.setPartnerCompaniesId(insPlyIncomeVo.getPartnerCompaniesId());  //合作公司id
         settlementDocumentaryFeesVo.setAgreementId(insPlyIncomeVo.getAgreementId());
-        settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getSettlementAmount());  //其他费用金额
+        settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getOtherFeevalue());  //其他费用金额
         settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getNoInvoicCommissionFeevalue().subtract(insPlyIncomeVo.getSettlementAmount())); //未结算
         settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());//已经开票
         settlementDocumentaryFeesVo.setCreateTime(LocalDateTime.now());
@@ -1943,7 +1962,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         HashMap<String, Object> params = new HashMap<>();
         params = this.saveParams(insPlyIncomeVo, params);
 
-
         BigDecimal sumCommissionFeevalue = BigDecimal.ZERO;  //总金额
         BigDecimal sumInvoicCommissionFeevalue = BigDecimal.ZERO; //开票未结算
         BigDecimal sumReadyCommissionFeevalue = BigDecimal.ZERO; // 已开票已结算
@@ -1961,7 +1979,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             BigDecimal unSettledAmount; //未结算金额
             params.put("partnerCompaniesId", item.getPartnerCompaniesId());
 
-            params.remove("handlingFeesStatus");
+//            params.remove("handlingFeesStatus");
             List<InsPlyIncome> insPlyIncomes = baseMapper.queryNew(params);  //金额总数
             for (InsPlyIncome all : insPlyIncomes) {
                 commissionFeevalue = commissionFeevalue.add(all.getCommissionFeevalue());
@@ -2055,20 +2073,23 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         // 存储已存在的年份-月份组合,以便快速查找
         Set<String> existingYearMonths = new HashSet<>();
         for (Map<String, Object> entry : resultMap) {
-            String year = String.valueOf(entry.get("year")) ;
-            int month = (Integer) entry.get("monthNumber");
-            existingYearMonths.add(year + "-" + month);
+            String monthYear = String.valueOf(entry.get("monthYear")) ;
+            existingYearMonths.add(monthYear);
         }
 
         // 遍历所有年份和月份,并添加缺失的条目
         for (String year : uniqueYears) {
             for (int month = 1; month <= 12; month++) {
-                String yearMonth = year + "-" + month;
+                String strNumber = String.valueOf(month);
+                if (strNumber.length() < 2) {
+                    strNumber = String.format("%02d", Integer.parseInt(strNumber));
+                }
+                String yearMonth = year + "-" + strNumber;
                 if (!existingYearMonths.contains(yearMonth)) {
                     // 创建一个新的条目并添加到resultMap中
                     HashMap<String, Object> newEntry = new HashMap<>();
                     newEntry.put("year", year);
-                    newEntry.put("monthNumber", month);
+                    newEntry.put("monthNumber", strNumber);
                     newEntry.put("allTotalOtherFeevalue", 0);
                     newEntry.put("invoicCommissionFeevalue", 0);
                     newEntry.put("monthYear", yearMonth);
@@ -2089,9 +2110,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     return yearComparison;
                 }
 
-                // 如果 year 相同,则比较 monthNumber
-                Integer monthNum1 = (Integer) o1.get("monthNumber");
-                Integer monthNum2 = (Integer) o2.get("monthNumber");
+//                 如果 year 相同,则比较 monthNumber
+
+                Integer monthNum1 = Integer.parseInt(String.format("%2s", o1.get("monthNumber")).replaceAll(" ", "0"));
+                Integer monthNum2 = Integer.parseInt(String.format("%2s", o2.get("monthNumber")).replaceAll(" ", "0"));
                 return monthNum1.compareTo(monthNum2);
             }
         });
@@ -2105,51 +2127,66 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo();  // 生成跟单费结算表
         if (!CollectionUtils.isEmpty(insPlyIncomeVo.getMultipleSelection())) {
             for (InsPlyIncomeVo insPlyIncomeVo1 : insPlyIncomeVo.getMultipleSelection()) {
+
                 insPlyIncomeVo.setSettlementAmount(insPlyIncomeVo1.getSettlementAmount());
                 insPlyIncomeVo.setOtherFeevalue(insPlyIncomeVo1.getAllTotalOtherFeevalue());
                 YearMonth yearMonth = YearMonth.parse(insPlyIncomeVo1.getMonthYear());
                 LocalDate signingTime = yearMonth.atDay(1);
+
                 settlementDocumentaryFeesVo.setSigningTime(signingTime);
 
+                if(insPlyIncomeVo.getOtherFeevalue().compareTo(BigDecimal.ZERO) ==0 ){
+                    throw  new SystemException("总金额为0不允许开票");
+                }
+                if(insPlyIncomeVo.getNoInvoicCommissionFeevalue().compareTo(BigDecimal.ZERO) ==0 ){
+                    throw  new SystemException("未开票金额为0不允许开票");
+                }
+                if( insPlyIncomeVo.getSettlementAmount()  ==null   ||   insPlyIncomeVo.getSettlementAmount().compareTo(BigDecimal.ZERO) <=0){
+                    throw  new SystemException("开票金额错误不允许开票");
+                }
+                if(insPlyIncomeVo.getNoInvoicCommissionFeevalue().compareTo(insPlyIncomeVo.getSettlementAmount()) <0){
+                    throw  new SystemException("开票金额必须小于未开票金额 不允许开票");
+                }
+
+                if (StringUtils.isNotEmpty(insPlyIncomeVo.getYear())) {
+                    settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
+                }
+                if (StringUtils.isNotEmpty(insPlyIncomeVo.getYear())) {
+                    settlementDocumentaryFeesVo.setYear(insPlyIncomeVo.getYear());
+                }
+                if (StringUtils.isNotEmpty(insPlyIncomeVo.getMonth())) {
+                    settlementDocumentaryFeesVo.setMonth(insPlyIncomeVo.getMonth());
+                }
+                if (StringUtils.isNotEmpty(insPlyIncomeVo.getDay())) {
+                    settlementDocumentaryFeesVo.setDay(insPlyIncomeVo.getDay());
+                }
+
+                settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
+                settlementDocumentaryFeesVo.setPartnerCompaniesId(insPlyIncomeVo.getPartnerCompaniesId());  //合作公司id
+                settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getOtherFeevalue());  //其他费用金额
+                settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getNoInvoicCommissionFeevalue().subtract(insPlyIncomeVo.getSettlementAmount())); //未结算
+                settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());//已经开票
+                settlementDocumentaryFeesVo.setCreateTime(LocalDateTime.now());
+                settlementDocumentaryFeesVo.setAgreementType("2");
+                settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
+                settlementDocumentaryFeesVo.setSettlementStatus("1");
+                settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
+                if (StringUtils.isNotEmpty(insPlyIncomeVo.getContractId())) {
+                    settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getContractId());  //开票号
+                }
+                settlementDocumentaryFeesVo.setHandlingFeesStatus(insPlyIncomeVo.getHandlingFeesStatus());
+                settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod()); //开票方式
+                settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints()); //税点
+                settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIds());
+//                settlementDocumentaryFeesVo.setSigningTime(insPlyIncomeVo.getSettlementTime());   //签单日期
+                //  税点支出
+                if (BigDecimalUtils.nullToZero(insPlyIncomeVo.getTaxPoints()) != null && BigDecimalUtils.nullToZero(insPlyIncomeVo.getSettlementAmount()) != null) {
+                    BigDecimal settlementAmount = insPlyIncomeVo.getSettlementAmount();
+                    settlementDocumentaryFeesVo.setExpendAmount(settlementAmount.multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100)))));
+                }
+                settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
             }
         }
-        if (StringUtils.isNotEmpty(insPlyIncomeVo.getYear())) {
-            settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
-        }
-        if (StringUtils.isNotEmpty(insPlyIncomeVo.getYear())) {
-            settlementDocumentaryFeesVo.setYear(insPlyIncomeVo.getYear());
-        }
-        if (StringUtils.isNotEmpty(insPlyIncomeVo.getMonth())) {
-            settlementDocumentaryFeesVo.setMonth(insPlyIncomeVo.getMonth());
-        }
-        if (StringUtils.isNotEmpty(insPlyIncomeVo.getDay())) {
-            settlementDocumentaryFeesVo.setDay(insPlyIncomeVo.getDay());
-        }
-        settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
-        settlementDocumentaryFeesVo.setPartnerCompaniesId(insPlyIncomeVo.getPartnerCompaniesId());  //合作公司id
-        settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getOtherFeevalue());  //其他费用金额
-        settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getNoInvoicCommissionFeevalue().subtract(insPlyIncomeVo.getSettlementAmount())); //未结算
-        settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());//已经开票
-        settlementDocumentaryFeesVo.setCreateTime(LocalDateTime.now());
-        settlementDocumentaryFeesVo.setAgreementType(insPlyIncomeVo.getAgreementType());
-        settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
-        settlementDocumentaryFeesVo.setSettlementStatus("1");
-        settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
-        if (StringUtils.isNotEmpty(insPlyIncomeVo.getContractId())) {
-            settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getContractId());  //开票号
-        }
-        settlementDocumentaryFeesVo.setHandlingFeesStatus(insPlyIncomeVo.getHandlingFeesStatus());
-        settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod()); //开票方式
-        settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints()); //税点
-        settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIds());
-        settlementDocumentaryFeesVo.setSigningTime(insPlyIncomeVo.getSettlementTime());   //签单日期
-        //  税点支出
-        if (BigDecimalUtils.nullToZero(insPlyIncomeVo.getTaxPoints()) != null && BigDecimalUtils.nullToZero(insPlyIncomeVo.getSettlementAmount()) != null) {
-            BigDecimal settlementAmount = insPlyIncomeVo.getSettlementAmount();
-            settlementDocumentaryFeesVo.setExpendAmount(settlementAmount.multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100)))));
-        }
-        settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
-
         return HttpResult.ok();
     }
 
@@ -2217,6 +2254,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     byBxLicenseno.setOtherFeevalue(this.calculateTotal(jqOtherAmount,syOtherAmount,null));
                     byBxLicenseno.setOtherFeerate(this.calculateTotal(jqOtherCostsProportion,syOtherCostsProportion ,null));
                     byBxLicenseno.setAllFeeValue(this.calculateTotal(jqOtherAmount,syOtherAmount,null));
+                    byBxLicenseno.setUpdateUserId(BaseController.getUser().getId());
+                    byBxLicenseno.setUpdateUserName(BaseController.getUser().getName());
                     baseMapper.updateById(byBxLicenseno);
 
 

+ 137 - 16
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -1028,35 +1028,156 @@
         LEFT  JOIN   esm_ins_company  eic   on  eic.id=a.partner_companies_id
         <where>
             1=1
-            <if test="agreementType !=null  and agreementType!='' ">
-                AND pa.agreement_type =#{agreementType}
+            <if test="startDate !=null  and  startDate!='' and  endDate !=null and endDate !=''">
+                and DATE_FORMAT( a.signdate, '%Y-%m-%d')  between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
             </if>
-            <if test="year !=null  and  year  !=''">
-                AND YEAR(a.signdate) =#{year}
+            <if test="agreementType !=null  and  agreementType  !=''">
+                and pa.agreement_type =#{agreementType}
             </if>
-            <if test="isOther !=null  and  isOther  !=''">
-                and a.is_not_documentary   =#{isOther}
+
+            <if test="signDateEnd !=null  and  signDateEnd!='' and  signDateStart !=null and signDateStart !=''">
+                and a.signdate   between #{signDateStart} and #{signDateEnd}
+            </if>
+
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                and a.handling_fees_status =#{handlingFeesStatus}
+            </if>
+
+            <if test="allPartnerCompaniesId !=null  and  allPartnerCompaniesId  !=''">
+                AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
+            </if>
+
+            <if test="provincePartnerCompaniesId !=null  and  provincePartnerCompaniesId  !=''">
+                and eic.parent_id LIKE CONCAT(#{provincePartnerCompaniesId}, '%')
+            </if>
+
+            <if test="dockingPerson !=null  and  dockingPerson  !=''">
+                and  pa.docking_person  =#{dockingPerson}
+            </if>
+
+            <if test="provinceId != null and provinceId != ''">
+                and pa.dept_id  LIKE CONCAT(#{provinceId}, '%')
+            </if>
+
+            <if test="cityId != null and cityId != ''">
+                and pa.dept_id  LIKE CONCAT(#{cityId}, '%')
+            </if>
+
+            <if test="countyId != null and countyId != ''">
+                and pa.dept_id   LIKE CONCAT(#{countyId}, '%')
+            </if>
+            <if test="taskId != null and taskId != ''">
+                and a.task_id = #{taskId}
+            </if>
+            <if test="orderno !=null  and  orderno  !=''">
+                and a.orderno =#{orderno}
+            </if>
+            <if test="companyName !=null  and  companyName  !=''">
+                and a.company_id =#{companyName}
+            </if>
+
+            <if test="policyno !=null  and  policyno  !=''">
+                and a.policyno =#{policyno}
+            </if>
+            <if test="documentaryFeesStatus !=null  and  documentaryFeesStatus  !=''">
+                and a.documentary_fees_status =#{documentaryFeesStatus}
             </if>
+
             <if test="isNotCar !=null  and  isNotCar  !=''">
                 and a.is_not_car =#{isNotCar}
             </if>
+
+            <if test="deptId !=null  and  deptId  !=''">
+                and pa.dept_id =#{deptId}
+            </if>
+
+
+            <if test="ids != null and ids != '' and ids.length > 0">
+                and a.id in
+                <foreach collection="ids" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="incomeIds != null and incomeIds != '' and incomeIds.size() > 0">
+                and a.id in
+                <foreach collection="incomeIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
+                and a.id in
+                <foreach collection="selectIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
+                and a.partner_companies_id in
+                <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+            <if test="isOther !=null  and  isOther  !=''">
+                and a.is_not_documentary   =#{isOther}
+            </if>
+            <if test="licenseno != null and licenseno != ''">
+                and a.licenseno  =#{licenseno}
+            </if>
+            <if test="syPolicyno != null and syPolicyno != ''">
+                and a.sy_policyno  =#{syPolicyno}
+            </if>
+
+            <if test="noPolicyno != null and noPolicyno != ''">
+                and a.no_policyno =#{noPolicyno}
+            </if>
+            <if test="signdate !=null  and  signdate  !=''">
+                AND  a.signdate =#{signdate}
+            </if>
+            <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
+                AND a.partner_companies_id =#{partnerCompaniesId}
+            </if>
+
+            <if test="partnerCompaniesName !=null  and  partnerCompaniesName  !=''">
+                AND   a.partner_companies_name =#{partnerCompaniesName}
+            </if>
+
+            <if test="createTime !=null  and  createTime  !=''">
+                AND  a.create_time =#{createTime}
+            </if>
+            <if test="settlementTime !=null  and  settlementTime  !=''">
+                AND a.settlement_time =#{settlementTime}
+            </if>
+
+            <if test="userId !=null  and  userId  !=''">
+                and a.userId   =#{userId}
+            </if>
+            <if test="companyId !=null  and  companyId  !=''">
+                and a.company_id   =#{companyId}
+            </if>
+            <if test="riskcode !=null  and  riskcode  !=''">
+                and a.riskcode   =#{riskcode}
+            </if>
+            <if test="year !=null  and  year  !=''">
+                AND YEAR(a.signdate) =#{year}
+            </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="partnerCompaniesName !=null  and  partnerCompaniesName  !=''">
-                AND   a.partner_companies_name =#{partnerCompaniesName}
-            </if>
-            <if test="allPartnerCompaniesId !=null  and  allPartnerCompaniesId  !=''">
-                AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
+            <if test="insuredName !=null  and  insuredName !=''">
+                AND  a.insured_name =#{insuredName}
             </if>
-            <if test="provincePartnerCompaniesId !=null  and  provincePartnerCompaniesId  !=''">
-                and eic.parent_id LIKE CONCAT(#{provincePartnerCompaniesId}, '%')
+            <if test="jqStartDate  !=null  and  jqStartDate  != ''  and  jqEndDate   != null  and  jqEndDate   !=''">
+                AND DATE(a.jq_start_date) BETWEEN #{jqStartDate} AND #{jqEndDate}
+
             </if>
-            <if test="companyName !=null  and  companyName  !=''">
-                and a.company_id =#{companyName}
+            <if test="syStartDate  !=null  and  syStartDate  != ''  and  syEndDate   != null  and  syEndDate   !=''">
+                AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
+
             </if>
         </where>
         GROUP BY  a.partner_companies_id
@@ -1355,7 +1476,7 @@
   <select id="otherTimeDetail"  resultType="java.util.HashMap">
       SELECT
           i.YEAR  as "year",
-          i.monthNumber as "monthNumber",
+          LPAD(i.monthNumber, 2, '0') as "monthNumber",
           i.allTotalOtherFeevalue as "allTotalOtherFeevalue",
           IFNULL(s.invoicCommissionFeevalue,0) AS invoicCommissionFeevalue,
           CONCAT(i.YEAR, '-', LPAD(i.monthNumber, 2, '0')) AS "monthYear",