| | |
| | | SysCompany add = Convert.convert(SysCompany.class, bo); |
| | | add.setCompanyStatus(1); |
| | | validEntityBeforeSave(add); |
| | | add.setCompanyStatus(0); |
| | | boolean save = this.save(add); |
| | | addCompanyUser(add, 0); |
| | | return save; |
| | |
| | | if (phoneCount>0){ |
| | | throw new BaseException(String.format("%1$s,企业联系电话已存在!", entity.getCompanyName())); |
| | | } |
| | | SysUser user = new SysUser(); |
| | | user.setPhonenumber(entity.getCompanyPhone()); |
| | | if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { |
| | | throw new BaseException(String.format("%1$s,企业联系电话已存在,请更换手机号!", entity.getCompanyName())); |
| | | } |
| | | } else { |
| | | int codeCount = this.count(lq().eq(SysCompany::getCompanyCode, entity.getCompanyCode()).ne(SysCompany::getCompanyId,entity.getCompanyId())); |
| | | if (codeCount>0){ |
| | |
| | | errorList.add(new ImportError(0, "企业名已存在!")); |
| | | } |
| | | int phoneCount = this.count(lq().eq(SysCompany::getCompanyPhone, entity.getCompanyPhone())); |
| | | SysUser user = new SysUser(); |
| | | user.setPhonenumber(entity.getCompanyPhone()); |
| | | if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) { |
| | | errorList.add(new ImportError(3, "企业联系电话系统中已存在,请更换电话!")); |
| | | } |
| | | if (phoneCount>0){ |
| | | errorList.add(new ImportError(3, "企业联系电话已存在!")); |
| | | } |
| | |
| | | { |
| | | return; |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | userService.insertUser(user); |
| | | } |