diff --git a/users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java b/users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java index d217bf3..9edaa3d 100644 --- a/users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java +++ b/users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java @@ -148,20 +148,25 @@ public class AliRealNameAuthenticationController { querys.put("LegalPersonName", enterpriseCertification.getLegalPerson()); String errorMsg = ""; - + //查询认证id + QueryWrapper 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 { } - } \ No newline at end of file diff --git a/users/src/main/java/com/huoran/users/service/EnterpriseCertificationService.java b/users/src/main/java/com/huoran/users/service/EnterpriseCertificationService.java index ff1b565..bc16fa8 100644 --- a/users/src/main/java/com/huoran/users/service/EnterpriseCertificationService.java +++ b/users/src/main/java/com/huoran/users/service/EnterpriseCertificationService.java @@ -14,7 +14,7 @@ import com.huoran.users.entity.req.EnterpriseCertificationLIstReq; * @since 2023-12-18 */ public interface EnterpriseCertificationService extends IService { - EnterpriseCertification checkWhetherItExists(String comapnyName); + EnterpriseCertification checkWhetherItExists(String comapnyName, Integer id); R selectEnterpriseCertificationList(EnterpriseCertificationLIstReq req); } diff --git a/users/src/main/java/com/huoran/users/service/impl/EnterpriseCertificationServiceImpl.java b/users/src/main/java/com/huoran/users/service/impl/EnterpriseCertificationServiceImpl.java index eb316fc..45435f0 100644 --- a/users/src/main/java/com/huoran/users/service/impl/EnterpriseCertificationServiceImpl.java +++ b/users/src/main/java/com/huoran/users/service/impl/EnterpriseCertificationServiceImpl.java @@ -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; /** *

@@ -23,11 +25,15 @@ import org.springframework.stereotype.Service; public class EnterpriseCertificationServiceImpl extends ServiceImpl implements EnterpriseCertificationService { @Override - public EnterpriseCertification checkWhetherItExists(String company_name) { + public EnterpriseCertification checkWhetherItExists(String company_name, Integer id) { QueryWrapper 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); }