Redeem 1 vuosi sitten
vanhempi
commit
988236cfab

+ 15 - 2
src/main/java/com/steerinfo/dil/controller/BackgroundProcessingController.java

@@ -17,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
 import oracle.jdbc.proxy.annotation.Post;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import com.steerinfo.dil.util.SSOUtil;
@@ -52,10 +53,10 @@ public class BackgroundProcessingController extends BaseRESTfulController {
         if("succeed".equals(resMap.get("status"))) {
             Map<String, Object> dataMap = (Map<String, Object>) resMap.get("data");
             Map<String, Object> userInfo = (Map<String, Object>) dataMap.get("user");
+            String userId = userInfo.get("userId").toString();
+            List<Map<String,Object>> mapList = (List<Map<String, Object>>) userInfo.get("sysRoles");
             // 根据用户名去查询该用户绑定的公司及下属公司;7.2改为只查本单位因前端会报错
             List<Map<String, Object>> companyList = backgroundProcessingMapper.getCurrentCompanyList(loginName);
-
-            //List<Map<String, Object>> companyList = backgroundProcessingMapper.getCompanyList(loginName);
             if(companyList != null && companyList.size() > 0) {
                 Map<String, Object> stringMap = new HashMap<>();
                 stringMap.put("companyId",-1);
@@ -67,6 +68,18 @@ public class BackgroundProcessingController extends BaseRESTfulController {
                 //resMap.put("code","500");
                 //return resMap;
             }
+            //遍历角色,查看是否有业务单位权限
+            for(Map<String,Object> map : mapList) {
+                //如果角色包含业务单位
+                if("businessCompany".equals(map.get("roleCode"))) {
+                    List<Map<String,Object>> businessCompanyList =  backgroundProcessingMapper.getCompanyList(userId);
+                    if(businessCompanyList != null) {
+                        companyList.addAll(businessCompanyList);
+                    }
+                }else{
+                    continue;
+                }
+            }
             Map<String,Object> rootCompanyMap = backgroundProcessingMapper.getCompanyRootMap(loginName);
             //根据companyList查询名字相同的
             userInfo.put("dilCompanyList", companyList);