caozixuan 1 rok pred
rodič
commit
597ea6c114

+ 13 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDeviceDeliveryServiceImpl.java

@@ -114,6 +114,18 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
                 if (supplierId == null || supplierId == 0) {
                     throw ExceptionResultEnum.ERROR.exception(String.format("excel中存在系统中不存在的供应商名称[%s]", supplierName));
                 }
+                DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
+                if (dpr.getHasDeviceDelivery() && !dpr.getHasAdmin() && !dpr.getHasPmo() && !dpr.getHasBusiness() && !dpr.getHasRegionManager()) {
+                    // 设备管理员权限
+                    Long userSupplierId = requestUser.getSupplierId();
+                    if (userSupplierId == null || userSupplierId == 0) {
+                        throw ExceptionResultEnum.ERROR.exception("请先在用户管理中绑定设备发货员对应的供应商");
+                    }
+                    if (!userSupplierId.equals(supplierId)) {
+                        throw ExceptionResultEnum.ERROR.exception(String.format("缺少供应商[%s]的设备管理权限", supplierName));
+                    }
+                }
+
 
                 String mailingAddress = deviceDeliveryImportDto.getMailingAddress();
                 String consignee = deviceDeliveryImportDto.getConsignee();
@@ -443,9 +455,8 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
      * 补充结果信息
      *
      * @param e 发货结果对象
-     * @throws Exception 异常
      */
-    private void fillResultInfo(TBDeviceDeliveryResult e) throws Exception {
+    private void fillResultInfo(TBDeviceDeliveryResult e) {
         DeviceUsageTypeEnum dbUsageType = e.getUsageType();
         e.setUsageTypeStr(Objects.nonNull(dbUsageType) ? dbUsageType.getTitle() : "");