|
@@ -3,35 +3,13 @@
|
|
<mapper namespace="com.qmth.sop.business.mapper.TBDingApplyMapper">
|
|
<mapper namespace="com.qmth.sop.business.mapper.TBDingApplyMapper">
|
|
|
|
|
|
<select id="flowTaskUnDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyUnDoneResult">
|
|
<select id="flowTaskUnDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyUnDoneResult">
|
|
- select t.* from(<include refid="flowTaskUnDoneListHeader"/>
|
|
|
|
- where 1 = 1
|
|
|
|
- <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
|
|
|
|
- and art.ASSIGNEE_ IN
|
|
|
|
- <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
- </if>
|
|
|
|
- <include refid="flowTaskUnDoneListFoot"/>
|
|
|
|
- union all
|
|
|
|
<include refid="flowTaskUnDoneListHeader"/>
|
|
<include refid="flowTaskUnDoneListHeader"/>
|
|
- left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
|
|
|
|
- where
|
|
|
|
- 1 = 1
|
|
|
|
- and art.ASSIGNEE_ is null
|
|
|
|
- <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
|
|
|
|
- and ari.USER_ID_ IN
|
|
|
|
- <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
- </if>
|
|
|
|
- and ari.TYPE_ = 'candidate'
|
|
|
|
- <include refid="flowTaskUnDoneListFoot" />) t order by t.code desc
|
|
|
|
|
|
+ <include refid="flowTaskUnDoneListFoot" /> order by tfcfe.code desc
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<sql id="flowTaskUnDoneListHeader">
|
|
<sql id="flowTaskUnDoneListHeader">
|
|
select
|
|
select
|
|
- distinct cast(art.ASSIGNEE_ as Decimal(24)) as userId,
|
|
|
|
- tfcf.type,
|
|
|
|
|
|
+ distinct tfcf.type,
|
|
tfcfe.code,
|
|
tfcfe.code,
|
|
tffa.status,
|
|
tffa.status,
|
|
tffa.setup,
|
|
tffa.setup,
|
|
@@ -49,9 +27,6 @@
|
|
tfcfe.create_id as createId,
|
|
tfcfe.create_id as createId,
|
|
su.real_name as createRealName,
|
|
su.real_name as createRealName,
|
|
tfcfe.flow_id as flowId,
|
|
tfcfe.flow_id as flowId,
|
|
- art.NAME_ as taskName,
|
|
|
|
- art.TASK_DEF_KEY_ as taskDefKey,
|
|
|
|
- art.ID_ as taskId,
|
|
|
|
tfcfe.flow_process_var as flowProcessVar,
|
|
tfcfe.flow_process_var as flowProcessVar,
|
|
tfcfe.t_f_custom_flow_id as customFlowId,
|
|
tfcfe.t_f_custom_flow_id as customFlowId,
|
|
tfcf.flow_deployment_id as flowDeploymentId,
|
|
tfcf.flow_deployment_id as flowDeploymentId,
|
|
@@ -60,14 +35,16 @@
|
|
tbd.sign_date as exceptionTime,
|
|
tbd.sign_date as exceptionTime,
|
|
tbda.apply_time as applyTime,
|
|
tbda.apply_time as applyTime,
|
|
tbda.reason,
|
|
tbda.reason,
|
|
- (select group_concat(ba.`path` SEPARATOR ';') from basic_attachment ba where find_in_set(ba.id, tbda.attachment_ids)) as attachmentPaths,
|
|
|
|
|
|
+ tbda.attachment_ids as attachmentPaths,
|
|
tbda.create_time as createTime,
|
|
tbda.create_time as createTime,
|
|
- su1.real_name as approveUserName,
|
|
|
|
ss.name as supplierName,
|
|
ss.name as supplierName,
|
|
ss.code as supplierCode,
|
|
ss.code as supplierCode,
|
|
tbs.service_lead_id as serviceUnitLeaderId,
|
|
tbs.service_lead_id as serviceUnitLeaderId,
|
|
tbc.lead_id as regionManagerId,
|
|
tbc.lead_id as regionManagerId,
|
|
- tbc.region_coordinator_id as coordinatorId
|
|
|
|
|
|
+ tbc.region_coordinator_id as coordinatorId,
|
|
|
|
+ art.NAME_ as taskName,
|
|
|
|
+ art.TASK_DEF_KEY_ as taskDefKey,
|
|
|
|
+ (select group_concat(cast(art.ID_ as char)) from ACT_RU_TASK art where art.PROC_INST_ID_ = tffa.flow_id) as taskIdArray
|
|
from
|
|
from
|
|
t_b_ding_apply tbda
|
|
t_b_ding_apply tbda
|
|
left join t_f_custom_flow_entity tfcfe on
|
|
left join t_f_custom_flow_entity tfcfe on
|
|
@@ -76,21 +53,29 @@
|
|
tfcfe.flow_id = tffa.flow_id
|
|
tfcfe.flow_id = tffa.flow_id
|
|
left join t_f_custom_flow tfcf on
|
|
left join t_f_custom_flow tfcf on
|
|
tfcf.id = tfcfe.t_f_custom_flow_id
|
|
tfcf.id = tfcfe.t_f_custom_flow_id
|
|
- left join ACT_RU_TASK art on
|
|
|
|
- art.PROC_INST_ID_ = tfcfe.flow_id
|
|
|
|
- left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
|
|
|
|
- left join t_b_service tbs on tbs.id = tbc.service_id
|
|
|
|
- left join sys_custom sc on sc.id = tbc.custom_id
|
|
|
|
- left join t_b_ding tbd on tbd.id = tbda.ding_id
|
|
|
|
- left join sys_user su ON tbda.create_id = su.id
|
|
|
|
- left join t_b_user_archives tbua on tbua.mobile_number = su.mobile_number
|
|
|
|
- left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbua.id
|
|
|
|
- left join sys_supplier ss on ss.id = tbuas.supplier_id
|
|
|
|
- left join sys_user su1 ON cast(art.ASSIGNEE_ as Decimal(24)) = su1.id
|
|
|
|
|
|
+ left join t_b_crm tbc on
|
|
|
|
+ tbc.crm_no = tfcfe.crm_no
|
|
|
|
+ left join t_b_service tbs on
|
|
|
|
+ tbs.id = tbc.service_id
|
|
|
|
+ left join sys_custom sc on
|
|
|
|
+ sc.id = tbc.custom_id
|
|
|
|
+ left join t_b_ding tbd on
|
|
|
|
+ tbd.id = tbda.ding_id
|
|
|
|
+ left join sys_user su on
|
|
|
|
+ tbda.create_id = su.id
|
|
|
|
+ left join t_b_user_archives tbua on
|
|
|
|
+ tbua.mobile_number = su.mobile_number
|
|
|
|
+ left join t_b_user_archives_supplier tbuas on
|
|
|
|
+ tbuas.user_archives_id = tbua.id
|
|
|
|
+ left join sys_supplier ss on
|
|
|
|
+ ss.id = tbuas.supplier_id
|
|
|
|
+ left join ACT_RU_TASK art on art.PROC_INST_ID_ = tffa.flow_id
|
|
|
|
+ left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
<sql id="flowTaskUnDoneListFoot">
|
|
<sql id="flowTaskUnDoneListFoot">
|
|
- and tfcf.type = 'DING_EXCEPTION_FLOW'
|
|
|
|
|
|
+ <where>
|
|
|
|
+ and tfcf.type = 'DING_EXCEPTION_FLOW'
|
|
<if test="serviceId != null and serviceId != ''">
|
|
<if test="serviceId != null and serviceId != ''">
|
|
and tbs.id = #{serviceId}
|
|
and tbs.id = #{serviceId}
|
|
</if>
|
|
</if>
|
|
@@ -130,10 +115,12 @@
|
|
</otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</choose>
|
|
</if>
|
|
</if>
|
|
|
|
+ and tffa.status in ('START','DRAFT','AUDITING','REJECT','CANCEL')
|
|
|
|
+ </where>
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
<select id="flowTaskDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyDoneResult">
|
|
<select id="flowTaskDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyDoneResult">
|
|
- select t.* from(select
|
|
|
|
|
|
+ select
|
|
distinct tfcf.type,
|
|
distinct tfcf.type,
|
|
tfcfe.code,
|
|
tfcfe.code,
|
|
tffa.status,
|
|
tffa.status,
|
|
@@ -162,10 +149,17 @@
|
|
tbda.create_time as createTime,
|
|
tbda.create_time as createTime,
|
|
tffa.update_time as flowTime,
|
|
tffa.update_time as flowTime,
|
|
tbda.reason,
|
|
tbda.reason,
|
|
- (select group_concat(ba.`path` SEPARATOR ';') from basic_attachment ba where find_in_set(ba.id, tbda.attachment_ids)) as attachmentPaths,
|
|
|
|
- (select CONCAT(tffl.approve_remark, ';' ,tffl.create_time) from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id order by tffl.create_time desc limit 1) as approveInfo,
|
|
|
|
- IFNULL((select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
|
|
|
|
- where find_in_set(us1.id, (select group_concat(tffl.approve_id) from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id and tffl.approve_setup > 1))),'--') as approveUsersName,
|
|
|
|
|
|
+ tbda.attachment_ids as attachmentPaths,
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ CONCAT(tffl.approve_remark, ';' , tffl.create_time)
|
|
|
|
+ from
|
|
|
|
+ t_f_flow_log tffl
|
|
|
|
+ where
|
|
|
|
+ tffl.flow_id = tfcfe.flow_id
|
|
|
|
+ order by
|
|
|
|
+ tffl.create_time desc
|
|
|
|
+ limit 1) as approveInfo,
|
|
ss.id as supplierId,
|
|
ss.id as supplierId,
|
|
tbd.id as dingId,
|
|
tbd.id as dingId,
|
|
ss.name as supplierName,
|
|
ss.name as supplierName,
|
|
@@ -174,63 +168,34 @@
|
|
tbs.service_lead_id as serviceUnitLeaderId,
|
|
tbs.service_lead_id as serviceUnitLeaderId,
|
|
tbc.lead_id as regionManagerId,
|
|
tbc.lead_id as regionManagerId,
|
|
tbc.region_coordinator_id as coordinatorId
|
|
tbc.region_coordinator_id as coordinatorId
|
|
- from t_b_ding_apply tbda
|
|
|
|
- left join t_f_custom_flow_entity tfcfe on tbda.ding_exception_no = tfcfe.code
|
|
|
|
- left join t_f_flow_approve tffa on tfcfe.flow_id = tffa.flow_id
|
|
|
|
- left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
|
|
|
|
- left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
|
|
|
|
- left join t_b_service tbs on tbs.id = tbc.service_id
|
|
|
|
- left join sys_custom sc on sc.id = tbc.custom_id
|
|
|
|
- left join t_b_ding tbd on tbd.id = tbda.ding_id
|
|
|
|
- left join sys_user su ON tbda.create_id = su.id
|
|
|
|
- left join t_b_user_archives tbua on tbua.mobile_number = su.mobile_number
|
|
|
|
- left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbua.id
|
|
|
|
- left join sys_supplier ss on ss.id = tbuas.supplier_id
|
|
|
|
- where 1 = 1 and tfcf.type = 'DING_EXCEPTION_FLOW'
|
|
|
|
- and (tffa.status = 'AUDITING' or tffa.status = 'REJECT' or tffa.status = 'FINISH')
|
|
|
|
- and EXISTS (
|
|
|
|
- select * from(select
|
|
|
|
- distinct aht.PROC_INST_ID_
|
|
|
|
- from
|
|
|
|
- ACT_HI_TASKINST aht
|
|
|
|
- where 1 = 1
|
|
|
|
- <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
|
|
|
|
- and aht.ASSIGNEE_ IN
|
|
|
|
- <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
- </if>
|
|
|
|
- and aht.END_TIME_ is not null
|
|
|
|
- UNION ALL
|
|
|
|
- select
|
|
|
|
- t.PROC_INST_ID_
|
|
|
|
- from
|
|
|
|
- (
|
|
|
|
- select
|
|
|
|
- ahi.*
|
|
|
|
from
|
|
from
|
|
- ACT_HI_IDENTITYLINK ahi
|
|
|
|
- where
|
|
|
|
- ahi.TYPE_ = 'candidate'
|
|
|
|
- and exists(
|
|
|
|
- select
|
|
|
|
- distinct aht.id_
|
|
|
|
- from
|
|
|
|
- ACT_HI_TASKINST aht
|
|
|
|
- where
|
|
|
|
- aht.ASSIGNEE_ is null
|
|
|
|
- and aht.END_TIME_ is not null
|
|
|
|
- and ahi.TASK_ID_ = aht.id_)
|
|
|
|
- <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
|
|
|
|
- and ahi.USER_ID_ IN
|
|
|
|
- <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
|
|
|
|
- #{item}
|
|
|
|
- </foreach>
|
|
|
|
- </if>) temp
|
|
|
|
- join ACT_HI_TASKINST t on
|
|
|
|
- t.ID_ = temp.TASK_ID_) temp where temp.PROC_INST_ID_ = tfcfe.flow_id)) t
|
|
|
|
- join t_b_ding tbd on tbd.id = t.dingId
|
|
|
|
- <where>
|
|
|
|
|
|
+ t_b_ding_apply tbda
|
|
|
|
+ left join t_f_custom_flow_entity tfcfe on
|
|
|
|
+ tbda.ding_exception_no = tfcfe.code
|
|
|
|
+ left join t_f_flow_approve tffa on
|
|
|
|
+ tfcfe.flow_id = tffa.flow_id
|
|
|
|
+ left join t_f_custom_flow tfcf on
|
|
|
|
+ tfcf.id = tfcfe.t_f_custom_flow_id
|
|
|
|
+ left join t_b_crm tbc on
|
|
|
|
+ tbc.crm_no = tfcfe.crm_no
|
|
|
|
+ left join t_b_service tbs on
|
|
|
|
+ tbs.id = tbc.service_id
|
|
|
|
+ left join sys_custom sc on
|
|
|
|
+ sc.id = tbc.custom_id
|
|
|
|
+ left join t_b_ding tbd on
|
|
|
|
+ tbd.id = tbda.ding_id
|
|
|
|
+ left join sys_user su on
|
|
|
|
+ tbda.create_id = su.id
|
|
|
|
+ left join t_b_user_archives tbua on
|
|
|
|
+ tbua.mobile_number = su.mobile_number
|
|
|
|
+ left join t_b_user_archives_supplier tbuas on
|
|
|
|
+ tbuas.user_archives_id = tbua.id
|
|
|
|
+ left join sys_supplier ss on
|
|
|
|
+ ss.id = tbuas.supplier_id
|
|
|
|
+ left join ACT_HI_TASKINST aht on aht.PROC_INST_ID_ = tffa.flow_id
|
|
|
|
+ <where> 1 = 1 and tfcf.type = 'DING_EXCEPTION_FLOW'
|
|
|
|
+ and (tffa.status = 'AUDITING' or tffa.status = 'REJECT' or tffa.status = 'FINISH')
|
|
|
|
+ <!--and aht.ASSIGNEE_ = #{dpr.requestUserId}-->
|
|
<if test="serviceId != null and serviceId != ''">
|
|
<if test="serviceId != null and serviceId != ''">
|
|
and t.serviceId = #{serviceId}
|
|
and t.serviceId = #{serviceId}
|
|
</if>
|
|
</if>
|
|
@@ -255,17 +220,17 @@
|
|
<if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
|
|
<if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
|
|
<choose>
|
|
<choose>
|
|
<when test="dpr.hasBusiness">
|
|
<when test="dpr.hasBusiness">
|
|
- AND t.serviceUnitLeaderId = #{dpr.requestUserId}
|
|
|
|
|
|
+ AND tbs.service_lead_id = #{dpr.requestUserId}
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
<choose>
|
|
<choose>
|
|
<when test="dpr.hasRegionManager">
|
|
<when test="dpr.hasRegionManager">
|
|
- AND t.regionManagerId = #{dpr.requestUserId}
|
|
|
|
|
|
+ AND tbc.lead_id = #{dpr.requestUserId}
|
|
</when>
|
|
</when>
|
|
<otherwise>
|
|
<otherwise>
|
|
<choose>
|
|
<choose>
|
|
<when test="dpr.hasRegionCoordinator">
|
|
<when test="dpr.hasRegionCoordinator">
|
|
- AND t.coordinatorId = #{dpr.requestUserId}
|
|
|
|
|
|
+ AND tbc.region_coordinator_id = #{dpr.requestUserId}
|
|
</when>
|
|
</when>
|
|
</choose>
|
|
</choose>
|
|
</otherwise>
|
|
</otherwise>
|
|
@@ -274,6 +239,6 @@
|
|
</choose>
|
|
</choose>
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
- order by t.code desc
|
|
|
|
|
|
+ order by tfcfe.code desc
|
|
</select>
|
|
</select>
|
|
</mapper>
|
|
</mapper>
|