企业认证列表

main
rong.liu 12 months ago
parent 1bab75ece5
commit 1e82fe25e4
  1. 45
      users/src/main/java/com/huoran/users/controller/AliRealNameAuthenticationController.java
  2. 80
      users/src/main/java/com/huoran/users/controller/EnterpriseCertificationController.java
  3. 97
      users/src/main/java/com/huoran/users/entity/EnterpriseCertification.java
  4. 44
      users/src/main/java/com/huoran/users/entity/req/EnterpriseCertificationLIstReq.java
  5. 60
      users/src/main/java/com/huoran/users/entity/req/EnterpriseCertificationReq.java
  6. 20
      users/src/main/java/com/huoran/users/mapper/EnterpriseCertificationMapper.java
  7. 1
      users/src/main/java/com/huoran/users/mapper/UserAuthenticationInformationMapper.java
  8. 46
      users/src/main/java/com/huoran/users/mapper/xml/EnterpriseCertificationMapper.xml
  9. 1
      users/src/main/java/com/huoran/users/mapper/xml/UserAuthenticationInformationMapper.xml
  10. 20
      users/src/main/java/com/huoran/users/service/EnterpriseCertificationService.java
  11. 1
      users/src/main/java/com/huoran/users/service/UserAuthenticationInformationService.java
  12. 38
      users/src/main/java/com/huoran/users/service/impl/EnterpriseCertificationServiceImpl.java

