Commit 861207f09a2d350055e4584faeed764c504d8ed2

Authored by yeqianyong
1 parent 6ef80aeb

楚江ERP-动态审核人接口开发(根据角色code获取审核人)

  1 +package com.lframework.xingyun.sc.handlers;
  2 +
  3 +import com.lframework.starter.web.core.utils.JsonUtil;
  4 +import com.lframework.starter.web.inner.mappers.system.SysUserRoleMapper;
  5 +import com.lframework.starter.web.inner.service.system.SysUserDeptService;
  6 +import lombok.extern.slf4j.Slf4j;
  7 +import org.apache.commons.collections4.CollectionUtils;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import javax.annotation.Resource;
  11 +import java.util.ArrayList;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +@Component
  16 +@Slf4j
  17 +public class TransactorHandler {
  18 +
  19 + @Resource
  20 + private SysUserDeptService userDeptService;
  21 + @Resource
  22 + private SysUserRoleMapper sysUserRoleMapper;
  23 +
  24 +
  25 + /**
  26 + * 根据角色code获取办理人
  27 + *
  28 + * @param roleCode 角色编号
  29 + * @param userId 业务数据创建人/更新人ID
  30 + * @return List<String>
  31 + */
  32 + public List<String> listTransactorsByRoleCode(String roleCode, String userId) {
  33 + log.info("================== listTransactorsByRoleCode invoke start, roleCode:{}, userId:{}", roleCode, userId);
  34 + // 获取角色下人员
  35 + List<String> userIdList = sysUserRoleMapper.listUserIdByRoleCode(roleCode);
  36 + if (CollectionUtils.isEmpty(userIdList)) {
  37 + return new ArrayList<>();
  38 + }
  39 + List<String> result = new ArrayList<>();
  40 + // 获取人员所属部门下所有人员(包含子部门)
  41 + Map<String, List<String>> userIdMap = userDeptService.mapAllUserByUserId(userIdList, true);
  42 + for (String id : userIdList) {
  43 + log.info("================== listTransactorsByRoleCode roleUserId:{}", id);
  44 + List<String> userIds = userIdMap.get(id);
  45 + log.info("================== listTransactorsByRoleCode userDeptUserId:{}", JsonUtil.toJsonString(userIds));
  46 + if (CollectionUtils.isNotEmpty(userIds) && userIds.contains(userId)) {
  47 + result.add(id);
  48 + }
  49 + }
  50 + log.info("================== listTransactorsByRoleCode invoke end, transactors:{}", JsonUtil.toJsonString(result));
  51 + return result;
  52 + }
  53 +}
@@ -205,7 +205,7 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe @@ -205,7 +205,7 @@ public class CustomerDevelopPlanServiceImpl extends BaseMpServiceImpl<CustomerDe
205 throw new DefaultClientException("仅驳回状态下可编辑!"); 205 throw new DefaultClientException("仅驳回状态下可编辑!");
206 } 206 }
207 // 重新发起流程 207 // 重新发起流程
208 - Instance instance = flowInstanceWrapperService.startInstance("CUSTOMER_DEVELOP", vo.getId(), BPM_FLAG, vo); 208 + Instance instance = flowInstanceWrapperService.startInstance("CUSTOMER_DEVELOP", vo.getId(), BPM_FLAG, data);
209 209
210 LambdaUpdateWrapper<CustomerDevelopPlan> updateWrapper = Wrappers.lambdaUpdate(CustomerDevelopPlan.class) 210 LambdaUpdateWrapper<CustomerDevelopPlan> updateWrapper = Wrappers.lambdaUpdate(CustomerDevelopPlan.class)
211 .set(CustomerDevelopPlan::getCustomerId, vo.getCustomerId()) 211 .set(CustomerDevelopPlan::getCustomerId, vo.getCustomerId())