|
@@ -281,4 +281,158 @@
|
|
<include refid="majorDeclareTodoCheck"/>
|
|
<include refid="majorDeclareTodoCheck"/>
|
|
limit 8
|
|
limit 8
|
|
</select>
|
|
</select>
|
|
|
|
+
|
|
|
|
+ <!--获取资产评估人员提成申报列表-->
|
|
|
|
+ <select id="assetsEvaluateDeclarePage" resultType="com.dayou.vo.CommissionDeclareVO">
|
|
|
|
+ select bus.*,dd.name as commissionType from (
|
|
|
|
+ SELECT
|
|
|
|
+ IFNULL(
|
|
|
|
+ cd.id,
|
|
|
|
+ ( SELECT id FROM commission_declare WHERE deleted = 0 AND business_id = assets.businessId AND production_id IS NULL )) id,
|
|
|
|
+ IFNULL(
|
|
|
|
+ cd.commission_rate_id,
|
|
|
|
+ ( SELECT commission_rate_id FROM commission_declare WHERE deleted = 0 AND business_id = assets.businessId AND production_id IS NULL )) commission_rate_id,
|
|
|
|
+ IFNULL(
|
|
|
|
+ cd.declare_result,
|
|
|
|
+ ( SELECT declare_result FROM commission_declare WHERE deleted = 0 AND business_id = assets.businessId AND production_id IS NULL )) declare_result,
|
|
|
|
+ assets.*
|
|
|
|
+ FROM
|
|
|
|
+ (
|
|
|
|
+ SELECT
|
|
|
|
+ assets.id AS businessId,
|
|
|
|
+ ap.id AS productionId,
|
|
|
|
+ ifnull( ap.id, assets.id ) AS aId,
|
|
|
|
+ assets.NAME AS orderName,
|
|
|
|
+ assets.order_id,
|
|
|
|
+ assets.bailor_contact_name,
|
|
|
|
+ assets.bailor_contact_tel,
|
|
|
|
+ assets.bailor,
|
|
|
|
+ assets.created AS orderCreated,
|
|
|
|
+ u.NAME AS clientManager,
|
|
|
|
+ u1.NAME AS principal,
|
|
|
|
+ cc1.NAME AS clienteleName,
|
|
|
|
+ cc2.NAME AS clienteleSubName,
|
|
|
|
+ ap.production_no AS reportNo,
|
|
|
|
+ ap.created
|
|
|
|
+ FROM
|
|
|
|
+ assets
|
|
|
|
+ LEFT JOIN ( SELECT id, business_id, production_no, create_production_date, created FROM assets_production WHERE deleted = 0 AND production_type != 'STATEMENT' ) ap ON assets.id = ap.business_id
|
|
|
|
+ LEFT JOIN USER u ON u.id = assets.client_manager_id
|
|
|
|
+ LEFT JOIN USER u1 ON u1.id = assets.principal_id
|
|
|
|
+ LEFT JOIN customer_company cc1 ON cc1.id = assets.clientele_id
|
|
|
|
+ LEFT JOIN customer_company cc2 ON cc2.id = assets.clientele_sub_id
|
|
|
|
+ WHERE
|
|
|
|
+ assets.deleted = 0
|
|
|
|
+ AND ap.create_production_date IS NOT NULL
|
|
|
|
+ AND assets.principal_id = #{evaluateUserId}) assets
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ id,
|
|
|
|
+ ifnull( production_id, business_id ) AS xId,
|
|
|
|
+ commission_rate_id,
|
|
|
|
+ declare_result
|
|
|
|
+ FROM
|
|
|
|
+ commission_declare
|
|
|
|
+ WHERE
|
|
|
|
+ deleted = 0
|
|
|
|
+ AND declare_user_id = #{evaluateUserId}) cd ON assets.aId = cd.xId) bus
|
|
|
|
+ left join business_commission_rate bcr on bus.commission_rate_id = bcr.id
|
|
|
|
+ left join dict_data dd on dd.id = bcr.business_cate_id
|
|
|
|
+ <where>
|
|
|
|
+ <if test="declare!=null and declare.orderId!=null and declare.orderId!=''">
|
|
|
|
+ and bus.order_id like concat ('%',#{declare.orderId},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="declare!=null and declare.name!=null and declare.name!=''">
|
|
|
|
+ and (bus.orderName like concat ('%',#{declare.name},'%') or bus.name like concat ('%',#{declare.name},'%') )
|
|
|
|
+ </if>
|
|
|
|
+ <if test="declare!=null and declare.reportNo!=null and declare.reportNo!=''">
|
|
|
|
+ and bus.report_no like concat ('%',#{declare.reportNo},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="declare!=null and declare.commissionRateId!=null ">
|
|
|
|
+ and bus.commission_rate_id = #{declare.commissionRateId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="declare!=null and declare.declareType!=null and declare.declareType==true">
|
|
|
|
+ and bus.productionId is not null
|
|
|
|
+ </if>
|
|
|
|
+ <if test="declare!=null and declare.declareType!=null and declare.declareType==false">
|
|
|
|
+ and bus.productionId is null
|
|
|
|
+ </if>
|
|
|
|
+ <if test="declare!=null and declare.declareResult!=null and declare.declareResult=='待申报'">
|
|
|
|
+ and bus.declare_result is null
|
|
|
|
+ </if>
|
|
|
|
+ <if test="declare!=null and declare.declareResult!=null and declare.declareResult=='审核中'">
|
|
|
|
+ and bus.declare_result = #{declare.declareResult}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="declare!=null and declare.declareResult!=null and declare.declareResult=='审核通过'">
|
|
|
|
+ and bus.declare_result = #{declare.declareResult}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="declare!=null and declare.declareResult!=null and declare.declareResult=='审核拒绝'">
|
|
|
|
+ and bus.declare_result = #{declare.declareResult}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ order by bus.created DESC ,bus.orderCreated DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!--资产待办绩效申报列表-->
|
|
|
|
+ <select id="assetsTodoCheckPage" resultType="com.dayou.vo.CommissionDeclareTodoCheckVO">
|
|
|
|
+ SELECT
|
|
|
|
+ wfni.id,
|
|
|
|
+ wtr.id AS taskId,
|
|
|
|
+ wfni.id AS currentNodeId,
|
|
|
|
+ wfni.business_id,
|
|
|
|
+ wfni.business_type,
|
|
|
|
+ assetsInfo.orderName,
|
|
|
|
+ assetsInfo.assets_name,
|
|
|
|
+ assetsInfo.reportNo,
|
|
|
|
+ assetsInfo.order_id,
|
|
|
|
+ wfni.NAME AS nodeName,
|
|
|
|
+ wfni.CODE AS nodeCode,
|
|
|
|
+ u.NAME AS handler,
|
|
|
|
+ u1.name as declareUser,
|
|
|
|
+ dd.name as businessCate,
|
|
|
|
+ (case bcr.user_type when 'MARKETER' then '市场人员' when 'EVALUATOR' then '评估人员' else '--' end) as userType,
|
|
|
|
+ bcr.min_ratio as ratio,
|
|
|
|
+ cd.created,
|
|
|
|
+ assetsInfo.prodId
|
|
|
|
+ FROM
|
|
|
|
+ work_task_record wtr
|
|
|
|
+ INNER JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ wn.NAME,
|
|
|
|
+ wn.CODE,
|
|
|
|
+ wfni.id,
|
|
|
|
+ wfni.business_id,
|
|
|
|
+ wfni.state,
|
|
|
|
+ wfni.business_type
|
|
|
|
+ FROM
|
|
|
|
+ work_flow_node_instance wfni
|
|
|
|
+ LEFT JOIN work_node wn ON wn.id = wfni.node_id
|
|
|
|
+ WHERE
|
|
|
|
+ wfni.business_type IN ( 'COMMISSION_DECLARE_ASSET_MARKET', 'COMMISSION_DECLARE_ASSET_EVALUATE' )
|
|
|
|
+ AND wfni.state = 'PENDING'
|
|
|
|
+ AND wfni.deleted = 0
|
|
|
|
+ AND wn.deleted = 0
|
|
|
|
+ ) wfni ON wtr.instance_id = wfni.id
|
|
|
|
+ INNER JOIN ( SELECT id, ifnull( production_id, business_id ) AS xId, commission_rate_id, declare_result, declare_user_id,created FROM commission_declare WHERE deleted = 0 ) cd ON cd.id = wfni.business_id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ ifnull( ap.id, assets.id ) AS aId,
|
|
|
|
+ assets.NAME AS orderName,
|
|
|
|
+ assets.order_id,
|
|
|
|
+ ap.assets_name,
|
|
|
|
+ ap.production_no AS reportNo ,
|
|
|
|
+ ap.id as prodId
|
|
|
|
+ FROM
|
|
|
|
+ assets
|
|
|
|
+ LEFT JOIN ( SELECT id, assets_name, business_id, production_no FROM assets_production WHERE deleted = 0 ) ap ON assets.id = ap.business_id
|
|
|
|
+ ) assetsInfo ON assetsInfo.aId = cd.xId
|
|
|
|
+ LEFT JOIN user u ON u.id = wtr.handler_id
|
|
|
|
+ left join business_commission_rate bcr on bcr.id = cd.commission_rate_id
|
|
|
|
+ left join dict_data dd on dd.id = bcr.business_cate_id
|
|
|
|
+ left join user u1 on u1.id = cd.declare_user_id
|
|
|
|
+ WHERE
|
|
|
|
+ wtr.handler_id = #{checkVO.handlerId}
|
|
|
|
+ AND u.deleted = 0
|
|
|
|
+ AND wtr.deleted = 0
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|