Showing
1 changed file
with
26 additions
and
37 deletions
| @@ -11,6 +11,7 @@ import com.lframework.starter.web.core.components.security.SecurityUtil; | @@ -11,6 +11,7 @@ import com.lframework.starter.web.core.components.security.SecurityUtil; | ||
| 11 | import com.lframework.starter.web.core.utils.IdUtil; | 11 | import com.lframework.starter.web.core.utils.IdUtil; |
| 12 | import com.lframework.starter.web.core.utils.JsonUtil; | 12 | import com.lframework.starter.web.core.utils.JsonUtil; |
| 13 | import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto; | 13 | import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto; |
| 14 | +import com.lframework.starter.web.inner.service.system.SysUserRoleService; | ||
| 14 | import com.lframework.xingyun.basedata.entity.Workshop; | 15 | import com.lframework.xingyun.basedata.entity.Workshop; |
| 15 | import com.lframework.xingyun.basedata.service.workshop.WorkshopService; | 16 | import com.lframework.xingyun.basedata.service.workshop.WorkshopService; |
| 16 | import com.lframework.xingyun.sc.entity.*; | 17 | import com.lframework.xingyun.sc.entity.*; |
| @@ -55,6 +56,7 @@ import java.time.format.DateTimeFormatter; | @@ -55,6 +56,7 @@ import java.time.format.DateTimeFormatter; | ||
| 55 | import java.util.ArrayList; | 56 | import java.util.ArrayList; |
| 56 | import java.util.List; | 57 | import java.util.List; |
| 57 | import java.util.Map; | 58 | import java.util.Map; |
| 59 | +import java.util.stream.Collectors; | ||
| 58 | 60 | ||
| 59 | @Component | 61 | @Component |
| 60 | @Slf4j | 62 | @Slf4j |
| @@ -107,6 +109,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -107,6 +109,9 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 107 | private MessageHandler messageHandler; | 109 | private MessageHandler messageHandler; |
| 108 | @Resource | 110 | @Resource |
| 109 | private ShipmentsPlanDetailService shipmentsPlanDetailService; | 111 | private ShipmentsPlanDetailService shipmentsPlanDetailService; |
| 112 | + @Resource | ||
| 113 | + private SysUserRoleService sysUserRoleService; | ||
| 114 | + | ||
| 110 | 115 | ||
| 111 | 116 | ||
| 112 | /** | 117 | /** |
| @@ -336,64 +341,48 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | @@ -336,64 +341,48 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic | ||
| 336 | userIdList.addAll(list2); | 341 | userIdList.addAll(list2); |
| 337 | } | 342 | } |
| 338 | Object o = variable.get("workshopCode"); | 343 | Object o = variable.get("workshopCode"); |
| 339 | - List<String> list3 = new ArrayList<>(); | ||
| 340 | - List<String> list4 = new ArrayList<>(); | ||
| 341 | - List<String> list5 = new ArrayList<>(); | ||
| 342 | - List<String> list6 = new ArrayList<>(); | 344 | + List<String> roleCodes = new ArrayList<>(); |
| 343 | if (o != null) { | 345 | if (o != null) { |
| 344 | String workshopCode = String.valueOf(o); | 346 | String workshopCode = String.valueOf(o); |
| 345 | if ("yfc".equals(workshopCode)) { | 347 | if ("yfc".equals(workshopCode)) { |
| 346 | //一分厂经营办计划员 | 348 | //一分厂经营办计划员 |
| 347 | - list3 = transactorHandler.listTransactorsByRoleCode("yfcjybjhy", createById); | 349 | + roleCodes.add("yfcjybjhy"); |
| 348 | //一分厂经营办主管 | 350 | //一分厂经营办主管 |
| 349 | - list4 = transactorHandler.listTransactorsByRoleCode("yfcjybzg", createById); | 351 | + roleCodes.add("yfcjybzg"); |
| 350 | //一分厂生产科计划员 | 352 | //一分厂生产科计划员 |
| 351 | - list5 = transactorHandler.listTransactorsByRoleCode("yfcsckjhy", createById); | ||
| 352 | - //一分营销管理科统计员 | ||
| 353 | - list6 = transactorHandler.listTransactorsByRoleCode("yfcyxglktjy", createById); | 353 | + roleCodes.add("yfcsckjhy"); |
| 354 | } else if ("efc".equals(workshopCode)) { | 354 | } else if ("efc".equals(workshopCode)) { |
| 355 | //二分厂经营办计划员 | 355 | //二分厂经营办计划员 |
| 356 | - list3 = transactorHandler.listTransactorsByRoleCode("efcjybjhy", createById); | 356 | + roleCodes.add("efcjybjhy"); |
| 357 | //二分厂经营办主管 | 357 | //二分厂经营办主管 |
| 358 | - list4 = transactorHandler.listTransactorsByRoleCode("efcjybzg", createById); | 358 | + roleCodes.add("efcjybzg"); |
| 359 | //二分厂生产科计划员 | 359 | //二分厂生产科计划员 |
| 360 | - list5 = transactorHandler.listTransactorsByRoleCode("efcsckjhy", createById); | ||
| 361 | - //二分营销管理科统计员 | ||
| 362 | - list6 = transactorHandler.listTransactorsByRoleCode("efcyxglktjy", createById); | 360 | + roleCodes.add("efcsckjhy"); |
| 363 | } else if ("sfc".equals(workshopCode)) { | 361 | } else if ("sfc".equals(workshopCode)) { |
| 364 | //三分厂经营办计划员 | 362 | //三分厂经营办计划员 |
| 365 | - list3 = transactorHandler.listTransactorsByRoleCode("sfcjybjhy", createById); | 363 | + roleCodes.add("sfcjybjhy"); |
| 366 | //三分厂经营办主管 | 364 | //三分厂经营办主管 |
| 367 | - list4 = transactorHandler.listTransactorsByRoleCode("sfcjybzg", createById); | 365 | + roleCodes.add("sfcjybzg"); |
| 368 | //三分厂生产科计划员 | 366 | //三分厂生产科计划员 |
| 369 | - list5 = transactorHandler.listTransactorsByRoleCode("sfcsckjhy", createById); | ||
| 370 | - //三分营销管理科统计员 | ||
| 371 | - list6 = transactorHandler.listTransactorsByRoleCode("sfcyxglktjy", createById); | 367 | + roleCodes.add("sfcsckjhy"); |
| 372 | } else if ("ztfc".equals(workshopCode)) { | 368 | } else if ("ztfc".equals(workshopCode)) { |
| 373 | //四分厂经营办计划员 | 369 | //四分厂经营办计划员 |
| 374 | - list3 = transactorHandler.listTransactorsByRoleCode("ztfcjybjhy", createById); | 370 | + roleCodes.add("ztfcjybjhy"); |
| 375 | //四分厂经营办主管 | 371 | //四分厂经营办主管 |
| 376 | - list4 = transactorHandler.listTransactorsByRoleCode("ztfcjybzg", createById); | 372 | + roleCodes.add("ztfcjybzg"); |
| 377 | //四分厂生产科计划员 | 373 | //四分厂生产科计划员 |
| 378 | - list5 = transactorHandler.listTransactorsByRoleCode("ztfcsckjhy", createById); | ||
| 379 | - //四分营销管理科统计员 | ||
| 380 | - list6 = transactorHandler.listTransactorsByRoleCode("ztfcyxglktjy", createById); | 374 | + roleCodes.add("ztfcsckjhy");; |
| 381 | } | 375 | } |
| 382 | - | ||
| 383 | } | 376 | } |
| 377 | + //营销管理科统计员 | ||
| 378 | + roleCodes.add("yxglktjy"); | ||
| 384 | 379 | ||
| 385 | - if (CollectionUtils.isNotEmpty(list3)) { | ||
| 386 | - userIdList.addAll(list3); | ||
| 387 | - } | ||
| 388 | - if (CollectionUtils.isNotEmpty(list4)) { | ||
| 389 | - userIdList.addAll(list4); | ||
| 390 | - } | ||
| 391 | - if (CollectionUtils.isNotEmpty(list5)) { | ||
| 392 | - userIdList.addAll(list5); | ||
| 393 | - } | ||
| 394 | - if (CollectionUtils.isNotEmpty(list6)) { | ||
| 395 | - userIdList.addAll(list6); | ||
| 396 | - } | 380 | + // 获取角色下人员ID |
| 381 | + List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(roleCodes); | ||
| 382 | + | ||
| 383 | + userIdList.addAll(userIds); | ||
| 384 | + //去重 | ||
| 385 | + userIdList = userIdList.stream().distinct().collect(Collectors.toList()); | ||
| 397 | SysSiteMessageDto messageDto = new SysSiteMessageDto(); | 386 | SysSiteMessageDto messageDto = new SysSiteMessageDto(); |
| 398 | messageDto.setUserIdList(userIdList); | 387 | messageDto.setUserIdList(userIdList); |
| 399 | messageDto.setTitle("订货单撤销通过通知"); | 388 | messageDto.setTitle("订货单撤销通过通知"); |