Selaa lähdekoodia

Merge branch 'mazq-feature-231011-roleauthsearch' into 'master'

Mazq feature 231011 roleauthsearch

See merge request dcuc-tjdsj/auth-service!246
黄资权 1 vuosi sitten
vanhempi
sitoutus
f614fabfb2

+ 26 - 0
dcuc-auth-service/pom.xml

@@ -294,6 +294,32 @@
                             <target>8</target>
                         </configuration>
                     </plugin>
+                    <!--生成git-infos.properties 版本文件-->
+                    <plugin>
+                        <groupId>pl.project13.maven</groupId>
+                        <artifactId>git-commit-id-plugin</artifactId>
+                        <version>4.9.10</version>
+                        <executions>
+                            <execution>
+                                <id>get-the-git-infos</id>
+                                <goals>
+                                    <goal>revision</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <abbrevLength>8</abbrevLength>
+                            <dateFormat>yyyy-MM-dd HH:mm:ss</dateFormat>
+                            <generateGitPropertiesFile>true</generateGitPropertiesFile>
+                            <includeOnlyProperties>
+                                <includeOnlyProperty>^git.branch</includeOnlyProperty>
+                                <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
+                                <includeOnlyProperty>^git.commit.(id|id.abbrev|message.full)*</includeOnlyProperty>
+                            </includeOnlyProperties>
+                            <generateGitPropertiesFilename>${project.build.outputDirectory}/git-infos.properties
+                            </generateGitPropertiesFilename>
+                        </configuration>
+                    </plugin>
                 </plugins>
             </build>
         </profile>

+ 1 - 4
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/business/impl/zerotrust/AuthTokenBusinessImpl.java

@@ -5,7 +5,6 @@ import com.dragoninfo.dcuc.app.entity.ApplyInfo;
 import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
 import com.dragoninfo.dcuc.auth.api.enums.zerotrust.ZeroTrustBusinessRespEnum;
 import com.dragoninfo.dcuc.auth.api.vo.zerotrust.ZeroTrustMessageRespVO;
-import com.dragoninfo.dcuc.auth.audit.dto.TokenOperationDto;
 import com.dragoninfo.dcuc.auth.audit.service.log.QmAuditPushService;
 import com.dragoninfo.dcuc.auth.business.ICacheBusiness;
 import com.dragoninfo.dcuc.auth.business.zerotrust.IAuthTokenBusiness;
@@ -15,8 +14,8 @@ import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
 import com.dragoninfo.dcuc.auth.sub.vo.ApplyInfoVo;
 import com.dragoninfo.dcuc.auth.sub.vo.AuthUserVo;
 import com.dragoninfo.dcuc.auth.token.enums.TokenActionEnum;
+import com.dragoninfo.dcuc.auth.token.enums.TokenTypeEnum;
 import com.dragoninfo.dcuc.auth.token.vo.*;
-import com.dragonsoft.auditlog.collection.qmtj.enums.TokenTypeEnum;
 import com.dragonsoft.duceap.commons.util.string.StringUtils;
 import com.dragonsoft.smtools.loader.SMFactory;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -28,8 +27,6 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 
 /**

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 235 - 225
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/business/impl/SubSyncBusinessImpl.java


+ 2 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/repo/AuthUserInfoRepository.java

@@ -111,6 +111,7 @@ public interface AuthUserInfoRepository extends BaseRepository<AuthUserInfo, Str
      */
     @Modifying
     @NativeQuery("update t_auth_user_info u inner join t_auth_org_info o on u.org_code = o.code " +
-            "set u.org_id = o.id where u.deleted='0' and u.org_id is null and u.org_code is not null")
+            "set u.org_id = o.id where u.deleted='0' and o.deleted = '0'" +
+            " and u.org_id is null and u.org_code is not null")
     void updateOrgInfoInUser();
 }

+ 1 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/repo/AuthUserOrgRelRepository.java

@@ -34,7 +34,7 @@ public interface AuthUserOrgRelRepository extends BaseRepository<AuthUserOrgRel,
      */
     @Modifying
     @NativeQuery("update t_auth_user_org_rel r inner join t_auth_org_info o on r.org_code = o.code " +
-            "set r.org_id = o.id where r.org_code is not null and r.org_id is null")
+            "set r.org_id = o.id where r.deleted = '0' and o.deleted = '0' and r.org_code is not null and r.org_id is null")
     void updateOrgInfoInUser();
 
     /**

+ 3 - 1
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/service/IAuthOrgTreeService.java

@@ -67,8 +67,10 @@ public interface IAuthOrgTreeService {
 
     /**
      * 部分更新树节点
+     *
      * @param updateOrgCodes
+     * @param delOrgInfos
      * @param async
      */
