|
@@ -10,20 +10,21 @@ import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
|
|
|
import com.dragoninfo.dcuc.auth.auth.business.IAuthApplyBusiness;
|
|
|
import com.dragoninfo.dcuc.auth.auth.constance.AuthFlowOpeCons;
|
|
|
import com.dragoninfo.dcuc.auth.auth.dto.*;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunApplyContent;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunAuthResult;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.entity.AppFunInfo;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.entity.WorkFlow;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.*;
|
|
|
import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowPermissionTypeEnum;
|
|
|
import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.service.IAppFunApplyContentService;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.service.IAppFunAuthResultService;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.service.IAppFunInfoService;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.service.IWorkFlowService;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.event.RedListCheckEvent;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.service.*;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.vo.RedListRiskLogVo;
|
|
|
import com.dragoninfo.dcuc.auth.config.DcucAuthApprovalConfig;
|
|
|
import com.dragoninfo.dcuc.auth.config.DcucAuthConfig;
|
|
|
import com.dragoninfo.dcuc.auth.constance.ApprovalApiConstance;
|
|
|
+import com.dragoninfo.dcuc.auth.list.entity.RedListContent;
|
|
|
+import com.dragoninfo.dcuc.auth.list.entity.WhiteList;
|
|
|
+import com.dragoninfo.dcuc.auth.list.service.IRedListService;
|
|
|
+import com.dragoninfo.dcuc.auth.list.service.IWhiteListService;
|
|
|
import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
|
|
|
+import com.dragoninfo.dcuc.auth.sub.enumresource.SubObjTypeEnum;
|
|
|
import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
|
|
|
import com.dragoninfo.dcuc.auth.util.WorkFlowTimeUtil;
|
|
|
import com.dragoninfo.dcuc.common.Constants;
|
|
@@ -41,7 +42,6 @@ import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
import com.dragonsoft.duceap.base.utils.UserContextUtils;
|
|
|
import com.dragonsoft.duceap.commons.util.UUIDUtils;
|
|
|
-import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
|
|
|
import com.dragonsoft.duceap.commons.util.string.StringUtils;
|
|
|
import com.dragonsoft.duceap.core.context.ContextUtils;
|
|
|
import com.dragonsoft.duceap.core.search.Searchable;
|
|
@@ -49,12 +49,14 @@ import com.dragonsoft.duceap.core.search.enums.SearchOperator;
|
|
|
import com.dragonsoft.duceap.core.search.filter.Condition;
|
|
|
import com.google.common.base.Joiner;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.http.Header;
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
|
import org.apache.http.client.methods.HttpPut;
|
|
|
import org.apache.http.message.BasicHeader;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.ApplicationEventPublisher;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageImpl;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
@@ -101,6 +103,17 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
@Autowired
|
|
|
private IAppFunInfoService appFunInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IRedListService redListService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IWhiteListService whiteListService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IRedListRiskLogService redListRiskLogService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ApplicationEventPublisher publisher;
|
|
|
|
|
|
@Override
|
|
|
public ResponseStatus funApplySave(AppFunAuthApplyDTO authApplyDTO) {
|
|
@@ -146,11 +159,22 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
String applicantOrdNo = status.getResult().toString();
|
|
|
workFlow.setApplicantOrdNo(applicantOrdNo);
|
|
|
workFlowService.update(workFlow);
|
|
|
+
|
|
|
+ sendRedListCheckEvent(authApplyDTO.getResourceInfos());
|
|
|
}
|
|
|
return status;
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void sendRedListCheckEvent(List<AppFunAuthResourceDTO> resourceInfos) {
|
|
|
+ String userId = UserContextUtils.getCurrentUser().getId();
|
|
|
+ RedListCheckEventDto eventDto = new RedListCheckEventDto();
|
|
|
+ eventDto.setApplyUserId(userId);
|
|
|
+ eventDto.setResourceInfos(resourceInfos);
|
|
|
+ RedListCheckEvent event = new RedListCheckEvent(this, eventDto);
|
|
|
+ publisher.publishEvent(event);
|
|
|
+ }
|
|
|
+
|
|
|
private List<AppFunAuthResourceDTO> fillResourceInfo(List<AppFunAuthResourceDTO> resourceInfos,
|
|
|
List<AppFunAuthResourceDTO> delResourceInfos,
|
|
|
AuthUserInfo userInfo) {
|
|
@@ -544,6 +568,39 @@ public class AuthApplyBusiness implements IAuthApplyBusiness {
|
|
|
return ResponseDTO.success(ResponseStatus.SUCCESS_CODE, dto);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean redListCheck(List<AppFunAuthResourceDTO> resourceInfos) {
|
|
|
+ String userId = UserContextUtils.getCurrentUser().getId();
|
|
|
+ List<String> funIds = resourceInfos.stream().map(AppFunAuthResourceDTO::getFunId).collect(Collectors.toList());
|
|
|
+ List<RedListContent> redList = redListService.getRedListContentByFunIds(funIds);
|
|
|
+ if (CollectionUtils.isEmpty(redList)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ WhiteList userWhite = whiteListService.getBySubId(SubObjTypeEnum.SUB_USER.getCode(), userId);
|
|
|
+ if (null == userWhite) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ String level = userWhite.getLevel();
|
|
|
+ List<RedListContent> collect = redList.stream().filter(e -> e.getLevel().compareTo(level) >= 1).collect(Collectors.toList());
|
|
|
+ return CollectionUtils.isNotEmpty(collect);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<RedListRiskLogVo> redListApplyLog(SearchDTO searchDTO) {
|
|
|
+ Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
+ Page<RedListRiskLog> page = redListRiskLogService.pageSearch(searchable);
|
|
|
+ if (page.isEmpty()) {
|
|
|
+ return new PageImpl<>(new ArrayList<>(), searchable.getPage(),0L);
|
|
|
+ }
|
|
|
+ List<RedListRiskLog> content = page.getContent();
|
|
|
+ List<RedListRiskLogVo> collect = content.stream().map(e -> {
|
|
|
+ RedListRiskLogVo logVo = new RedListRiskLogVo();
|
|
|
+ BeanUtils.copyProperties(e, logVo);
|
|
|
+ return logVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return new PageImpl<>(collect, page.getPageable(), page.getTotalElements());
|
|
|
+ }
|
|
|
+
|
|
|
private String getApprovalUrl(String applyOrdNo, String approvalApi) {
|
|
|
String url = authConfig.getApprovalCenterUrl();
|
|
|
approvalApi = approvalApi.replace("{approveNo}", applyOrdNo);
|