Selaa lähdekoodia

1.控制台业务数据

wuhp 2 vuotta sitten
vanhempi
commit
9e246208a6

+ 34 - 0
src/main/java/com/ydtech/modules/admin/controller/taskStatistics/TaskStatisticsController.java

@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 /**
  * @description:   任务统计
  * @author: whp
@@ -109,6 +111,38 @@ public class TaskStatisticsController {
             return HttpResult.error("查询错误"+e.getMessage());
         }
     }
+    /**
+     * @description:   控制台-业务数据
+     * @author: whp
+     * @date: 2024/8/13
+     **/
+    @PostMapping("getBusinessData")
+    @ApiOperation(value = "控制台-业务数据")
+    public HttpResult<IPage<TaskStatisticsDto>> getBusinessData(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+        try{
+            IPage<TaskStatisticsDto> result = taskStatisticsService.getBusinessData(taskStatisticsVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
+    /**
+     * @description:   控制台-业务数据 - 保险分布
+     * @author: whp
+     * @date: 2024/8/13
+     **/
+    @PostMapping("getDistribution")
+    @ApiOperation(value = "控制台-业务数据-保险分布")
+    public HttpResult<List<TaskStatisticsDto>> getDistribution(@RequestBody TaskStatisticsVo taskStatisticsVo) {
+        try{
+            List<TaskStatisticsDto> result = taskStatisticsService.getDistribution(taskStatisticsVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+
 
 
 }

+ 23 - 0
src/main/java/com/ydtech/modules/admin/model/dto/TaskStatisticsDto.java

@@ -70,4 +70,27 @@ public class TaskStatisticsDto {
 
     @ApiModelProperty(value = "报价笔数")
     private String orderNumber;
+
+    @ApiModelProperty(value = "单均保费")
+    private BigDecimal averagePremium;
+
+    @ApiModelProperty(value = "人员数量")
+    private BigDecimal userNumber;
+
+    @ApiModelProperty(value = "人均产能")
+    private BigDecimal perCapitaAmount;
+
+    @ApiModelProperty(value = "保险公司编码")
+    private String companyId;
+
+    @ApiModelProperty(value = "合作公司编码")
+    private String parterCompanyId;
+
+
+    @ApiModelProperty(value = "报价状态")
+    private String quotationStatus;
+
+
+    @ApiModelProperty(value = "保险公司图标")
+    private String logo;
 }

+ 5 - 0
src/main/java/com/ydtech/modules/admin/model/report/company/CompanyQutationCountDataQueryDto.java

@@ -42,4 +42,9 @@ public class CompanyQutationCountDataQueryDto {
     @ApiModelProperty("时间类型  1.近1月 2.近3月  3.近半年")
     private String  dateType;
 
+
+    @ApiModelProperty("机构来源(1-渠道、2-个代)")
+    private String  managementSource;
+
+
 }

+ 3 - 0
src/main/java/com/ydtech/modules/admin/model/vo/QxFrontlineAgentVo.java

@@ -58,5 +58,8 @@ public class QxFrontlineAgentVo implements Serializable {
     private String level;
 
 
+    @ApiModelProperty(value = "机构所属")
+    private String deptId;
+
 
 }

+ 17 - 0
src/main/java/com/ydtech/modules/admin/model/vo/TaskStatisticsVo.java

@@ -50,6 +50,23 @@ public class TaskStatisticsVo implements Serializable {
     @ApiModelProperty(value = "投保险种")
     private String riskCode;
 
+    @ApiModelProperty(value = "保险公司编码")
+    private String companyId;
+
+    @ApiModelProperty(value = "合作公司编码")
+    private String parterCompanyId;
+
+
+    @ApiModelProperty(value = "报价状态")
+    private String quotationStatus;
+
+    @ApiModelProperty(value = "保费排序")
+    private String orderSort;
+
+    @ApiModelProperty(value = "保费排序")
+    private String userNumberSort;
+
+
 
 
 

+ 14 - 0
src/main/java/com/ydtech/modules/admin/service/TaskStatisticsService.java

@@ -5,6 +5,8 @@ import com.ydtech.modules.admin.model.dto.TaskStatisticsDto;
 import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 
+import java.util.List;
+
 /**
  * @description:   任务统计
  * @author: whp
@@ -36,4 +38,16 @@ public interface TaskStatisticsService {
      * @date: 2024/8/12
      **/
     IPage<TaskStatisticsDto> totalQuotation(TaskStatisticsVo taskStatisticsVo);
+    /**
+     * @description:   控制台-业务数据
+     * @author: whp
+     * @date: 2024/8/13
+     **/
+    IPage<TaskStatisticsDto> getBusinessData(TaskStatisticsVo taskStatisticsVo);
+    /**
+     * @description:   控制台-业务数据 - 保险分布
+     * @author: whp
+     * @date: 2024/8/13
+     **/
+    List<TaskStatisticsDto> getDistribution(TaskStatisticsVo taskStatisticsVo);
 }

+ 32 - 0
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -19,6 +19,7 @@ import com.ydtech.modules.order.entity.InsAreaCompany;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -109,6 +110,37 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         IPage<TaskStatisticsDto> list = this.insAreaCompanyMapper.totalQuotation(page,taskStatisticsVo);
         return list;
     }
+    /**
+     * @description:   控制台-业务数据
+     * @author: whp
+     * @date: 2024/8/13
+     **/
+    @Override
+    public IPage<TaskStatisticsDto> getBusinessData(TaskStatisticsVo taskStatisticsVo) {
+        PageVo<TaskStatisticsVo> pageVo = new PageVo<>();
+        Page page = new Page(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageSize());
+        pageVo.setPageNum(taskStatisticsVo.getPageNum());
+        pageVo.setPageSize(taskStatisticsVo.getPageSize());
+        IPage<TaskStatisticsDto> list = this.insAreaCompanyMapper.getBusinessData(page,taskStatisticsVo);
+        return list;
+    }
+    /**
+     * @description:   控制台-业务数据 - 保险分布
+     * @author: whp
+     * @date: 2024/8/13
+     **/
+    @Override
+    public List<TaskStatisticsDto> getDistribution(TaskStatisticsVo taskStatisticsVo) {
+        List<TaskStatisticsDto> result = new ArrayList<>();
+         //0 报价中 1 待核保  2 已核保代缴费  3 已承保  4  核保退回
+        for (int i = 0; i < 5; i++) {
+            taskStatisticsVo.setQuotationStatus(i+"");
+            TaskStatisticsDto taskStatisticsDtoItem = insAreaCompanyMapper.getDistribution(taskStatisticsVo);
+            taskStatisticsDtoItem.setQuotationStatus(i+"");
+            result.add(taskStatisticsDtoItem);
+        }
+        return result;
+    }
 
 
 }

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

@@ -1376,8 +1376,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             insPlyIncome.setOtherFeevalue(this.calculateTotal(insPlyIncome.getJqOtherCostsPremium(), insPlyIncome.getSyOtherCostsPremium(), insPlyIncome.getNoOtherCostsPremium()));  //跟单费金额
             insPlyIncome.setOtherFeerate(this.calculateTotal(jqOtherCostsProportion, syOtherCostsProportion, noOtherCostsProportion));
             //跟单费比例
-            insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(), insPlyIncome.getOtherFeevalue(), null)); // 总费用 =  手续费+跟单费
-            insPlyIncome.setReceivableAmount(this.calculateTotal(insPlyIncome.getCommissionFeevalue(), insPlyIncome.getOtherFeevalue(), null));
             //应收比例 交强应收比例=交强手续费比例+交强非跟单比例
             insPlyIncome.setJqReceivableProportion(this.calculateTotal(jqSuperviseCostsProportion, jqOtherCostsProportion, null)); //交强应收
             insPlyIncome.setSyReceivableProportion(this.calculateTotal(sySuperviseCostsProportion, syOtherCostsProportion, null)); //商业应收
@@ -1388,6 +1386,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             if(insPlyIncomeVo.getPtOtherFeevalue()!=null  &&  insPlyIncomeVo.getPtOtherFeevalue().compareTo(BigDecimal.ZERO) >0){
                 insPlyIncome.setOtherFeevalue(insPlyIncomeVo.getPtOtherFeevalue());
             }
+            insPlyIncome.setAllFeeValue(this.calculateTotal(insPlyIncome.getCommissionFeevalue(), insPlyIncome.getOtherFeevalue(), null)); // 总费用 =  手续费+跟单费
+            insPlyIncome.setReceivableAmount(this.calculateTotal(insPlyIncome.getCommissionFeevalue(), insPlyIncome.getOtherFeevalue(), null));
         } else {
             String agreementId = insPlyIncomeVo.getAgreementId();
 

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

@@ -228,6 +228,11 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
      **/
     IPage<TaskStatisticsDto> totalQuotation( @Param("page") Page page,@Param("vo") TaskStatisticsVo taskStatisticsVo);
 
+    IPage<TaskStatisticsDto> getBusinessData( @Param("page") Page page,@Param("vo")  TaskStatisticsVo taskStatisticsVo);
+
+    TaskStatisticsDto getDistribution(@Param("vo")  TaskStatisticsVo taskStatisticsVo);
+
+
 }
 
 

