diff --git a/users/src/main/java/com/huoran/users/controller/EnterpriseCertificationController.java b/users/src/main/java/com/huoran/users/controller/EnterpriseCertificationController.java index 70d1583..7ced0ce 100644 --- a/users/src/main/java/com/huoran/users/controller/EnterpriseCertificationController.java +++ b/users/src/main/java/com/huoran/users/controller/EnterpriseCertificationController.java @@ -10,6 +10,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -33,6 +34,8 @@ public class EnterpriseCertificationController { @Autowired public EnterpriseCertificationService service; + + /** * 由前台申请认证后才有后台认证记录,认证状态有 待审核、已通过、未驳回三种状态,没有未提交这种状态 * @@ -76,6 +79,9 @@ public class EnterpriseCertificationController { public R save(@RequestBody @ApiParam(name = "企业实名认证信息记录对象", value = "传入json格式", required = true) EnterpriseCertification enterpriseCertification, HttpServletRequest request) { String accountId = TokenUtils.getIdByJwtToken(request); enterpriseCertification.setAccountId(Integer.valueOf(accountId)); + if (!ObjectUtils.isEmpty(service.checkWhetherItExists(enterpriseCertification.getCompanyName(), null, enterpriseCertification.getOpenId()))) { + throw new RuntimeException("企业名称已存在"); + } boolean addState = service.save(enterpriseCertification); return addState ? R.ok() : R.error("新增失败"); } diff --git a/users/src/main/java/com/huoran/users/mapper/xml/EnterpriseCertificationMapper.xml b/users/src/main/java/com/huoran/users/mapper/xml/EnterpriseCertificationMapper.xml index 5b7aed5..eaa50f4 100644 --- a/users/src/main/java/com/huoran/users/mapper/xml/EnterpriseCertificationMapper.xml +++ b/users/src/main/java/com/huoran/users/mapper/xml/EnterpriseCertificationMapper.xml @@ -34,13 +34,13 @@ t.platform_source = #{req.platformSource} - - and t.audit_status =#{req.auditStatus,jdbcType=VARCHAR} + + and t.audit_status =#{req.auditStatus,jdbcType=INTEGER} - - and t.authentication_status =#{req.authenticationStatus,jdbcType=VARCHAR} + + and t.authentication_status =#{req.authenticationStatus,jdbcType=INTEGER}