Commit e323ce299140994283d4eecbc647a6a15461f6d2

Authored by yeqianyong
2 parents 2d678f21 394b4ee9

Merge branch 'master_after20' into master_cj_zq

# Conflicts:
#	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,6 +13,7 @@ import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto;
13 import com.lframework.starter.web.inner.entity.SysDept; 13 import com.lframework.starter.web.inner.entity.SysDept;
14 import com.lframework.starter.web.inner.service.DicCityService; 14 import com.lframework.starter.web.inner.service.DicCityService;
15 import com.lframework.starter.web.inner.service.system.SysDeptService; 15 import com.lframework.starter.web.inner.service.system.SysDeptService;
  16 +import com.lframework.starter.web.inner.service.system.SysUserRoleService;
16 import com.lframework.xingyun.basedata.entity.Customer; 17 import com.lframework.xingyun.basedata.entity.Customer;
17 import com.lframework.xingyun.basedata.entity.Workshop; 18 import com.lframework.xingyun.basedata.entity.Workshop;
18 import com.lframework.xingyun.basedata.service.customer.CustomerService; 19 import com.lframework.xingyun.basedata.service.customer.CustomerService;
@@ -91,6 +92,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr @@ -91,6 +92,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr
91 private PurchaseOrderLineService purchaseOrderLineService; 92 private PurchaseOrderLineService purchaseOrderLineService;
92 @Resource 93 @Resource
93 private ReceiptLedgerInfoService receiptLedgerInfoService; 94 private ReceiptLedgerInfoService receiptLedgerInfoService;
  95 + @Resource
  96 + private SysUserRoleService sysUserRoleService;
94 97
95 98
96 @Override 99 @Override
@@ -308,6 +311,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr @@ -308,6 +311,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr
308 if (CollectionUtils.isEmpty(detailList)) { 311 if (CollectionUtils.isEmpty(detailList)) {
309 throw new DefaultClientException("发货明细数据不存在!"); 312 throw new DefaultClientException("发货明细数据不存在!");
310 } 313 }
  314 + // 剔除经营办发货员添加的计划
  315 + dataFilter(detailList);
311 // 根据客户分组 316 // 根据客户分组
312 Map<String, List<ShipmentsPlanDetail>> detailMap = new HashMap<>(); 317 Map<String, List<ShipmentsPlanDetail>> detailMap = new HashMap<>();
313 for (ShipmentsPlanDetail detail : detailList) { 318 for (ShipmentsPlanDetail detail : detailList) {
@@ -765,4 +770,35 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr @@ -765,4 +770,35 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr
765 ticketVo.setLoadingTime(loadingTime); 770 ticketVo.setLoadingTime(loadingTime);
766 return ticketVo; 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 +6,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
6 import com.github.pagehelper.PageInfo; 6 import com.github.pagehelper.PageInfo;
7 import com.lframework.starter.web.core.components.security.SecurityUtil; 7 import com.lframework.starter.web.core.components.security.SecurityUtil;
8 import com.lframework.starter.web.core.utils.*; 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 import com.lframework.xingyun.basedata.entity.Workshop; 14 import com.lframework.xingyun.basedata.entity.Workshop;
10 import com.lframework.xingyun.basedata.service.workshop.WorkshopService; 15 import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
11 import com.lframework.xingyun.basedata.vo.workshop.QueryWorkshopVo; 16 import com.lframework.xingyun.basedata.vo.workshop.QueryWorkshopVo;
@@ -49,6 +54,12 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP @@ -49,6 +54,12 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
49 private WorkshopService workshopService; 54 private WorkshopService workshopService;
50 @Resource 55 @Resource
51 private PurchaseOrderInfoService purchaseOrderInfoService; 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 @Override 65 @Override
@@ -187,6 +198,20 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP @@ -187,6 +198,20 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
187 existOrderSpecIds.addAll(orderSpecIds); 198 existOrderSpecIds.addAll(orderSpecIds);
188 } 199 }
189 vo.setOrderSpecIds(existOrderSpecIds); 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 PageHelperUtil.startPage(pageIndex, pageSize); 216 PageHelperUtil.startPage(pageIndex, pageSize);
192 List<ShipmentsPlanDetail> dataList = getBaseMapper().queryCanShipmentsData(vo); 217 List<ShipmentsPlanDetail> dataList = getBaseMapper().queryCanShipmentsData(vo);
@@ -433,16 +458,11 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP @@ -433,16 +458,11 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
433 LocalTime shipmentsTime = detail.getShipmentsTime(); 458 LocalTime shipmentsTime = detail.getShipmentsTime();
434 Boolean canShipments = detail.getCanShipments(); 459 Boolean canShipments = detail.getCanShipments();
435 Boolean preShipments = detail.getPreShipments(); 460 Boolean preShipments = detail.getPreShipments();
436 - if ("CHECKING".equals(status)) {  
437 - // 提交计划 461 + if ("IN_PROGRESS".equals(status)) {
  462 + // 核对计划
438 if (!preShipments && shipmentsTime == null) { 463 if (!preShipments && shipmentsTime == null) {
439 throw new DefaultClientException("发货时点不能为空!"); 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 if (!preShipments && canShipments == null) { 466 if (!preShipments && canShipments == null) {
447 throw new DefaultClientException("是否可发货不能为空!"); 467 throw new DefaultClientException("是否可发货不能为空!");
448 } 468 }
@@ -75,4 +75,10 @@ public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serial @@ -75,4 +75,10 @@ public class QueryShipmentsPlanDetailVo extends PageVo implements BaseVo, Serial
75 */ 75 */
76 @ApiModelProperty("客户名称") 76 @ApiModelProperty("客户名称")
77 private Boolean completed; 77 private Boolean completed;
  78 +
  79 + /**
  80 + * 创建人ID集合
  81 + */
  82 + @ApiModelProperty("创建人ID集合")
  83 + private List<String> createByIds;
78 } 84 }
@@ -203,6 +203,12 @@ @@ -203,6 +203,12 @@
203 #{item} 203 #{item}
204 </foreach> 204 </foreach>
205 </if> 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 <if test="vo.orderNo != null and vo.orderNo != ''"> 212 <if test="vo.orderNo != null and vo.orderNo != ''">
207 AND o.order_no like concat('%', #{vo.orderNo}, '%') 213 AND o.order_no like concat('%', #{vo.orderNo}, '%')
208 </if> 214 </if>