|  | @@ -25,15 +25,12 @@ import com.xunmei.system.api.domain.SysOrg;
 | 
											
												
													
														|  |  import com.xunmei.system.api.domain.SysUser;
 |  |  import com.xunmei.system.api.domain.SysUser;
 | 
											
												
													
														|  |  import io.netty.util.internal.StringUtil;
 |  |  import io.netty.util.internal.StringUtil;
 | 
											
												
													
														|  |  import lombok.extern.slf4j.Slf4j;
 |  |  import lombok.extern.slf4j.Slf4j;
 | 
											
												
													
														|  | 
 |  | +import org.apache.commons.collections4.CollectionUtils;
 | 
											
												
													
														|  |  import org.springframework.beans.factory.annotation.Autowired;
 |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import org.springframework.transaction.annotation.Transactional;
 |  |  import org.springframework.transaction.annotation.Transactional;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -import javax.annotation.Resource;
 |  | 
 | 
											
												
													
														|  | -import java.util.ArrayList;
 |  | 
 | 
											
												
													
														|  | -import java.util.Date;
 |  | 
 | 
											
												
													
														|  | -import java.util.List;
 |  | 
 | 
											
												
													
														|  | -import java.util.Optional;
 |  | 
 | 
											
												
													
														|  | 
 |  | +import java.util.*;
 | 
											
												
													
														|  |  import java.util.stream.Collectors;
 |  |  import java.util.stream.Collectors;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  /**
 |  |  /**
 | 
											
										
											
												
													
														|  | @@ -79,7 +76,6 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |              return "未获取到用户信息数据";
 |  |              return "未获取到用户信息数据";
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  |          // 将同步到的用户数据线保存下来
 |  |          // 将同步到的用户数据线保存下来
 | 
											
												
													
														|  |          List<FjnxUser> fjnxUserList = FjnxXmlUsersDtoConvertToFjnxUsers(fjnxXmlUserDto.getUserVos());
 |  |          List<FjnxUser> fjnxUserList = FjnxXmlUsersDtoConvertToFjnxUsers(fjnxXmlUserDto.getUserVos());
 | 
											
												
													
														|  |          ifjnxUserService.saveOrUpdateBatch(fjnxUserList);
 |  |          ifjnxUserService.saveOrUpdateBatch(fjnxUserList);
 | 
											
										
											
												
													
														|  | @@ -100,22 +96,30 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          List<SysOrg> existOrgList = existAllOrgResult.getData();
 |  |          List<SysOrg> existOrgList = existAllOrgResult.getData();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        // 获取到机构同步时 保留的同步机构原始数据
 | 
											
												
													
														|  |          List<FjnxOrg> existFjnxOrgList = ifjnxOrgService.list();
 |  |          List<FjnxOrg> existFjnxOrgList = ifjnxOrgService.list();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        //将FJNXUser 转换为SysUser 并保存
 |  | 
 | 
											
												
													
														|  | 
 |  | +        //获取配置表中配置的 数据拿到办事处和地区行社的机构编码 以及映射关系
 | 
											
												
													
														|  | 
 |  | +        List<FjnxOrgBusinessRelation> specialOrgList = fjnxOrgBusinessRelationMapper.selectList(Wrappers.emptyWrapper());
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        //系统中不存在同步用户时 将FJNXUser 转换为SysUser 并保存
 | 
											
												
													
														|  |          if (ObjectUtil.isEmpty(existUserList)) {
 |  |          if (ObjectUtil.isEmpty(existUserList)) {
 | 
											
												
													
														|  | -            final R<Boolean> booleanR = remoteUserService.batchSaveSyncUser(FjnxUsersConvertToUsers(fjnxXmlUserDto.getUserVos(), existOrgList, existFjnxOrgList), SecurityConstants.INNER);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            final R<Boolean> booleanR = remoteUserService.batchSaveSyncUser(FjnxUsersConvertToUsers(fjnxXmlUserDto.getUserVos(), existOrgList, existFjnxOrgList,specialOrgList), SecurityConstants.INNER);
 | 
											
												
													
														|  |              if (booleanR != null && booleanR.getCode() != 200) {
 |  |              if (booleanR != null && booleanR.getCode() != 200) {
 | 
											
												
													
														|  |                  log.error("调用远程服务接口remoteUserService.batchSaveSyncOrg 失败:{}", booleanR.getMsg());
 |  |                  log.error("调用远程服务接口remoteUserService.batchSaveSyncOrg 失败:{}", booleanR.getMsg());
 | 
											
												
													
														|  |                  return "remoteUserService.batchSaveSyncUser 调用失败:" + booleanR.getMsg();
 |  |                  return "remoteUserService.batchSaveSyncUser 调用失败:" + booleanR.getMsg();
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              return null;
 |  |              return null;
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        // 系统中存在已同步的用户时
 | 
											
												
													
														|  |          List<SysUser> addList = new ArrayList<>();
 |  |          List<SysUser> addList = new ArrayList<>();
 | 
											
												
													
														|  |          List<SysUser> updateList = new ArrayList<>();
 |  |          List<SysUser> updateList = new ArrayList<>();
 | 
											
												
													
														|  |          List<SysUser> deleteList = new ArrayList<>();
 |  |          List<SysUser> deleteList = new ArrayList<>();
 | 
											
												
													
														|  |          List<String> fjnxUserCodeList = new ArrayList<>();
 |  |          List<String> fjnxUserCodeList = new ArrayList<>();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          fjnxXmlUserDto.getUserVos().forEach(fjnxUser -> {
 |  |          fjnxXmlUserDto.getUserVos().forEach(fjnxUser -> {
 | 
											
												
													
														|  |              String orgCode = fjnxUser.getDepCode();
 |  |              String orgCode = fjnxUser.getDepCode();
 | 
											
												
													
														|  |              if (!StringUtil.isNullOrEmpty(orgCode) && !StringUtil.isNullOrEmpty(fjnxUser.getUserId())) {
 |  |              if (!StringUtil.isNullOrEmpty(orgCode) && !StringUtil.isNullOrEmpty(fjnxUser.getUserId())) {
 | 
											
										
											
												
													
														|  | @@ -123,13 +127,9 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |                  Optional<SysOrg> optionalOrg = existOrgList.stream().filter(x -> orgCode.equals(x.getCode())).findFirst();
 |  |                  Optional<SysOrg> optionalOrg = existOrgList.stream().filter(x -> orgCode.equals(x.getCode())).findFirst();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -                SysOrg userBusinessSysOrg = getUserBusinessFjnxOrg(existFjnxOrgList, existOrgList, fjnxUser);
 |  | 
 | 
											
												
													
														|  | -                if (optionalOrg.isPresent() && ObjectUtil.isNotEmpty(userBusinessSysOrg)) {
 |  | 
 | 
											
												
													
														|  | -//                    final Optional<SysOrg> businessSysOrgOptional = existOrgList.stream().filter(x -> userBusinessFjnxOrg.getOrgCode().equals(x.getCode())).findFirst();
 |  | 
 | 
											
												
													
														|  | -//                    if(!businessSysOrgOptional.isPresent())
 |  | 
 | 
											
												
													
														|  | -//                    {
 |  | 
 | 
											
												
													
														|  | -//                        return;
 |  | 
 | 
											
												
													
														|  | -//                    }
 |  | 
 | 
											
												
													
														|  | 
 |  | +                // 获取用户的业务机构信息
 | 
											
												
													
														|  | 
 |  | +                SysOrg userBusinessSysOrg = getUserBusinessFjnxOrg(existFjnxOrgList, existOrgList, fjnxUser,specialOrgList);
 | 
											
												
													
														|  | 
 |  | +                if (optionalOrg.isPresent()) {
 | 
											
												
													
														|  |                      Optional<SysUser> optionalUser = existUserList.stream().filter(x -> fjnxUser.getUserId().equals(x.getCode())).findFirst();
 |  |                      Optional<SysUser> optionalUser = existUserList.stream().filter(x -> fjnxUser.getUserId().equals(x.getCode())).findFirst();
 | 
											
												
													
														|  |                      if (optionalUser.isPresent()) {
 |  |                      if (optionalUser.isPresent()) {
 | 
											
												
													
														|  |                          updateList.add(FjnxUserConvertToUser(fjnxUser, optionalUser.get(), optionalOrg.get(), userBusinessSysOrg));
 |  |                          updateList.add(FjnxUserConvertToUser(fjnxUser, optionalUser.get(), optionalOrg.get(), userBusinessSysOrg));
 | 
											
										
											
												
													
														|  | @@ -140,9 +140,12 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |                      log.error("同步人员【{}】所属机构编码【{}】在当前数据库中未找到,{}", fjnxUser.getUserId() + fjnxUser.getUserName(), fjnxUser.getDepCode(), fjnxUser);
 |  |                      log.error("同步人员【{}】所属机构编码【{}】在当前数据库中未找到,{}", fjnxUser.getUserId() + fjnxUser.getUserName(), fjnxUser.getDepCode(), fjnxUser);
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  | 
 |  | +            else{
 | 
											
												
													
														|  | 
 |  | +                log.error("同步人员【{}】没有机构编码或者用户id,机构编码【{}】,用户id【{}】,{}", fjnxUser.getUserName(), fjnxUser.getDepCode(),fjnxUser.getUserId(), fjnxUser);
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |          });
 |  |          });
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        // 人员在本系统中存在 但是在统一运营门户中不存在
 |  | 
 | 
											
												
													
														|  | 
 |  | +        // 已同步的人员在本系统中存在 但是在统一运营门户中不存在,标记为删除
 | 
											
												
													
														|  |          deleteList = existUserList.stream().filter(entity -> !fjnxUserCodeList.contains(entity.getCode()) && entity.getSource() == 1).collect(Collectors.toList());
 |  |          deleteList = existUserList.stream().filter(entity -> !fjnxUserCodeList.contains(entity.getCode()) && entity.getSource() == 1).collect(Collectors.toList());
 | 
											
												
													
														|  |          deleteList.forEach(x -> x.setDeleted(1));
 |  |          deleteList.forEach(x -> x.setDeleted(1));
 | 
											
												
													
														|  |          existUserList.addAll(addList);
 |  |          existUserList.addAll(addList);
 | 
											
										
											
												
													
														|  | @@ -170,7 +173,7 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |              return "未获取到机构信息数据";
 |  |              return "未获取到机构信息数据";
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        List<FjnxOrg> fjnxOrgList = ConvertXmlOrgDtoToOrgJinx(fjnxXmlOrgDto.getOrgVos());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        List<FjnxOrg> fjnxOrgList = ConvertXmlOrgDtoToOrgFjnx(fjnxXmlOrgDto.getOrgVos());
 | 
											
												
													
														|  |          ifjnxOrgService.saveOrUpdateBatch(fjnxOrgList);
 |  |          ifjnxOrgService.saveOrUpdateBatch(fjnxOrgList);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          R<List<SysOrg>> existAllOrgResult = remoteOrgService.getAllOrg(SecurityConstants.INNER);
 |  |          R<List<SysOrg>> existAllOrgResult = remoteOrgService.getAllOrg(SecurityConstants.INNER);
 | 
											
										
											
												
													
														|  | @@ -606,12 +609,15 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |          org.setShortName(getOrgShortName(fjnxOrgDto));
 |  |          org.setShortName(getOrgShortName(fjnxOrgDto));
 | 
											
												
													
														|  |          org.setCode(fjnxOrgDto.getOrgCode());
 |  |          org.setCode(fjnxOrgDto.getOrgCode());
 | 
											
												
													
														|  |          org.setGuid(fjnxOrgDto.getOrgCode());
 |  |          org.setGuid(fjnxOrgDto.getOrgCode());
 | 
											
												
													
														|  | 
 |  | +        if(fjnxOrgDto.getShortName().endsWith("办事处"))
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +            String a="";
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |          org.setParentGuid(fjnxOrgDto.getBusinessParentCode());
 |  |          org.setParentGuid(fjnxOrgDto.getBusinessParentCode());
 | 
											
												
													
														|  |          org.setTreeParentCode(fjnxOrgDto.getTreeShowParentCode());
 |  |          org.setTreeParentCode(fjnxOrgDto.getTreeShowParentCode());
 | 
											
												
													
														|  |          org.setPhone(fjnxOrgDto.getOrgPhone());
 |  |          org.setPhone(fjnxOrgDto.getOrgPhone());
 | 
											
												
													
														|  |          org.setAddress(fjnxOrgDto.getOrgAddress());
 |  |          org.setAddress(fjnxOrgDto.getOrgAddress());
 | 
											
												
													
														|  | -        //我们系统自己可以调整顺序, 不覆盖sort的值
 |  | 
 | 
											
												
													
														|  | -//        org.setSort(ConvertOrgOrderValue(fjnxOrgDto.getOrgOrder()));
 |  | 
 | 
											
												
													
														|  | 
 |  | +        org.setSort(ConvertOrgOrderValue(fjnxOrgDto.getOrgOrder()));
 | 
											
												
													
														|  |          org.setUpdateTime(fjnxOrgDto.getUpdateTime());
 |  |          org.setUpdateTime(fjnxOrgDto.getUpdateTime());
 | 
											
												
													
														|  |          org.setRemark(fjnxOrgDto.getRemark());
 |  |          org.setRemark(fjnxOrgDto.getRemark());
 | 
											
												
													
														|  |          //org.setLevel(fjnxOrgDto.getOrgPath().split("/").length);
 |  |          //org.setLevel(fjnxOrgDto.getOrgPath().split("/").length);
 | 
											
										
											
												
													
														|  | @@ -686,11 +692,14 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |          org.setCode(fjnxOrg.getOrgCode());
 |  |          org.setCode(fjnxOrg.getOrgCode());
 | 
											
												
													
														|  |          org.setGuid(fjnxOrg.getOrgCode());
 |  |          org.setGuid(fjnxOrg.getOrgCode());
 | 
											
												
													
														|  |          org.setParentGuid(fjnxOrg.getBusinessParentCode());
 |  |          org.setParentGuid(fjnxOrg.getBusinessParentCode());
 | 
											
												
													
														|  | 
 |  | +        if(fjnxOrg.getShortName().equals("泉州办事处"))
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +            String a="";
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |          org.setTreeParentCode(fjnxOrg.getTreeShowParentCode());
 |  |          org.setTreeParentCode(fjnxOrg.getTreeShowParentCode());
 | 
											
												
													
														|  |          org.setPhone(fjnxOrg.getOrgPhone());
 |  |          org.setPhone(fjnxOrg.getOrgPhone());
 | 
											
												
													
														|  |          org.setAddress(fjnxOrg.getOrgAddress());
 |  |          org.setAddress(fjnxOrg.getOrgAddress());
 | 
											
												
													
														|  | -        //我们系统自己可以调整顺序, 不覆盖sort的值
 |  | 
 | 
											
												
													
														|  | -//        org.setSort(ConvertOrgOrderValue(fjnxOrg.getOrgOrder()));
 |  | 
 | 
											
												
													
														|  | 
 |  | +        org.setSort(ConvertOrgOrderValue(fjnxOrg.getOrgOrder()));
 | 
											
												
													
														|  |          org.setUpdateTime(fjnxOrg.getUpdateTime());
 |  |          org.setUpdateTime(fjnxOrg.getUpdateTime());
 | 
											
												
													
														|  |          org.setRemark(fjnxOrg.getRemark());
 |  |          org.setRemark(fjnxOrg.getRemark());
 | 
											
												
													
														|  |  //        org.setLevel(fjnxOrg.getOrgPath().split("/").length);
 |  |  //        org.setLevel(fjnxOrg.getOrgPath().split("/").length);
 | 
											
										
											
												
													
														|  | @@ -746,16 +755,24 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    private List<SysUser> FjnxUsersConvertToUsers(List<FJNXUserDto> fjnxUserDtoList, List<SysOrg> orgList, List<FjnxOrg> fjnxOrgList) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     *
 | 
											
												
													
														|  | 
 |  | +     * @param fjnxUserDtoList 同步获取到的用户信息
 | 
											
												
													
														|  | 
 |  | +     * @param orgList 系统中的机构信息
 | 
											
												
													
														|  | 
 |  | +     * @param fjnxOrgList 福建nx的机构信息
 | 
											
												
													
														|  | 
 |  | +     * @param specialOrgList 配置表中配置的 特殊机构信息,地区行社、办事处、以及他们的对应关系
 | 
											
												
													
														|  | 
 |  | +     * @return
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    private List<SysUser> FjnxUsersConvertToUsers(List<FJNXUserDto> fjnxUserDtoList, List<SysOrg> orgList, List<FjnxOrg> fjnxOrgList,List<FjnxOrgBusinessRelation> specialOrgList) {
 | 
											
												
													
														|  |          List<SysUser> result = new ArrayList<>();
 |  |          List<SysUser> result = new ArrayList<>();
 | 
											
												
													
														|  |          if (ObjectUtil.isNotEmpty(fjnxUserDtoList)) {
 |  |          if (ObjectUtil.isNotEmpty(fjnxUserDtoList)) {
 | 
											
												
													
														|  | -            fjnxUserDtoList.forEach(x -> {
 |  | 
 | 
											
												
													
														|  | -                SysOrg userBusinessSysOrg = getUserBusinessFjnxOrg(fjnxOrgList, orgList, x);
 |  | 
 | 
											
												
													
														|  | -                Optional<SysOrg> optionalOrg = orgList.stream().filter(org -> org.getCode().equals(x.getDepCode())).findFirst();
 |  | 
 | 
											
												
													
														|  | 
 |  | +            fjnxUserDtoList.forEach(fjnxUserDto -> {
 | 
											
												
													
														|  | 
 |  | +                SysOrg userBusinessSysOrg = getUserBusinessFjnxOrg(fjnxOrgList, orgList,fjnxUserDto, specialOrgList);
 | 
											
												
													
														|  | 
 |  | +                Optional<SysOrg> optionalOrg = orgList.stream().filter(org -> org.getCode().equals(fjnxUserDto.getDepCode())).findFirst();
 | 
											
												
													
														|  |                  if (optionalOrg.isPresent() && ObjectUtil.isNotEmpty(userBusinessSysOrg)) {
 |  |                  if (optionalOrg.isPresent() && ObjectUtil.isNotEmpty(userBusinessSysOrg)) {
 | 
											
												
													
														|  | -                    result.add(FjnxUserConvertToUser(x, null,optionalOrg.get(), userBusinessSysOrg));
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    result.add(FjnxUserConvertToUser(fjnxUserDto, null,optionalOrg.get(), userBusinessSysOrg));
 | 
											
												
													
														|  |                  } else {
 |  |                  } else {
 | 
											
												
													
														|  | -                    log.error("同步人员【{}】所属机构编码【{}】在当前数据库中未找到,{}", x.getUserId() + x.getUserName(), x.getDepCode(), x);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    log.error("同步人员【{}】所属机构编码【{}】在当前数据库中未找到,{}", fjnxUserDto.getUserId() + fjnxUserDto.getUserName(), fjnxUserDto.getDepCode(), fjnxUserDto);
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              });
 |  |              });
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
										
											
												
													
														|  | @@ -796,9 +813,16 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |          user.setJobNumber(fjnxUserDto.getTeller());
 |  |          user.setJobNumber(fjnxUserDto.getTeller());
 | 
											
												
													
														|  |          user.setApproveStatus(1L);
 |  |          user.setApproveStatus(1L);
 | 
											
												
													
														|  |          user.setUpdateTime(fjnxUserDto.getUpdateTime());
 |  |          user.setUpdateTime(fjnxUserDto.getUpdateTime());
 | 
											
												
													
														|  | -        user.setOrgId(businessOrg.getId());
 |  | 
 | 
											
												
													
														|  | -        user.setOrgName(businessOrg.getName());
 |  | 
 | 
											
												
													
														|  | -        user.setOrgPath(businessOrg.getPath());
 |  | 
 | 
											
												
													
														|  | 
 |  | +        if(ObjectUtil.isNotEmpty(businessOrg)){
 | 
											
												
													
														|  | 
 |  | +            user.setOrgId(businessOrg.getId());
 | 
											
												
													
														|  | 
 |  | +            user.setOrgName(businessOrg.getShortName());
 | 
											
												
													
														|  | 
 |  | +            user.setOrgPath(businessOrg.getPath());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        else {
 | 
											
												
													
														|  | 
 |  | +            user.setOrgId(org.getId());
 | 
											
												
													
														|  | 
 |  | +            user.setOrgName(org.getShortName());
 | 
											
												
													
														|  | 
 |  | +            user.setOrgPath(org.getPath());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |          //0 禁用 1 启用已改密码 2 启用未改密码
 |  |          //0 禁用 1 启用已改密码 2 启用未改密码
 | 
											
												
													
														|  |          user.setIsLock(fjnxUserDto.getUserStatus());
 |  |          user.setIsLock(fjnxUserDto.getUserStatus());
 | 
											
												
													
														|  |          user.setSource(1);
 |  |          user.setSource(1);
 | 
											
										
											
												
													
														|  | @@ -818,26 +842,163 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |       *
 |  |       *
 | 
											
												
													
														|  |       * @return
 |  |       * @return
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    private SysOrg getUserBusinessFjnxOrg(List<FjnxOrg> fjnxOrgList, List<SysOrg> existOrgList, FJNXUserDto fjnxUserDto) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private SysOrg getUserBusinessFjnxOrg(List<FjnxOrg> fjnxOrgList, List<SysOrg> existOrgList, FJNXUserDto fjnxUserDto,List<FjnxOrgBusinessRelation> specialOrgList) {
 | 
											
												
													
														|  |          final Optional<FjnxOrg> fjnxOrgOptional = fjnxOrgList.stream().filter(x -> x.getOrgCode().equals(fjnxUserDto.getDepCode())).findFirst();
 |  |          final Optional<FjnxOrg> fjnxOrgOptional = fjnxOrgList.stream().filter(x -> x.getOrgCode().equals(fjnxUserDto.getDepCode())).findFirst();
 | 
											
												
													
														|  |          if (fjnxOrgOptional.isPresent()) {
 |  |          if (fjnxOrgOptional.isPresent()) {
 | 
											
												
													
														|  | -            if ("0001".equals(fjnxOrgOptional.get().getOrgType())) {
 |  | 
 | 
											
												
													
														|  | -                final Optional<FjnxOrg> corporCodeOptional = fjnxOrgList.stream().filter(x -> x.getOrgCode().equals(fjnxUserDto.getCorporCode())).findFirst();
 |  | 
 | 
											
												
													
														|  | -                if (corporCodeOptional.isPresent()) {
 |  | 
 | 
											
												
													
														|  | -                    return getSysOrgByFjnxOrg(existOrgList, corporCodeOptional.get());
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            final Integer syncUserOrgLevel = getSyncUserOrgLevel(fjnxOrgOptional.get().getOrgPath(), specialOrgList);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            //省联社下级机关部门下的人,迁移到顶级机构下
 | 
											
												
													
														|  | 
 |  | +//            if(ObjectUtil.equal(syncUserOrgLevel,1))
 | 
											
												
													
														|  | 
 |  | +//            {
 | 
											
												
													
														|  | 
 |  | +//                final Optional<SysOrg> topOrg = existOrgList.stream().filter(x -> x.getParentId().equals(-1L)).findFirst();
 | 
											
												
													
														|  | 
 |  | +//                if(topOrg.isPresent())
 | 
											
												
													
														|  | 
 |  | +//                {
 | 
											
												
													
														|  | 
 |  | +//                    return topOrg.get();
 | 
											
												
													
														|  | 
 |  | +//                }
 | 
											
												
													
														|  | 
 |  | +//                return null;
 | 
											
												
													
														|  | 
 |  | +//            }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            //办事处机构下,人员迁移到地区行社下
 | 
											
												
													
														|  | 
 |  | +            if(ObjectUtil.equal(syncUserOrgLevel,2))
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +//                final String dqhsOrgCode = getUserOwnerBscOrgMapperDqhsOrgCode(fjnxOrgOptional.get().getOrgPath(), specialOrgList);
 | 
											
												
													
														|  | 
 |  | +                final String dqhsOrgCode = getUserOwnerBscOrgCode(fjnxOrgOptional.get().getOrgPath(), specialOrgList);
 | 
											
												
													
														|  | 
 |  | +                if(StringUtil.isNullOrEmpty(dqhsOrgCode))
 | 
											
												
													
														|  | 
 |  | +                {
 | 
											
												
													
														|  | 
 |  | +                    return getSysOrgByOrgCode(existOrgList,dqhsOrgCode);
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                return null;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            //地区行社处机构下,部门下的人迁移到法人机构下
 | 
											
												
													
														|  | 
 |  | +            if(ObjectUtil.equal(syncUserOrgLevel,3))
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                if ("0001".equals(fjnxOrgOptional.get().getOrgType())) {
 | 
											
												
													
														|  | 
 |  | +                    // 获取法人机构
 | 
											
												
													
														|  | 
 |  | +                    final Optional<FjnxOrg> corporCodeOptional = fjnxOrgList.stream().filter(x -> x.getOrgCode().equals(fjnxUserDto.getCorporCode())).findFirst();
 | 
											
												
													
														|  | 
 |  | +                    if (corporCodeOptional.isPresent()) {
 | 
											
												
													
														|  | 
 |  | +                        return getSysOrgByFjnxOrg(existOrgList, corporCodeOptional.get());
 | 
											
												
													
														|  | 
 |  | +                    } else {
 | 
											
												
													
														|  | 
 |  | +                        log.error("同步人员【{}】所属法人机构编码【{}】在当前sync_fjnx_org中未找到对应法人机构,{}", fjnxUserDto.getUserId() + fjnxUserDto.getUserName(), fjnxUserDto.getCorporCode(), fjnxUserDto);
 | 
											
												
													
														|  | 
 |  | +                    }
 | 
											
												
													
														|  |                  } else {
 |  |                  } else {
 | 
											
												
													
														|  | -                    log.error("同步人员【{}】所属法人机构编码【{}】在当前fjnx_org中未找到对应法人机构,{}", fjnxUserDto.getUserId() + fjnxUserDto.getUserName(), fjnxUserDto.getCorporCode(), fjnxUserDto);
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    return getSysOrgByFjnxOrg(existOrgList, fjnxOrgOptional.get());
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  | -            } else {
 |  | 
 | 
											
												
													
														|  | -                return getSysOrgByFjnxOrg(existOrgList, fjnxOrgOptional.get());
 |  | 
 | 
											
												
													
														|  | -//               return fjnxOrgOptional.get();
 |  | 
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
												
													
														|  | -            log.error("同步人员【{}】所属机构编码【{}】在当前fjnx_org中未找到对应机构,{}", fjnxUserDto.getUserId() + fjnxUserDto.getUserName(), fjnxUserDto.getDepCode(), fjnxUserDto);
 |  | 
 | 
											
												
													
														|  | 
 |  | +            log.error("同步人员【{}】所属机构编码【{}】在当前sync_fjnx_org中未找到对应机构,{}", fjnxUserDto.getUserId() + fjnxUserDto.getUserName(), fjnxUserDto.getDepCode(), fjnxUserDto);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        return null;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 获取法人机构
 | 
											
												
													
														|  | 
 |  | +     * @return
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +//    private SysOrg getcorporOrg(){
 | 
											
												
													
														|  | 
 |  | +//
 | 
											
												
													
														|  | 
 |  | +//    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 根据用户所属机构找到用户机构位置 1:省联社下级机关部门下 2:办事处机构下 3:地区行社机构下, null 代表没找到对应机构
 | 
											
												
													
														|  | 
 |  | +     * @return
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    private Integer getSyncUserOrgLevel(String userOrgPath,List<FjnxOrgBusinessRelation> specialOrgList)
 | 
											
												
													
														|  | 
 |  | +    {
 | 
											
												
													
														|  | 
 |  | +            final boolean userOrgLevelLowerOfBSC = isUserOrgLevelLowerOfBSC(userOrgPath, specialOrgList);
 | 
											
												
													
														|  | 
 |  | +            if(userOrgLevelLowerOfBSC){
 | 
											
												
													
														|  | 
 |  | +                return 2;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            final boolean userOrgLevelLowerOfDQHS = isUserOrgLevelLowerOfDQHS(userOrgPath, specialOrgList);
 | 
											
												
													
														|  | 
 |  | +            if(userOrgLevelLowerOfDQHS)
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                return 3;
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            return 1;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 用户所在机构层级是否低于办事处
 | 
											
												
													
														|  | 
 |  | +      * @param userOrgPath 用户所在机构path
 | 
											
												
													
														|  | 
 |  | +     * @param specialOrgList 同步配置表中配置的各类型数据, 类型为2的为办事处
 | 
											
												
													
														|  | 
 |  | +     * @return
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    private boolean isUserOrgLevelLowerOfBSC(String userOrgPath,List<FjnxOrgBusinessRelation> specialOrgList){
 | 
											
												
													
														|  | 
 |  | +        final List<String> bacOrgCodeList = specialOrgList.stream().filter(x -> x.getOrgType().equals(2)).map(FjnxOrgBusinessRelation::getOrgCode).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +        final List<String> orgCodeList = orgPathConvertToOrgCodeList(userOrgPath);
 | 
											
												
													
														|  | 
 |  | +        final int length = CollectionUtils.intersection(orgCodeList, bacOrgCodeList).toArray().length;
 | 
											
												
													
														|  | 
 |  | +        if(length>0)
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +            return true;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        return false;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 获取用户机构所在的办事处机构对应的地址行社编码
 | 
											
												
													
														|  | 
 |  | +     * @param userOrgPath
 | 
											
												
													
														|  | 
 |  | +     * @param specialOrgList
 | 
											
												
													
														|  | 
 |  | +     * @return
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    private String getUserOwnerBscOrgMapperDqhsOrgCode(String userOrgPath,List<FjnxOrgBusinessRelation> specialOrgList){
 | 
											
												
													
														|  | 
 |  | +        final List<String> bacOrgCodeList = specialOrgList.stream().filter(x -> x.getOrgType().equals(2)).map(FjnxOrgBusinessRelation::getOrgCode).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +        final List<String> orgCodeList = orgPathConvertToOrgCodeList(userOrgPath);
 | 
											
												
													
														|  | 
 |  | +        final Optional<Object> first = Arrays.stream(CollectionUtils.intersection(orgCodeList, bacOrgCodeList).toArray()).findFirst();
 | 
											
												
													
														|  | 
 |  | +        if(first.isPresent())
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +            final Optional<FjnxOrgBusinessRelation> basOrgMapperDqhsOrg = specialOrgList.stream().filter(x -> x.getOrgType().equals(2) && x.getOrgCode().equals(first.get().toString())).findFirst();
 | 
											
												
													
														|  | 
 |  | +            if(basOrgMapperDqhsOrg.isPresent())
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                return basOrgMapperDqhsOrg.get().getDqhsOrgCode();
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          return null;
 |  |          return null;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    private String getUserOwnerBscOrgCode(String userOrgPath,List<FjnxOrgBusinessRelation> specialOrgList){
 | 
											
												
													
														|  | 
 |  | +        final List<String> bacOrgCodeList = specialOrgList.stream().filter(x -> x.getOrgType().equals(2)).map(FjnxOrgBusinessRelation::getOrgCode).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +        final List<String> orgCodeList = orgPathConvertToOrgCodeList(userOrgPath);
 | 
											
												
													
														|  | 
 |  | +        final Optional<Object> first = Arrays.stream(CollectionUtils.intersection(orgCodeList, bacOrgCodeList).toArray()).findFirst();
 | 
											
												
													
														|  | 
 |  | +        if(first.isPresent())
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +          return first.get().toString();
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        return null;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 用户所在机构层级是否低于地区行社
 | 
											
												
													
														|  | 
 |  | +     * @param userOrgPath 用户所在机构path
 | 
											
												
													
														|  | 
 |  | +     * @param specialOrgList 同步配置表中配置的各类型数据, 类型为3的为地区行社
 | 
											
												
													
														|  | 
 |  | +     * @return
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    private boolean isUserOrgLevelLowerOfDQHS(String userOrgPath,List<FjnxOrgBusinessRelation> specialOrgList){
 | 
											
												
													
														|  | 
 |  | +        final List<String> dqhsOrgCodeList = specialOrgList.stream().filter(x -> x.getOrgType().equals(3)).map(FjnxOrgBusinessRelation::getOrgCode).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +        final List<String> orgCodeList = orgPathConvertToOrgCodeList(userOrgPath);
 | 
											
												
													
														|  | 
 |  | +        final int length = CollectionUtils.intersection(orgCodeList, dqhsOrgCodeList).toArray().length;
 | 
											
												
													
														|  | 
 |  | +        if(length>0)
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +            return true;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        return false;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private List<String> orgPathConvertToOrgCodeList(String userOrgPath){
 | 
											
												
													
														|  | 
 |  | +        if(StringUtil.isNullOrEmpty(userOrgPath))
 | 
											
												
													
														|  | 
 |  | +        {
 | 
											
												
													
														|  | 
 |  | +            return new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        return Arrays.asList( userOrgPath.split("/"));
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    // 根据FjnxOrg 对象查询到系统对应的机构对象
 | 
											
												
													
														|  |      private SysOrg getSysOrgByFjnxOrg(List<SysOrg> existOrgList, FjnxOrg fjnxOrg) {
 |  |      private SysOrg getSysOrgByFjnxOrg(List<SysOrg> existOrgList, FjnxOrg fjnxOrg) {
 | 
											
												
													
														|  |          final Optional<SysOrg> businessSysOrgOptional = existOrgList.stream().filter(x -> fjnxOrg.getOrgCode().equals(x.getCode())).findFirst();
 |  |          final Optional<SysOrg> businessSysOrgOptional = existOrgList.stream().filter(x -> fjnxOrg.getOrgCode().equals(x.getCode())).findFirst();
 | 
											
												
													
														|  |          if (businessSysOrgOptional.isPresent()) {
 |  |          if (businessSysOrgOptional.isPresent()) {
 | 
											
										
											
												
													
														|  | @@ -847,15 +1008,28 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |          return null;
 |  |          return null;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    private SysOrg getSysOrgByOrgCode(List<SysOrg> existOrgList, String orgCode) {
 | 
											
												
													
														|  | 
 |  | +        final Optional<SysOrg> businessSysOrgOptional = existOrgList.stream().filter(x -> orgCode.equals(x.getCode())).findFirst();
 | 
											
												
													
														|  | 
 |  | +        if (businessSysOrgOptional.isPresent()) {
 | 
											
												
													
														|  | 
 |  | +            return businessSysOrgOptional.get();
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        return null;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      /**
 |  |      /**
 | 
											
												
													
														|  |       * 将从fjnx统一门户获取到的原始机构数据转换为
 |  |       * 将从fjnx统一门户获取到的原始机构数据转换为
 | 
											
												
													
														|  |       * @param list 从fjnx获取的原始机构数据
 |  |       * @param list 从fjnx获取的原始机构数据
 | 
											
												
													
														|  |       * @return
 |  |       * @return
 | 
											
												
													
														|  |       */
 |  |       */
 | 
											
												
													
														|  | -    private List<FjnxOrg> ConvertXmlOrgDtoToOrgJinx(List<FJNXOrgDto> list) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    private List<FjnxOrg> ConvertXmlOrgDtoToOrgFjnx(List<FJNXOrgDto> list) {
 | 
											
												
													
														|  |          if (ObjectUtil.isEmpty(list)) {
 |  |          if (ObjectUtil.isEmpty(list)) {
 | 
											
												
													
														|  |              return new ArrayList<>();
 |  |              return new ArrayList<>();
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | 
 |  | +        //新增自定顶级机构“福建农信社”
 | 
											
												
													
														|  | 
 |  | +        list.add(createCustomRootOrg());
 | 
											
												
													
														|  |          List<FjnxOrgBusinessRelation> fjnxOrgBusinessRelationList = fjnxOrgBusinessRelationMapper.selectList(Wrappers.emptyWrapper());
 |  |          List<FjnxOrgBusinessRelation> fjnxOrgBusinessRelationList = fjnxOrgBusinessRelationMapper.selectList(Wrappers.emptyWrapper());
 | 
											
												
													
														|  |          final ArrayList<FjnxOrg> resultList = new ArrayList<>();
 |  |          final ArrayList<FjnxOrg> resultList = new ArrayList<>();
 | 
											
												
													
														|  |          Date syncDateTime = new Date();
 |  |          Date syncDateTime = new Date();
 | 
											
										
											
												
													
														|  | @@ -864,6 +1038,10 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |                  log.error("没有机构编码,机构名称:{}", item.getOrgName());
 |  |                  log.error("没有机构编码,机构名称:{}", item.getOrgName());
 | 
											
												
													
														|  |                  return;
 |  |                  return;
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  | 
 |  | +            if(ObjectUtil.equal(item.getShortName(),"省联社"))
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                item.setShortName("省联社职能部门");
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              FjnxOrg tempOrg = new FjnxOrg();
 |  |              FjnxOrg tempOrg = new FjnxOrg();
 | 
											
												
													
														|  |              BeanUtils.copyBeanProp(tempOrg, item);
 |  |              BeanUtils.copyBeanProp(tempOrg, item);
 | 
											
										
											
												
													
														|  | @@ -871,15 +1049,22 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |              tempOrg.setLastSyncTime(syncDateTime);
 |  |              tempOrg.setLastSyncTime(syncDateTime);
 | 
											
												
													
														|  |              tempOrg.setBusinessParentCode(tempOrg.getOrgParent());
 |  |              tempOrg.setBusinessParentCode(tempOrg.getOrgParent());
 | 
											
												
													
														|  |              tempOrg.setTreeShowParentCode(tempOrg.getOrgParent());
 |  |              tempOrg.setTreeShowParentCode(tempOrg.getOrgParent());
 | 
											
												
													
														|  | 
 |  | +            if(item.getOrgCode().equals("M33000000"))
 | 
											
												
													
														|  | 
 |  | +            {
 | 
											
												
													
														|  | 
 |  | +                String a="M33000000";
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              Optional<FjnxOrgBusinessRelation> first = fjnxOrgBusinessRelationList.stream().filter(b -> b.getOrgCode().equals(item.getOrgCode())).findFirst();
 |  |              Optional<FjnxOrgBusinessRelation> first = fjnxOrgBusinessRelationList.stream().filter(b -> b.getOrgCode().equals(item.getOrgCode())).findFirst();
 | 
											
												
													
														|  |              if (first.isPresent()) {
 |  |              if (first.isPresent()) {
 | 
											
												
													
														|  | -                if (list.stream().anyMatch(y -> y.getOrgCode().equals(first.get().getBusinessParentCode()))) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +                if (!StringUtil.isNullOrEmpty(first.get().getBusinessParentCode()) &&  list.stream().anyMatch(y -> y.getOrgCode().equals(first.get().getBusinessParentCode()))) {
 | 
											
												
													
														|  |                      tempOrg.setBusinessParentCode(first.get().getBusinessParentCode());
 |  |                      tempOrg.setBusinessParentCode(first.get().getBusinessParentCode());
 | 
											
												
													
														|  | -                    tempOrg.setTreeShowParentCode(item.getOrgParent());
 |  | 
 | 
											
												
													
														|  |                  } else {
 |  |                  } else {
 | 
											
												
													
														|  |                      log.error("设置fjnx业务父级机构失败,机构名称:{},机构编码:{},业务父级机构编码:{}", item.getOrgName(), first.get().getOrgCode(), first.get().getBusinessParentCode());
 |  |                      log.error("设置fjnx业务父级机构失败,机构名称:{},机构编码:{},业务父级机构编码:{}", item.getOrgName(), first.get().getOrgCode(), first.get().getBusinessParentCode());
 | 
											
												
													
														|  | -                    return;
 |  | 
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +                if (!StringUtil.isNullOrEmpty(first.get().getTreeShowParentCode()) &&  list.stream().anyMatch(y -> y.getOrgCode().equals(first.get().getTreeShowParentCode()))) {
 | 
											
												
													
														|  | 
 |  | +                    tempOrg.setTreeShowParentCode(first.get().getTreeShowParentCode());
 | 
											
												
													
														|  | 
 |  | +                } else {
 | 
											
												
													
														|  | 
 |  | +                    log.error("设置fjnx机构树显示父级机构失败,机构名称:{},机构编码:{},机构树显示父级机构编码:{}", item.getOrgName(), first.get().getOrgCode(), first.get().getBusinessParentCode());
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              }
 |  |              }
 | 
											
												
													
														|  |              resultList.add(tempOrg);
 |  |              resultList.add(tempOrg);
 | 
											
										
											
												
													
														|  | @@ -1036,4 +1221,15 @@ public class FJNXSyncServiceImpl implements IFJNXSyncService {
 | 
											
												
													
														|  |          return customOrg;
 |  |          return customOrg;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    private FJNXOrgDto createCustomRootOrg() {
 | 
											
												
													
														|  | 
 |  | +        FJNXOrgDto customOrg = new FJNXOrgDto();
 | 
											
												
													
														|  | 
 |  | +        customOrg.setOrgName(thirdPartySystemConfig.getFjnxSyncOrgCustomRootOrgName());
 | 
											
												
													
														|  | 
 |  | +        customOrg.setShortName(thirdPartySystemConfig.getFjnxSyncOrgCustomRootOrgName());
 | 
											
												
													
														|  | 
 |  | +        customOrg.setOrgCode(thirdPartySystemConfig.getFjnxSyncOrgCustomRootOrgCode());
 | 
											
												
													
														|  | 
 |  | +        customOrg.setCorporCode(thirdPartySystemConfig.getFjnxSyncOrgCustomRootOrgCode());
 | 
											
												
													
														|  | 
 |  | +        customOrg.setOrgPath("/" + customOrg.getOrgCode());
 | 
											
												
													
														|  | 
 |  | +        customOrg.setUsableFlag(1);
 | 
											
												
													
														|  | 
 |  | +        return customOrg;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |  }
 |  |  }
 |