|
|
@@ -5,8 +5,13 @@ import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
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.UserService;
|
|
|
import com.github.zuihou.authority.service.common.DictionaryItemService;
|
|
|
+import com.github.zuihou.authority.strategy.DataScopeContext;
|
|
|
+import com.github.zuihou.authority.strategy.impl.ThisLevelChildrenDataScope;
|
|
|
import com.github.zuihou.authority.utils.XxlJobUtil;
|
|
|
import com.github.zuihou.base.service.SuperCacheServiceImpl;
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
@@ -14,6 +19,8 @@ import com.github.zuihou.common.constant.CacheKey;
|
|
|
import com.github.zuihou.common.constant.DictionaryType;
|
|
|
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.auth.DataScopeType;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.database.properties.DatabaseProperties;
|
|
|
@@ -31,6 +38,7 @@ import com.github.zuihou.tenant.service.*;
|
|
|
import com.github.zuihou.utils.BeanPlusUtil;
|
|
|
import com.github.zuihou.utils.StrPool;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.compress.utils.Lists;
|
|
|
import org.apache.commons.httpclient.NameValuePair;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -90,6 +98,9 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
|
|
|
@Autowired
|
|
|
private DatabaseProperties databaseProperties;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserService userService;
|
|
|
+
|
|
|
@Value("${xxl.job.admin.addresses}")
|
|
|
private String jobAdminUrl;
|
|
|
@Value("${xxl.job.login.username}")
|
|
|
@@ -113,11 +124,16 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
|
|
|
if(map==null) map = new HashMap();
|
|
|
//需要查询状态
|
|
|
String resourceStatus = map.get("resourceStatus")==null?"":map.get("resourceStatus").toString();
|
|
|
+ String gatherSql = "";
|
|
|
if("1".equals(resourceStatus)){
|
|
|
- String gatherSql = getGatherSQL();
|
|
|
+ gatherSql = getGatherSQL();
|
|
|
map.put("gatherSql",gatherSql);
|
|
|
}
|
|
|
|
|
|
+ String getOrgIds = this.getOrgIds();
|
|
|
+ if(StringUtil.isNotEmpty(getOrgIds)){
|
|
|
+ map.put("orgIds", getOrgIds);
|
|
|
+ }
|
|
|
List<Map>list = productionresourceviewMapper.getList(map);
|
|
|
//设置字典表
|
|
|
setDesc(list);
|
|
|
@@ -143,9 +159,15 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
|
|
|
|
|
|
//需要查询状态
|
|
|
String resourceStatus = map.get("resourceStatus")==null?"":map.get("resourceStatus").toString();
|
|
|
+ String gatherSql = "";
|
|
|
if("1".equals(resourceStatus)){
|
|
|
- String gatherSql = getGatherSQL();
|
|
|
- map.put("gatherSql",gatherSql);
|
|
|
+ gatherSql = getGatherSQL();
|
|
|
+ map.put("gatherSql",gatherSql);
|
|
|
+ }
|
|
|
+
|
|
|
+ String getOrgIds = this.getOrgIds();
|
|
|
+ if(StringUtil.isNotEmpty(getOrgIds)){
|
|
|
+ map.put("orgIds", getOrgIds);
|
|
|
}
|
|
|
|
|
|
getQueryMap(map);
|
|
|
@@ -164,6 +186,16 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
|
|
|
return retMap;
|
|
|
}
|
|
|
|
|
|
+ public String getOrgIds(){
|
|
|
+ //机构部门数据权限判断验证
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
+ Long userId = BaseContextHandler.getUserId();
|
|
|
+ //获取用户权限访问机构
|
|
|
+ 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, ",") : "";
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private Map getQueryMap(Map map){
|
|
|
Map modelMap = map.get("model")==null?null:(Map)map.get("model");
|
|
|
@@ -236,7 +268,7 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
|
|
|
// 启用属性自动注入
|
|
|
@InjectionResult
|
|
|
public IPage<Productionresource> pageList(IPage page, LbqWrapper<Productionresource> wrapper) {
|
|
|
- return baseMapper.pageList(page, wrapper);
|
|
|
+ return baseMapper.pageList(page, wrapper, new DataScope());
|
|
|
}
|
|
|
|
|
|
@Override
|