Bladeren bron

1.控制台小订单修改

wuhp 2 jaren geleden
bovenliggende
commit
9adf701c72

+ 33 - 0
src/main/java/com/ydtech/modules/admin/model/report/company/CompanyQutationCountDataDto.java

@@ -76,4 +76,37 @@ public class CompanyQutationCountDataDto {
      */
     @ApiModelProperty("缴费率")
     private BigDecimal contributionRate;
+
+    /***
+     *  承保数/核保书=缴费率
+     */
+    @ApiModelProperty("失败数")
+    private BigDecimal areaCompanyErrNumber;
+
+
+    /***
+     *  总报价
+     */
+    @ApiModelProperty("总报价")
+    private BigDecimal allNumber;
+
+
+    /***
+     *  成功报价数
+     */
+    @ApiModelProperty("成功报价数")
+    private BigDecimal orderSuccessNumber;
+
+    /***
+     *  成功报价数
+     */
+    @ApiModelProperty("人工审核数")
+    private BigDecimal numberManual;
+
+    /***
+     *  成功报价率
+     */
+    @ApiModelProperty("成功报价率")
+    private BigDecimal orderSuccessNumberRate;
+
 }

+ 36 - 0
src/main/java/com/ydtech/modules/admin/service/impl/CompanyDataReportServiceImpl.java