@ -8,11 +8,14 @@ import com.google.gson.Gson;
import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils;
import com.huoran.users.config.AliRealNameAuthenticationConfig;
import com.huoran.users.entity.EnterpriseCertification;
import com.huoran.users.entity.UserAuthenticationInformation;
import com.huoran.users.entity.req.EnterpriseCertificationReq;
import com.huoran.users.entity.res.BusinessLicenseOCRResp;
import com.huoran.users.entity.res.CreditCodeResp;
import com.huoran.users.entity.res.IdCardOCRResp;
import com.huoran.users.entity.res.RealNameAuthenticationResp;
import com.huoran.users.service.EnterpriseCertificationService;
import com.huoran.users.service.UserAuthenticationInformationService;
import com.huoran.users.utils.ali.FaceRecognitionAidUtil;
import com.huoran.users.utils.ali.HttpUtils;
@ -40,6 +43,11 @@ public class AliRealNameAuthenticationController {
@Autowired
public UserAuthenticationInformationService service;
//企业认证信息存储
@Autowired
public EnterpriseCertificationService enterpriseCertificationService;
/* @ApiOperation(value = "身份证图片验证(对象)")
@PostMapping("/faceAuthenticationByObject")
public R faceAuthenticationByObject(HttpServletRequest request, @RequestBody IdCardOCRReq req) throws IOException {
@ -160,11 +168,14 @@ public class AliRealNameAuthenticationController {
}
@ApiOperation(value = "统一社会信用代码认证")
@ApiOperation(value = "统一社会信用代码认证",response = CreditCodeResp.class)
@PostMapping("/creditCodeAuthentication")
public R creditCodeAuthentication(@RequestParam(name = "comapnyName", required = true) @ApiParam(value = "公司的名字") String comapnyName,
@RequestParam(name = "legalPerson", required = true) @ApiParam(value = "法人") String legalPerson,
@RequestParam(name = "creditCode", required = true) @ApiParam(value = "统一社会信用代码") String creditCode, HttpServletRequest request) throws IOException {
public R creditCodeAuthentication(@RequestBody EnterpriseCertification enterpriseCertification, HttpServletRequest request) throws IOException {
String accountId = TokenUtils.getIdByJwtToken(request);
enterpriseCertification.setAccountId(Integer.valueOf(accountId));
enterpriseCertification.setSubmitTime(new Date());
String host = "https://sys.81api.com";
String path = "/verifyCompany/";
String method = "GET";
@ -172,21 +183,22 @@ public class AliRealNameAuthenticationController {
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
headers.put("Authorization", "APPCODE " + AliRealNameAuthenticationConfig.ALI_API_APPCODE);
Map<String, String> querys = new HashMap<String, String>();
querys.put("ComapnyName", comapnyName);
querys.put("CreditCode", creditCode);
querys.put("LegalPersonName", legalPerson);
querys.put("ComapnyName", enterpriseCertification.getCompanyName());
querys.put("CreditCode", enterpriseCertification.getCreditCode());
querys.put("LegalPersonName", enterpriseCertification.getLegalPerson());
String errorMsg = "";
try {
HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
// System.out.println(response.toString());
//获取response的body
//System.out.println(EntityUtils.toString(response.getEntity()));
CreditCodeResp info = new Gson().fromJson(EntityUtils.toString(response.getEntity()), CreditCodeResp.class);
if (info.getStatus()) {
return R.ok().put("message", "认证通过!");
if (!ObjectUtils.isEmpty(enterpriseCertificationService.checkWhetherItExists(enterpriseCertification.getCompanyName()))){
errorMsg = "企业名称已存在";
throw new RuntimeException(errorMsg);
}
enterpriseCertificationService.save(enterpriseCertification);
return R.ok("提交成功,请等待审核!");
} else {
errorMsg = info.getReason();
return R.ok().put("message", info.getReason());
@ -199,15 +211,6 @@ public class AliRealNameAuthenticationController {
}
public static <T> T jsonToObject(String json) {
try {
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readValue(json, new TypeReference<T>() {});
} catch (Exception e) {
e.printStackTrace();
return null;
}
}

@ -0,0 +1,80 @@
package com.huoran.users.controller;
import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils;
import com.huoran.users.entity.EnterpriseCertification;
import com.huoran.users.entity.EnterpriseCertification;
import com.huoran.users.entity.req.EnterpriseCertificationLIstReq;
import com.huoran.users.service.EnterpriseCertificationService;
import com.huoran.users.service.EnterpriseCertificationService;
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.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* <p>
* 企业认证审核 前端控制器
* </p>
*
* @author chen
* @since 2023-12-18
*/
@Api(value = "后台-企业实名认证相关", tags = "后台-企业实名认证相关")
@RestController
@RequestMapping("/enterprise/certification")
public class EnterpriseCertificationController {
@Autowired
public EnterpriseCertificationService service;
@PostMapping("/selectEnterpriseCertificationList")
@ApiOperation(value = "企业认证列表", response = EnterpriseCertification.class)
public R selectEnterpriseCertificationList(@RequestBody EnterpriseCertificationLIstReq req) {
return service.selectEnterpriseCertificationList(req);
}
@PostMapping("/findById")
@ApiOperation(value = "查询详情", response = EnterpriseCertification.class)
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
EnterpriseCertification enterpriseCertification = service.getById(id);
return R.ok().put("data", enterpriseCertification);
}
@PostMapping("/save")
@ApiOperation(value = "新增", response = EnterpriseCertification.class)
public R save(@RequestBody @ApiParam(name = "企业实名认证信息记录对象", value = "传入json格式", required = true) EnterpriseCertification enterpriseCertification, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
enterpriseCertification.setAccountId(Integer.valueOf(accountId));
boolean addState = service.save(enterpriseCertification);
return addState ? R.ok() : R.error("新增失败");
}
@PostMapping("/update")
@ApiOperation(value = "修改", response = EnterpriseCertification.class)
public R update(@RequestBody @ApiParam(name = "企业实名认证信息记录对象", value = "传入json格式", required = true) EnterpriseCertification enterpriseCertification, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
enterpriseCertification.setAccountId(Integer.valueOf(accountId));
boolean updateState = service.updateById(enterpriseCertification);
return updateState ? R.ok() : R.error("编辑失败");
}
@PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除", response = EnterpriseCertification.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) {
boolean delState = service.removeByIds(ids);
return delState ? R.ok() : R.error("删除失败");
}
}

