Explorar o código

分销费手续费管理费报表基础架构

cuixinpeng %!s(int64=2) %!d(string=hai) anos
pai
achega
f536558e90

+ 81 - 0
src/main/java/com/ydtech/modules/report/model/vo/PayApplyUserReportListResVo.java

@@ -0,0 +1,81 @@
+package com.ydtech.modules.report.model.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @Author: CXP
+ * @Date: 2024/1/17 21:54
+ */
+@Data
+public class PayApplyUserReportListResVo {
+
+    @ExcelProperty(value = "机构名称")
+    @TableField(value = "institution")
+    private String institution;
+
+    @ExcelProperty(value = "团队名称")
+    @TableField(value = "deptname")
+    private String deptname;
+
+    @ExcelProperty(value = "业务员名称")
+    @TableField(value = "username")
+    private String username;
+
+    @ExcelProperty(value = "单号")
+    @TableField(value = "policyno")
+    private String policyno;
+
+    @ExcelProperty(value = "产品名称")
+    @TableField(value = "riskcode")
+    private String riskcode;
+
+    @ExcelProperty(value = "待付手续费")
+    @TableField(value = "wait_pay_costs_premiums")
+    private BigDecimal waitPayCostsPremiums;
+
+
+    @ExcelProperty(value = "已付手续费")
+    @TableField(value = "paid_costs_premiums")
+    private BigDecimal paidCostsPremiums;
+
+
+    @ExcelProperty(value = "手续费合计")
+    @TableField(value = "sum_costs_premiums")
+    private BigDecimal sumCostsPremiums;
+
+
+    @ExcelProperty(value = "待付分销费")
+    @TableField(value = "wait_pay_retail_premiums")
+    private BigDecimal waitPayRetailPremiums;
+
+    @ExcelProperty(value = "已付分销费")
+    @TableField(value = "paid_retail_premiums")
+    private BigDecimal paidRetailPremiums;
+
+
+    @ExcelProperty(value = "总分销费")
+    @TableField(value = "sum_retail_premiums")
+    private BigDecimal sumRetailPremiums;
+
+    /**
+     * 机构Id
+     */
+    @ExcelIgnore
+    private String institutionId;
+    /**
+     * 团队Id
+     */
+    @ExcelIgnore
+    private String deptId;
+    /**
+     * 人员Id
+     */
+    @ExcelIgnore
+    private String userId;
+
+}

+ 55 - 4
src/main/resources/mapper/modules/report/ReportInsurancePolicyMapper.xml

@@ -751,6 +751,7 @@
 
 
 
+    <!--===========================================分割线=======报表手续费和分销费=================================================-->
 
     <resultMap id="PayApplyUserReportDataMap" type="com.ydtech.modules.report.model.vo.PayApplyUserReportResVo">
         <result property="institution" column="institution" jdbcType="VARCHAR"/>
@@ -766,7 +767,10 @@
 
 
     <select id="queryPayApplyUserReportData"  resultMap="PayApplyUserReportDataMap">
-        SELECT deptid,userid,
+        SELECT deptid,
+            <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
+                userid,
+            </if>
           SUM( CASE feetype  WHEN '1'  THEN totalfee  ELSE 0  END )  AS sum_costs_premiums,
           SUM( CASE feetype  WHEN '1'  THEN paidfee  ELSE 0  END )  AS paid_costs_premiums,
           SUM( CASE feetype  WHEN '1'  THEN totalfee-paidfee  ELSE 0  END )  AS wait_pay_costs_premiums,
@@ -804,7 +808,10 @@
         select
         count(1)
         from (
-        SELECT deptid,userid,
+        SELECT deptid,
+        <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
+            userid,
+        </if>
         SUM( CASE feetype  WHEN '1'  THEN totalfee  ELSE 0  END )  AS sum_costs_premiums,
         SUM( CASE feetype  WHEN '1'  THEN paidfee  ELSE 0  END )  AS paid_costs_premiums,
         SUM( CASE feetype  WHEN '1'  THEN totalfee-paidfee  ELSE 0  END )  AS wait_pay_costs_premiums,
@@ -839,8 +846,52 @@
         </if>
         ) as s
     </select>
