Commit e323ce299140994283d4eecbc647a6a15461f6d2
Merge branch 'master_after20' into master_cj_zq
# Conflicts: # xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
Showing
4 changed files
with
75 additions
and
7 deletions
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| ... | ... | @@ -13,6 +13,7 @@ import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto; |
| 13 | 13 | import com.lframework.starter.web.inner.entity.SysDept; |
| 14 | 14 | import com.lframework.starter.web.inner.service.DicCityService; |
| 15 | 15 | import com.lframework.starter.web.inner.service.system.SysDeptService; |
| 16 | +import com.lframework.starter.web.inner.service.system.SysUserRoleService; | |
| 16 | 17 | import com.lframework.xingyun.basedata.entity.Customer; |
| 17 | 18 | import com.lframework.xingyun.basedata.entity.Workshop; |
| 18 | 19 | import com.lframework.xingyun.basedata.service.customer.CustomerService; |
| ... | ... | @@ -91,6 +92,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 91 | 92 | private PurchaseOrderLineService purchaseOrderLineService; |
| 92 | 93 | @Resource |
| 93 | 94 | private ReceiptLedgerInfoService receiptLedgerInfoService; |
| 95 | + @Resource | |
| 96 | + private SysUserRoleService sysUserRoleService; | |
| 94 | 97 | |
| 95 | 98 | |
| 96 | 99 | @Override |
| ... | ... | @@ -308,6 +311,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 308 | 311 | if (CollectionUtils.isEmpty(detailList)) { |
| 309 | 312 | throw new DefaultClientException("发货明细数据不存在!"); |
| 310 | 313 | } |
| 314 | + // 剔除经营办发货员添加的计划 | |
| 315 | + dataFilter(detailList); | |
| 311 | 316 | // 根据客户分组 |
| 312 | 317 | Map<String, List<ShipmentsPlanDetail>> detailMap = new HashMap<>(); |
| 313 | 318 | for (ShipmentsPlanDetail detail : detailList) { |
| ... | ... | @@ -765,4 +770,35 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 765 | 770 | ticketVo.setLoadingTime(loadingTime); |
| 766 | 771 | return ticketVo; |
| 767 | 772 | } |
| 773 | + | |
| 774 | + | |
| 775 | + /** | |
| 776 | + * 数据过滤 | |
| 777 | + * | |
| 778 | + * @param dataList 源数据 | |
| 779 | + */ | |
| 780 | + private void dataFilter(List<ShipmentsPlanDetail> dataList) { | |
| 781 | + if (CollectionUtils.isEmpty(dataList)) { | |
| 782 | + return; | |
| 783 | + } | |
| 784 | + // 获取所有经营办发货员 | |
| 785 | + List<String> roleCodeList = new ArrayList<>(); | |
| 786 | + roleCodeList.add("yfcjybfhy"); | |
| 787 | + roleCodeList.add("efcjybfhy"); | |
| 788 | + roleCodeList.add("sfcjybfhy"); | |
| 789 | + roleCodeList.add("ztfcjybfhy"); | |
| 790 | + List<String> deliveryUserIds = sysUserRoleService.listUserIdByRoleCodes(roleCodeList); | |
| 791 | + if (CollectionUtils.isEmpty(deliveryUserIds)) { | |
| 792 | + return; | |
| 793 | + } | |
| 794 | + Iterator<ShipmentsPlanDetail> iterator = dataList.iterator(); | |
| 795 | + while (iterator.hasNext()) { | |
| 796 | + ShipmentsPlanDetail next = iterator.next(); | |
| 797 | + String createById = next.getCreateById(); | |
| 798 | + if (deliveryUserIds.contains(createById)) { | |
| 799 | + // 剔除经营办发货员添加的计划 | |
| 800 | + iterator.remove(); | |
| 801 | + } | |
| 802 | + } | |
| 803 | + } | |
| 768 | 804 | } | ... | ... |
| ... | ... | @@ -6,6 +6,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 6 | 6 | import com.github.pagehelper.PageInfo; |
| 7 | 7 | import com.lframework.starter.web.core.components.security.SecurityUtil; |
| 8 | 8 | import com.lframework.starter.web.core.utils.*; |
| 9 | +import com.lframework.starter.web.inner.entity.SysRole; | |
| 10 | +import com.lframework.starter.web.inner.entity.SysUserRole; | |
| 11 | +import com.lframework.starter.web.inner.service.system.SysRoleService; | |
| 12 | +import com.lframework.starter.web.inner.service.system.SysUserDeptService; | |
| 13 | +import com.lframework.starter.web.inner.service.system.SysUserRoleService; | |
| 9 | 14 | import com.lframework.xingyun.basedata.entity.Workshop; |
| 10 | 15 | import com.lframework.xingyun.basedata.service.workshop.WorkshopService; |
| 11 | 16 | import com.lframework.xingyun.basedata.vo.workshop.QueryWorkshopVo; |
| ... | ... | @@ -49,6 +54,12 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 49 | 54 | private WorkshopService workshopService; |
| 50 | 55 | @Resource |
| 51 | 56 | private PurchaseOrderInfoService purchaseOrderInfoService; |
| 57 | + @Resource | |
| 58 | + private SysUserRoleService sysUserRoleService; | |
| 59 | + @Resource | |
| 60 | + private SysRoleService sysRoleService; | |
| 61 | + @Resource | |
| 62 | + private SysUserDeptService sysUserDeptService; | |
| 52 | 63 | |
| 53 | 64 | |
| 54 | 65 | @Override |
| ... | ... | @@ -187,6 +198,20 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 187 | 198 | existOrderSpecIds.addAll(orderSpecIds); |
| 188 | 199 | } |
| 189 | 200 | vo.setOrderSpecIds(existOrderSpecIds); |
| 201 | + // 业务员做权限控制 | |
| 202 | + List<String> userIds = new ArrayList<>(); | |
| 203 | + String currentUserId = SecurityUtil.getCurrentUser().getId(); | |
| 204 | + List<SysUserRole> userRoles = sysUserRoleService.getByUserId(currentUserId); | |
| 205 | + List<String> roleIds = userRoles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList()); | |
| 206 | + List<SysRole> roleList = sysRoleService.listByIds(roleIds); | |
| 207 | + for (SysRole role : roleList) { | |
| 208 | + String code = role.getCode(); | |
| 209 | + if ("ywy".equals(code)) { | |
| 210 | + userIds = sysUserDeptService.listAllUserByUserId(Collections.singletonList(currentUserId), false); | |
| 211 | + break; | |
| 212 | + } | |
| 213 | + } | |
| 214 | + vo.setCreateByIds(userIds); | |
| 190 | 215 | // 开启分页 |
| 191 | 216 | PageHelperUtil.startPage(pageIndex, pageSize); |
| 192 | 217 | List<ShipmentsPlanDetail> dataList = getBaseMapper().queryCanShipmentsData(vo); |
| ... | ... | @@ -433,16 +458,11 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP |
| 433 | 458 | LocalTime shipmentsTime = detail.getShipmentsTime(); |
| 434 | 459 | Boolean canShipments = detail.getCanShipments(); |
| 435 | 460 | Boolean preShipments = detail.getPreShipments(); |
| 436 | - if ("CHECKING".equals(status)) { | |
| 437 | - // 提交计划 | |
| 461 | + if ("IN_PROGRESS".equals(status)) { | |
| 462 | + // 核对计划 | |
| 438 | 463 | if (!preShipments && shipmentsTime == null) { |
| 439 | 464 | throw new DefaultClientException("发货时点不能为空!"); |
| 440 | 465 | } |
| 441 | - if (preShipments && canShipments == null) { | |
| 442 | - throw new DefaultClientException("是否可发货不能为空!"); | |
| 443 | - } | |
| 444 | - } else if ("IN_PROGRESS".equals(status)) { | |
| 445 | - // 核对计划 | |
| 446 | 466 | if (!preShipments && canShipments == null) { |
| 447 | 467 | throw new DefaultClientException("是否可发货不能为空!"); |
| 448 | 468 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/vo/shipments/plan/QueryShipmentsPlanDetailVo.java
| ... | ... | @@ -75,4 +75,10 @@ public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serial |
| 75 | 75 | */ |
| 76 | 76 | @ApiModelProperty("客户名称") |
| 77 | 77 | private Boolean completed; |
| 78 | + | |
| 79 | + /** | |
| 80 | + * 创建人ID集合 | |
| 81 | + */ | |
| 82 | + @ApiModelProperty("创建人ID集合") | |
| 83 | + private List<String> createByIds; | |
| 78 | 84 | } | ... | ... |
| ... | ... | @@ -203,6 +203,12 @@ |
| 203 | 203 | #{item} |
| 204 | 204 | </foreach> |
| 205 | 205 | </if> |
| 206 | + <if test="vo.createByIds != null and vo.createByIds.size() > 0"> | |
| 207 | + and o.contract_create_by_id in | |
| 208 | + <foreach collection="vo.createByIds" open="(" separator="," close=")" item="item"> | |
| 209 | + #{item} | |
| 210 | + </foreach> | |
| 211 | + </if> | |
| 206 | 212 | <if test="vo.orderNo != null and vo.orderNo != ''"> |
| 207 | 213 | AND o.order_no like concat('%', #{vo.orderNo}, '%') |
| 208 | 214 | </if> | ... | ... |