| | |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public Integer create(Company company) { |
| | | company.setType(Constants.ONE); |
| | | if(StringUtils.isBlank(company.getName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | |
| | | company.setHkId(UUID.randomUUID().toString().replace("-","")); |
| | | companyMapper.insert(company); |
| | | //下发海康安防平台 |
| | | if(!addHkOrg(company)){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,组织同步下发失败,请稍后重试"); |
| | | } |
| | | // if(!addHkOrg(company)){ |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,组织同步下发失败,请稍后重试"); |
| | | // } |
| | | Company com = new Company(); |
| | | com.setId(company.getId()); |
| | | com.setCompanyPath(idPath+company.getId()+"/"); |
| | |
| | | company.setHkDate(company.getHkDate()); |
| | | companyMapper.updateById(company); |
| | | //下发海康安防平台 |
| | | if(StringUtils.isNotBlank(model.getHkId()) && Constants.equalsInteger(Constants.ONE,model.getHkStatus()) && !delHkOrg(model)){ |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,组织删除下发失败,请确认该组织无下级组织或组织人员信息~"); |
| | | } |
| | | // if(StringUtils.isNotBlank(model.getHkId()) && Constants.equalsInteger(Constants.ONE,model.getHkStatus()) && !delHkOrg(model)){ |
| | | // throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,组织删除下发失败,请确认该组织无下级组织或组织人员信息~"); |
| | | // } |
| | | } |
| | | |
| | | @Override |