领用审批优化,加上会签的逻辑

This commit is contained in:
zfh 2025-03-05 09:23:17 +08:00
parent c205a38005
commit 3df87f5cef
3 changed files with 71 additions and 10 deletions

View File

@ -265,4 +265,13 @@ public class LeaseApplyInfo extends BaseEntity{
@ApiModelProperty(value = "公司名称") @ApiModelProperty(value = "公司名称")
private String companyName; private String companyName;
@ApiModelProperty(value = "本流程节点id")
private Integer nodeId;
@ApiModelProperty(value = "流程配置值")
private String configValue;
@ApiModelProperty(value = "所属记录")
private Integer recordId;
} }

View File

@ -29,7 +29,10 @@ import com.bonus.material.task.domain.TmTaskAgreement;
import com.bonus.material.task.mapper.TmTaskAgreementMapper; import com.bonus.material.task.mapper.TmTaskAgreementMapper;
import com.bonus.material.task.mapper.TmTaskMapper; import com.bonus.material.task.mapper.TmTaskMapper;
import com.bonus.material.work.domain.SysWorkflowRecord; import com.bonus.material.work.domain.SysWorkflowRecord;
import com.bonus.material.work.domain.SysWorkflowRecordHistory;
import com.bonus.material.work.domain.SysWorkflowType; import com.bonus.material.work.domain.SysWorkflowType;
import com.bonus.material.work.mapper.SysWorkflowConfigMapper;
import com.bonus.material.work.mapper.SysWorkflowRecordHistoryMapper;
import com.bonus.material.work.mapper.SysWorkflowRecordMapper; import com.bonus.material.work.mapper.SysWorkflowRecordMapper;
import com.bonus.material.work.mapper.SysWorkflowTypeMapper; import com.bonus.material.work.mapper.SysWorkflowTypeMapper;
import com.bonus.material.work.service.SysWorkflowRecordService; import com.bonus.material.work.service.SysWorkflowRecordService;
@ -73,6 +76,12 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
@Resource @Resource
private SysWorkflowRecordService sysWorkflowRecordService; private SysWorkflowRecordService sysWorkflowRecordService;
@Resource
private SysWorkflowConfigMapper sysWorkflowConfigMapper;
@Resource
private SysWorkflowRecordHistoryMapper sysWorkflowRecordHistoryMapper;
/** /**
* 新增领用任务 * 新增领用任务
* *
@ -368,6 +377,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
public List<LeaseApplyInfo> selectAuditLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) { public List<LeaseApplyInfo> selectAuditLeaseApplyInfoList(LeaseApplyInfo leaseApplyInfo) {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
leaseApplyInfo.setUserId(userId == 0 ? null : userId); leaseApplyInfo.setUserId(userId == 0 ? null : userId);
log.info("用户id为{}",userId);
List<LeaseApplyInfo> list = mapper.selectAuditLeaseApplyInfoList(leaseApplyInfo); List<LeaseApplyInfo> list = mapper.selectAuditLeaseApplyInfoList(leaseApplyInfo);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
String keyWord = leaseApplyInfo.getKeyWord(); String keyWord = leaseApplyInfo.getKeyWord();
@ -378,6 +388,45 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
} }
for (LeaseApplyInfo leaseApplyInfoNew : list) {
//获取当前节点并根据当前节点获取审核人审核的角色信息
if (leaseApplyInfoNew.getNodeId()!=null){
log.info("当前节点为{}",leaseApplyInfoNew.getNodeId());
String configValue = sysWorkflowConfigMapper.selectConfigValueByNodeId(leaseApplyInfoNew.getNodeId());
leaseApplyInfoNew.setConfigValue(configValue);
//判断当前节点是否审核
SysWorkflowRecordHistory sysWorkflowRecordHistory = new SysWorkflowRecordHistory();
sysWorkflowRecordHistory.setRecordId(leaseApplyInfoNew.getRecordId());
sysWorkflowRecordHistory.setNodeId(leaseApplyInfoNew.getNodeId());
List<SysWorkflowRecordHistory> SysWorkflowRecordHistoryList = sysWorkflowRecordHistoryMapper.seleteSysWorkflowRecordHistory(sysWorkflowRecordHistory);
//判断是或签还是会签0:或签 1:会签
if (0==leaseApplyInfoNew.getLeaseSignType().intValue()){
//当前节点已经审核需要修改节点值
if (SysWorkflowRecordHistoryList.get(0)!=null){
String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId());
leaseApplyInfoNew.setNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId());
leaseApplyInfoNew.setConfigValue(configValueNew);
}
}else {
String[] ConfigValue = configValue.split(",");
for (SysWorkflowRecordHistory sysWorkflowRecordHistoryNew : SysWorkflowRecordHistoryList) {
if (sysWorkflowRecordHistoryNew!=null){
// 过滤数组元素
List<String> filteredList = Arrays.stream(ConfigValue)
.filter(value -> value.equals(sysWorkflowRecordHistoryNew.getCreateBy()))
.collect(Collectors.toList());
leaseApplyInfoNew.setConfigValue(filteredList.toString());
//判断是否这个节点的所有人都审核
if (filteredList.size()==0){
String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId());
leaseApplyInfoNew.setNodeId(SysWorkflowRecordHistoryList.get(0).getNextNodeId());
leaseApplyInfoNew.setConfigValue(configValueNew);
}
}
}
}
}
}
return list; return list;
} }

View File

@ -38,6 +38,8 @@
<result property="leaseSignUrl" column="lease_sign_url"/> <result property="leaseSignUrl" column="lease_sign_url"/>
<result property="leaseSignType" column="lease_sign_type"/> <result property="leaseSignType" column="lease_sign_type"/>
<result property="applyCode" column="apply_code"/> <result property="applyCode" column="apply_code"/>
<result property="nodeId" column="next_node_id"/>
<result property="recordId" column="record_id"/>
</resultMap> </resultMap>
<resultMap type="com.bonus.material.lease.domain.LeaseApplyDetails" id="LeaseApplyDetailsResult"> <resultMap type="com.bonus.material.lease.domain.LeaseApplyDetails" id="LeaseApplyDetailsResult">
@ -465,14 +467,15 @@
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark, lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id, lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id,
lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party, lai.lease_sign_url, lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party, lai.lease_sign_url,
lai.lease_sign_type,tt.task_id as taskId, lai.lease_sign_type,tt.task_id as taskId,swn.node_sign_type as leaseSignType,
bai.unit_id,bai.project_id,bu.unit_name, bp.pro_name,bai.agreement_id, bai.agreement_code, swr.workflow_status as taskStatus, lai.unit_id,lai.project_id,bu.unit_name, bp.pro_name, swr.workflow_status as taskStatus,bai.agreement_code,
swrs.next_node_id,swrs.record_id,
case tt.task_status case tt.task_status
when 0 then '待审核' when 0 then '待审核'
when 1 then '执行中' when 1 then '待审核'
when 2 then '执行完成' when 2 then '审核中'
when 3 then '执行中断' when 3 then '已完成'
when 4 then '已完成'
end as taskStatusName, end as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum, IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(sum(lad.al_num),0) as alNum, IFNULL(sum(lad.al_num),0) as alNum,
@ -485,8 +488,8 @@
left join lease_apply_details lad on lai.id = lad.parent_id left join lease_apply_details lad on lai.id = lad.parent_id
left join tm_task_agreement tta on lai.task_id = tta.task_id left join tm_task_agreement tta on lai.task_id = tta.task_id
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
left join bm_unit bu on bu.unit_id = bai.unit_id left join bm_unit bu on bu.unit_id = lai.unit_id
left join bm_project bp on bp.pro_id = bai.project_id left join bm_project bp on bp.pro_id = lai.project_id
left join sys_dept sd on sd.dept_id = bp.imp_unit left join sys_dept sd on sd.dept_id = bp.imp_unit
left join sys_dict_data sda on tt.task_status = sda.dict_value left join sys_dict_data sda on tt.task_status = sda.dict_value
and sda.dict_type = 'lease_task_status' and sda.dict_type = 'lease_task_status'
@ -496,8 +499,9 @@
left join sys_workflow_type swt on swr.workflow_id = swt.id left join sys_workflow_type swt on swr.workflow_id = swt.id
left join sys_workflow_node swn on swt.id = swn.type_id left join sys_workflow_node swn on swt.id = swn.type_id
left join sys_workflow_config swc on swn.id = swc.node_id left join sys_workflow_config swc on swn.id = swc.node_id
left join sys_workflow_record_history swrs on swr.id = swrs.record_id
where 1=1 where 1=1
<if test="userId != null and userId != ''">and swc.config_value = #{userId}</if> <if test="userId != null and userId != ''">and swc.config_value LIKE CONCAT('%', #{userId}, '%')</if>
<if test="code != null and code != ''">and lai.code = #{code}</if> <if test="code != null and code != ''">and lai.code = #{code}</if>
<if test="taskId != null ">and lai.task_id = #{taskId}</if> <if test="taskId != null ">and lai.task_id = #{taskId}</if>
<if test="leasePerson != null and leasePerson != ''">and lai.lease_person = #{leasePerson}</if> <if test="leasePerson != null and leasePerson != ''">and lai.lease_person = #{leasePerson}</if>
@ -545,7 +549,6 @@
<if test="costBearingParty != null and costBearingParty != ''">and lai.cost_bearing_party = <if test="costBearingParty != null and costBearingParty != ''">and lai.cost_bearing_party =
#{costBearingParty} #{costBearingParty}
</if> </if>
and lai.apply_code is not null
<if test="isApp != null and taskStatus==1">and (tt.task_status = 0 or tt.task_status = 1 or tt.task_status = 2) </if> <if test="isApp != null and taskStatus==1">and (tt.task_status = 0 or tt.task_status = 1 or tt.task_status = 2) </if>
<if test="isApp != null and taskStatus==3">and (tt.task_status = 3 or tt.task_status = 4)</if> <if test="isApp != null and taskStatus==3">and (tt.task_status = 3 or tt.task_status = 4)</if>
GROUP BY lai.id GROUP BY lai.id