From a017a21118075849cab164d4fda64edcbf5ccd89 Mon Sep 17 00:00:00 2001 From: ye1023 <12588209+ye1023@user.noreply.gitee.com> Date: Mon, 25 May 2026 09:35:12 +0800 Subject: [PATCH] =?UTF-8?q?yxk-20260525-=E5=8A=9E=E7=90=86=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E5=86=99=E5=85=A5=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E5=AE=A1=E6=89=B9=E6=84=8F=E8=A7=81=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ExtActBpmLogServiceImpl.java | 271 +++++++++++++----- 1 file changed, 199 insertions(+), 72 deletions(-) diff --git a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/impl/ExtActBpmLogServiceImpl.java b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/impl/ExtActBpmLogServiceImpl.java index 7e261f9..8d874bd 100644 --- a/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/impl/ExtActBpmLogServiceImpl.java +++ b/jeecg-boot-platform/jeecg-boot-module-bpm-flowable/src/main/java/org/jeecg/modules/extbpm/process/service/impl/ExtActBpmLogServiceImpl.java @@ -3,6 +3,7 @@ package org.jeecg.modules.extbpm.process.service.impl; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; import org.flowable.engine.HistoryService; import org.flowable.engine.RuntimeService; @@ -11,45 +12,55 @@ import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.task.api.Task; import org.jeecg.common.api.dto.message.BusTemplateMessageDTO; -import org.jeecg.common.api.dto.message.TemplateDTO; import org.jeecg.common.constant.CommonSendStatus; import org.jeecg.common.constant.enums.EmailTemplateEnum; import org.jeecg.common.constant.enums.SysAnnmentTypeEnum; import org.jeecg.common.system.api.ISysBaseAPI; import org.jeecg.common.system.util.JwtUtil; import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.common.util.*; +import org.jeecg.common.util.DateUtils; +import org.jeecg.common.util.SpringContextUtils; +import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.extbpm.process.entity.ExtActBpmFile; import org.jeecg.modules.extbpm.process.entity.ExtActBpmLog; +import org.jeecg.modules.extbpm.process.entity.ExtActFlowData; import org.jeecg.modules.extbpm.process.entity.ExtActTaskCc; import org.jeecg.modules.extbpm.process.mapper.ExtActBpmFileMapper; import org.jeecg.modules.extbpm.process.mapper.ExtActBpmLogMapper; +import org.jeecg.modules.extbpm.process.mapper.ExtActFlowDataMapper; import org.jeecg.modules.extbpm.process.mapper.ExtActTaskCcMapper; import org.jeecg.modules.extbpm.process.service.IExtActBpmLogService; import org.jeecg.modules.extbpm.util.BpmSytemMsgPushUtil; +import org.jeecg.modules.taskapprovalopinion.entity.TaskApprovalOpinion; +import org.jeecg.modules.taskapprovalopinion.service.ITaskApprovalOpinionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -import javax.mail.internet.MimeMessage; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** - * @Description: 流程审批日志 - * @author: jeecg-boot - * @date: 2019-03-28 - * @version: V1.0 + * 流程审批日志服务。 */ @Slf4j @Service("extActBpmLogService") public class ExtActBpmLogServiceImpl extends ServiceImpl implements IExtActBpmLogService { + private static final String RECORD_TYPE_PROCESS = "PROCESS"; + private static final String RECORD_TYPE_SYSTEM = "SYSTEM"; + + private static final String ACTION_APPROVE = "APPROVE"; + private static final String ACTION_REJECT = "REJECT"; + private static final String ACTION_TRANSFER = "TRANSFER"; + private static final String ACTION_ENTRUST = "ENTRUST"; + private static final String ACTION_ADD_SIGN = "ADD_SIGN"; + private static final String ACTION_INVALID = "INVALID"; + private static final String ACTION_CALLBACK = "CALLBACK"; + private static final String ACTION_SYSTEM = "SYSTEM"; + @Lazy @Autowired private ISysBaseAPI sysBaseAPI; @@ -58,6 +69,12 @@ public class ExtActBpmLogServiceImpl extends ServiceImpl getBpmLogsbyProcessId(String processInstanceId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -188,10 +197,147 @@ public class ExtActBpmLogServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(ExtActFlowData::getProcessInstId, processInstanceId); + List flowDataList = extActFlowDataMapper.selectList(queryWrapper); + return flowDataList.isEmpty() ? null : flowDataList.get(0); + } + + /** + * task_task 属于其他业务表,这里只做可选补齐,避免新表双写反向影响办理流程。 + */ + private void fillTaskTaskFields(TaskApprovalOpinion opinion) { + if (jdbcTemplate == null || oConvertUtils.isEmpty(opinion.getTaskTaskId())) { + return; + } + try { + List> rows = jdbcTemplate.queryForList( + "select business_id, flow_code, sys_org_code from task_task where id = ?", + opinion.getTaskTaskId()); + if (rows.isEmpty()) { + return; + } + Map row = rows.get(0); + if (oConvertUtils.isEmpty(opinion.getBusinessId())) { + opinion.setBusinessId(getStringValue(row, "business_id")); + } + if (oConvertUtils.isEmpty(opinion.getFlowCode())) { + opinion.setFlowCode(getStringValue(row, "flow_code")); + } + if (oConvertUtils.isEmpty(opinion.getSysOrgCode())) { + opinion.setSysOrgCode(getStringValue(row, "sys_org_code")); + } + } catch (Exception e) { + log.debug("补全 task_task 业务字段失败,跳过。taskTaskId={}", opinion.getTaskTaskId(), e); + } + } + + private String getStringValue(Map row, String key) { + for (Map.Entry entry : row.entrySet()) { + if (entry.getKey() != null && entry.getKey().equalsIgnoreCase(key) && entry.getValue() != null) { + return String.valueOf(entry.getValue()); + } + } + return null; + } + + private String resolveHandleActionType(Map map, String rejectDescription) { + String processModel = oConvertUtils.getString(map.get("processModel")); + if ("3".equals(processModel) || oConvertUtils.isNotEmpty(rejectDescription)) { + return ACTION_REJECT; + } + return ACTION_APPROVE; + } + + private String resolveSystemActionType(String comment) { + if (oConvertUtils.isEmpty(comment)) { + return ACTION_SYSTEM; + } + if (comment.contains("作废")) { + return ACTION_INVALID; + } + if (comment.contains("取回")) { + return ACTION_CALLBACK; + } + if (comment.contains("转办")) { + return ACTION_TRANSFER; + } + if (comment.contains("委派")) { + return ACTION_ENTRUST; + } + return ACTION_SYSTEM; + } + + private String resolveActionResult(String value, String defaultValue) { + return oConvertUtils.isNotEmpty(value) ? value : defaultValue; + } + + /** + * 附件仍保存到原审批日志附件表,不迁移到新审批意见表。 */ private void saveBpmFiles(String bpmLogId, String fileList) { if (oConvertUtils.isNotEmpty(fileList)) { @@ -210,22 +356,16 @@ public class ExtActBpmLogServiceImpl extends ServiceImpl