Parcourir la source

Merge branch 'huangzqa-new-version-20210404' into 'develop'

Huangzqa new version 20210404

See merge request dcuc-tjdsj/auth-service!7
黄资权 il y a 4 ans
Parent
commit
59ce343aca

+ 27 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/dto/ServiceAuthResultDTO.java

@@ -2,7 +2,6 @@ package com.dragoninfo.dcuc.auth.auth.dto;
 
 import lombok.Data;
 
-import javax.persistence.Column;
 import java.io.Serializable;
 import java.util.Date;
 
@@ -72,4 +71,31 @@ public class ServiceAuthResultDTO implements Serializable {
      * 是否删除
      */
     private String deleted;
+
+    /**
+     * 申请人名字
+     */
+    private String applicantName;
+
+    /**
+     * 申请人身份证
+     */
+    private String applicantIdcard;
+
+    /**
+     * 申请人电话
+     */
+    private String applicantPhoneNo;
+
+    /**
+     * 申请人机构名称
+     */
+    private String applicantOrgName;
+
+    /**
+     * 申请人机构Code
+     */
+    private String applicantOrgCode;
+
+
 }

+ 6 - 1
dcuc-auth-model/src/main/java/com/dragoninfo/dcuc/auth/auth/po/ServiceAuthResultPO.java

@@ -46,7 +46,7 @@ public class ServiceAuthResultPO {
     private String serviceId;
 
     /**
-     * 服务停用
+     * 服务停用
      */
     private String serviceStatus;
 
@@ -64,4 +64,9 @@ public class ServiceAuthResultPO {
      * 是否删除
      */
     private String deleted;
+
+    /**
+     * 流程id
+     */
+    private String flowId;
 }

+ 10 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/IAuthFlowService.java

@@ -6,6 +6,8 @@ import com.dragoninfo.dcuc.auth.auth.entity.ServiceAuthFlow;
 import com.dragonsoft.duceap.core.search.Searchable;
 import org.springframework.data.domain.Page;
 
+import java.util.List;
+
 /**
  * 审批工单service
  * @author mazq
@@ -47,4 +49,12 @@ public interface IAuthFlowService {
      * @return
      */
     ServiceAuthFlow getByFlowId(String flowId);
+
+    /**
+     * 根据流程id集合获取授权申请单
+     *
+     * @param flowIds
+     * @return
+     */
+    List<ServiceAuthFlow> getByFlowIds(List<String> flowIds);
 }

+ 9 - 0
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/AuthFlowServiceImpl.java

@@ -100,4 +100,13 @@ public class AuthFlowServiceImpl implements IAuthFlowService {
         return flows.get(0);
     }
 
+    @Override
+    public List<ServiceAuthFlow> getByFlowIds(List<String> flowIds) {
+        Searchable searchable = Searchable.newSearchable();
+        searchable.addSearchFilter("flow_id", SearchOperator.in, flowIds.toArray());
+        searchable.addSearchFilter("deleted", SearchOperator.eq, BooleanEnum.FALSE.getValue());
+        logger.info("Select FlowId searchDTO {} ", JsonUtils.toJSONString(searchable.toSearchDTO()));
+        return serviceAuthFlowBPO.find(ServiceAuthFlow.class, searchable);
+    }
+
 }

+ 40 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/ServiceAuthResultServiceImpl.java

@@ -16,9 +16,11 @@ import com.dragoninfo.dcuc.auth.auth.enumresources.WokrFlowPermissionTypeEnum;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowStatusEnum;
 import com.dragoninfo.dcuc.auth.auth.enumresources.WorkFlowTypeEnum;
 import com.dragoninfo.dcuc.auth.auth.po.ServiceAuthResultPO;
+import com.dragoninfo.dcuc.auth.auth.service.IAuthFlowService;
 import com.dragoninfo.dcuc.auth.auth.service.IServiceAuthResultService;
 import com.dragoninfo.dcuc.auth.auth.vo.ServiceAuthenticationResVO;
 import com.dragoninfo.dcuc.auth.util.DcucConstantsUtil;
+import com.dragoninfo.dcuc.user.user.facade.IUserInfoFacade;
 import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
 import com.dragonsoft.duceap.base.enums.BooleanEnum;
 import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
@@ -68,6 +70,12 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
     @Autowired
     private IServiceResourceFacade serviceResourceFacade;
 