-
-
+    <resultMap id="PayApplyUserReportListDataMap" type="com.ydtech.modules.report.model.vo.PayApplyUserReportResVo">
+        <result property="institution" column="institution" jdbcType="VARCHAR"/>
+        <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
+        <result property="username" column="username" jdbcType="VARCHAR"/>
+        <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
+        <result property="policyno" column="policyno" jdbcType="VARCHAR"/>
+        <result property="riskcode" column="riskcode" jdbcType="VARCHAR"/>
+        <result property="waitPayCostsPremiums" column="wait_pay_costs_premiums" jdbcType="DECIMAL"/>
+        <result property="paidCostsPremiums" column="paid_costs_premiums" jdbcType="DECIMAL"/>
+        <result property="sumCostsPremiums" column="sum_costs_premiums" jdbcType="DECIMAL"/>
+        <result property="waitPayRetailPremiums" column="wait_pay_retail_premiums" jdbcType="DECIMAL"/>
+        <result property="paidRetailPremiums" column="paid_retail_premiums" jdbcType="DECIMAL"/>
+        <result property="sumRetailPremiums" column="sum_retail_premiums" jdbcType="DECIMAL"/>
+    </resultMap>
+    <select id="queryPayApplyUserReportList" resultMap="PayApplyUserReportListDataMap">
+        SELECT deptname,username,inscompany,policyno,riskcode,
+          CASE feetype  WHEN '1'  THEN totalfee  ELSE 0  END   AS sum_costs_premiums,
+          CASE feetype  WHEN '1'  THEN paidfee  ELSE 0  END   AS paid_costs_premiums,
+          CASE feetype  WHEN '1'  THEN totalfee-paidfee  ELSE 0  END   AS wait_pay_costs_premiums,
+          CASE feetype  WHEN '2'  THEN totalfee  ELSE 0  END   AS sum_retail_premiums,
+          CASE feetype  WHEN '2'  THEN paidfee  ELSE 0  END  AS paid_retail_premiums,
+          CASE feetype  WHEN '2'  THEN totalfee-paidfee  ELSE 0  END   AS wait_pay_retail_premiums
+        FROM report_payable_basedata  p WHERE 1=1
+        <choose>
+            <!--条件中团队不为空时,直接拼接团队-->
+            <when test="reportReqVo.teamCode != null and reportReqVo.teamCode != ''">
+                and p.deptid = #{reportReqVo.teamCode}
+            </when>
+            <!--条件中团队为空时,使用机构模糊查询-->
+            <otherwise>
+                <if test="reportReqVo.deptId != null and reportReqVo.deptId != ''">
+                    and p.deptid like #{reportReqVo.deptId}"%"
+                </if>
+            </otherwise>
+        </choose>
+        <if test="reportReqVo.userId != null and reportReqVo.userId != ''">
+            and p.userId = #{reportReqVo.userId}
+        </if>
+        <if test="reportReqVo.insCompany != null and reportReqVo.insCompany != ''">
+            and p.inscompany = #{reportReqVo.insCompany}
+        </if>
+        <if test="reportReqVo.quoteStartDate != null and reportReqVo.quoteEndDate != null">
+            and p.signdate  between #{reportReqVo.quoteStartDate} AND #{reportReqVo.quoteEndDate}
+        </if>
+    </select>
+    <!--===========================================分割线=======报表管理费=================================================-->
     <resultMap id="PayApplyDeptReportDataMap" type="com.ydtech.modules.report.model.vo.PayApplyDeptReportResVo">
         <result property="institution" column="institution" jdbcType="VARCHAR"/>
         <result property="deptname" column="deptname" jdbcType="VARCHAR"/>