Browse Source

新增设备所属产业查询功能和线边库监控查询功能

oyq28 3 years ago
parent
commit
3e499b7997

BIN
imcs-admin-boot/imcs-authority-server/src/main/java.7z


+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/ShelvesServiceImpl.java

@@ -115,7 +115,7 @@ public class ShelvesServiceImpl extends SuperCacheServiceImpl<ShelvesMapper, She
     public List<Shelves> shelvesTreeList(){
         //[{id=xx,name=xx,children=[{id=xx,name=xx}]}]
         List<Shelves> returnList = new ArrayList<Shelves>();
-        List<Shelves> list = baseMapper.selectList(Wraps.<Shelves>lbQ().orderByAsc(Shelves::getWeight));
+        List<Shelves> list = baseMapper.selectList(Wraps.<Shelves>lbQ().eq(Shelves::getStatus,1).orderByAsc(Shelves::getWeight));
 
         for(Shelves map:list){
             //一级

+ 1 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/edgeLibrary/service/impl/StorgeServiceImpl.java

@@ -181,6 +181,7 @@ public class StorgeServiceImpl extends SuperCacheServiceImpl<StorgeMapper, Storg
     public Storge lockStorge(Storge storge, Long campId) {
         //TODO高并发的情况下,这里还需要验证
         storge.setCampId(campId);
+        //storge.setTargetId(targetId);
         storge.setLockStatus("0");
         this.updateById(storge);
         return storge;

+ 20 - 1
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/productionResourceCenter/ZZoneController.java

@@ -1,7 +1,10 @@
 package com.github.zuihou.business.controller.productionResourceCenter;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.authority.service.auth.UserService;
 import com.github.zuihou.base.request.PageParams;
 import com.github.zuihou.business.DemoLine.DemoLineConstant;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
@@ -17,6 +20,8 @@ import java.util.Map;
 import java.util.stream.Collectors;
 import com.github.zuihou.base.controller.SuperController;
 import com.github.zuihou.base.R;
+import com.github.zuihou.common.util.StringUtil;
+import com.github.zuihou.context.BaseContextHandler;
 import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
@@ -26,6 +31,8 @@ import com.qiniu.common.Zone;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.compress.utils.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import com.github.zuihou.security.annotation.PreAuth;
@@ -47,6 +54,10 @@ import com.github.zuihou.security.annotation.PreAuth;
 @Api(value = "ZZone", tags = "区域管理")
 @SysLog(enabled = true)
 public class ZZoneController extends SuperController<ZZoneService, Long, ZZone, ZZonePageDTO, ZZoneSaveDTO, ZZoneUpdateDTO> {
+
+    @Autowired
+    private UserService userService;
+
     @Override
     public void query(PageParams<ZZonePageDTO> params, IPage<ZZone> page, Long defSize) {
         ZZonePageDTO data = params.getModel();
@@ -63,7 +74,15 @@ public class ZZoneController extends SuperController<ZZoneService, Long, ZZone,
     @ApiOperation(value = "查询区域管理", notes = "查询区域管理")
     @GetMapping("/all")
     public R<List<ZZone>> list() {
-        return success(baseService.list());
+        Long userId = BaseContextHandler.getUserId();
+        //获取用户权限访问机构
+        Map<String, Object> orgMap = userService.getDataScopeById(userId);
+        List<Long> orgIds = orgMap.containsKey("orgIds")? (List)orgMap.get("orgIds") : Lists.newArrayList();
+        QueryWrapper<ZZone> queryWrapper = null;
+        if(CollectionUtil.isNotEmpty(orgIds)){
+            queryWrapper = new QueryWrapper<ZZone>().in("org_id", orgIds);
+        }
+        return success(baseService.list(queryWrapper));
     }
 
     @ApiOperation(value = "查询区域管理", notes = "查询区域管理")