| | |
| | | import com.highdatas.mdm.entity.Maintain; |
| | | import com.highdatas.mdm.entity.MaintainDetail; |
| | | import com.highdatas.mdm.entity.TUser; |
| | | import com.highdatas.mdm.pojo.ActivitiBusinessType; |
| | | import com.highdatas.mdm.pojo.ActivitiStatus; |
| | | import com.highdatas.mdm.pojo.Page; |
| | | import com.highdatas.mdm.pojo.Result; |
| | | import com.highdatas.mdm.pojo.*; |
| | | import com.highdatas.mdm.service.*; |
| | | import com.highdatas.mdm.service.act.*; |
| | | import com.highdatas.mdm.util.DbUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | IFlowsService flowsService; |
| | | |
| | | @Autowired |
| | | ITUserService userService; |
| | | |
| | | @Autowired |
| | | HistoryService historyService; |
| | |
| | | IMaintainFieldService maintainFieldService; |
| | | |
| | | private TUser user; |
| | | |
| | | /** |
| | | * |
| | | * @description: 启动流程 |
| | | * @param key 流程key |
| | | * @param session 请求session |
| | | * @param maintainId 版本id |
| | | * @param type 业务类型 |
| | | * @return: flows 流程实例 |
| | | * |
| | | */ |
| | | @Override |
| | | public Flows start(String key, HttpSession session, String maintainId, ActivitiBusinessType type) { |
| | | return start(key, session, maintainId, type, null); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 启动流程 |
| | | * @param key 流程key |
| | | * @param session 请求session |
| | | * @param maintainId 版本id |
| | | * @param type 业务类型 |
| | | * @param params 参数类型 |
| | | * @return: flows 流程实例 |
| | | * |
| | | */ |
| | | @Override |
| | | public Flows start(String key, HttpSession session, String maintainId, ActivitiBusinessType type, Map<String, Object> params) { |
| | | |
| | | identityService.setSession( session); |
| | | Flows flows = new Flows(); |
| | |
| | | flows.setBusinessType(type); |
| | | flows.setStatus(ActivitiStatus.working); |
| | | HashMap<String, Object> variableMap = new HashMap<>(); |
| | | variableMap.put("reasson", "申请审批"); |
| | | if (params != null) { |
| | | variableMap.putAll(params); |
| | | } |
| | | variableMap.put("reason", "申请审批"); |
| | | |
| | | String workflowId = identityService.startProcess(id, key, null, variableMap); |
| | | flows.setWorkflowId(workflowId); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 获取待审批列表 |
| | | * @param tableName 表名 |
| | | * @param session 请求session |
| | | * @param pageNo 页数 |
| | | * @param pageSize 每页条数 |
| | | * @return: result 待处理流程list |
| | | * |
| | | */ |
| | | @Override |
| | | public Result todoTask(HttpSession session, String tableName, Integer pageNo, Integer pageSize) { |
| | | taskService.setSession(session); |
| | | List<String> todoTask = taskService.getTodoTask(); |
| | | if (todoTask.size() == 0) { |
| | | return Result.success(null); |
| | | return Result.success(CodeMsg.SUCCESS); |
| | | } |
| | | |
| | | Wrapper<Flows> flowsWrapper = new EntityWrapper<Flows>().in("workflow_id", todoTask).ne("business_type", ActivitiBusinessType.exists); |
| | |
| | | |
| | | List<Flows> maintainList = records.stream() |
| | | .filter(flows -> flows.getBusinessType().equals(ActivitiBusinessType.maintain)) |
| | | .filter(flows -> (!flows.getStatus().equals(ActivitiStatus.open) || !flows.getStatus().equals(ActivitiStatus.close))) |
| | | .filter(flows -> maintainService.selectById(flows.getBusinessId()) != null) |
| | | .filter(flows -> maintainService.selectById(flows.getBusinessId()).getTableName().equalsIgnoreCase(tableName)).collect(Collectors.toList()); |
| | | |
| | | List<Flows> maintainFieldList = records.stream() |
| | | List<Flows> collect = records.stream() |
| | | .filter(flows -> flows.getBusinessType().equals(ActivitiBusinessType.field)) |
| | | .filter(flows -> (!flows.getStatus().equals(ActivitiStatus.open) || !flows.getStatus().equals(ActivitiStatus.close))) |
| | | .filter(flows -> maintainFieldService.selectById(flows.getBusinessId()) != null) |
| | | .filter(flows -> maintainFieldService.selectById(flows.getBusinessId()).getTableName().equalsIgnoreCase(tableName)).collect(Collectors.toList()); |
| | | records = new ArrayList<>(); |
| | | |
| | | records.addAll(maintainFieldList); |
| | | records.addAll(maintainList); |
| | | records.addAll(collect); |
| | | } |
| | | Page page = new Page(records.size()); |
| | | page.setPageNo(pageNo); |
| | |
| | | |
| | | for (Flows flow : records) { |
| | | String userId = flow.getUserId(); |
| | | TUser user = userService.selectOne(new EntityWrapper<TUser>().eq("user_id", userId)); |
| | | TUser user = DbUtils.getUserById(userId); |
| | | if (user == null) { |
| | | continue; |
| | | } |
| | |
| | | return Result.success(flowPages); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 保存用户信息到流程服务里 |
| | | * @param user 用户信息 |
| | | * @return: void |
| | | * |
| | | */ |
| | | |
| | | @Override |
| | | public void setUser(TUser user) { |
| | | this.user = user; |
| | |
| | | runtimeService.setUser(user); |
| | | repositoryService.setUser(user); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @description: 获取用户信息到流程服务里 |
| | | * @return: void |
| | | * |
| | | */ |
| | | @Override |
| | | public TUser getUser() { |
| | | return this.user; |