Showing
14 changed files
with
408 additions
and
11 deletions
| 1 | package com.lframework.xingyun.sc.controller.shipments; | 1 | package com.lframework.xingyun.sc.controller.shipments; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.io.resource.ClassPathResource; | 3 | import cn.hutool.core.io.resource.ClassPathResource; |
| 4 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | ||
| 4 | import com.lframework.starter.web.core.utils.JsonUtil; | 5 | import com.lframework.starter.web.core.utils.JsonUtil; |
| 5 | import com.lframework.starter.web.inner.entity.SysDept; | 6 | import com.lframework.starter.web.inner.entity.SysDept; |
| 7 | +import com.lframework.starter.web.inner.entity.SysRole; | ||
| 6 | import com.lframework.starter.web.inner.entity.SysUser; | 8 | import com.lframework.starter.web.inner.entity.SysUser; |
| 9 | +import com.lframework.starter.web.inner.entity.SysUserDept; | ||
| 7 | import com.lframework.starter.web.inner.service.system.SysDeptService; | 10 | import com.lframework.starter.web.inner.service.system.SysDeptService; |
| 11 | +import com.lframework.starter.web.inner.service.system.SysRoleService; | ||
| 12 | +import com.lframework.starter.web.inner.service.system.SysUserDeptService; | ||
| 8 | import com.lframework.starter.web.inner.service.system.SysUserService; | 13 | import com.lframework.starter.web.inner.service.system.SysUserService; |
| 9 | import com.lframework.xingyun.sc.bo.shipments.order.GetShipmentsOrderInfoBo; | 14 | import com.lframework.xingyun.sc.bo.shipments.order.GetShipmentsOrderInfoBo; |
| 10 | import com.lframework.xingyun.sc.bo.shipments.order.QueryShipmentsOrderInfoBo; | 15 | import com.lframework.xingyun.sc.bo.shipments.order.QueryShipmentsOrderInfoBo; |
| @@ -87,6 +92,10 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | @@ -87,6 +92,10 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | ||
| 87 | @Resource | 92 | @Resource |
| 88 | private SysDeptService sysDeptService; | 93 | private SysDeptService sysDeptService; |
| 89 | @Resource | 94 | @Resource |
| 95 | + private SysRoleService sysRoleService; | ||
| 96 | + @Resource | ||
| 97 | + private SysUserDeptService sysUserDeptService; | ||
| 98 | + @Resource | ||
| 90 | private PurchaseOrderInfoService purchaseOrderInfoService; | 99 | private PurchaseOrderInfoService purchaseOrderInfoService; |
| 91 | @Resource | 100 | @Resource |
| 92 | private PurchaseOrderLineService purchaseOrderLineService; | 101 | private PurchaseOrderLineService purchaseOrderLineService; |
| @@ -103,7 +112,15 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | @@ -103,7 +112,15 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | ||
| 103 | @HasPermission({"shipping-plan-manage:invoice:query"}) | 112 | @HasPermission({"shipping-plan-manage:invoice:query"}) |
| 104 | @GetMapping("/query") | 113 | @GetMapping("/query") |
| 105 | public InvokeResult<PageResult<QueryShipmentsOrderInfoBo>> query(@Valid QueryShipmentsOrderInfoVo vo) { | 114 | public InvokeResult<PageResult<QueryShipmentsOrderInfoBo>> query(@Valid QueryShipmentsOrderInfoVo vo) { |
| 106 | - PageResult<ShipmentsOrderInfo> pageResult = shipmentsOrderInfoService.query(getPageIndex(vo), getPageSize(vo), vo); | 115 | + // 业务员、办事处内勤、办事处主管按区域/办事处查看数据 |
| 116 | + PageResult<ShipmentsOrderInfo> pageResult; | ||
| 117 | + List<String> roleCodes = getCurrentUserRoleCodes(); | ||
| 118 | + if (isDeptBasedRole(roleCodes)) { | ||
| 119 | + applyQueryPermission(vo, roleCodes); | ||
| 120 | + pageResult = shipmentsOrderInfoService.queryWithoutPermission(getPageIndex(vo), getPageSize(vo), vo); | ||
| 121 | + } else { | ||
| 122 | + pageResult = shipmentsOrderInfoService.query(getPageIndex(vo), getPageSize(vo), vo); | ||
| 123 | + } | ||
| 107 | List<ShipmentsOrderInfo> dataList = pageResult.getDatas(); | 124 | List<ShipmentsOrderInfo> dataList = pageResult.getDatas(); |
| 108 | List<QueryShipmentsOrderInfoBo> results = null; | 125 | List<QueryShipmentsOrderInfoBo> results = null; |
| 109 | if (!CollectionUtil.isEmpty(dataList)) { | 126 | if (!CollectionUtil.isEmpty(dataList)) { |
| @@ -113,6 +130,126 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | @@ -113,6 +130,126 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { | ||
| 113 | } | 130 | } |
| 114 | 131 | ||
| 115 | /** | 132 | /** |
| 133 | + * 获取当前用户的角色编码列表 | ||
| 134 | + */ | ||
| 135 | + private List<String> getCurrentUserRoleCodes() { | ||
| 136 | + String currentUserId = SecurityUtil.getCurrentUser().getId(); | ||
| 137 | + List<SysRole> roles = sysRoleService.getByUserId(currentUserId); | ||
| 138 | + if (CollectionUtil.isEmpty(roles)) { | ||
| 139 | + return Collections.emptyList(); | ||
| 140 | + } | ||
| 141 | + return roles.stream().map(SysRole::getCode).collect(Collectors.toList()); | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + /** | ||
| 145 | + * 判断当前用户是否为业务员、办事处内勤、办事处主管等办事处相关角色 | ||
| 146 | + */ | ||
| 147 | + private boolean isDeptBasedRole(List<String> roleCodes) { | ||
| 148 | + return roleCodes.contains("ywy") | ||
| 149 | + || roleCodes.contains("bscnq") | ||
| 150 | + || roleCodes.contains("bsczg"); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * 对业务员、办事处内勤、办事处主管应用区域/办事处权限过滤 | ||
| 155 | + */ | ||
| 156 | + private void applyQueryPermission(QueryShipmentsOrderInfoVo vo, List<String> roleCodes) { | ||
| 157 | + String currentUserId = SecurityUtil.getCurrentUser().getId(); | ||
| 158 | + DeptScope scope = resolveDeptScope(currentUserId); | ||
| 159 | + if (scope == null) { | ||
| 160 | + return; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + boolean isYwy = roleCodes.contains("ywy"); | ||
| 164 | + | ||
| 165 | + if (isYwy) { | ||
| 166 | + // 业务员:有区域按区域过滤,没有则按办事处过滤 | ||
| 167 | + if (StringUtils.isNotBlank(scope.getRegionId())) { | ||
| 168 | + vo.setRegion(scope.getRegionId()); | ||
| 169 | + vo.setDeptId(null); | ||
| 170 | + } else if (StringUtils.isNotBlank(scope.getOfficeDeptId())) { | ||
| 171 | + vo.setDeptId(scope.getOfficeDeptId()); | ||
| 172 | + vo.setRegion(null); | ||
| 173 | + } | ||
| 174 | + } else { | ||
| 175 | + // 办事处内勤/办事处主管:始终按办事处过滤 | ||
| 176 | + if (StringUtils.isNotBlank(scope.getOfficeDeptId())) { | ||
| 177 | + vo.setDeptId(scope.getOfficeDeptId()); | ||
| 178 | + vo.setRegion(null); | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + /** | ||
| 184 | + * 解析用户的办事处/区域归属 | ||
| 185 | + */ | ||
| 186 | + private DeptScope resolveDeptScope(String userId) { | ||
| 187 | + List<SysUserDept> userDeptList = sysUserDeptService.getByUserId(userId); | ||
| 188 | + if (CollectionUtil.isEmpty(userDeptList)) { | ||
| 189 | + return null; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + Set<String> officeCodes = new HashSet<>(Arrays.asList("BF", "CZ", "DG", "FS", "NB", "SZ", "WZ", "ZT", "WM")); | ||
| 193 | + for (SysUserDept userDept : userDeptList) { | ||
| 194 | + String deptId = userDept.getDeptId(); | ||
| 195 | + if (StringUtils.isBlank(deptId)) { | ||
| 196 | + continue; | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + SysDept current = sysDeptService.findById(deptId); | ||
| 200 | + SysDept child = null; | ||
| 201 | + while (current != null) { | ||
| 202 | + if (officeCodes.contains(current.getCode())) { | ||
| 203 | + DeptScope scope = new DeptScope(); | ||
| 204 | + scope.setOfficeDeptId(current.getId()); | ||
| 205 | + if (child != null && !officeCodes.contains(child.getCode())) { | ||
| 206 | + scope.setRegionId(child.getId()); | ||
| 207 | + } | ||
| 208 | + return scope; | ||
| 209 | + } | ||
| 210 | + child = current; | ||
| 211 | + if (StringUtils.isBlank(current.getParentId())) { | ||
| 212 | + break; | ||
| 213 | + } | ||
| 214 | + current = sysDeptService.findById(current.getParentId()); | ||
| 215 | + } | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + return null; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + /** | ||
| 222 | + * 用户办事处/区域归属信息 | ||
| 223 | + */ | ||
| 224 | + private static class DeptScope { | ||
| 225 | + /** | ||
| 226 | + * 办事处ID | ||
| 227 | + */ | ||
| 228 | + private String officeDeptId; | ||
| 229 | + | ||
| 230 | + /** | ||
| 231 | + * 区域ID | ||
| 232 | + */ | ||
| 233 | + private String regionId; | ||
| 234 | + | ||
| 235 | + public String getOfficeDeptId() { | ||
| 236 | + return officeDeptId; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + public void setOfficeDeptId(String officeDeptId) { | ||
| 240 | + this.officeDeptId = officeDeptId; | ||
| 241 | + } | ||
| 242 | + | ||
| 243 | + public String getRegionId() { | ||
| 244 | + return regionId; | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + public void setRegionId(String regionId) { | ||
| 248 | + this.regionId = regionId; | ||
| 249 | + } | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + /** | ||
| 116 | * 根据ID查询 | 253 | * 根据ID查询 |
| 117 | */ | 254 | */ |
| 118 | @ApiOperation("根据ID查询") | 255 | @ApiOperation("根据ID查询") |
| @@ -76,10 +76,22 @@ public class CarRequestPlanController extends DefaultBaseController { | @@ -76,10 +76,22 @@ public class CarRequestPlanController extends DefaultBaseController { | ||
| 76 | @GetMapping("/query") | 76 | @GetMapping("/query") |
| 77 | public InvokeResult<PageResult<GetCarRequestPlanBo>> query(@Valid QueryCarRequestPlanVo vo) { | 77 | public InvokeResult<PageResult<GetCarRequestPlanBo>> query(@Valid QueryCarRequestPlanVo vo) { |
| 78 | 78 | ||
| 79 | - // wlgs角色只能查看要车单运作科审核人已填写的数据 | ||
| 80 | - applyWlgsRoleFilter(vo); | 79 | + String currentUserId = SecurityUtil.getCurrentUser().getId(); |
| 80 | + List<SysRole> roles = sysRoleService.getByUserId(currentUserId); | ||
| 81 | + List<String> roleCodes = CollectionUtil.isEmpty(roles) ? new java.util.ArrayList<>() | ||
| 82 | + : roles.stream().map(SysRole::getCode).collect(Collectors.toList()); | ||
| 81 | 83 | ||
| 82 | - PageResult<CarRequestPlan> pageResult = carRequestPlanService.query(getPageIndex(vo), getPageSize(vo), vo); | 84 | + // 办事处内勤/办事处主管能看到所有数据-暂时 |
| 85 | + boolean isBscRole = roleCodes.contains("bscnq") || roleCodes.contains("bsczg"); | ||
| 86 | + | ||
| 87 | + PageResult<CarRequestPlan> pageResult; | ||
| 88 | + if (isBscRole) { | ||
| 89 | + pageResult = carRequestPlanService.queryWithoutPermission(getPageIndex(vo), getPageSize(vo), vo); | ||
| 90 | + } else { | ||
| 91 | + // wlgs角色只能查看要车单运作科审核人已填写的数据 | ||
| 92 | + applyWlgsRoleFilter(roleCodes, vo); | ||
| 93 | + pageResult = carRequestPlanService.query(getPageIndex(vo), getPageSize(vo), vo); | ||
| 94 | + } | ||
| 83 | 95 | ||
| 84 | List<CarRequestPlan> datas = pageResult.getDatas(); | 96 | List<CarRequestPlan> datas = pageResult.getDatas(); |
| 85 | List<GetCarRequestPlanBo> results = null; | 97 | List<GetCarRequestPlanBo> results = null; |
| @@ -350,13 +362,7 @@ public class CarRequestPlanController extends DefaultBaseController { | @@ -350,13 +362,7 @@ public class CarRequestPlanController extends DefaultBaseController { | ||
| 350 | /** | 362 | /** |
| 351 | * wlgs角色只能查看要车单运作科审核人已填写的数据 | 363 | * wlgs角色只能查看要车单运作科审核人已填写的数据 |
| 352 | */ | 364 | */ |
| 353 | - private void applyWlgsRoleFilter(QueryCarRequestPlanVo vo) { | ||
| 354 | - String currentUserId = SecurityUtil.getCurrentUser().getId(); | ||
| 355 | - List<SysRole> roles = sysRoleService.getByUserId(currentUserId); | ||
| 356 | - if (CollectionUtil.isEmpty(roles)) { | ||
| 357 | - return; | ||
| 358 | - } | ||
| 359 | - List<String> roleCodes = roles.stream().map(SysRole::getCode).collect(Collectors.toList()); | 365 | + private void applyWlgsRoleFilter(List<String> roleCodes, QueryCarRequestPlanVo vo) { |
| 360 | if (roleCodes.contains("wlgs")) { | 366 | if (roleCodes.contains("wlgs")) { |
| 361 | vo.setOperationsDepartmentAuditorNotNull(true); | 367 | vo.setOperationsDepartmentAuditorNotNull(true); |
| 362 | } | 368 | } |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| @@ -210,6 +210,104 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | @@ -210,6 +210,104 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr | ||
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | @Override | 212 | @Override |
| 213 | + public PageResult<ShipmentsOrderInfo> queryWithoutPermission(Integer pageIndex, Integer pageSize, QueryShipmentsOrderInfoVo vo) { | ||
| 214 | + Assert.greaterThanZero(pageIndex); | ||
| 215 | + Assert.greaterThanZero(pageSize); | ||
| 216 | + | ||
| 217 | + PageHelperUtil.startPage(pageIndex, pageSize); | ||
| 218 | + List<ShipmentsOrderInfo> dataList = this.queryWithoutPermission(vo); | ||
| 219 | + | ||
| 220 | + return PageResultUtil.convert(new PageInfo<>(dataList)); | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + @Override | ||
| 224 | + public List<ShipmentsOrderInfo> queryWithoutPermission(QueryShipmentsOrderInfoVo vo) { | ||
| 225 | + if (StringUtils.isNotBlank(vo.getDeptName())) { | ||
| 226 | + // 办事处模糊查询处理 | ||
| 227 | + LambdaQueryWrapper<SysDept> queryWrapper = Wrappers.lambdaQuery(SysDept.class); | ||
| 228 | + queryWrapper.like(SysDept::getName, vo.getDeptName()); | ||
| 229 | + List<SysDept> deptList = sysDeptService.getBaseMapper().selectList(queryWrapper); | ||
| 230 | + if (CollectionUtils.isEmpty(deptList)) { | ||
| 231 | + return Collections.emptyList(); | ||
| 232 | + } | ||
| 233 | + List<String> deptIds = deptList.stream().map(SysDept::getId).collect(Collectors.toList()); | ||
| 234 | + vo.setDeptIds(deptIds); | ||
| 235 | + } | ||
| 236 | + List<ShipmentsOrderInfo> shipmentsOrderList = getBaseMapper().queryWithoutPermission(vo); | ||
| 237 | + if (CollectionUtils.isEmpty(shipmentsOrderList)) { | ||
| 238 | + return Collections.emptyList(); | ||
| 239 | + } | ||
| 240 | + // 办事处处理 | ||
| 241 | + List<String> deptIds = new ArrayList<>(); | ||
| 242 | + for (ShipmentsOrderInfo orderInfo : shipmentsOrderList) { | ||
| 243 | + String deptId = orderInfo.getDeptId(); | ||
| 244 | + String region = orderInfo.getRegion(); | ||
| 245 | + if (!StringUtils.isBlank(deptId)) { | ||
| 246 | + String[] split = deptId.split(","); | ||
| 247 | + Collections.addAll(deptIds, split); | ||
| 248 | + } | ||
| 249 | + if (!StringUtils.isBlank(region)) { | ||
| 250 | + String[] split = region.split(","); | ||
| 251 | + Collections.addAll(deptIds, split); | ||
| 252 | + } | ||
| 253 | + } | ||
| 254 | + Map<String, SysDept> deptMap = new HashMap<>(); | ||
| 255 | + if (CollectionUtils.isNotEmpty(deptIds)) { | ||
| 256 | + deptIds = deptIds.stream().distinct().collect(Collectors.toList()); | ||
| 257 | + List<SysDept> deptList = sysDeptService.listByIds(deptIds); | ||
| 258 | + deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getId, Function.identity())); | ||
| 259 | + } | ||
| 260 | + for (ShipmentsOrderInfo orderInfo : shipmentsOrderList) { | ||
| 261 | + String deptId = orderInfo.getDeptId(); | ||
| 262 | + String region = orderInfo.getRegion(); | ||
| 263 | + if (!StringUtils.isBlank(deptId)) { | ||
| 264 | + String[] split = deptId.split(","); | ||
| 265 | + if (split.length > 1) { | ||
| 266 | + StringBuilder builder = new StringBuilder(); | ||
| 267 | + for (int i = 0; i < split.length; i++) { | ||
| 268 | + SysDept sysDept = deptMap.get(split[i]); | ||
| 269 | + if (sysDept != null) { | ||
| 270 | + builder.append(sysDept.getName()); | ||
| 271 | + builder.append(","); | ||
| 272 | + } | ||
| 273 | + } | ||
| 274 | + builder.deleteCharAt(builder.length() - 1); | ||
| 275 | + | ||
| 276 | + orderInfo.setDeptName(builder.toString()); | ||
| 277 | + } else { | ||
| 278 | + SysDept sysDept = deptMap.get(split[0]); | ||
| 279 | + if (sysDept != null) { | ||
| 280 | + orderInfo.setDeptName(sysDept.getName()); | ||
| 281 | + } | ||
| 282 | + } | ||
| 283 | + } | ||
| 284 | + if (!StringUtils.isBlank(region)) { | ||
| 285 | + String[] split = region.split(","); | ||
| 286 | + if (split.length > 1) { | ||
| 287 | + StringBuilder builder = new StringBuilder(); | ||
| 288 | + for (int i = 0; i < split.length; i++) { | ||
| 289 | + SysDept sysDept = deptMap.get(split[i]); | ||
| 290 | + if (sysDept != null) { | ||
| 291 | + builder.append(sysDept.getName()); | ||
| 292 | + builder.append(","); | ||
| 293 | + } | ||
| 294 | + } | ||
| 295 | + builder.deleteCharAt(builder.length() - 1); | ||
| 296 | + | ||
| 297 | + orderInfo.setRegionName(builder.toString()); | ||
| 298 | + } else { | ||
| 299 | + SysDept sysDept = deptMap.get(split[0]); | ||
| 300 | + if (sysDept != null) { | ||
| 301 | + orderInfo.setRegionName(sysDept.getName()); | ||
| 302 | + } | ||
| 303 | + } | ||
| 304 | + } | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + return shipmentsOrderList; | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + @Override | ||
| 213 | public ShipmentsOrderInfo findById(String id) { | 311 | public ShipmentsOrderInfo findById(String id) { |
| 214 | ShipmentsOrderInfo orderInfo = getBaseMapper().selectById(id); | 312 | ShipmentsOrderInfo orderInfo = getBaseMapper().selectById(id); |
| 215 | // 购货单位 | 313 | // 购货单位 |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/car/CarRequestPlanServiceImpl.java
| @@ -61,12 +61,30 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM | @@ -61,12 +61,30 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM | ||
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | @Override | 63 | @Override |
| 64 | + public PageResult<CarRequestPlan> queryWithoutPermission(Integer pageIndex, Integer pageSize, QueryCarRequestPlanVo vo) { | ||
| 65 | + | ||
| 66 | + Assert.greaterThanZero(pageIndex); | ||
| 67 | + Assert.greaterThanZero(pageSize); | ||
| 68 | + | ||
| 69 | + PageHelperUtil.startPage(pageIndex, pageSize); | ||
| 70 | + List<CarRequestPlan> datas = this.queryWithoutPermission(vo); | ||
| 71 | + | ||
| 72 | + return PageResultUtil.convert(new PageInfo<>(datas)); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Override | ||
| 64 | public List<CarRequestPlan> query(QueryCarRequestPlanVo vo) { | 76 | public List<CarRequestPlan> query(QueryCarRequestPlanVo vo) { |
| 65 | 77 | ||
| 66 | return getBaseMapper().query(vo); | 78 | return getBaseMapper().query(vo); |
| 67 | } | 79 | } |
| 68 | 80 | ||
| 69 | @Override | 81 | @Override |
| 82 | + public List<CarRequestPlan> queryWithoutPermission(QueryCarRequestPlanVo vo) { | ||
| 83 | + | ||
| 84 | + return getBaseMapper().queryWithoutPermission(vo); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @Override | ||
| 70 | public CarRequestPlan findById(String id) { | 88 | public CarRequestPlan findById(String id) { |
| 71 | 89 | ||
| 72 | return getBaseMapper().findById(id); | 90 | return getBaseMapper().findById(id); |
| 1 | package com.lframework.xingyun.sc.mappers; | 1 | package com.lframework.xingyun.sc.mappers; |
| 2 | 2 | ||
| 3 | +import com.lframework.starter.web.core.annotations.permission.DataPermission; | ||
| 4 | +import com.lframework.starter.web.core.annotations.permission.DataPermissions; | ||
| 3 | import com.lframework.starter.web.core.mapper.BaseMapper; | 5 | import com.lframework.starter.web.core.mapper.BaseMapper; |
| 6 | +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; | ||
| 4 | import com.lframework.xingyun.sc.entity.CarRequestPlan; | 7 | import com.lframework.xingyun.sc.entity.CarRequestPlan; |
| 5 | import com.lframework.xingyun.sc.vo.shipments.car.QueryCarRequestPlanVo; | 8 | import com.lframework.xingyun.sc.vo.shipments.car.QueryCarRequestPlanVo; |
| 6 | import org.apache.ibatis.annotations.Param; | 9 | import org.apache.ibatis.annotations.Param; |
| @@ -20,9 +23,19 @@ public interface CarRequestPlanMapper extends BaseMapper<CarRequestPlan> { | @@ -20,9 +23,19 @@ public interface CarRequestPlanMapper extends BaseMapper<CarRequestPlan> { | ||
| 20 | * @param vo | 23 | * @param vo |
| 21 | * @return | 24 | * @return |
| 22 | */ | 25 | */ |
| 26 | + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { | ||
| 27 | + @DataPermission(template = "order", alias = "tb") | ||
| 28 | + }) | ||
| 23 | List<CarRequestPlan> query(@Param("vo") QueryCarRequestPlanVo vo); | 29 | List<CarRequestPlan> query(@Param("vo") QueryCarRequestPlanVo vo); |
| 24 | 30 | ||
| 25 | /** | 31 | /** |
| 32 | + * 查询列表(不带数据权限,用于办事处内勤/办事处主管查看所有数据) | ||
| 33 | + * @param vo | ||
| 34 | + * @return | ||
| 35 | + */ | ||
| 36 | + List<CarRequestPlan> queryWithoutPermission(@Param("vo") QueryCarRequestPlanVo vo); | ||
| 37 | + | ||
| 38 | + /** | ||
| 26 | * 查询 | 39 | * 查询 |
| 27 | * | 40 | * |
| 28 | * @param id 主键 | 41 | * @param id 主键 |
| 1 | package com.lframework.xingyun.sc.mappers; | 1 | package com.lframework.xingyun.sc.mappers; |
| 2 | 2 | ||
| 3 | +import com.lframework.starter.web.core.annotations.permission.DataPermission; | ||
| 4 | +import com.lframework.starter.web.core.annotations.permission.DataPermissions; | ||
| 3 | import com.lframework.starter.web.core.mapper.BaseMapper; | 5 | import com.lframework.starter.web.core.mapper.BaseMapper; |
| 6 | +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; | ||
| 4 | import com.lframework.xingyun.sc.entity.DelayedShipment; | 7 | import com.lframework.xingyun.sc.entity.DelayedShipment; |
| 5 | import com.lframework.xingyun.sc.vo.shipments.delay.QueryDelayedShipmentVo; | 8 | import com.lframework.xingyun.sc.vo.shipments.delay.QueryDelayedShipmentVo; |
| 6 | import org.apache.ibatis.annotations.Param; | 9 | import org.apache.ibatis.annotations.Param; |
| @@ -20,6 +23,9 @@ public interface DelayedShipmentMapper extends BaseMapper<DelayedShipment> { | @@ -20,6 +23,9 @@ public interface DelayedShipmentMapper extends BaseMapper<DelayedShipment> { | ||
| 20 | * @param vo | 23 | * @param vo |
| 21 | * @return | 24 | * @return |
| 22 | */ | 25 | */ |
| 26 | + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { | ||
| 27 | + @DataPermission(template = "order", alias = "tb") | ||
| 28 | + }) | ||
| 23 | List<DelayedShipment> query(@Param("vo") QueryDelayedShipmentVo vo); | 29 | List<DelayedShipment> query(@Param("vo") QueryDelayedShipmentVo vo); |
| 24 | 30 | ||
| 25 | /** | 31 | /** |
| 1 | package com.lframework.xingyun.sc.mappers; | 1 | package com.lframework.xingyun.sc.mappers; |
| 2 | 2 | ||
| 3 | +import com.lframework.starter.web.core.annotations.permission.DataPermission; | ||
| 4 | +import com.lframework.starter.web.core.annotations.permission.DataPermissions; | ||
| 3 | import com.lframework.starter.web.core.mapper.BaseMapper; | 5 | import com.lframework.starter.web.core.mapper.BaseMapper; |
| 6 | +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; | ||
| 4 | import com.lframework.xingyun.sc.entity.ReplenishmentOrder; | 7 | import com.lframework.xingyun.sc.entity.ReplenishmentOrder; |
| 5 | import com.lframework.xingyun.sc.vo.purchase.QueryReplenishmentOrderVo; | 8 | import com.lframework.xingyun.sc.vo.purchase.QueryReplenishmentOrderVo; |
| 6 | import org.apache.ibatis.annotations.Param; | 9 | import org.apache.ibatis.annotations.Param; |
| @@ -20,5 +23,8 @@ public interface ReplenishmentOrderMapper extends BaseMapper<ReplenishmentOrder> | @@ -20,5 +23,8 @@ public interface ReplenishmentOrderMapper extends BaseMapper<ReplenishmentOrder> | ||
| 20 | * @param vo | 23 | * @param vo |
| 21 | * @return | 24 | * @return |
| 22 | */ | 25 | */ |
| 26 | + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { | ||
| 27 | + @DataPermission(template = "order", alias = "tb") | ||
| 28 | + }) | ||
| 23 | List<ReplenishmentOrder> query(@Param("vo") QueryReplenishmentOrderVo vo); | 29 | List<ReplenishmentOrder> query(@Param("vo") QueryReplenishmentOrderVo vo); |
| 24 | } | 30 | } |
| @@ -25,9 +25,20 @@ public interface ShipmentsOrderInfoMapper extends BaseMapper<ShipmentsOrderInfo> | @@ -25,9 +25,20 @@ public interface ShipmentsOrderInfoMapper extends BaseMapper<ShipmentsOrderInfo> | ||
| 25 | * @param vo 查询条件 | 25 | * @param vo 查询条件 |
| 26 | * @return List<ShipmentsOrderInfo> | 26 | * @return List<ShipmentsOrderInfo> |
| 27 | */ | 27 | */ |
| 28 | + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { | ||
| 29 | + @DataPermission(template = "order", alias = "tb") | ||
| 30 | + }) | ||
| 28 | List<ShipmentsOrderInfo> query(@Param("vo") QueryShipmentsOrderInfoVo vo); | 31 | List<ShipmentsOrderInfo> query(@Param("vo") QueryShipmentsOrderInfoVo vo); |
| 29 | 32 | ||
| 30 | /** | 33 | /** |
| 34 | + * 查询列表(不带数据权限,用于业务员/办事处内勤/办事处主管按区域/办事处查看) | ||
| 35 | + * | ||
| 36 | + * @param vo 查询条件 | ||
| 37 | + * @return List<ShipmentsOrderInfo> | ||
| 38 | + */ | ||
| 39 | + List<ShipmentsOrderInfo> queryWithoutPermission(@Param("vo") QueryShipmentsOrderInfoVo vo); | ||
| 40 | + | ||
| 41 | + /** | ||
| 31 | * 批量新增 | 42 | * 批量新增 |
| 32 | * | 43 | * |
| 33 | * @param orderInfos 数据集合 | 44 | * @param orderInfos 数据集合 |
| 1 | package com.lframework.xingyun.sc.mappers; | 1 | package com.lframework.xingyun.sc.mappers; |
| 2 | 2 | ||
| 3 | +import com.lframework.starter.web.core.annotations.permission.DataPermission; | ||
| 4 | +import com.lframework.starter.web.core.annotations.permission.DataPermissions; | ||
| 5 | +import com.lframework.starter.web.inner.components.permission.OrderDataPermissionDataPermissionType; | ||
| 3 | import com.lframework.xingyun.sc.entity.ShipmentsPlan; | 6 | import com.lframework.xingyun.sc.entity.ShipmentsPlan; |
| 4 | import com.lframework.starter.web.core.mapper.BaseMapper; | 7 | import com.lframework.starter.web.core.mapper.BaseMapper; |
| 5 | import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanVo; | 8 | import com.lframework.xingyun.sc.vo.shipments.plan.QueryShipmentsPlanVo; |
| @@ -21,6 +24,9 @@ public interface ShipmentsPlanMapper extends BaseMapper<ShipmentsPlan> { | @@ -21,6 +24,9 @@ public interface ShipmentsPlanMapper extends BaseMapper<ShipmentsPlan> { | ||
| 21 | * @param vo 查询条件 | 24 | * @param vo 查询条件 |
| 22 | * @return List<ShipmentsPlan> | 25 | * @return List<ShipmentsPlan> |
| 23 | */ | 26 | */ |
| 27 | + @DataPermissions(type = OrderDataPermissionDataPermissionType.class, value = { | ||
| 28 | + @DataPermission(template = "order", alias = "tb") | ||
| 29 | + }) | ||
| 24 | List<ShipmentsPlan> query(@Param("vo") QueryShipmentsPlanVo vo); | 30 | List<ShipmentsPlan> query(@Param("vo") QueryShipmentsPlanVo vo); |
| 25 | 31 | ||
| 26 | /** | 32 | /** |
| @@ -32,6 +32,21 @@ public interface ShipmentsOrderInfoService extends BaseMpService<ShipmentsOrderI | @@ -32,6 +32,21 @@ public interface ShipmentsOrderInfoService extends BaseMpService<ShipmentsOrderI | ||
| 32 | List<ShipmentsOrderInfo> query(QueryShipmentsOrderInfoVo vo); | 32 | List<ShipmentsOrderInfo> query(QueryShipmentsOrderInfoVo vo); |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | + * 查询列表(不带数据权限,用于业务员/办事处内勤/办事处主管按区域/办事处查看) | ||
| 36 | + * | ||
| 37 | + * @param vo 查询条件 | ||
| 38 | + * @return List<ShipmentsOrderInfo> | ||
| 39 | + */ | ||
| 40 | + List<ShipmentsOrderInfo> queryWithoutPermission(QueryShipmentsOrderInfoVo vo); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 查询列表(不带数据权限,分页) | ||
| 44 | + * | ||
| 45 | + * @return PageResult<ShipmentsOrderInfo> | ||
| 46 | + */ | ||
| 47 | + PageResult<ShipmentsOrderInfo> queryWithoutPermission(Integer pageIndex, Integer pageSize, QueryShipmentsOrderInfoVo vo); | ||
| 48 | + | ||
| 49 | + /** | ||
| 35 | * 根据ID查询 | 50 | * 根据ID查询 |
| 36 | * | 51 | * |
| 37 | * @param id 主键ID | 52 | * @param id 主键ID |
| @@ -29,6 +29,18 @@ public interface CarRequestPlanService extends BaseMpService<CarRequestPlan> { | @@ -29,6 +29,18 @@ public interface CarRequestPlanService extends BaseMpService<CarRequestPlan> { | ||
| 29 | List<CarRequestPlan> query(QueryCarRequestPlanVo vo); | 29 | List<CarRequestPlan> query(QueryCarRequestPlanVo vo); |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | + * 查询列表(不带数据权限,用于办事处内勤/办事处主管查看所有数据) | ||
| 33 | + */ | ||
| 34 | + PageResult<CarRequestPlan> queryWithoutPermission(Integer pageIndex, Integer pageSize, QueryCarRequestPlanVo vo); | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 查询列表(不带数据权限) | ||
| 38 | + * @param vo | ||
| 39 | + * @return | ||
| 40 | + */ | ||
| 41 | + List<CarRequestPlan> queryWithoutPermission(QueryCarRequestPlanVo vo); | ||
| 42 | + | ||
| 43 | + /** | ||
| 32 | * 根据ID查询 | 44 | * 根据ID查询 |
| 33 | * @param id | 45 | * @param id |
| 34 | * @return | 46 | * @return |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/order/QueryShipmentsOrderInfoVo.java
| @@ -48,6 +48,12 @@ public class QueryShipmentsOrderInfoVo extends PageVo implements BaseVo, Seriali | @@ -48,6 +48,12 @@ public class QueryShipmentsOrderInfoVo extends PageVo implements BaseVo, Seriali | ||
| 48 | private List<String> deptIds; | 48 | private List<String> deptIds; |
| 49 | 49 | ||
| 50 | /** | 50 | /** |
| 51 | + * 区域ID | ||
| 52 | + */ | ||
| 53 | + @ApiModelProperty("区域ID") | ||
| 54 | + private String region; | ||
| 55 | + | ||
| 56 | + /** | ||
| 51 | * 办事处名称 | 57 | * 办事处名称 |
| 52 | */ | 58 | */ |
| 53 | @ApiModelProperty("办事处名称") | 59 | @ApiModelProperty("办事处名称") |
| @@ -88,6 +88,51 @@ | @@ -88,6 +88,51 @@ | ||
| 88 | ORDER BY tb.create_time DESC | 88 | ORDER BY tb.create_time DESC |
| 89 | </select> | 89 | </select> |
| 90 | 90 | ||
| 91 | + <select id="queryWithoutPermission" resultMap="ShipmentsOrderInfo"> | ||
| 92 | + <include refid="ShipmentsOrderInfo_sql"/> | ||
| 93 | + <where> | ||
| 94 | + AND tb.status != 'DRAFT' | ||
| 95 | + <if test="vo.workshopId != null and vo.workshopId != ''"> | ||
| 96 | + AND tb.workshop_id = #{vo.workshopId} | ||
| 97 | + </if> | ||
| 98 | + <if test="vo.shipmentsDateStart != null"> | ||
| 99 | + AND tb.shipments_date >= #{vo.shipmentsDateStart} | ||
| 100 | + </if> | ||
| 101 | + <if test="vo.shipmentsDateEnd != null"> | ||
| 102 | + AND tb.shipments_date <= #{vo.shipmentsDateEnd} | ||
| 103 | + </if> | ||
| 104 | + <if test="vo.deptIds != null and vo.deptIds.size() > 0"> | ||
| 105 | + AND ( | ||
| 106 | + <foreach collection="vo.deptIds" item="deptId" separator=" OR "> | ||
| 107 | + FIND_IN_SET(#{deptId}, tb.dept_id) > 0 | ||
| 108 | + </foreach> | ||
| 109 | + ) | ||
| 110 | + </if> | ||
| 111 | + <if test="vo.deptId != null and vo.deptId != ''"> | ||
| 112 | + AND FIND_IN_SET(#{vo.deptId}, tb.dept_id) > 0 | ||
| 113 | + </if> | ||
| 114 | + <if test="vo.status != null and vo.status != ''"> | ||
| 115 | + AND tb.status = #{vo.status} | ||
| 116 | + </if> | ||
| 117 | + <if test="vo.customerName != null and vo.customerName != ''"> | ||
| 118 | + AND c.name LIKE CONCAT('%', #{vo.customerName}, '%') | ||
| 119 | + </if> | ||
| 120 | + <if test="vo.code != null and vo.code != ''"> | ||
| 121 | + AND tb.code LIKE CONCAT('%', #{vo.code}, '%') | ||
| 122 | + </if> | ||
| 123 | + <if test="vo.region != null and vo.region != ''"> | ||
| 124 | + AND FIND_IN_SET(#{vo.region}, tb.region) > 0 | ||
| 125 | + </if> | ||
| 126 | + <if test="vo.searchKey != null and vo.searchKey != ''"> | ||
| 127 | + AND ( | ||
| 128 | + tb.code LIKE CONCAT('%', #{vo.searchKey}, '%') | ||
| 129 | + OR c.name LIKE CONCAT('%', #{vo.searchKey}, '%') | ||
| 130 | + ) | ||
| 131 | + </if> | ||
| 132 | + </where> | ||
| 133 | + ORDER BY tb.create_time DESC | ||
| 134 | + </select> | ||
| 135 | + | ||
| 91 | <insert id="batchAdd"> | 136 | <insert id="batchAdd"> |
| 92 | INSERT INTO shipments_order_info ( | 137 | INSERT INTO shipments_order_info ( |
| 93 | id, | 138 | id, |
| @@ -59,6 +59,24 @@ | @@ -59,6 +59,24 @@ | ||
| 59 | ORDER BY tb.request_car_date DESC | 59 | ORDER BY tb.request_car_date DESC |
| 60 | </select> | 60 | </select> |
| 61 | 61 | ||
| 62 | + <select id="queryWithoutPermission" resultMap="CarRequestPlan"> | ||
| 63 | + <include refid="CarRequestPlan_sql"/> | ||
| 64 | + <where> | ||
| 65 | + <if test="vo.requestCarDateStart != null"> | ||
| 66 | + AND tb.request_car_date >= #{vo.requestCarDateStart} | ||
| 67 | + </if> | ||
| 68 | + <if test="vo.requestCarDateEnd != null"> | ||
| 69 | + <![CDATA[ | ||
| 70 | + AND tb.request_car_date <= #{vo.requestCarDateEnd} | ||
| 71 | + ]]> | ||
| 72 | + </if> | ||
| 73 | + <if test="vo.workshopId != null and vo.workshopId != ''"> | ||
| 74 | + AND tb.workshop_id = #{vo.workshopId} | ||
| 75 | + </if> | ||
| 76 | + </where> | ||
| 77 | + ORDER BY tb.request_car_date DESC | ||
| 78 | + </select> | ||
| 79 | + | ||
| 62 | <select id="findById" resultType="com.lframework.xingyun.sc.entity.CarRequestPlan"> | 80 | <select id="findById" resultType="com.lframework.xingyun.sc.entity.CarRequestPlan"> |
| 63 | <include refid="CarRequestPlan_sql"/> | 81 | <include refid="CarRequestPlan_sql"/> |
| 64 | <where> | 82 | <where> |