-    void updateTreeByCode(List<String> updateOrgCodes, boolean async);
+    void updateTreeByCode(List<String> updateOrgCodes, List<AuthOrgInfo> delOrgInfos, boolean async);
 }

+ 4 - 2
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/service/impl/AuthOrgInfoService.java

@@ -114,8 +114,10 @@ public class AuthOrgInfoService implements IAuthOrgInfoService {
             String code = e.getCode();
             AuthOrgInfo exist = existMap.get(code);
             //删除机构信息
-            if(BooleanEnum.TRUE.value.equals(e.getDeleted())) {
-                orgInfoRepository.deleteByCode(code);
+            if(BooleanEnum.TRUE.value.equals(e.getDeleted()) && exist != null) {
+                orgInfoRepository.deleteById(exist.getId());
+                exist.setDeleted(BooleanEnum.TRUE.value);
+                list.add(exist);
                 continue ;
             }
             //新增或修改机构

+ 17 - 10
dcuc-auth-service/src/main/java/com/dragoninfo/dcuc/auth/sub/service/impl/AuthOrgTreeServiceImpl.java

@@ -85,8 +85,8 @@ public class AuthOrgTreeServiceImpl implements IAuthOrgTreeService {
     }
 
     @Override
-    public void updateTreeByCode(List<String> updateOrgCodes, boolean async) {
-        Runnable runnable = () -> updateTask(updateOrgCodes);
+    public void updateTreeByCode(List<String> updateOrgCodes, List<AuthOrgInfo> delOrgInfos, boolean async) {
+        Runnable runnable = () -> updateTask(updateOrgCodes, delOrgInfos);
         if (async) {
             Thread thread = new Thread(runnable);
             thread.start();
@@ -94,14 +94,20 @@ public class AuthOrgTreeServiceImpl implements IAuthOrgTreeService {
             runnable.run();
         }
     }
-
-    private void updateTask(List<String> updateOrgCodes) {
-        List<AuthOrgInfo> updateOrgInfos = authOrgInfoService.getOrgByCodes(updateOrgCodes);
-        Set<String> existOrgCodes = updateOrgInfos.stream().map(AuthOrgInfo::getCode).collect(Collectors.toSet());
+    private void updateTask(List<String> updateOrgCodes, List<AuthOrgInfo> delOrgInfos) {
+        // 被删除的上机构(如果上级机构没有一起被删除的话)也需要加入更新的机构集合中
+        ArrayList<String> cpUpdateOrgCodes = new ArrayList<>(updateOrgCodes);
+        // 被删除的上机构(如果上级机构没有一起被删除的话)也需要加入更新的机构集合中
+        List<String> delUpOrgCodes = delOrgInfos.stream()
+                .map(AuthOrgInfo::getUpGovCode)
+                .distinct()
+                .collect(Collectors.toList());
+        cpUpdateOrgCodes.addAll(delUpOrgCodes);
+        List<AuthOrgInfo> updateOrgInfos = authOrgInfoService.getOrgByCodes(cpUpdateOrgCodes);
         //构建需要更新的树节点
         List<OrgTreeNodeDTO> treeNods = getTreeNods(updateOrgInfos);
 
-        List<AuthOrgInfo> childInfos = authOrgInfoService.getChildByCodes(updateOrgCodes);
+        List<AuthOrgInfo> childInfos = authOrgInfoService.getChildByCodes(cpUpdateOrgCodes);
         Map<String, List<AuthOrgInfo>> childIdGroup = childInfos
                 .stream()
                 .collect(Collectors.groupingBy(AuthOrgInfo::getUpGovId));
@@ -121,10 +127,10 @@ public class AuthOrgTreeServiceImpl implements IAuthOrgTreeService {
             }
         });
         //过滤删除的机构
-        List<String> delCodes = updateOrgCodes.stream()
-                .filter(e -> !existOrgCodes.contains(e))
+        List<String> delOrgCodes = delOrgInfos.stream()
+                .map(AuthOrgInfo::getCode)
                 .collect(Collectors.toList());
-        holder.updateTreeNodes(treeNods, delCodes);
+        holder.updateTreeNodes(treeNods, delOrgCodes);
     }
 
     /**
@@ -375,6 +381,7 @@ public class AuthOrgTreeServiceImpl implements IAuthOrgTreeService {
                 List<OrgTreeNodeDTO> selfNodes = orgIds.stream().map(treeNodeMap::get).collect(Collectors.toList());
                 List<OrgTreeNodeDTO> collect = selfNodes
                         .stream()
+                        .filter(Objects::nonNull)
                         .map(OrgTreeNodeDTO::getChildIds)
                         .flatMap(List::stream)
                         .distinct()

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä