|
@@ -5,14 +5,14 @@ import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
|
|
|
import com.dragoninfo.dcuc.auth.audit.enums.AuthResultEnum;
|
|
|
import com.dragoninfo.dcuc.auth.audit.service.log.LogInfoFillService;
|
|
|
import com.dragoninfo.dcuc.auth.auth.bpo.RoleBPO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunInfoDTO;
|
|
|
import com.dragoninfo.dcuc.auth.auth.dto.RoleApiDto;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.AppFunAuthResult;
|
|
|
import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
|
|
|
import com.dragoninfo.dcuc.auth.auth.entity.RoleInfo;
|
|
|
import com.dragoninfo.dcuc.auth.auth.entity.StaffAssignAuthInfo;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.service.IAppFunInfoService;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.service.IRoleFunRsRlService;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.service.IRoleService;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.service.IStaffAssignAuthInfoService;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.enumresources.AuthStatusEnum;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.service.*;
|
|
|
import com.dragoninfo.dcuc.auth.auth.vo.RoleAppFunVO;
|
|
|
import com.dragoninfo.dcuc.auth.util.AesEncoder;
|
|
|
import com.dragoninfo.dcuc.user.user.entity.UserInfo;
|
|
@@ -24,13 +24,17 @@ import com.dragonsoft.duceap.base.exception.ApplicationException;
|
|
|
import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
|
|
|
import com.dragonsoft.duceap.commons.util.string.StringUtils;
|
|
|
import com.dragonsoft.duceap.core.persistent.factory.PersistentFactory;
|
|
|
+import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
+import com.dragonsoft.duceap.core.search.enums.SearchOperator;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author huanghy
|
|
@@ -58,6 +62,9 @@ public class RoleService extends BaseService<RoleInfo, String> implements IRoleS
|
|
|
@Autowired
|
|
|
private LogInfoFillService logInfoFillService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IAppFunAuthResultService appFunAuthResultService;
|
|
|
+
|
|
|
@Override
|
|
|
public void checkIn() {
|
|
|
roleBPO.get("PERFLIMYYJEPAPVGGEZDPIFWPXXWMQJK");
|
|
@@ -103,9 +110,29 @@ public class RoleService extends BaseService<RoleInfo, String> implements IRoleS
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
List<String> roleRs = roleFunRsRlService.getFunsByRoles(roleIds.toString());
|
|
|
logger.info("根据角色id集合查找权限耗时:{}s ", (System.currentTimeMillis() - startTime) / 1000);
|
|
|
+
|
|
|
+ List<AppFunAuthResult> resultList = getSelfAuthByAppCodeAndUserId(appCode,userId);
|
|
|
+ if(CollectionUtils.isNotEmpty(resultList)) {
|
|
|
+ List<String> funCodes = resultList
|
|
|
+ .stream()
|
|
|
+ .map(AppFunAuthResult::getFunCode)
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ roleRs.addAll(funCodes);
|
|
|
+ logger.info("自助授权查询耗时:{}",(System.currentTimeMillis() - startTime) / 1000);
|
|
|
+ }
|
|
|
return roleRs;
|
|
|
}
|
|
|
|
|
|
+ private List<AppFunAuthResult> getSelfAuthByAppCodeAndUserId(String appCode,String userId) {
|
|
|
+ Searchable searchable = Searchable.newSearchable();
|
|
|
+ searchable.addSearchFilter("appCode", SearchOperator.eq, appCode);
|
|
|
+ searchable.addSearchFilter("userId", SearchOperator.eq, userId);
|
|
|
+ searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.value);
|
|
|
+ searchable.addSearchFilter("authStatus", SearchOperator.eq, AuthStatusEnum.START.getValue());
|
|
|
+ return appFunAuthResultService.getResultList(searchable);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public List<Map<String, Object>> getAuthsDetailsByUserIdAndAppCode(String userId, String appCode) {
|
|
@@ -513,6 +540,28 @@ public class RoleService extends BaseService<RoleInfo, String> implements IRoleS
|
|
|
|
|
|
logInfoFillService.sendFunAuthenticationLog(AuthResultEnum.SUC, dto, funsByroleIds);
|
|
|
|
|
|
+
|
|
|
+ List<AppFunAuthResult> appFunAuthResults = getSelfAuthByAppCodeAndUserId(appCode, dto.getUserId());
|
|
|
+
|
|
|
+ List<String> funIds = appFunAuthResults
|
|
|
+ .stream()
|
|
|
+ .map(AppFunAuthResult::getFunId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if(CollectionUtils.isNotEmpty(funIds)) {
|
|
|
+ List<AppFunInfoDTO> funInfos = appFunInfoService.getByIds(funIds);
|
|
|
+ List<Map<String, Object>> collect = funInfos.stream().map(item -> {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("name", item.getName());
|
|
|
+ map.put("code", item.getCode());
|
|
|
+ map.put("pid", item.getParentId());
|
|
|
+ map.put("url", item.getUrl());
|
|
|
+ map.put("sort", item.getSeq());
|
|
|
+ return map;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ results.addAll(collect);
|
|
|
+ logger.info("自助授权查询耗时:{}", (System.currentTimeMillis() - startTime) / 1000);
|
|
|
+ }
|
|
|
+
|
|
|
return ResponseDTO.success("查询成功", results);
|
|
|
}
|
|
|
|