| | |
| | | import com.ruoyi.company.mapper.CompanyMapper; |
| | | import com.ruoyi.company.service.CompanyService; |
| | | import com.ruoyi.company.service.UserService; |
| | | import com.ruoyi.company.utils.AliyunCloudAuthUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private final UserService userService; |
| | | private final HttpServletResponse response; |
| | | |
| | | private final AliyunCloudAuthUtil aliyunCloudAuthUtil; |
| | | /** |
| | | * 获取企业列表 |
| | | * |
| | |
| | | User user = BeanUtils.copyBean(dto, User.class); |
| | | user.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | userService.save(user); |
| | | // TODO 校验身份证信息 |
| | | |
| | | Company company = BeanUtils.copyBean(dto, Company.class); |
| | | company.setUserId(user.getUserId()); |
| | | //根据公司名称查询数据库 |
| | | Long count = this.lambdaQuery().eq(Company::getCompanyName, company.getCompanyName()).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("该公司账号已存在"); |
| | | } |
| | | //身份证二要素校验 |
| | | Boolean res = aliyunCloudAuthUtil.verifyIdCard(dto.getLegalPersonName(), dto.getIdCardNumber()); |
| | | if (!res) { |
| | | throw new ServiceException("身份证信息不匹配"); |
| | | } |
| | | this.save(company); |
| | | } |
| | |
| | | if (count > 0) { |
| | | throw new ServiceException("该公司账号已存在"); |
| | | } |
| | | //身份证二要素校验 |
| | | Boolean res = aliyunCloudAuthUtil.verifyIdCard(dto.getLegalPersonName(), dto.getIdCardNumber()); |
| | | if (!res) { |
| | | throw new ServiceException("身份证信息不匹配"); |
| | | } |
| | | Company companyUpd = BeanUtils.copyBean(dto, Company.class); |
| | | companyUpd.setId(company.getId()); |
| | | this.updateById(companyUpd); |