@ -0,0 +1,97 @@
package com.huoran.users.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 企业认证审核
* </p>
*
* @author chen
* @since 2023-12-18
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("hr_enterprise_certification")
@ApiModel(value="EnterpriseCertification对象", description="企业认证审核")
public class EnterpriseCertification implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "申请认证人账号id")
private Integer accountId;
@ApiModelProperty(value = "企业名称")
private String companyName;
@ApiModelProperty(value = "统一社会信用代码")
private String creditCode;
@ApiModelProperty(value = "法人")
private String legalPerson;
@ApiModelProperty(value = "公司类型")
private String type;
@ApiModelProperty(value = "公司注册日期")
private String establishDate;
@ApiModelProperty(value = "公司营业期限终止日期")
private String validPeriod;
@ApiModelProperty(value = "公司地址")
private String address;
@ApiModelProperty(value = "注册资本")
private String capital;
@ApiModelProperty(value = "经营范围")
private String business;
@ApiModelProperty(value = "营业执照照片")
private String businessLicensePicture;
@ApiModelProperty(value = "办学许可证")
private String licenseForRunningSchool;
@ApiModelProperty(value = "提交时间")
private Date submitTime;
@ApiModelProperty(value = "审核状态(0默认待审核,1通过,2驳回)")
private Integer auditStatus;
@ApiModelProperty(value = "来源区分(5:幼儿园,6:供应商)")
private String platformsOurce;
@ApiModelProperty(value = "账号")
@TableField(exist = false)
private String account;
@ApiModelProperty(value = "申请人")
@TableField(exist = false)
private String proposer;
@ApiModelProperty(value = "联系方式")
@TableField(exist = false)
private String contactInformation;
}

@ -0,0 +1,44 @@
package com.huoran.users.entity.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
* 企业认证审核
* </p>
*
* @author chen
* @since 2023-12-18
*/
@Data
@ApiModel(value = "EnterpriseCertification对象", description = "企业认证审核列表请求参数")
public class EnterpriseCertificationLIstReq {
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "开始提交时间")
private String startCommitTime;
@ApiModelProperty(value = "结束提交时间")
private String endCommitTime;
@ApiModelProperty(value = "认证状态(0默认待审核,1通过,2驳回)")
private Integer auditStatus;
@ApiModelProperty(value = "来源区分(5:幼儿园,6:供应商)")
private String platformsOurce;
@ApiModelProperty(value = "账号")
private String account;
@ApiModelProperty(value = "当前页数", name = "pageNum", example = "1", required = true)
private Integer pageNum;
@ApiModelProperty(value = "当前页需要显示的数量", name = "pageSize", example = "10", required = true)
private Integer pageSize;
}

@ -0,0 +1,60 @@
package com.huoran.users.entity.req;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(value = "企业认证请求参数")
public class EnterpriseCertificationReq {
@ApiModelProperty(value = "公司的名字")
private String comapnyName;
@ApiModelProperty(value = "法人")
private String legalPerson;
@ApiModelProperty(value = "统一社会信用代码")
private String creditCode;
@ApiModelProperty(value = "公司类型")
private String type;
@ApiModelProperty(value = "公司注册日期(例:证件上为2014年04月16日,算法返回20140416")
private String establishDate;
@ApiModelProperty(value = "公司营业期限终止日期(例:证件上为2014年04月16日至2034年04月15日,算法返回20340415)")
private String validPeriod;
@ApiModelProperty(value = "公司地址,没有识别出来时返回FailInRecognition")
private String address;
@ApiModelProperty(value = "注册资本,没有识别出来时返回FailInRecognition")
private String capital;
@ApiModelProperty(value = "经营范围,没有识别出来时返回FailInRecognition")
private String business;
@ApiModelProperty(value = "营业执照图片")
private String businessLicensePicture;
@ApiModelProperty(value = "办学许可证件")
private String licenseForRunningSchool;
@ApiModelProperty(value = "申请人")
private String proposer;
@ApiModelProperty(value = "联系方式")
private String contactInformation;
@ApiModelProperty(value = "提交时间")
private Date submitTime;
}

