Commit c5878dde4b496170612ca9c86948536e17d2a97a
1 parent
cc2cf7d3
销售-发货计划:办事处内勤、办事处主管(能看到自己申请发货创建的和子部门下人创建的数据+系统自动生成),明细数据只能看到自己创建的和子部门下人创建的,关联订单查询合同创建人实现
Showing
6 changed files
with
23 additions
and
14 deletions
| @@ -77,12 +77,12 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | @@ -77,12 +77,12 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP | ||
| 77 | Assert.greaterThanZero(pageIndex); | 77 | Assert.greaterThanZero(pageIndex); |
| 78 | Assert.greaterThanZero(pageSize); | 78 | Assert.greaterThanZero(pageSize); |
| 79 | 79 | ||
| 80 | - // 业务员(ywy)角色做权限控制:明细创建人多为系统自动生成,按明细关联订货单的合同创建人过滤(自己 + 本区域人) | 80 | + // 业务员(ywy)/办事处内勤(bscnq)/办事处主管(bsczg)角色做权限控制:明细创建人多为系统自动生成,按明细关联订货单的合同创建人过滤(自己 + 本区域人) |
| 81 | String currentUserId = SecurityUtil.getCurrentUser().getId(); | 81 | String currentUserId = SecurityUtil.getCurrentUser().getId(); |
| 82 | List<SysRole> roleList = sysRoleService.getByUserId(currentUserId); | 82 | List<SysRole> roleList = sysRoleService.getByUserId(currentUserId); |
| 83 | for (SysRole role : roleList) { | 83 | for (SysRole role : roleList) { |
| 84 | String code = role.getCode(); | 84 | String code = role.getCode(); |
| 85 | - if ("ywy".equals(code)) { | 85 | + if ("ywy".equals(code) || "bscnq".equals(code) || "bsczg".equals(code)) { |
| 86 | vo.setCreateByIds(sysUserDeptService.listAllUserByUserId(Collections.singletonList(currentUserId), true)); | 86 | vo.setCreateByIds(sysUserDeptService.listAllUserByUserId(Collections.singletonList(currentUserId), true)); |
| 87 | break; | 87 | break; |
| 88 | } | 88 | } |
| @@ -47,6 +47,14 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap | @@ -47,6 +47,14 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap | ||
| 47 | * 业务员角色编码 | 47 | * 业务员角色编码 |
| 48 | */ | 48 | */ |
| 49 | private static final String ROLE_CODE_YWY = "ywy"; | 49 | private static final String ROLE_CODE_YWY = "ywy"; |
| 50 | + /** | ||
| 51 | + * 办事处内勤角色编码 | ||
| 52 | + */ | ||
| 53 | + private static final String ROLE_CODE_BSCNQ = "bscnq"; | ||
| 54 | + /** | ||
| 55 | + * 办事处主管角色编码 | ||
| 56 | + */ | ||
| 57 | + private static final String ROLE_CODE_BSCZG = "bsczg"; | ||
| 50 | 58 | ||
| 51 | @Override | 59 | @Override |
| 52 | public PageResult<ShipmentsPlan> query(Integer pageIndex, Integer pageSize, QueryShipmentsPlanVo vo) { | 60 | public PageResult<ShipmentsPlan> query(Integer pageIndex, Integer pageSize, QueryShipmentsPlanVo vo) { |
| @@ -57,15 +65,16 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap | @@ -57,15 +65,16 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap | ||
| 57 | String currentUserId = SecurityUtil.getCurrentUser().getId(); | 65 | String currentUserId = SecurityUtil.getCurrentUser().getId(); |
| 58 | // 获取当前人所属角色 | 66 | // 获取当前人所属角色 |
| 59 | List<SysRole> roleList = sysRoleService.getByUserId(currentUserId); | 67 | List<SysRole> roleList = sysRoleService.getByUserId(currentUserId); |
| 60 | - // 业务员(ywy)角色标记:需特殊处理,额外可见系统自动生成且非申请发货来源的数据 | ||
| 61 | - boolean isYwy = false; | 68 | + // 业务员(ywy)/办事处内勤(bscnq)/办事处主管(bsczg)角色标记:需特殊处理,额外可见系统自动生成且非申请发货来源的数据 |
| 69 | + boolean isSpecialScope = false; | ||
| 62 | for (SysRole role : roleList) { | 70 | for (SysRole role : roleList) { |
| 63 | String roleCode = role.getCode(); | 71 | String roleCode = role.getCode(); |
| 64 | if (StringUtils.isBlank(roleCode)) { | 72 | if (StringUtils.isBlank(roleCode)) { |
| 65 | continue; | 73 | continue; |
| 66 | } | 74 | } |
| 67 | - if (ROLE_CODE_YWY.equals(roleCode)) { | ||
| 68 | - isYwy = true; | 75 | + if (ROLE_CODE_YWY.equals(roleCode) || ROLE_CODE_BSCNQ.equals(roleCode) |
| 76 | + || ROLE_CODE_BSCZG.equals(roleCode)) { | ||
| 77 | + isSpecialScope = true; | ||
| 69 | } | 78 | } |
| 70 | String workshopCode = ""; | 79 | String workshopCode = ""; |
| 71 | if (roleCode.startsWith("yfc")) { | 80 | if (roleCode.startsWith("yfc")) { |
| @@ -82,8 +91,8 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap | @@ -82,8 +91,8 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap | ||
| 82 | } | 91 | } |
| 83 | } | 92 | } |
| 84 | vo.setWorkshopCodeList(workshopCodeList); | 93 | vo.setWorkshopCodeList(workshopCodeList); |
| 85 | - if (isYwy) { | ||
| 86 | - // 业务员口径:自己创建的 + 本区域(所属部门及其下级部门)人创建的 + 系统自动生成且非申请发货来源的 | 94 | + if (isSpecialScope) { |
| 95 | + // 特殊口径:自己创建的 + 本区域(所属部门及其下级部门)人创建的 + 系统自动生成且非申请发货来源的 | ||
| 87 | vo.setYwyUserId(currentUserId); | 96 | vo.setYwyUserId(currentUserId); |
| 88 | List<SysUserDept> userDeptList = sysUserDeptService.getByUserId(currentUserId); | 97 | List<SysUserDept> userDeptList = sysUserDeptService.getByUserId(currentUserId); |
| 89 | vo.setYwyDeptIds(userDeptList.stream().map(SysUserDept::getDeptId).distinct() | 98 | vo.setYwyDeptIds(userDeptList.stream().map(SysUserDept::getDeptId).distinct() |
| @@ -30,8 +30,8 @@ public interface ShipmentsPlanMapper extends BaseMapper<ShipmentsPlan> { | @@ -30,8 +30,8 @@ public interface ShipmentsPlanMapper extends BaseMapper<ShipmentsPlan> { | ||
| 30 | List<ShipmentsPlan> query(@Param("vo") QueryShipmentsPlanVo vo); | 30 | List<ShipmentsPlan> query(@Param("vo") QueryShipmentsPlanVo vo); |
| 31 | 31 | ||
| 32 | /** | 32 | /** |
| 33 | - * 业务员(ywy)角色专用查询(无数据权限注解,Service 层按角色分流调用): | ||
| 34 | - * 自己创建的 + 本区域(所属部门及其下级部门)人创建的 + 系统自动创建的 | 33 | + * 特殊数据口径角色专用查询(无数据权限注解,Service 层按角色分流调用;适用业务员 ywy / 办事处内勤 bscnq / 办事处主管 bsczg): |
| 34 | + * 自己创建的 + 本区域(所属部门及其下级部门)人创建的 + 系统自动创建且非申请发货来源的 | ||
| 35 | */ | 35 | */ |
| 36 | List<ShipmentsPlan> queryYwyScope(@Param("vo") QueryShipmentsPlanVo vo); | 36 | List<ShipmentsPlan> queryYwyScope(@Param("vo") QueryShipmentsPlanVo vo); |
| 37 | 37 |
| @@ -40,13 +40,13 @@ public class QueryShipmentsPlanVo extends PageVo implements BaseVo, Serializable | @@ -40,13 +40,13 @@ public class QueryShipmentsPlanVo extends PageVo implements BaseVo, Serializable | ||
| 40 | private LocalDateTime createEndTime; | 40 | private LocalDateTime createEndTime; |
| 41 | 41 | ||
| 42 | /** | 42 | /** |
| 43 | - * 业务员(ywy)角色专用:当前用户ID(后端注入,前端传参无效) | 43 | + * 特殊数据口径角色专用(业务员 ywy / 办事处内勤 bscnq / 办事处主管 bsczg):当前用户ID(后端注入,前端传参无效) |
| 44 | */ | 44 | */ |
| 45 | @ApiModelProperty(hidden = true) | 45 | @ApiModelProperty(hidden = true) |
| 46 | private String ywyUserId; | 46 | private String ywyUserId; |
| 47 | 47 | ||
| 48 | /** | 48 | /** |
| 49 | - * 业务员(ywy)角色专用:当前用户所属部门ID集合(后端注入,前端传参无效) | 49 | + * 特殊数据口径角色专用(业务员 ywy / 办事处内勤 bscnq / 办事处主管 bsczg):当前用户所属部门ID集合(后端注入,前端传参无效) |
| 50 | */ | 50 | */ |
| 51 | @ApiModelProperty(hidden = true) | 51 | @ApiModelProperty(hidden = true) |
| 52 | private List<String> ywyDeptIds; | 52 | private List<String> ywyDeptIds; |
| @@ -126,7 +126,7 @@ | @@ -126,7 +126,7 @@ | ||
| 126 | </otherwise> | 126 | </otherwise> |
| 127 | </choose> | 127 | </choose> |
| 128 | </if> | 128 | </if> |
| 129 | - <!-- 业务员(ywy)权限:明细创建人多为系统自动生成,按关联订货单的合同创建人过滤(Java 层已预算常量集合) --> | 129 | + <!-- 业务员(ywy)/办事处内勤(bscnq)/办事处主管(bsczg)权限:明细创建人多为系统自动生成,按关联订货单的合同创建人过滤(Java 层已预算常量集合) --> |
| 130 | <if test="vo.createByIds != null and vo.createByIds.size() > 0"> | 130 | <if test="vo.createByIds != null and vo.createByIds.size() > 0"> |
| 131 | AND o.contract_create_by_id IN | 131 | AND o.contract_create_by_id IN |
| 132 | <foreach collection="vo.createByIds" open="(" separator="," close=")" item="item"> | 132 | <foreach collection="vo.createByIds" open="(" separator="," close=")" item="item"> |
| @@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
| 62 | ORDER BY tb.create_time DESC | 62 | ORDER BY tb.create_time DESC |
| 63 | </select> | 63 | </select> |
| 64 | 64 | ||
| 65 | - <!-- 业务员(ywy)角色专用查询(Mapper 方法无 @DataPermissions 注解,避免框架创建人条件把系统自动创建的数据过滤掉): | 65 | + <!-- 特殊数据口径角色专用查询(Mapper 方法无 @DataPermissions 注解,避免框架创建人条件把系统自动创建的数据过滤掉;适用业务员 ywy / 办事处内勤 bscnq / 办事处主管 bsczg): |
| 66 | 自己创建的 + 本区域(所属部门及其下级部门)人创建的 + 系统自动生成且非申请发货来源的 --> | 66 | 自己创建的 + 本区域(所属部门及其下级部门)人创建的 + 系统自动生成且非申请发货来源的 --> |
| 67 | <select id="queryYwyScope" resultMap="ShipmentsPlan"> | 67 | <select id="queryYwyScope" resultMap="ShipmentsPlan"> |
| 68 | <include refid="ShipmentsPlan_sql"/> | 68 | <include refid="ShipmentsPlan_sql"/> |