Showing
2 changed files
with
21 additions
and
1 deletions
| ... | ... | @@ -338,6 +338,12 @@ public class GetPurchaseOrderInfoBo extends BaseBo<PurchaseOrderInfo> { |
| 338 | 338 | @ApiModelProperty("质保书名称") |
| 339 | 339 | private String warrantyCertificateFileName; |
| 340 | 340 | |
| 341 | + /** | |
| 342 | + * 是否展示上传按钮(非持久化字段) | |
| 343 | + */ | |
| 344 | + @ApiModelProperty("是否展示上传按钮") | |
| 345 | + private boolean showUpload = false; | |
| 346 | + | |
| 341 | 347 | |
| 342 | 348 | public GetPurchaseOrderInfoBo() { |
| 343 | 349 | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/order/PurchaseOrderInfoController.java
| ... | ... | @@ -87,6 +87,9 @@ public class PurchaseOrderInfoController extends DefaultBaseController { |
| 87 | 87 | private TransactorHandler transactorHandler; |
| 88 | 88 | @Resource |
| 89 | 89 | private ContractDistributorStandardService contractDistributorStandardService; |
| 90 | + @Resource | |
| 91 | + private SysRoleService sysRoleService; | |
| 92 | + | |
| 90 | 93 | |
| 91 | 94 | |
| 92 | 95 | /** |
| ... | ... | @@ -104,7 +107,8 @@ public class PurchaseOrderInfoController extends DefaultBaseController { |
| 104 | 107 | |
| 105 | 108 | if (!CollectionUtil.isEmpty(datas)) { |
| 106 | 109 | String currentUserId = SecurityUtil.getCurrentUser().getId(); |
| 107 | - | |
| 110 | + List<SysRole> roles = sysRoleService.getByUserId(currentUserId); | |
| 111 | + List<String> roleCodes = roles.stream().map(SysRole::getCode).collect(Collectors.toList()); | |
| 108 | 112 | results = datas.stream().map(purchaseOrderInfo -> { |
| 109 | 113 | GetPurchaseOrderInfoBo bo = new GetPurchaseOrderInfoBo(purchaseOrderInfo); |
| 110 | 114 | // 判断 contractCreateById 是否等于当前用户 ID |
| ... | ... | @@ -113,6 +117,16 @@ public class PurchaseOrderInfoController extends DefaultBaseController { |
| 113 | 117 | isCreateBy = true; |
| 114 | 118 | } |
| 115 | 119 | bo.setContractCreateBy(isCreateBy); |
| 120 | + // 最终精简版代码 | |
| 121 | + if (CollectionUtils.isNotEmpty(roleCodes)) { | |
| 122 | + String workshopCode = purchaseOrderInfo.getWorkshopCode(); | |
| 123 | + // 只有当车间代码在白名单内,且用户拥有对应权限时,才显示上传 | |
| 124 | + if (Arrays.asList("yfc", "efc", "sfc", "ztfc").contains(workshopCode)) { | |
| 125 | + if (roleCodes.contains(workshopCode + "pzglkzjy")) { | |
| 126 | + bo.setShowUpload(true); | |
| 127 | + } | |
| 128 | + } | |
| 129 | + } | |
| 116 | 130 | return bo; |
| 117 | 131 | }).collect(Collectors.toList()); |
| 118 | 132 | } | ... | ... |