浏览代码

修改后端异常bug和实现设备选择数据隔离

oyq28 3 年之前
父节点
当前提交
e2135d78a1

+ 2 - 1
imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/job/DashboardJob.java

@@ -203,10 +203,11 @@ public class DashboardJob {
     }
 
     private Claims parseJWT(String token){
+        final String BASE64_SECURITY = Base64.getEncoder().encodeToString(BaseContextConstants.JWT_SIGN_KEY.getBytes(Charsets.UTF_8));
         Claims claims = null;
         try {
             claims = Jwts.parserBuilder()
-                    .setSigningKey(Base64.getDecoder().decode(BaseContextConstants.JWT_SIGN_KEY)) // 设置标识名
+                    .setSigningKey(Base64.getDecoder().decode(BASE64_SECURITY)) // 设置标识名
                     .build()
                     .parseClaimsJws(token)  //解析token
                     .getBody();

+ 8 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/productionResourceCenter/service/impl/ProductionresourceBizServiceImpl.java

@@ -8,8 +8,10 @@ import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
 import com.github.zuihou.business.productionResourceCenter.entity.Productionresource;
 import com.github.zuihou.business.productionResourceCenter.entity.ResourceBusiness;
+import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.service.ProductionresourceBizService;
 import com.github.zuihou.business.productionResourceCenter.service.ResourceBusinessService;
+import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
@@ -42,8 +44,14 @@ public class ProductionresourceBizServiceImpl extends SuperServiceImpl<Productio
     @Autowired
     private ResourceBusinessService resourceBusinessService;
 
+    @Autowired
+    private ZZoneService zZoneService;
+
     @Override
     public Map<String, Object> pageList(Map<String, Object> map) {
+        //默认显示保障中心设备
+        String org_id = zZoneService.getOne(new LbqWrapper<ZZone>().eq(ZZone::getNo, "safeguard")).getOrgId().toString();
+        map.put("orgIds", org_id);
         Map<String, Object> returnMap = productionresourceService.pageList(map);
         List<Map> list = returnMap.get("data")==null?new ArrayList():(List)returnMap.get("data");
         list.stream().map((item) -> {

+ 6 - 1
imcs-admin-boot/imcs-tenant-biz/src/main/java/com/github/zuihou/tenant/service/impl/ProductionresourceServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.github.zuihou.authority.entity.auth.User;
 import com.github.zuihou.authority.entity.common.DictionaryItem;
 import com.github.zuihou.authority.entity.core.Org;
+import com.github.zuihou.authority.service.auth.RoleService;
 import com.github.zuihou.authority.service.auth.UserService;
 import com.github.zuihou.authority.service.common.DictionaryItemService;
 import com.github.zuihou.authority.strategy.DataScopeContext;
@@ -167,7 +168,10 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
 
         String getOrgIds = this.getOrgIds();
         if(StringUtil.isNotEmpty(getOrgIds)){
-            map.put("orgIds", getOrgIds);
+            String safeguard_orgId = map.get("orgIds").toString();
+            map.put("orgIds", safeguard_orgId+","+getOrgIds);
+        }else{
+            map.remove("orgIds");
         }
 
         getQueryMap(map);
@@ -193,6 +197,7 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
         //获取用户权限访问机构
         Map<String, Object> orgMap = userService.getDataScopeById(userId);
         List<Long> orgIds = orgMap.containsKey("orgIds")? (List)orgMap.get("orgIds") : Lists.newArrayList();
+
         return CollectionUtil.isNotEmpty(orgIds)? CollectionUtil.join(orgIds, ",") : "";
     }