瀏覽代碼

故障知识库的数据权限问题

lipenghui 2 月之前
父節點
當前提交
1dd1468a2e

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/information/IotInformationDbDO.java

@@ -61,4 +61,6 @@ public class IotInformationDbDO extends BaseDO {
      */
     private Integer auditStatus;
 
+    private Long deptId;
+
 }

+ 5 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotInfoServiceImpl.java

@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
 import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoClassifyListReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoPageReqVO;
 import cn.iocoder.yudao.module.pms.controller.admin.vo.IotInfoSaveReqVO;
+import cn.iocoder.yudao.module.pms.dal.dataobject.IotDeviceDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoClassifyDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotInfoDO;
 import cn.iocoder.yudao.module.pms.dal.dataobject.IotTreeDO;
@@ -42,6 +43,8 @@ public class IotInfoServiceImpl implements IotInfoService {
     private IotInfoClassifyService iotInfoClassifyService;
     @Autowired
     private IotTreeService iotTreeService;
+    @Autowired
+    private IotDeviceService iotDeviceService;
 
     @Override
     public void createIotInfo(IotInfoSaveReqVO createReqVO) {
@@ -50,10 +53,12 @@ public class IotInfoServiceImpl implements IotInfoService {
             throw exception(IOT_INFO_NOT_EXISTS);
         }
         Long classId = createReqVO.getClassId();
+        IotDeviceDO iotDevice = iotDeviceService.getIotDevice(createReqVO.getDeviceId());
         List<IotInfoDO> collect = createReqVO.getFileList().stream().map(e -> {
             IotInfoDO iotInfo = BeanUtils.toBean(createReqVO, IotInfoDO.class);
             iotInfo.setFilename(StringUtils.substringAfterLast(e.get("url"), "/"));
             iotInfo.setFilePath(e.get("url"));
+            iotInfo.setDeptId(iotDevice.getDeptId());
             long size = Long.parseLong(e.get("size"));
             double mb = size / (1024.0 * 1024.0);
             iotInfo.setFileSize(String.format("%.2f MB", mb));

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/maintain/IotMaintainServiceImpl.java

@@ -199,6 +199,7 @@ public class IotMaintainServiceImpl implements IotMaintainService {
                 informationDbDO.setSolutions(iotMaintain.getSolution());
                 informationDbDO.setDescription(iotMaintain.getDescription());
                 informationDbDO.setRemark(iotMaintain.getRemark());
+                informationDbDO.setDeptId(iotMaintain.getDeptId());
                 iotInformationDbMapper.insert(informationDbDO);
             }
         });