diff --git a/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java b/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java index 719995e7..eda0eb0c 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/BsCompanyController.java @@ -89,10 +89,13 @@ public class BsCompanyController { try { BsCompany company = secCompanyModel.getCompany(); SecUser user = secCompanyModel.getUser(); - if (StringUtils.isBlank(company.getName()) || StringUtils.isBlank(company.getRegionId()) || - StringUtils.isBlank(company.getAddress()) || StringUtils.isBlank(company.getPhone()) || - StringUtils.isBlank(user.getLoginName()) || - StringUtils.isBlank(user.getPassword()) || StringUtils.isBlank(user.getTelephone())) { + if (StringUtils.isBlank(company.getName()) + || StringUtils.isBlank(company.getRegionId()) + || StringUtils.isBlank(company.getAddress()) + || StringUtils.isBlank(company.getPhone()) + || StringUtils.isBlank(user.getLoginName()) + || StringUtils.isBlank(user.getPassword()) + || StringUtils.isBlank(user.getTelephone())) { log.error("BsCompanyController --> addCompanyAndUser() error!", "参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } @@ -103,25 +106,13 @@ public class BsCompanyController { throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); } UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); - // 校验区域 - if (company.getRegionId().length() >= 4) { - company.setRegionId(company.getRegionId().substring(0,4)); - } else { - log.error("BsCompanyController --> addCompanyAndUser() error!", "单位区域必须选择到市级区域"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_REGION_HAS_IN_CITY_ERROR, ""); - } + // 校验公司名称 BsCompany secCompany = bsCompanyService.selectCompanyByName(company.getName()); if (secCompany != null) { log.error("BsCompanyController --> addCompanyAndUser() error!", "该单位已经存在"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_NAME_IS_EXIST_ERROR, ""); } -// // 校验区域下是否存在公司 -// BsCompany companyRegion = bsCompanyService.selectCompanyByRegion(company.getRegionId()); -// if (companyRegion != null) { -// log.error("BsCompanyController --> addCompanyAndUser() error!", "该区域下已存在单位"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_REGION_IS_EXIST_ERROR, ""); -// } // 校验用户 SecUser secUser = secUserService.findByLoginName(user.getLoginName()); if (secUser != null) { @@ -135,7 +126,6 @@ public class BsCompanyController { throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PHONE_HAS_ONE_ERROR, ""); } - //生成公司状态 company.setStatus(1); company.setCreateTime(new Date()); @@ -203,33 +193,18 @@ public class BsCompanyController { } UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); - // 校验区域 - if (company.getRegionId().length() >= 4) { - company.setRegionId(company.getRegionId().substring(0,4)); - } else { - log.error("BsCompanyController --> updateCompany() error!", "单位区域必须选择到市级区域"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_REGION_HAS_IN_CITY_ERROR, ""); - } // 校验公司名称 BsCompany secCompany = bsCompanyService.selectCompanyByName(company.getName()); if (secCompany != null && !secCompany.getId().equals(company.getId())) { log.error("BsCompanyController --> updateCompany() error!", "该单位已经存在"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_NAME_IS_EXIST_ERROR, ""); } -// // 校验区域下是否存在公司 -// BsCompany companyRegion = bsCompanyService.selectCompanyByRegion(company.getRegionId()); -// if (companyRegion != null && !companyRegion.getId().equals(company.getId())) { -// log.error("BsCompanyController --> updateCompany() error!", "该区域下已存在单位"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPANY_REGION_IS_EXIST_ERROR, ""); -// } - BsOrganization organization = bsOrganizationService.findTopByCompany(company.getId()); if (organization == null) { log.error("BsCompanyController --> updateCompany() error!", "未找到该部门信息"); throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_FIND_ORGANIZATION_ERROR, ""); } - // 查询用户 SecUser secUser = secUserService.findById(user.getId()); if (secUser == null) { diff --git a/hai-service/src/main/java/com/hai/service/impl/BsCompanyServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsCompanyServiceImpl.java index f0bf2723..5c9195c8 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsCompanyServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsCompanyServiceImpl.java @@ -71,7 +71,7 @@ public class BsCompanyServiceImpl implements BsCompanyService { secOrganization.setManagerName(secUser.getUserName()); secOrganization.setManagerPhone(secUser.getTelephone()); bsOrganizationMapper.updateByPrimaryKey(secOrganization); - // 保存用户角色[就业局主角色] + // 保存用户角色 SecUserRoleRel userRole = new SecUserRoleRel(); userRole.setUserId(secUser.getId()); userRole.setRoleId(2L);