Commit 422a48fdfc9f8fb4ce562a621f7d85a39ac38830
1 parent
36dfb64e
采购-报价管理:获取某采购处下所有可分配人员(采购处内贸科业务员、区域经理、采购处主管)
Showing
2 changed files
with
31 additions
and
1 deletions
| @@ -16,9 +16,11 @@ import com.lframework.starter.web.core.utils.PageResultUtil; | @@ -16,9 +16,11 @@ import com.lframework.starter.web.core.utils.PageResultUtil; | ||
| 16 | import com.lframework.starter.web.inner.bo.system.user.QuerySysUserBo; | 16 | import com.lframework.starter.web.inner.bo.system.user.QuerySysUserBo; |
| 17 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; | 17 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 18 | import com.lframework.starter.web.inner.entity.SysDept; | 18 | import com.lframework.starter.web.inner.entity.SysDept; |
| 19 | +import com.lframework.starter.web.inner.entity.SysRole; | ||
| 19 | import com.lframework.starter.web.inner.entity.SysUser; | 20 | import com.lframework.starter.web.inner.entity.SysUser; |
| 20 | import com.lframework.starter.web.inner.entity.SysUserDept; | 21 | import com.lframework.starter.web.inner.entity.SysUserDept; |
| 21 | import com.lframework.starter.web.inner.service.system.SysDeptService; | 22 | import com.lframework.starter.web.inner.service.system.SysDeptService; |
| 23 | +import com.lframework.starter.web.inner.service.system.SysRoleService; | ||
| 22 | import com.lframework.starter.web.inner.service.system.SysUserDeptService; | 24 | import com.lframework.starter.web.inner.service.system.SysUserDeptService; |
| 23 | import com.lframework.starter.web.inner.service.system.SysUserService; | 25 | import com.lframework.starter.web.inner.service.system.SysUserService; |
| 24 | import com.lframework.xingyun.sc.procurement.entity.SupplierQuotationDeal; | 26 | import com.lframework.xingyun.sc.procurement.entity.SupplierQuotationDeal; |
| @@ -36,6 +38,7 @@ import java.util.ArrayList; | @@ -36,6 +38,7 @@ import java.util.ArrayList; | ||
| 36 | import java.util.Collections; | 38 | import java.util.Collections; |
| 37 | import java.util.List; | 39 | import java.util.List; |
| 38 | import java.util.Map; | 40 | import java.util.Map; |
| 41 | +import java.util.HashSet; | ||
| 39 | import java.util.Set; | 42 | import java.util.Set; |
| 40 | import java.util.stream.Collectors; | 43 | import java.util.stream.Collectors; |
| 41 | import java.util.stream.Stream; | 44 | import java.util.stream.Stream; |
| @@ -48,6 +51,18 @@ import org.springframework.transaction.annotation.Transactional; | @@ -48,6 +51,18 @@ import org.springframework.transaction.annotation.Transactional; | ||
| 48 | public class SupplierQuotationDealServiceImpl | 51 | public class SupplierQuotationDealServiceImpl |
| 49 | extends BaseMpServiceImpl<SupplierQuotationDealMapper, SupplierQuotationDeal> | 52 | extends BaseMpServiceImpl<SupplierQuotationDealMapper, SupplierQuotationDeal> |
| 50 | implements SupplierQuotationDealService { | 53 | implements SupplierQuotationDealService { |
| 54 | + | ||
| 55 | + private static final Set<String> ALLOWED_ASSIGN_ROLE_CODES = new HashSet<>(); | ||
| 56 | + | ||
| 57 | + static { | ||
| 58 | + ALLOWED_ASSIGN_ROLE_CODES.add("htcgeczg"); | ||
| 59 | + ALLOWED_ASSIGN_ROLE_CODES.add("htcgyczg"); | ||
| 60 | + ALLOWED_ASSIGN_ROLE_CODES.add("ltcgczg"); | ||
| 61 | + ALLOWED_ASSIGN_ROLE_CODES.add("nmcgkywy"); | ||
| 62 | + ALLOWED_ASSIGN_ROLE_CODES.add("qyjl"); | ||
| 63 | + ALLOWED_ASSIGN_ROLE_CODES.add("ztcgczg"); | ||
| 64 | + } | ||
| 65 | + | ||
| 51 | @Resource | 66 | @Resource |
| 52 | private SupplierQuotationProjectMapper supplierQuotationProjectMapper; | 67 | private SupplierQuotationProjectMapper supplierQuotationProjectMapper; |
| 53 | @Resource | 68 | @Resource |
| @@ -58,6 +73,8 @@ public class SupplierQuotationDealServiceImpl | @@ -58,6 +73,8 @@ public class SupplierQuotationDealServiceImpl | ||
| 58 | private SysUserDeptService sysUserDeptService; | 73 | private SysUserDeptService sysUserDeptService; |
| 59 | @Resource | 74 | @Resource |
| 60 | private SysUserService sysUserService; | 75 | private SysUserService sysUserService; |
| 76 | + @Resource | ||
| 77 | + private SysRoleService sysRoleService; | ||
| 61 | 78 | ||
| 62 | @Transactional(rollbackFor = Exception.class) | 79 | @Transactional(rollbackFor = Exception.class) |
| 63 | @Override | 80 | @Override |
| @@ -180,6 +197,8 @@ public class SupplierQuotationDealServiceImpl | @@ -180,6 +197,8 @@ public class SupplierQuotationDealServiceImpl | ||
| 180 | return Collections.emptyList(); | 197 | return Collections.emptyList(); |
| 181 | } | 198 | } |
| 182 | return userList.stream() | 199 | return userList.stream() |
| 200 | + .filter(user -> matchAllowedAssignRole(user.getId())) | ||
| 201 | + .sorted((o1, o2) -> StringUtils.defaultString(o1.getName()).compareTo(StringUtils.defaultString(o2.getName()))) | ||
| 183 | .map(QuerySysUserBo::new) | 202 | .map(QuerySysUserBo::new) |
| 184 | .collect(Collectors.toList()); | 203 | .collect(Collectors.toList()); |
| 185 | } | 204 | } |
| @@ -213,4 +232,15 @@ public class SupplierQuotationDealServiceImpl | @@ -213,4 +232,15 @@ public class SupplierQuotationDealServiceImpl | ||
| 213 | .distinct() | 232 | .distinct() |
| 214 | .collect(Collectors.toList()); | 233 | .collect(Collectors.toList()); |
| 215 | } | 234 | } |
| 235 | + | ||
| 236 | + private boolean matchAllowedAssignRole(String userId) { | ||
| 237 | + List<SysRole> sysRoleList = sysRoleService.getByUserId(userId); | ||
| 238 | + if (CollectionUtil.isEmpty(sysRoleList)) { | ||
| 239 | + return false; | ||
| 240 | + } | ||
| 241 | + return sysRoleList.stream() | ||
| 242 | + .map(SysRole::getCode) | ||
| 243 | + .filter(StringUtils::isNotBlank) | ||
| 244 | + .anyMatch(ALLOWED_ASSIGN_ROLE_CODES::contains); | ||
| 245 | + } | ||
| 216 | } | 246 | } |
| @@ -30,7 +30,7 @@ public interface SupplierQuotationDealService extends BaseMpService<SupplierQuot | @@ -30,7 +30,7 @@ public interface SupplierQuotationDealService extends BaseMpService<SupplierQuot | ||
| 30 | void assign(AssignSupplierQuotationDealVo vo); | 30 | void assign(AssignSupplierQuotationDealVo vo); |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | - * 获取当前部门及其子部门下人员 | 33 | + * 获取当前部门及其子部门下人员(采购处主管、区域经理、采购处业务员) |
| 34 | * | 34 | * |
| 35 | * @param purchaseDepartment 部门主键 | 35 | * @param purchaseDepartment 部门主键 |
| 36 | */ | 36 | */ |