Commit 72fe299c9f51b4534e2fe953a8d447d8fb421ece

Authored by 房远帅
2 parents 874a716d 57f9a42d

Merge branch 'mater_procurement' into master_quotation

... ... @@ -321,6 +321,12 @@ public class ProcurementDomesticCustomerCredit extends BaseEntity implements Bas
321 321 private Boolean showChangeReviewExamineDetail;
322 322
323 323 /**
  324 + * 角色编码(非持久化字段)
  325 + */
  326 + @TableField(exist = false)
  327 + private String roleCode;
  328 +
  329 + /**
324 330 * 创建人ID
325 331 */
326 332 @TableField(fill = FieldFill.INSERT)
... ...
... ... @@ -14,6 +14,7 @@ import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
14 14 import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
15 15 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
16 16 import com.lframework.starter.common.utils.Assert;
  17 +import com.lframework.starter.common.utils.CollectionUtil;
17 18 import com.lframework.starter.common.utils.ObjectUtil;
18 19 import com.lframework.starter.mq.core.service.MqProducerService;
19 20 import com.lframework.starter.web.core.annotations.oplog.OpLog;
... ... @@ -24,7 +25,9 @@ import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
24 25 import com.lframework.starter.web.core.utils.*;
25 26 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
26 27 import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto;
  28 +import com.lframework.starter.web.inner.entity.SysRole;
27 29 import com.lframework.starter.web.inner.entity.SysUser;
  30 +import com.lframework.starter.web.inner.service.system.SysRoleService;
28 31 import com.lframework.starter.web.inner.service.system.SysUserService;
29 32 import com.lframework.xingyun.sc.procurement.dto.DomesticReviewerDto;
30 33 import com.lframework.xingyun.sc.procurement.entity.ProcurementDomesticCustomerCredit;
... ... @@ -65,6 +68,9 @@ public class ProcurementDomesticCustomerCreditServiceImpl
65 68 private FlowTaskWrapperMapper flowTaskWrapperMapper;
66 69 @Autowired
67 70 private MqProducerService mqProducerService;
  71 + @Autowired
  72 + private SysRoleService sysRoleService;
  73 +
68 74
69 75 @Override
70 76 public PageResult<ProcurementDomesticCustomerCredit> query(Integer pageIndex, Integer pageSize,
... ... @@ -166,6 +172,31 @@ public class ProcurementDomesticCustomerCreditServiceImpl
166 172
167 173 //开启审核
168 174 ProcurementDomesticCustomerCredit customerCredit = getBaseMapper().findById(data.getId());
  175 + List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId());
  176 + String roleCode = null;
  177 + if (CollectionUtil.isNotEmpty(sysRoleList)) {
  178 + // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率
  179 + Set<String> roleCodeSet = sysRoleList.stream()
  180 + .map(SysRole::getCode)
  181 + .collect(Collectors.toSet());
  182 +
  183 + // 2. 判断是否包含采购主管相关的角色
  184 + if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg")
  185 + || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) {
  186 + roleCode = "cgczg";
  187 + } else if (roleCodeSet.contains("qyjl")) {
  188 + // 3. 如果没有,继续判断是否包含区域经理
  189 + roleCode = "qyjl";
  190 + } else if (roleCodeSet.contains("nmcgkywy")) {
  191 + // 4. 如果还没有,继续判断是否包含内贸采购科业务员
  192 + roleCode = "nmcgkywy";
  193 + } else {
  194 + throw new DefaultClientException("当前角色无法发起审核!");
  195 + }
  196 + } else {
  197 + throw new DefaultClientException("当前角色无法发起审核!");
  198 + }
  199 + customerCredit.setRoleCode(roleCode);
169 200 flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, customerCredit);
170 201
171 202 OpLogUtil.setVariable("id", data.getId());
... ... @@ -253,7 +284,31 @@ public class ProcurementDomesticCustomerCreditServiceImpl
253 284 //编辑-直接更新入库
254 285 getBaseMapper().updateById(data);
255 286 }
256   -
  287 + List<SysRole> sysRoleList = sysRoleService.getByUserId(SecurityUtil.getCurrentUser().getId());
  288 + String roleCode = null;
  289 + if (CollectionUtil.isNotEmpty(sysRoleList)) {
  290 + // 1. 提取角色列表中的所有 code,转换为 Set 集合,提升后续判断效率
  291 + Set<String> roleCodeSet = sysRoleList.stream()
  292 + .map(SysRole::getCode)
  293 + .collect(Collectors.toSet());
  294 +
  295 + // 2. 判断是否包含采购主管相关的角色
  296 + if (roleCodeSet.contains("htcgeczg") || roleCodeSet.contains("htcgyczg")
  297 + || roleCodeSet.contains("ltcgczg") || roleCodeSet.contains("ztcgczg")) {
  298 + roleCode = "cgczg";
  299 + } else if (roleCodeSet.contains("qyjl")) {
  300 + // 3. 如果没有,继续判断是否包含区域经理
  301 + roleCode = "qyjl";
  302 + } else if (roleCodeSet.contains("nmcgkywy")) {
  303 + // 4. 如果还没有,继续判断是否包含内贸采购科业务员
  304 + roleCode = "nmcgkywy";
  305 + } else {
  306 + throw new DefaultClientException("当前角色无法发起审核!");
  307 + }
  308 + } else {
  309 + throw new DefaultClientException("当前角色无法发起审核!");
  310 + }
  311 + data.setRoleCode(roleCode);
257 312 //开启审核
258 313 flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, data);
259 314
... ...