@ -0,0 +1,20 @@
package com.huoran.users.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huoran.users.entity.EnterpriseCertification;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.huoran.users.entity.req.EnterpriseCertificationLIstReq;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 企业认证审核 Mapper 接口
* </p>
*
* @author chen
* @since 2023-12-18
*/
public interface EnterpriseCertificationMapper extends BaseMapper<EnterpriseCertification> {
IPage<EnterpriseCertification> selectEnterpriseCertificationList(IPage<EnterpriseCertification> page, @Param("req")EnterpriseCertificationLIstReq req);
}

@ -1,5 +1,6 @@
package com.huoran.users.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.huoran.users.entity.UserAuthenticationInformation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huoran.users.mapper.EnterpriseCertificationMapper">
<select id="selectEnterpriseCertificationList"
resultType="com.huoran.users.entity.EnterpriseCertification">
SELECT
t.*
FROM
(
SELECT
IFNULL( info.real_name, u.user_name ) proposer,
a.phone AS contactInformation,
a.account,
c.*
FROM
hr_enterprise_certification c
INNER JOIN hr_user_account a ON a.id = c.account_id
INNER JOIN hr_user_info u ON u.user_id = a.user_id
LEFT JOIN hr_user_authentication_information info ON info.account_id = a.id
WHERE
a.is_del = 0
AND u.is_del = 0
) t WHERE t.platforms_ource = #{req.platformsOurce}
<if test=" req.auditStatus!= null">
and t.audit_status = #{req.auditStatus}
</if>
<if test="req.startCommitTime != '' and req.startCommitTime!= null
and req.endCommitTime != '' and req.endCommitTime!= null">
AND date_format( t.submit_time, '%Y-%m-%d' )
BETWEEN #{req.startCommitTime} AND #{req.endCommitTime}
</if>
<if test="req.keyWord!=null and req.keyWord!='' ">
and (
proposer like concat('%' #{req.keyWord} '%')
or account like concat('%' #{req.keyWord} '%')
or contactInformation like concat('%' #{req.keyWord} '%')
or company_name like concat('%' #{req.keyWord} '%'))
</if>
</select>
</mapper>

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.huoran.users.mapper.UserAuthenticationInformationMapper">
</mapper>

@ -0,0 +1,20 @@
package com.huoran.users.service;
import com.huoran.common.response.R;
import com.huoran.users.entity.EnterpriseCertification;
import com.baomidou.mybatisplus.extension.service.IService;
import com.huoran.users.entity.req.EnterpriseCertificationLIstReq;
/**
* <p>
* 企业认证审核 服务类
* </p>
*
* @author chen
* @since 2023-12-18
*/
public interface EnterpriseCertificationService extends IService<EnterpriseCertification> {
EnterpriseCertification checkWhetherItExists(String comapnyName);
R selectEnterpriseCertificationList(EnterpriseCertificationLIstReq req);
}

@ -12,5 +12,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @since 2023-12-14
*/
public interface UserAuthenticationInformationService extends IService<UserAuthenticationInformation> {
}

@ -0,0 +1,38 @@
package com.huoran.users.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.common.response.R;
import com.huoran.users.entity.EnterpriseCertification;
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 org.springframework.stereotype.Service;
/**
* <p>
* 企业认证审核 服务实现类
* </p>
*
* @author chen
* @since 2023-12-18
*/
@Service
public class EnterpriseCertificationServiceImpl extends ServiceImpl<EnterpriseCertificationMapper, EnterpriseCertification> implements EnterpriseCertificationService {
@Override
public EnterpriseCertification checkWhetherItExists(String company_name) {
QueryWrapper<EnterpriseCertification> wrapper = new QueryWrapper<>();
wrapper.eq("company_name", company_name);
return getOne(wrapper);
}
@Override
public R selectEnterpriseCertificationList(EnterpriseCertificationLIstReq req) {
Page<EnterpriseCertification> page = new Page<EnterpriseCertification>(req.getPageNum(), req.getPageSize());
IPage<EnterpriseCertification> pageList = baseMapper.selectEnterpriseCertificationList(page, req);
return R.ok().put("data", pageList);
}
}
Loading…
Cancel
Save