From fccfe7d50f42f5be4c4612d61b7ae852e2ef37cd Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期四, 17 四月 2025 15:26:09 +0800 Subject: [PATCH] 优化指派设备与审签设备的权限校验查询,新增导入电子样板触发审签流程,新增电子样板指派设备功能 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java | 109 ++++++++++++++++++++---------------------------------- 1 files changed, 41 insertions(+), 68 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java index 6ffcbf9..f72e491 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.beanutils.BeanUtils; import org.apache.shiro.SecurityUtils; import org.flowable.common.engine.api.FlowableException; import org.flowable.engine.TaskService; @@ -11,14 +12,15 @@ import org.flowable.task.api.Task; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.dnc.entity.DocInfo; +import org.jeecg.modules.dnc.entity.PermissionStreamNew; import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.DocInfoMapper; import org.jeecg.modules.dnc.request.DocInfoQueryRequest; import org.jeecg.modules.dnc.response.ActivitiCode; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.response.UcenterCode; -import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.service.IDocInfoService; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dncFlow.entity.DispatchFile; import org.jeecg.modules.dncFlow.mapper.DispatchFileMapper; @@ -37,6 +39,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.lang.reflect.InvocationTargetException; import java.util.*; /** @@ -51,20 +54,12 @@ @Autowired @Lazy private IDocInfoService docInfoService; - @Autowired - private IProcessStreamService processStreamService; - @Autowired - private IWorkStepService workStepService; - @Autowired - private IPermissionStreamNewService permissionStreamNewService; @Resource private FlowCommonService flowCommonService; @Resource private IFlowDefinitionService flowDefinitionService; @Autowired private IFlowTaskService flowTaskService; - @Autowired - private IDeviceTypeService deviceTypeService; @Autowired private TaskService taskService; @Autowired @@ -73,6 +68,8 @@ private DocInfoMapper docInfoMapper; @Autowired private ISysUserRoleService sysUserRoleService; + @Autowired + private PermissionService permissionService; /** * 娴佺▼鍚姩,淇濆瓨瀵瑰簲鐨勬暟鎹� * @param dispatchFile @@ -230,6 +227,7 @@ * @return */ @Override + @Transactional public Result<?> auditDispatchFile(DispatchFileFlowTaskVo dispatchFileFlowTaskVo) { try { // 鍙傛暟鏍¢獙 @@ -299,6 +297,36 @@ } catch (Exception e) { return Result.error("鎿嶄綔澶辫触锛�" + e.getMessage()); } + } + + /** + * 鎵归噺瀹℃壒鎿嶄綔 + * @param dispatchFileFlowTaskVo + * @return + */ + @Override + @Transactional + public Result<?> auditBatchDispatchFile(DispatchFileFlowTaskVo dispatchFileFlowTaskVo) throws InvocationTargetException, IllegalAccessException { + if (dispatchFileFlowTaskVo.getTaskIds()==null || dispatchFileFlowTaskVo.getTaskIds().isEmpty()) { + return Result.error(CommonCode.INVALID_PARAM.toString()); + } + if (dispatchFileFlowTaskVo.getTaskIds().contains(",")){ + String[] taskIds = dispatchFileFlowTaskVo.getTaskIds().split(","); + for (String taskId : taskIds) { + FlowMyBusiness flowMyBusiness=flowMyBusinessService.getOne(new QueryWrapper<FlowMyBusiness>().eq("task_id",taskId)); + DispatchFileFlowTaskVo dispatchFileFlowTaskVoNew=new DispatchFileFlowTaskVo(); + BeanUtils.copyProperties(dispatchFileFlowTaskVoNew, dispatchFileFlowTaskVo); + dispatchFileFlowTaskVoNew.setTaskId(taskId); + dispatchFileFlowTaskVoNew.setDataId(flowMyBusiness.getDataId()); + dispatchFileFlowTaskVoNew.setInstanceId(flowMyBusiness.getProcessInstanceId()); + if (dispatchFileFlowTaskVo.getTargetKey().equals("task_prepare")){ + reStartDispatchFile(dispatchFileFlowTaskVoNew); + }else { + auditDispatchFile(dispatchFileFlowTaskVoNew); + } + } + } + return Result.OK("鎿嶄綔鎴愬姛"); } /** @@ -391,67 +419,12 @@ return true; } - //鑾峰彇鏂囦欢淇℃伅 - private DocInfo getDocInfo(DispatchFile dispatchFile) { - DocInfo docInfo = docInfoService.getByDocAttrAndDocId(dispatchFile.getDocId(), - Integer.parseInt(dispatchFile.getAttributionType()), dispatchFile.getAttributionId()); - if (docInfo == null || docInfo.getDocStatus() == 3) { - ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); - } - return docInfo; - } - - private PermissionStreamNew getPermissionStreams(DispatchFile dispatchFile) { - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - DeviceType deviceType = deviceTypeService.getById(dispatchFile.getAttributionId()); - String attributionId = deviceType != null ? deviceType.getAttributionId() : dispatchFile.getAttributionId(); - - PermissionStreamNew permissionStreams; - if (dispatchFile.getAttributionType().equals("5")) { - // 宸ュ簭 - permissionStreams = handleProcess(dispatchFile, attributionId, user); - } else { - // 宸ユ - permissionStreams = handleWorkStep(dispatchFile, attributionId, user); - } - if (permissionStreams == null) { + PermissionStreamNew permissionStreamNew = permissionService.getPermissionStreams(dispatchFile); + if (permissionStreamNew == null) { ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); } - return permissionStreams; - } - - private PermissionStreamNew handleProcess(DispatchFile dispatchFile, String attributionId, LoginUser user) { - ProcessStream processStream = processStreamService.getById(attributionId); - if (processStream == null) { - ExceptionCast.cast(CommonCode.INVALID_PARAM); - } - dispatchFile.setProductId(processStream.getProductId()); - dispatchFile.setComponentId(processStream.getComponentId()); - dispatchFile.setPartsId(processStream.getPartsId()); - dispatchFile.setPsvId(processStream.getPsvId()); - dispatchFile.setProcessId(processStream.getProcessId()); - if (deviceTypeService.getById(dispatchFile.getAttributionId()) != null) { - dispatchFile.setDeviceTypeId(deviceTypeService.getById(dispatchFile.getAttributionId()).getId()); - } - return permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), user.getId(), "5"); - } - - private PermissionStreamNew handleWorkStep(DispatchFile dispatchFile, String attributionId, LoginUser user) { - WorkStep workStep = workStepService.getById(attributionId); - if (workStep == null) { - ExceptionCast.cast(CommonCode.INVALID_PARAM); - } - dispatchFile.setProductId(workStep.getProductId()); - dispatchFile.setComponentId(workStep.getComponentId()); - dispatchFile.setPartsId(workStep.getPartsId()); - dispatchFile.setPsvId(workStep.getPsvId()); - dispatchFile.setProcessId(workStep.getProcessId()); - dispatchFile.setStepId(workStep.getId()); - if (deviceTypeService.getById(dispatchFile.getAttributionId()) != null) { - dispatchFile.setDeviceTypeId(deviceTypeService.getById(dispatchFile.getAttributionId()).getId()); - } - return permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(), user.getId(), "6"); + return permissionStreamNew; } @Override -- Gitblit v1.9.3