| | |
| | | if(StringUtils.isBlank(parent.getHkId())){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,父级组织信息尚未同步下发成功~"); |
| | | } |
| | | if(Constants.equalsInteger(parent.getType(),Constants.ZERO)){ |
| | | //如果父级是相关方组织,下级不能建立内部组织 |
| | | if(Constants.equalsInteger(company.getType(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,相关方组织,下级不能建立内部组织~"); |
| | | if(Objects.nonNull(parent.getType())&&!Constants.equalsInteger(parent.getType(),-1)){ |
| | | if(Constants.equalsInteger(company.getType(),parent.getType())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,组织信息错误"); |
| | | } |
| | | }else if(Objects.isNull(parent.getType())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,组织信息错误"); |
| | | } |
| | | // if(Constants.equalsInteger(parent.getType(),Constants.ZERO)){ |
| | | // //如果父级是相关方组织,下级不能建立内部组织 |
| | | // if(Constants.equalsInteger(company.getType(),Constants.ONE)){ |
| | | // throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,相关方组织,下级不能建立内部组织~"); |
| | | // } |
| | | // } |
| | | idPath = parent.getCompanyPath(); |
| | | company.setHkParentId(parent.getHkId()); |
| | | company.setCompanyPath(parent.getCompanyPath()+company.getId()+"/"); |
| | |
| | | if(model == null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "对不起,组织信息不存在~"); |
| | | } |
| | | if( Constants.equalsInteger(Constants.ONE,model.getType())&& Constants.equalsInteger(Constants.ZERO,company.getType())){ |
| | | //如果由内部组织切换成内部组织,排查下级组织是否有内部组织 |
| | | if(companyJoinMapper.selectCount(new QueryWrapper<Company>().lambda() |
| | | .eq(Company::getIsdeleted,Constants.ZERO ) |
| | | .eq(Company::getType,Constants.ONE ) |
| | | .ne(Company::getId,model.getId()) |
| | | .likeRight(Company::getCompanyPath,model.getCompanyPath())) >0){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "对不起,下级部门存在内部组织,该部门不支持切换为相关方组织!~"); |
| | | } |
| | | } |
| | | |
| | | // if( Constants.equalsInteger(Constants.ONE,model.getType())&& Constants.equalsInteger(Constants.ZERO,company.getType())){ |
| | | // //如果由内部组织切换成内部组织,排查下级组织是否有内部组织 |
| | | // if(companyJoinMapper.selectCount(new QueryWrapper<Company>().lambda() |
| | | // .eq(Company::getIsdeleted,Constants.ZERO ) |
| | | // .eq(Company::getType,Constants.ONE ) |
| | | // .ne(Company::getId,model.getId()) |
| | | // .likeRight(Company::getCompanyPath,model.getCompanyPath())) >0){ |
| | | // throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(), "对不起,下级部门存在内部组织,该部门不支持切换为相关方组织!~"); |
| | | // } |
| | | // } |
| | | company.setType(null); |
| | | company.setEditDate(new Date()); |
| | | company.setEditor(user.getId()); |
| | | company.setHkStatus(Constants.ONE); |
| | |
| | | queryWrapper.leftJoin(SystemUser.class,SystemUser::getId,Company::getEditor); |
| | | queryWrapper.eq(Company::getIsdeleted,Constants.ZERO); |
| | | if(Objects.nonNull(type) && ( Constants.equalsInteger(type,Constants.ONE) || Constants.equalsInteger(type,Constants.ZERO))){ |
| | | queryWrapper.eq(type!=null,Company::getType,type); |
| | | // queryWrapper.eq(type!=null,Company::getType,type); |
| | | queryWrapper.apply("( type = "+type+" or type = -1 )"); |
| | | }else if(Objects.nonNull(type) && Constants.equalsInteger(type,Constants.TWO)){ |
| | | String companySpecialId = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SPECIAL_COMPANY_ID).getCode(); |
| | | if(StringUtils.isNotBlank(companySpecialId)){ |