|
|
@@ -33,13 +33,148 @@
|
|
|
iocui.name as insurName,
|
|
|
CASE io.entry_status
|
|
|
WHEN 1 THEN '车险出单'
|
|
|
- WHEN 2 THEN '待客录单'
|
|
|
+ WHEN 2 THEN '代客录单'
|
|
|
WHEN 3 THEN '补录订单'
|
|
|
ELSE '未知状态'
|
|
|
END AS order_type,
|
|
|
suji.name as name,
|
|
|
su.mobile as mobile,
|
|
|
- suji.type_attr as attrType,
|
|
|
+ CASE suji.type_attr
|
|
|
+ WHEN 1 THEN '前线人员'
|
|
|
+ WHEN 2 THEN '后线人员'
|
|
|
+ WHEN 3 THEN '合伙人'
|
|
|
+ WHEN 4 THEN '工作室管理员'
|
|
|
+ WHEN 5 THEN '团队'
|
|
|
+ WHEN 6 THEN '个代'
|
|
|
+ WHEN 7 THEN '渠道'
|
|
|
+ WHEN 8 THEN '电销'
|
|
|
+ ELSE ''
|
|
|
+ END AS attrType,
|
|
|
+ io.signing_time as signingTime,
|
|
|
+ io.create_time as quotationTime, sua.username as dockingPerson,
|
|
|
+ pa.agreement_abbreviation as agreementName,io.product_name as productName,
|
|
|
+ ioc.jq_premium as jqPremium, ioc.sy_premium as syPremium, ioc.jy_premium as jyPremium,
|
|
|
+ ioc.sum_premium as sumPremium,sd.name as deptName,ifa.create_time as createTime,
|
|
|
+ ifa.create_by as createBy,io.pay_time as payTime, ifa.audit_time as auditTime,
|
|
|
+ ifa.audit_user as auditUser, ifa.refuse
|
|
|
+ FROM ins_fee_audit ifa
|
|
|
+ LEFT JOIN ins_orders as io on ifa.order_no = io.id
|
|
|
+ LEFT JOIN ins_orders_car_info as ioci on io.id = ioci.order_no
|
|
|
+ LEFT JOIN ins_orders_car_user_info as iocui on io.id = iocui.order_no and iocui.policy_person_type = 3
|
|
|
+ LEFT JOIN sys_user qsu on qsu.mobile = io.real_quote_user_id
|
|
|
+ LEFT JOIN sys_user_jzg_info suji ON suji.user_id = qsu.id and suji.system_code = #{param.systemCode}
|
|
|
+ LEFT JOIN sys_user su on su.id = io.real_quote_user_id
|
|
|
+ LEFT JOIN sys_dept sd on suji.dept_id = sd.id
|
|
|
+ LEFT JOIN ptl_agreement pa on io.agreement_id = pa.id
|
|
|
+ LEFT JOIN sys_user sua on sua.id = pa.custodian_id
|
|
|
+ LEFT JOIN ins_orders_costs ioc on ioc.order_no = io.id
|
|
|
+ LEFT JOIN ins_orders_external_policy ioep on ioep.order_no = io.id
|
|
|
+ <where>
|
|
|
+ <choose>
|
|
|
+ <when test="param.receiveUser != null and param.receiveUser != ''">
|
|
|
+ and ifa.receive_user = #{param.receiveUser}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and ifa.receive_user is NULL
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="param.auditType != null">
|
|
|
+ and ifa.audit_type = #{param.auditType}
|
|
|
+ </if>
|
|
|
+ <if test="param.isProblem != null">
|
|
|
+ and ifa.is_problem = #{param.isProblem}
|
|
|
+ </if>
|
|
|
+ <if test="param.licenseNo != null and param.licenseNo != ''">
|
|
|
+ and ioci.license_no like concat('%',#{param.licenseNo},'%')
|
|
|
+ </if>
|
|
|
+ <if test="param.attrType != null ">
|
|
|
+ and suji.type_attr = #{param.attrType}
|
|
|
+ </if>
|
|
|
+ <if test="param.salesman != null and param.salesman != ''">
|
|
|
+ and (su.username = #{param.salesman} or su.mobile = #{param.salesman})
|
|
|
+ </if>
|
|
|
+ <if test="param.orderStatus != null ">
|
|
|
+ and io.order_status = #{param.orderStatus}
|
|
|
+ </if>
|
|
|
+ <if test="param.orderType != null and param.orderType != ''">
|
|
|
+ and io.entry_status = #{param.orderType}
|
|
|
+ </if>
|
|
|
+ <if test="param.companyIdList != null and param.companyIdList.size() > 0" >
|
|
|
+ AND io.company_id in
|
|
|
+ <foreach collection="param.companyIdList" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="param.deptId != null and param.deptId != ''">
|
|
|
+ and suji.dept_id = #{param.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="param.insurName != null and param.insurName != ''">
|
|
|
+ and iocui.name = #{param.insurName}
|
|
|
+ </if>
|
|
|
+ <if test="param.quotationTimeStart != null and param.quotationTimeEnd != null">
|
|
|
+ and DATE_FORMAT(io.create_time, '%Y-%m-%d') between #{param.quotationTimeStart} AND #{param.quotationTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="param.signingTimeStart != null and param.signingTimeEnd != null">
|
|
|
+ and DATE_FORMAT(io.signing_time, '%Y-%m-%d') between #{param.signingTimeStart} AND #{param.signingTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="param.orderNo != null and param.orderNo != ''">
|
|
|
+ and ifa.order_no = #{param.orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="param.agreementId != null and param.agreementId != ''">
|
|
|
+ and pa.id = #{param.agreementId}
|
|
|
+ </if>
|
|
|
+ <if test="param.productName != null and param.productName != ''">
|
|
|
+ and io.product_name = #{param.productName}
|
|
|
+ </if>
|
|
|
+ <if test="param.payTimeStart != null and param.payTimeEnd != null">
|
|
|
+ and DATE_FORMAT(io.pay_time, '%Y-%m-%d') between #{param.payTimeStart} AND #{param.payTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="param.ciPolicyNumber != null and param.ciPolicyNumber != ''">
|
|
|
+ and ioep.jq_policy = #{param.ciPolicyNumber}
|
|
|
+ </if>
|
|
|
+ <if test="param.biPolicyNumber != null and param.biPolicyNumber != ''">
|
|
|
+ and ioep.sy_policy = #{param.biPolicyNumber}
|
|
|
+ </if>
|
|
|
+ <if test="param.niPolicyNumber != null and param.niPolicyNumber != ''">
|
|
|
+ and ioep.no_policy = #{param.niPolicyNumber}
|
|
|
+ </if>
|
|
|
+ <if test="param.auditTimeStart != null and param.auditTimeEnd != null">
|
|
|
+ and DATE_FORMAT(ifa.audit_time, '%Y-%m-%d') between #{param.auditTimeStart} AND #{param.auditTimeEnd}
|
|
|
+ </if>
|
|
|
+ <if test="param.auditUser != null and param.auditUser != ''">
|
|
|
+ and ifa.audit_user = #{param.auditUser}
|
|
|
+ </if>
|
|
|
+ <if test="param.auditStatus != null and param.auditStatus != ''">
|
|
|
+ and ifa.audit_status = #{param.auditStatus}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY io.create_time desc
|
|
|
+ </select>
|
|
|
+ <select id="queryList" resultType="com.jzg.commons.entity.orders.vo.FeeAuditVo">
|
|
|
+ SELECT
|
|
|
+ ifa.order_no as orderNo,
|
|
|
+ io.company_name as companyName,
|
|
|
+ ioci.license_no AS licenseNo,
|
|
|
+ iocui.name as insurName,
|
|
|
+ CASE io.entry_status
|
|
|
+ WHEN 1 THEN '车险出单'
|
|
|
+ WHEN 2 THEN '代客录单'
|
|
|
+ WHEN 3 THEN '补录订单'
|
|
|
+ ELSE '未知状态'
|
|
|
+ END AS order_type,
|
|
|
+ suji.name as name,
|
|
|
+ su.mobile as mobile,
|
|
|
+ CASE suji.type_attr
|
|
|
+ WHEN 1 THEN '前线人员'
|
|
|
+ WHEN 2 THEN '后线人员'
|
|
|
+ WHEN 3 THEN '合伙人'
|
|
|
+ WHEN 4 THEN '工作室管理员'
|
|
|
+ WHEN 5 THEN '团队'
|
|
|
+ WHEN 6 THEN '个代'
|
|
|
+ WHEN 7 THEN '渠道'
|
|
|
+ WHEN 8 THEN '电销'
|
|
|
+ ELSE ''
|
|
|
+ END AS attrType,
|
|
|
io.signing_time as signingTime,
|
|
|
io.create_time as quotationTime, sua.username as dockingPerson,
|
|
|
pa.agreement_abbreviation as agreementName,io.product_name as productName,
|