@@ -13,9 +13,11 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 
 /**
  *  @version
@@ -62,6 +64,24 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
 
         Page<CompanyQutationCountDataDto> resultSubOrder = insAreaCompanyMapper.queryCompanyQutationCountDataPage(companyQutationCountDataQueryDto, page);
         Long total = this.insAreaCompanyMapper.queryCompanyQutationCountDataPageTotal(companyQutationCountDataQueryDto);
+
+        List<CompanyQutationCountDataDto> records = resultSubOrder.getRecords();
+        for (CompanyQutationCountDataDto  item :records){
+            String companyId = item.getCompanyId();
+            String parterCompanyId = item.getParterCompanyId();
+
+            companyQutationCountDataQueryDto.setCompanyId(companyId);
+            companyQutationCountDataQueryDto.setParterCompanyId(parterCompanyId);
+            CompanyQutationCountDataDto   errItem=  insAreaCompanyMapper.getInsAreaCompanyError(companyQutationCountDataQueryDto);
+            if(ObjectUtils.isNotEmpty(errItem)){
+                BigDecimal areaCompanyErrNumber = errItem.getAreaCompanyErrNumber();  //失败报价数
+                BigDecimal orderSuccessNumber = item.getOrderSuccessNumber();//成功报价数
+                BigDecimal allNumber = this.calculateTotal(areaCompanyErrNumber, orderSuccessNumber, null);
+                item.setAllNumber(allNumber);
+                item.setAreaCompanyErrNumber(areaCompanyErrNumber);
+                item.setOrderSuccessNumberRate(item.getOrderSuccessNumber().divide(item.getAllNumber()));
+            }
+        }
         resultSubOrder.setTotal(total);
         return new BasePageResult<>(companyQutationCountDataQueryDto.getPageNum(), page.getSize(), resultSubOrder.getTotal(), page.getPages(),
                 resultSubOrder.getRecords());
@@ -146,6 +166,22 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
         }
         return ordersDataDto;
     }
+    private BigDecimal calculateTotal(BigDecimal value1, BigDecimal value2, BigDecimal value3) {
+        BigDecimal total = BigDecimal.ZERO;
+
+        if (value1 != null) {
+            total = total.add(value1);
+        }
+
+        if (value2 != null) {
+            total = total.add(value2);
+        }
+        if (value3 != null) {
+            total = total.add(value3);
+        }
+
+        return total;
+    }
 }
 
 

+ 3 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java

@@ -281,6 +281,9 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
     Long queryCompanyQutationCountDataPageTotal(@Param("vo") CompanyQutationCountDataQueryDto companyQutationCountDataQueryDto);
 
 
+    CompanyQutationCountDataDto getInsAreaCompanyError(@Param("vo") CompanyQutationCountDataQueryDto companyQutationCountDataQueryDto);
+
+
 }
 
 

+ 42 - 9
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -846,44 +846,77 @@
     <select id="queryCompanyQutationCountDataPage"
             resultType="com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto">
         SELECT
-        a.* , (select ins.namesimple  from  esm_ins_company ins  where  a.parterCompanyId = ins.id)   as  "parterCompanyName"
+        a.* ,
+        (select ins.namesimple from esm_ins_company
+        ins where a.parterCompanyId = ins.id) as "parterCompanyName"
         FROM
         (
         SELECT
+        count(agree.partner_companies_id) as "orderSuccessNumber",
         agree.insurance_company AS companyName,
         agree.partner_companies_id AS parterCompanyId,
+        iac.company_id as "companId",
         count( iac.orderstatus ) AS qutationCount,
+        count( iac.id ) AS orderSuccessNumberRate,
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END )/ count( iac.orderstatus ) AS passRate,
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )/ count( iac.orderstatus ) AS closeRate,
-        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )/ count( iac.orderstatus ) AS contributionRate
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )/ count( iac.orderstatus ) AS contributionRate,
+        COUNT(CASE WHEN  agree.audit_type =1 and ifa.auditstatus =1 and iac.orderstatus =3 THEN 1 END) as "numberManual"
         FROM
         ins_area_company iac
         LEFT JOIN ptl_agreement agree ON iac.agreement_id = agree.id
-
         LEFT JOIN ins_orders io ON iac.orderno = io.orderno
         LEFT JOIN sys_dept sd ON sd.id = io.deptid
+        LEFT JOIN ins_fee_audit ifa  on ifa.ins_order_no =iac.id
         WHERE
         agree.id IS NOT NULL
         <if test="vo.companyId  != null  and  vo.companyId!='' ">
-            agree.insurance_company_id = #{vo.companyId}
+            AND agree.insurance_company_id = #{vo.companyId}
         </if>
         <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
-            agree.partner_companies_id = #{vo.parterCompanyId}
+            AND agree.partner_companies_id = #{vo.parterCompanyId}
         </if>
         <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
-            AND  iac.createtime  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            AND iac.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
         </if>
         <if test="vo.managementSource  != null  and  vo.managementSource!=''">
-            AND  sd.management_source  =#{vo.managementSource}
+            AND sd.management_source =#{vo.managementSource}
         </if>
         GROUP BY
         agree.insurance_company,
+        iac.company_id,
         agree.partner_companies_id
         ) a
     </select>
 
+    <select id="getInsAreaCompanyError"
+            resultType="com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto">
+        SELECT
+        count(iace.id) as "areaCompanyErrNumber"
+        FROM
+        ins_area_company_error iace
+        LEFT JOIN ins_orders io ON iace.orderno = io.orderno
+        LEFT JOIN sys_dept sd ON sd.id = io.deptid
+        LEFT JOIN ptl_agreement agree ON iace.agreement_id = agree.id
+
+        WHERE
+        agree.id IS NOT NULL
+        <if test="vo.companyId  != null  and  vo.companyId!='' ">
+            AND agree.insurance_company_id = #{vo.companyId}
+        </if>
+        <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
+            AND agree.partner_companies_id = #{vo.parterCompanyId}
+        </if>
+        <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+            AND iace.create_time BETWEEN #{vo.beginDate} AND #{vo.endDate}
+        </if>
+        <if test="vo.managementSource  != null  and  vo.managementSource!=''">
+            AND sd.management_source =#{vo.managementSource}
+        </if>
+    </select>
+
     <select id="queryCompanyQutationCountDataPageTotal"
             resultType="java.lang.Long">
         SELECT
@@ -900,10 +933,10 @@
         WHERE
         agree.id IS NOT NULL
         <if test="vo.companyId  != null  and  vo.companyId!='' ">
-            agree.insurance_company_id = #{vo.companyId}
+            AND  agree.insurance_company_id = #{vo.companyId}
         </if>
         <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
-            agree.partner_companies_id = #{vo.parterCompanyId}
+            AND agree.partner_companies_id = #{vo.parterCompanyId}
         </if>
         <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
             AND  iac.createtime  BETWEEN #{vo.beginDate} AND #{vo.endDate}