+    @Autowired
+    private IAuthFlowService authFlowService;
+
+    @Autowired
+    private IUserInfoFacade userInfoFacade;
+
     @Override
     public ServiceAuthResult saveAuthResult(ServiceAuthResult serviceAuthResult) {
         serviceAuthResult.setCreateTime(new Date());
@@ -169,7 +177,7 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
             //新增授权
             for (String serviceCode : map.keySet()) {
                 //已经存在的更新
-                if (allAuthResultMap.keySet().contains(serviceCode)) {
+                if (allAuthResultMap.containsKey(serviceCode)) {
                     ServiceAuthResult serviceAuthResult = allAuthResultMap.get(serviceCode);
                     serviceAuthResult.setStartTime(startTime);
                     serviceAuthResult.setEndTime(endTime);
@@ -362,11 +370,42 @@ public class ServiceAuthResultServiceImpl implements IServiceAuthResultService {
             dto.setAuthStatus(item.getServiceStatus());
             dtos.add(dto);
         });
+        //补全查询申请人电话和申请人单位
+        constructApplicantInfo(dtos);
         Pageable newPageable = new PageRequest(paging.getNumber(), paging.getSize());
         PageImpl<ServiceAuthResultDTO> pageResult = new PageImpl<>(dtos, newPageable, paging.getTotalElements());
         return pageResult;
     }
 
+    /**
+     * 补全查询申请人电话和申请人单位
+     */
+    private void constructApplicantInfo(List<ServiceAuthResultDTO> dtos) {
+        List<String> flowIds = dtos.stream().filter(item -> StringUtils.isNotBlank(item.getFlowId()))
+                .map(item -> item.getFlowId())
+                .collect(Collectors.toList());
+        if (CollectionUtils.isEmpty(flowIds)) {
+            return;
+        }
+        List<ServiceAuthFlow> authFlows = authFlowService.getByFlowIds(flowIds);
+        Map<String, ServiceAuthFlow> authFlowMap = authFlows.stream()
+                .collect(Collectors.toMap(item -> item.getFlowId(), item -> item, (oldKey, newKey) -> newKey));
+        dtos.stream()
+                .filter(item -> StringUtils.isNotBlank(item.getFlowId()))
+                .forEach(item -> {
+                    String flowId = item.getFlowId();
+                    ServiceAuthFlow serviceAuthFlow = authFlowMap.get(flowId);
+                    if (serviceAuthFlow == null) {
+                        return;
+                    }
+                    item.setApplicantIdcard(serviceAuthFlow.getApplicantIdcard());
+                    item.setApplicantName(serviceAuthFlow.getApplicantName());
+                    item.setApplicantOrgName(serviceAuthFlow.getApplicantOrgName());
+                    item.setApplicantPhoneNo(serviceAuthFlow.getApplicantPhoneNo());
+                    item.setApplicantOrgCode(serviceAuthFlow.getApplicantOrgCode());
+                });
+    }
+
     @Override
     public ServiceAuthResultDTO getDetail(String id) {
         ServiceAuthResult result = serviceAuthResultBPO.get(id);

+ 7 - 6
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/auth/service/impl/StaffAssignAuthInfoService.java

@@ -908,13 +908,14 @@ public class StaffAssignAuthInfoService extends BaseService<StaffAssignAuthInfo,
             if (applyInfo == null) {
 
                 applyInfo = applyInfoFacade.applyDetail(appId);
-                String appOrg = applyInfo.getOrgId();
+                // String appOrg = applyInfo.getOrgId();
+                appMap.put(appId, applyInfo);
                 //应用所属机构本级或者下级人员才能赋予相应角色
-                if (appOrg.equalsIgnoreCase(userInfo.getOrgId()) || userOrgPath.indexOf(appOrg) != -1) {
-                    appMap.put(appId, applyInfo);
-                } else {
-                    return ResponseStatus.fail("人员【" + userInfo.getName() + "】所在的机构不是应用所在机构的本级或下级");
-                }
+//                if (appOrg.equalsIgnoreCase(userInfo.getOrgId()) || userOrgPath.indexOf(appOrg) != -1) {
+//                    appMap.put(appId, applyInfo);
+//                } else {
+//                    return ResponseStatus.fail("人员【" + userInfo.getName() + "】所在的机构不是应用所在机构的本级或下级");
+//                }
             }
             String applyInfoOrgId = applyInfo.getOrgId();
             if (!isEnoughQuota(appId, applyInfoOrgId, roleId, userInfo.getOrgId(), 1, true)) {