Merge remote-tracking branch 'origin/main'

main
cheney 11 months ago
commit 9a41de6178
  1. 14
      users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java
  2. 2
      users/src/main/java/com/huoran/users/service/EnterpriseCertificationService.java
  3. 10
      users/src/main/java/com/huoran/users/service/impl/EnterpriseCertificationServiceImpl.java

@ -148,20 +148,25 @@ public class AliRealNameAuthenticationController {
querys.put("LegalPersonName", enterpriseCertification.getLegalPerson());
String errorMsg = "";
//查询认证id
QueryWrapper<EnterpriseCertification> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("account_id", accountId);
EnterpriseCertification certification = enterpriseCertificationService.getOne(queryWrapper);
enterpriseCertification.setId(certification.getId());
try {
HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
CreditCodeResp info = new Gson().fromJson(EntityUtils.toString(response.getEntity()), CreditCodeResp.class);
if (info.getStatus()) {
if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName()))) {
if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(), certification.getId()))) {
errorMsg = "企业名称已存在";
throw new RuntimeException(errorMsg);
}
enterpriseCertificationService.updateById(enterpriseCertification);
return R.ok("提交成功,请等待审核!");
} else {
errorMsg = info.getReason();
return R.ok().put("message", info.getReason());
return R.error().put("message", info.getReason());
}
} catch (Exception e) {
e.printStackTrace();
@ -196,7 +201,7 @@ public class AliRealNameAuthenticationController {
HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
CreditCodeResp info = new Gson().fromJson(EntityUtils.toString(response.getEntity()), CreditCodeResp.class);
if (info.getStatus()) {
if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName()))) {
if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName(),null))) {
errorMsg = "企业名称已存在";
throw new RuntimeException(errorMsg);
}
@ -215,5 +220,4 @@ public class AliRealNameAuthenticationController {
}
}

@ -14,7 +14,7 @@ import com.huoran.users.entity.req.EnterpriseCertificationLIstReq;
* @since 2023-12-18
*/
public interface EnterpriseCertificationService extends IService<EnterpriseCertification> {
EnterpriseCertification checkWhetherItExists(String comapnyName);
EnterpriseCertification checkWhetherItExists(String comapnyName, Integer id);
R selectEnterpriseCertificationList(EnterpriseCertificationLIstReq req);
}

@ -9,7 +9,9 @@ import com.huoran.users.entity.req.EnterpriseCertificationLIstReq;
import com.huoran.users.mapper.EnterpriseCertificationMapper;
import com.huoran.users.service.EnterpriseCertificationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.swagger.models.auth.In;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
/**
* <p>
@ -23,11 +25,15 @@ import org.springframework.stereotype.Service;
public class EnterpriseCertificationServiceImpl extends ServiceImpl<EnterpriseCertificationMapper, EnterpriseCertification> implements EnterpriseCertificationService {
@Override
public EnterpriseCertification checkWhetherItExists(String company_name) {
public EnterpriseCertification checkWhetherItExists(String company_name, Integer id) {
QueryWrapper<EnterpriseCertification> wrapper = new QueryWrapper<>();
wrapper.eq("company_name", company_name);
if (!ObjectUtils.isEmpty(id)){
wrapper.last( " and id <> " + id);
}
//校验已经通过的企业名称是否重复
wrapper.eq("audit_status", 2);
// wrapper.eq("audit_status", 2);
return getOne(wrapper);
}

Loading…
Cancel
Save