+ 3 - 0
src/main/resources/mapper/modules/esm/EsmUserReferrerMapper.xml

@@ -354,6 +354,9 @@
             <if test="vo.houseId != null and vo.houseId != ''">
                 and sd.id like concat('%',#{vo.houseId},'%')
             </if>
+            <if test="vo.deptId != null and vo.deptId != ''">
+                and sd.id like concat('%',#{vo.deptId},'%')
+            </if>
         </where>
     </select>
 </mapper>

+ 131 - 1
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -860,6 +860,8 @@
             ins_area_company iac
                 LEFT JOIN ptl_agreement agree ON iac.agreement_id = agree.id
                 LEFT JOIN esm_ins_company ins ON agree.partner_companies_id = ins.id
+                LEFT JOIN ins_orders io on iac.orderno = io.orderno
+                LEFT JOIN sys_dept sd on sd.id = io.deptid
         WHERE
             agree.id IS NOT NULL
             <if test="vo.companyId  != null  and  vo.companyId!='' ">
@@ -871,6 +873,9 @@
             <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  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}
+            </if>
         GROUP BY
             agree.insurance_company_id,
             agree.insurance_company,
@@ -1186,7 +1191,7 @@
         agree.insurance_company_id AS companyId,
         agree.insurance_company AS companyName,
         agree.partner_companies_id AS parterCompanyId,
-        ins.NAME AS parterCompanyName,
+        ins.namesimple AS parterCompanyName,
         count(iac.orderstatus) AS orderNumber,
         '-' as bigQutationCount,
         '-' as bigUnderwritingCount,
@@ -1233,4 +1238,129 @@
         ins.NAME
     </select>
 
+    <select id="getBusinessData" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
+
+        select
+            a.companyId as "companyId",
+            a.insuranceCompanyName as "insuranceCompanyName",
+            a.parterCompanyId as "parterCompanyId",
+            a.partnerCompaniesName as "partnerCompaniesName",
+            a.totalPremium as "totalPremium",
+            a.qutationInsureCount as "qutationInsureCount",
+            a.averagePremium as "averagePremium",
+            a.userNumber as "userNumber",
+            a.perCapitaAmount as "perCapitaAmount",
+            b.logo  as "logo"
+        from  (
+        SELECT
+        agree.insurance_company_id AS "companyId",
+        agree.insurance_company AS "insuranceCompanyName",
+        agree.partner_companies_id AS "parterCompanyId",
+        ins.namesimple AS "partnerCompaniesName",
+        sum(iac.sumpremium) as "totalPremium",
+        COUNT(0 ) AS "qutationInsureCount",
+        sum(iac.sumpremium) / COUNT(0 )  AS "averagePremium",
+        COUNT(DISTINCT io.userId) AS "userNumber",
+        sum(iac.sumpremium) / COUNT(DISTINCT io.userId)  as "perCapitaAmount"
+        FROM
+        ins_area_company iac
+        LEFT JOIN ptl_agreement agree ON iac.agreement_id = agree.id
+        LEFT JOIN ins_orders  io  on  io.orderno  = iac.orderno
+        LEFT JOIN esm_ins_company ins ON agree.partner_companies_id = ins.id
+        WHERE
+        agree.id IS NOT NULL
+        and  iac.orderstatus = '3'
+        <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.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
+            AND iac.signing_time BETWEEN #{vo.createtimeStart} AND #{vo.createtimeStart}
+        </if>
+        <if test="vo.provinceId != null and vo.provinceId != ''">
+            and io.deptid like "${vo.provinceId}%"
+        </if>
+        <if test="vo.cityId != null and vo.cityId != ''">
+            and io.deptid like "${vo.cityId}%"
+        </if>
+        <if test="vo.countyId != null and vo.countyId != ''">
+            and io.deptid like "${vo.countyId}%"
+        </if>
+        <if test="vo.houseId != null and vo.houseId != ''">
+            and io.deptid like "${vo.houseId}%"
+        </if>
+        GROUP BY
+        agree.insurance_company_id,
+        agree.insurance_company,
+        agree.partner_companies_id
+        <choose>
+            <when test="vo.orderSort != null and vo.orderSort != '' and  vo.userNumberSort == null ">
+                order by
+                sum(sumpremium) ${vo.orderSort == 'asc' ? 'asc' : 'desc'}
+            </when>
+            <when test="vo.userNumberSort != null and vo.userNumberSort != '' and  vo.orderSort == null ">
+                order by
+                COUNT(DISTINCT io.userId) ${vo.userNumberSort == 'asc' ? 'asc' : 'desc'}
+            </when>
+            <when test="vo.userNumberSort != null and vo.userNumberSort != '' and  vo.orderSort != null and vo.orderSort != ''  ">
+                order by
+                COUNT(DISTINCT io.userId) ${vo.userNumberSort == 'asc' ? 'asc' : 'desc'},   sum(sumpremium) ${vo.orderSort == 'asc' ? 'asc' : 'desc'}
+            </when>
+        </choose>
+        )  a
+        left join  esm_ins_company  b on b.id =a.companyId
+    </select>
+
+
+    <select id="getDistribution" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
+        SELECT
+        agree.insurance_company_id AS "companyId",
+        agree.insurance_company AS "insuranceCompanyName",
+        agree.partner_companies_id AS "parterCompanyId",
+        ins.namesimple AS "partnerCompaniesName",
+        sum(sumpremium) as "totalPremium",
+        COUNT(0) AS "qutationInsureCount",
+        sum(sumpremium) /  COUNT(0) AS "averagePremium",
+        COUNT(DISTINCT io.userId) AS "userNumber",
+        sum(sumpremium) / COUNT(DISTINCT io.userId)  as "perCapitaAmount"
+        FROM
+        ins_area_company iac
+        LEFT JOIN ptl_agreement agree ON iac.agreement_id = agree.id
+        LEFT JOIN ins_orders  io  on  io.orderno  = iac.orderno
+        LEFT JOIN esm_ins_company ins ON agree.partner_companies_id = ins.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.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
+            AND iac.signing_time BETWEEN #{vo.createtimeStart} AND #{vo.createtimeStart}
+        </if>
+        <if test="vo.provinceId != null and vo.provinceId != ''">
+            and io.deptid like "${vo.provinceId}%"
+        </if>
+        <if test="vo.cityId != null and vo.cityId != ''">
+            and io.deptid like "${vo.cityId}%"
+        </if>
+        <if test="vo.countyId != null and vo.countyId != ''">
+            and io.deptid like "${vo.countyId}%"
+        </if>
+        <if test="vo.houseId != null and vo.houseId != ''">
+            and io.deptid like "${vo.houseId}%"
+        </if>
+        <if test="vo.quotationStatus != null and vo.quotationStatus != ''">
+            and iac.orderstatus  =#{vo.quotationStatus}
+        </if>
+        GROUP BY
+        agree.insurance_company_id,
+        agree.insurance_company,
+        agree.partner_companies_id,
+        ins.namesimple
+    </select>
+
 </mapper>