合并代码恢复自身代码

This commit is contained in:
hongchao 2025-09-13 20:09:29 +08:00
parent 1dd6d9be47
commit dae408efad
3 changed files with 234 additions and 18 deletions

View File

@ -196,7 +196,7 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
handleDirectApproval(sysWorkflowNodeList, sysWorkflowRecordHistory, sysUser, taskId, recordCode, recordId,nextNodeId,nodeId);
} else {
// 处理审核驳回
handleRejection(sysWorkflowNodeList, sysWorkflowRecordHistory);
handleDirectReject(sysWorkflowNodeList, sysWorkflowRecordHistory, sysUser, taskId, recordCode, recordId,nextNodeId,nodeId);
}
}else{
throw new ServiceException("当前账号没有审批权限!");
@ -564,6 +564,140 @@ public class SysWorkflowRecordHistoryServiceImpl implements SysWorkflowRecordHis
}
}
private void handleDirectReject(List<SysWorkflowNode> sysWorkflowNodeList, SysWorkflowRecordHistory sysWorkflowRecordHistory,
SysUser sysUser, Integer taskId, String recordCode, Integer recordId, Integer nextNodeId, Integer nodeId) {
boolean found = false;
Integer proId = null;
Integer proIdThree = null ;
List<WorkPeopleInfo> userList = new ArrayList<>();
for (int i = 0; i < sysWorkflowNodeList.size(); i++) {
// 判断列表中哪个节点是当前审批的节点如果不是审批的节点不处理
if (sysWorkflowRecordHistory.getNextNodeId().equals(sysWorkflowNodeList.get(i).getId())) {
log.info("-------------进入到了当前审批的节点-------------");
// sysWorkflowRecordHistoryMapper.addSysWorkflowRecordHistory(sysWorkflowRecordHistory);
// 增加节点code编码判断是否有节点审批限制
if (StringUtils.isNotBlank(sysWorkflowNodeList.get(i).getNodeRestrictCode())) { //属于后三个审批流
log.info("-------------当前节点有审批限制,进行限制🚫-------------");
switch (sysWorkflowNodeList.get(i).getNodeRestrictCode()) {
case "unit":
// 限制同一unit单位
//获取转入接收方的agreementId
proId = sysWorkflowRecordHistoryMapper.getLeaseAgreementIdByTaskId(sysWorkflowRecordHistory);
if(i==2){ //到发起方施工管理部
proIdThree = sysWorkflowRecordHistoryMapper.getBackAgreementIdByTaskId(sysWorkflowRecordHistory);
}else{
proIdThree = null;
}
int deptId = directAuditMapper.getImpUnit(String.valueOf(proId));
DirectApplyInfo directApplyInfo = new DirectApplyInfo();
directApplyInfo.setLeaseProId(String.valueOf(proId));
directApplyInfo.setDeptId(deptId);
//插入history表中
SysWorkflowRecordHistory history = sysWorkflowRecordHistory;
history.setNodeId(sysWorkflowRecordHistory.getNextNodeId());
if(i!=sysWorkflowNodeList.size()-1){
history.setNextNodeId(sysWorkflowNodeList.get(i+1).getId());
sysWorkflowNodeList.get(i).setNextNodeId(sysWorkflowNodeList.get(i+1).getId());
sysWorkflowNodeList.get(i).setNextRoleIds(sysWorkflowNodeList.get(i+1).getRoleIds());
}else{
history.setNextNodeId(null);
sysWorkflowNodeList.get(i).setNextNodeId(null);
sysWorkflowNodeList.get(i).setNextRoleIds(null);
}
sysWorkflowNodeService.copeNodeConfigPersonValuesByNodeTwo(sysWorkflowNodeList.get(i), directApplyInfo,userList,sysWorkflowNodeList.size());
sysWorkflowRecordHistory.setDirectUserIds(sysWorkflowNodeList.get(i).getConfigValues());
history.setDirectUserIds(sysWorkflowNodeList.get(i).getConfigValues());
sysWorkflowRecordHistoryMapper.addSysWorkflowRecordHistory(history);
break;
case "project":
// 限制工程暂无相关需求暂定
break;
case "org":
// 限制分公司暂无相关需求暂定
break;
default:
throw new ServiceException("当前节点有审批限制code却是非法字符请联系管理员");
}
}else{//属于前三个审批流
proId = sysWorkflowRecordHistoryMapper.getBackAgreementIdByTaskId(sysWorkflowRecordHistory);
int deptId = directAuditMapper.getImpUnit(String.valueOf(proId));
DirectApplyInfo directApplyInfo = new DirectApplyInfo();
directApplyInfo.setBackProId(String.valueOf(proId));
directApplyInfo.setDeptId(deptId);
//插入history表中
SysWorkflowRecordHistory history = sysWorkflowRecordHistory;
history.setNodeId(sysWorkflowRecordHistory.getNextNodeId());
if(i!=sysWorkflowNodeList.size()-1){
history.setNextNodeId(sysWorkflowNodeList.get(i+1).getId());
sysWorkflowNodeList.get(i).setNextNodeId(sysWorkflowNodeList.get(i+1).getId());
sysWorkflowNodeList.get(i).setNextRoleIds(sysWorkflowNodeList.get(i+1).getRoleIds());
}else{
history.setNextNodeId(null);
sysWorkflowNodeList.get(i).setNextNodeId(null);
sysWorkflowNodeList.get(i).setNextRoleIds(null);
}
sysWorkflowNodeService.copeNodeConfigPersonValuesByNodeTwo(sysWorkflowNodeList.get(i), directApplyInfo,userList,sysWorkflowNodeList.size());
sysWorkflowRecordHistory.setDirectUserIds(sysWorkflowNodeList.get(i).getConfigValues());
history.setDirectUserIds(sysWorkflowNodeList.get(i).getConfigValues());
sysWorkflowRecordHistoryMapper.addSysWorkflowRecordHistory(history);
}
//获取当前node的directUserIds
String userIdsNow = sysWorkflowRecordHistoryMapper.getNowUserIds(sysWorkflowRecordHistory);
// 判断当前用户是否是当前节点的配置用户
if (userIdsNow.contains(sysUser.getUserId().toString())) {
log.info("-------------✅通过校验,当前用户是该节点审批人员,进行更新任务信息-------------");
// 根据任务ID 更新审批流状态
updateWorkflowStatus(taskId, 1);
// 根据任务ID 更新任务状态
updateTmTask(taskId.longValue(), LeaseTaskStatusEnum.LEASE_AUDIT_ING.getStatus());
found = true;
break;
} else {
//删除新增节点
sysWorkflowRecordHistoryMapper.deleteNowNode(sysWorkflowRecordHistory);
throw new ServiceException("您不是当前节点配置的审批人员,无法进行操作!!");
}
}
}
// 如果前面更新失败 -> 方法停止 -> 不进行下一步操作否则继续
if (!found) {
return;
}
//驳回
updateWorkflowStatus(taskId, 3);
SysWorkflowAuditDto dto = sysWorkflowRecordMapper.getSysWorkflowRecodeByTaskId(taskId);
if (dto == null) {
throw new ServiceException("任务类型为空");
}
// 修改工单信息
updateWorkOrder(recordId, sysUser.getUserName());
DirectApplyInfo directApplyInfo = new DirectApplyInfo();
directApplyInfo.setId(taskId);
directApplyInfo.setStatus("2");
directAuditMapper.updateDirectAudit(directApplyInfo);
try {
log.info("-------------节点更新工单信息✔-------------");
// 修改工单信息
updateWorkOrder(recordId, sysUser.getUserName());
log.info("-------------节点更新工单信息结束-------------");
} catch (Exception e) {
System.err.println("更新工单信息失败:" + e.getMessage());
log.error("更新工单信息失败: {}", e.getMessage(), e);
}
}
private void checkFinalNodeApproval(SysWorkflowRecordHistory sysWorkflowRecordHistory, List<SysWorkflowNode> sysWorkflowNodeList) {
List<SysWorkflowRecordHistory> historyList = sysWorkflowRecordHistoryMapper.seleteSysWorkflowRecordHistory(sysWorkflowRecordHistory);
String configValueNew = sysWorkflowConfigMapper.selectConfigValueByNodeId(sysWorkflowRecordHistory.getNodeId());

View File

@ -389,6 +389,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectLeaseApplyInfoList" parameterType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo" resultMap="LeaseApplyInfoResult">
<include refid="selectLeaseApplyInfoVo"/>
<where>
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bt.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="keyWord != null and keyWord != ''">
and (
lai.create_by like concat('%',#{keyWord},'%') or
bp.pro_name like concat('%',#{keyWord},'%') or
lai.lease_person like concat('%',#{keyWord},'%')
)
</if>
<if test="taskStatus != null"> and tt.task_status = #{taskStatus}</if>
<if test="code != null and code != ''"> and lai.code = #{code}</if>
<if test="taskId != null "> and lai.task_id = #{taskId}</if>
@ -421,6 +437,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTotalList" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo">
select
sd.dept_name as impUnitName,
lai.id, lai.code as code, lai.lease_person as leasePerson,
lai.create_by, lai.create_time as leaseTime, lai.update_by, lai.update_time, lai.remark, lai.company_id,
lai.lease_sign_url as leaseSignUrl, lai.lease_sign_type as leaseSignType,
@ -450,7 +467,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId}
</if>
<where>
where
1=1
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="leasePerson != null and leasePerson != ''">
and lai.lease_person LIKE CONCAT('%', #{leasePerson}, '%')
</if>
<if test="code != null and code != ''">
and lai.code LIKE CONCAT('%', #{code}, '%')
</if>
<if test="leaseUnit != null and leaseUnit != ''">
and bu.unit_name LIKE CONCAT('%', #{leaseUnit}, '%')
</if>
<if test="leaseProject != null and leaseProject != ''">
and bp.pro_name LIKE CONCAT('%', #{leaseProject}, '%')
</if>
<if test="statusList != null and statusList.size() > 0">
and tt.task_status in
<foreach item="item" collection="statusList" open="(" separator="," close=")">
@ -467,7 +500,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<![CDATA[ AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
and tt.task_type = '2'
</where>
GROUP BY lai.id
ORDER BY tt.create_time desc
</select>
@ -792,6 +824,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getLeaseInfoDetails" resultType="com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo">
SELECT
sd.dept_name AS impUnitName,
bp.pro_center AS departName,
lod.id AS id,
lod.parent_id AS parentId,
mt.type_id AS typeId,
@ -823,8 +857,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_unit bt on lai.team_id = bt.unit_id
LEFT JOIN bm_project bp ON lai.project_id = bp.pro_id
LEFT JOIN sys_user su on su.user_id=lod.create_by
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
lod.is_finished = '1'
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bt.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[and DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
@ -837,11 +881,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="keyWord != null and keyWord != ''">
and (
mt2.type_name like concat('%', #{keyWord}, '%') or
mt.type_name like concat('%', #{keyWord}, '%') or
lai.`code` like concat('%', #{keyWord}, '%') or
lai.lease_person like concat('%', #{keyWord}, '%') or
lod.create_by like concat('%', #{keyWord}, '%') or
bt.unit_name like concat('%', #{keyWord}, '%') or
su.nick_name like concat('%', #{keyWord}, '%') or
bp.pro_name like concat('%', #{keyWord}, '%')
)
</if>
@ -1030,6 +1072,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPublishList" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo">
SELECT
sd.dept_name as impUnitName,
lai.id AS id,
lai.code AS code,
lai.create_by AS createBy,

View File

@ -736,6 +736,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT * FROM (
-- 原查询包含status计算
SELECT
sd.dept_name as impUnitName,
bp.pro_center AS departName,
mt3.type_name as materialName,
mt2.type_name AS typeName,
mt.type_name AS typeModelName,
sai.ma_id AS maId,
@ -759,14 +762,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
LEFT JOIN clz_slt_agreement_info csi ON mm.ma_id = csi.ma_id
LEFT JOIN clz_bm_agreement_info cba ON csi.agreement_id = cba.agreement_id
LEFT JOIN bm_unit bu ON cba.unit_id = bu.unit_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.`status` = '0'
AND mt.jiju_type = 2
AND sai.ma_id IS NOT NULL
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="proName != null and proName != ''">
and bp.pro_name LIKE CONCAT('%', #{proName}, '%')
</if>
<if test="materialName != null and materialName != ''">
and mt3.type_name LIKE CONCAT('%', #{materialName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bu.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( mm.this_check_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="agreementIdList != null and agreementIdList.size >0">
AND sai.agreement_id IN
<foreach item="item" collection="agreementIdList" open="(" separator="," close=")">
@ -804,17 +827,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTeamNumList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo">
SELECT
sd.dept_name AS impUnitName,
bp.pro_center AS departName,
bu.unit_id as teamId,
bu.unit_name as teamName,
bu.link_man as teamLeaderIdCard,
SUM( sai.num ) as usNum,
bu.bzz_idcard as idCard,
bp.imp_unit as impUnit
bp.imp_unit as impUnit,
bp.pro_name as proName
FROM
bm_unit bu
LEFT JOIN clz_bm_agreement_info bai ON bu.unit_id = bai.unit_id
LEFT JOIN clz_slt_agreement_info sai ON bai.agreement_id = sai.agreement_id
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
WHERE
sai.`status` = 0 and bu.type_id = 1731
<if test="keyWord != null and keyWord != ''">
@ -823,6 +850,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bu.link_man like concat('%',#{keyWord},'%')
)
</if>
<if test="impUnitName != null and impUnitName != ''">
and sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="departName != null and departName != ''">
and bp.pro_center LIKE CONCAT('%', #{departName}, '%')
</if>
<if test="proName != null and proName != ''">
and bp.pro_name LIKE CONCAT('%', #{proName}, '%')
</if>
<if test="teamName != null and teamName != ''">
and bu.unit_name LIKE CONCAT('%', #{teamName}, '%')
</if>
GROUP BY
bu.unit_id
</select>