Merge remote-tracking branch 'origin/cc_partner_init' into cc_partner_init
This commit is contained in:
@@ -52,6 +52,7 @@ public enum ErrorCodeEnum {
|
|||||||
GET_PHONENUMBER_INFO_ERROR(1021079, "手机号归属地获取异常", null),
|
GET_PHONENUMBER_INFO_ERROR(1021079, "手机号归属地获取异常", null),
|
||||||
IDENTITY_CARD_PARSE_FAIL(1021080, "身份证解析失败", null),
|
IDENTITY_CARD_PARSE_FAIL(1021080, "身份证解析失败", null),
|
||||||
WECHAT_BIND_OTHER_MOBILE(1021081, "授权号码有误,请核对", null),
|
WECHAT_BIND_OTHER_MOBILE(1021081, "授权号码有误,请核对", null),
|
||||||
|
BUSINESS_LICENSE_PARSE_FAIL(1021082, "营业证照解析失败", null),
|
||||||
PARAMS_REQUIRED(400002, "参数缺失!", null),
|
PARAMS_REQUIRED(400002, "参数缺失!", null),
|
||||||
DATA_CONVERT_ERROR(400002, "日期转换异常!", null),
|
DATA_CONVERT_ERROR(400002, "日期转换异常!", null),
|
||||||
PARENT_NODE_NOT_EXIST(400002, "父节点不存在", null),
|
PARENT_NODE_NOT_EXIST(400002, "父节点不存在", null),
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public enum WorkflowSubStageStatusEnum {
|
|||||||
SIGN_INTENT_AGREEMENT_60(60,"待补充"),
|
SIGN_INTENT_AGREEMENT_60(60,"待补充"),
|
||||||
SIGN_INTENT_AGREEMENT_65(65,"不通过"),
|
SIGN_INTENT_AGREEMENT_65(65,"不通过"),
|
||||||
SIGN_INTENT_AGREEMENT_70(70,"待提交"),
|
SIGN_INTENT_AGREEMENT_70(70,"待提交"),
|
||||||
SIGN_INTENT_AGREEMENT_75(75,"待审核"),
|
SIGN_INTENT_AGREEMENT_75(75,"待OA审核"),
|
||||||
SIGN_INTENT_AGREEMENT_80(80,"签约失败"),
|
SIGN_INTENT_AGREEMENT_80(80,"签约失败"),
|
||||||
|
|
||||||
|
|
||||||
@@ -78,4 +78,13 @@ public enum WorkflowSubStageStatusEnum {
|
|||||||
return INVITING_INTERVIEWS_15.getCode().equals(workflowSubStageStatus) || FIRST_INTERVIEWS_30.getCode().equals(workflowSubStageStatus) || SECOND_INTERVIEWS_105.getCode().equals(workflowSubStageStatus);
|
return INVITING_INTERVIEWS_15.getCode().equals(workflowSubStageStatus) || FIRST_INTERVIEWS_30.getCode().equals(workflowSubStageStatus) || SECOND_INTERVIEWS_105.getCode().equals(workflowSubStageStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WorkflowSubStageStatusEnum getNextStatus(WorkflowSubStageStatusEnum workflowSubStageStatusEnum) {
|
||||||
|
switch (workflowSubStageStatusEnum) {
|
||||||
|
case INTENT_0:
|
||||||
|
return INTENT_5;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.cool.store.mapper;
|
||||||
|
|
||||||
|
import com.cool.store.entity.SigningBaseInfoDO;
|
||||||
|
import com.cool.store.request.IntentAgreementSubmitRequest;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface IntentAgreementMapper {
|
||||||
|
|
||||||
|
boolean insert(@Param("request") SigningBaseInfoDO request);
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?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.cool.store.mapper.IntentAgreementMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.cool.store.entity.SigningBaseInfoDO">
|
||||||
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||||||
|
<result column="partner_base_info_id" jdbcType="VARCHAR" property="partnerBaseInfoId" />
|
||||||
|
<result column="sign_name" jdbcType="VARCHAR" property="signName" />
|
||||||
|
<result column="mobile" jdbcType="VARCHAR" property="mobile" />
|
||||||
|
<result column="sex" jdbcType="TINYINT" property="sex" />
|
||||||
|
<result column="id_card_front" jdbcType="VARCHAR" property="idCardFront" />
|
||||||
|
<result column="id_card_reverse" jdbcType="VARCHAR" property="idCardReverse" />
|
||||||
|
<result column="id_card_no" jdbcType="VARCHAR" property="idCardNo" />
|
||||||
|
<result column="id_card_address" jdbcType="VARCHAR" property="idCardAddress" />
|
||||||
|
<result column="current_residence" jdbcType="VARCHAR" property="currentResidence" />
|
||||||
|
<result column="address_detail" jdbcType="VARCHAR" property="addressDetail" />
|
||||||
|
<result column="business_license" jdbcType="VARCHAR" property="businessLicense" />
|
||||||
|
<result column="business_license_code" jdbcType="VARCHAR" property="businessLicenseCode" />
|
||||||
|
<result column="business_license_address" jdbcType="VARCHAR" property="businessLicenseAddress" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="deleted" jdbcType="TINYINT" property="deleted"/>
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,
|
||||||
|
partner_base_info_id,
|
||||||
|
sign_name
|
||||||
|
mobile,
|
||||||
|
sex,
|
||||||
|
id_card_front,
|
||||||
|
id_card_reverse,
|
||||||
|
id_card_no,
|
||||||
|
id_card_address,
|
||||||
|
current_residence,
|
||||||
|
address_detail,
|
||||||
|
business_license,
|
||||||
|
business_license_code,
|
||||||
|
business_license_address,
|
||||||
|
create_time,
|
||||||
|
update_time,
|
||||||
|
deleted
|
||||||
|
</sql>
|
||||||
|
<insert id="insert" parameterType="com.cool.store.entity.SigningBaseInfoDO" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into xfsg_signing_base_info
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="request.partnerId != null">partner_id,</if>
|
||||||
|
<if test="request.lineId != null">line_id,</if>
|
||||||
|
<if test="request.signName != null">sign_name,</if>
|
||||||
|
<if test="request.mobile != null">mobile,</if>
|
||||||
|
<if test="request.sex != null">sex,</if>
|
||||||
|
<if test="request.idCardFront != null">id_card_front,</if>
|
||||||
|
<if test="request.idCardReverse != null">id_card_reverse,</if>
|
||||||
|
<if test="request.idCardNo != null">id_card_no,</if>
|
||||||
|
<if test="request.idCardAddress != null">id_card_address,</if>
|
||||||
|
<if test="request.currentResidence != null">current_residence,</if>
|
||||||
|
<if test="request.addressDetail != null">address_detail,</if>
|
||||||
|
<if test="request.businessLicense != null">business_license,</if>
|
||||||
|
<if test="request.businessLicenseCode != null">business_license_code,</if>
|
||||||
|
<if test="request.businessLicenseAddress != null">business_license_address,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="request.partnerId != null">#{request.partnerId},</if>
|
||||||
|
<if test="request.lineId != null">#{request.lineId},</if>
|
||||||
|
<if test="request.signName != null">#{request.signName},</if>
|
||||||
|
<if test="request.mobile != null">#{request.mobile},</if>
|
||||||
|
<if test="request.sex != null">#{request.sex},</if>
|
||||||
|
<if test="request.idCardFront != null">#{request.idCardFront},</if>
|
||||||
|
<if test="request.idCardReverse != null">#{request.idCardReverse},</if>
|
||||||
|
<if test="request.idCardNo != null">#{request.idCardNo},</if>
|
||||||
|
<if test="request.idCardAddress != null">#{request.idCardAddress},</if>
|
||||||
|
<if test="request.currentResidence != null">#{request.currentResidence},</if>
|
||||||
|
<if test="request.addressDetail != null">#{request.addressDetail},</if>
|
||||||
|
<if test="request.businessLicense != null">#{request.businessLicense},</if>
|
||||||
|
<if test="request.businessLicenseCode != null">#{request.businessLicenseCode},</if>
|
||||||
|
<if test="request.businessLicenseAddress != null">#{request.businessLicenseAddress},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.cool.store.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SigningBaseInfoDO {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String partnerId;
|
||||||
|
|
||||||
|
private Long lineId;
|
||||||
|
|
||||||
|
private String signName;
|
||||||
|
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
private String idCardFront;
|
||||||
|
|
||||||
|
private String idCardReverse;
|
||||||
|
|
||||||
|
private String idCardNo;
|
||||||
|
|
||||||
|
private String idCardAddress;
|
||||||
|
|
||||||
|
private String currentResidence;
|
||||||
|
|
||||||
|
private String addressDetail;
|
||||||
|
|
||||||
|
private String businessLicense;
|
||||||
|
|
||||||
|
private String businessLicenseCode;
|
||||||
|
|
||||||
|
private String businessLicenseAddress;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.cool.store.request;
|
||||||
|
|
||||||
|
import com.cool.store.entity.SigningBaseInfoDO;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("提交意向签署协议Request")
|
||||||
|
public class IntentAgreementSubmitRequest {
|
||||||
|
|
||||||
|
private String partnerId;
|
||||||
|
|
||||||
|
private Long lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty("签约人姓名")
|
||||||
|
private String signName;
|
||||||
|
@ApiModelProperty("手机号")
|
||||||
|
private String mobile;
|
||||||
|
@ApiModelProperty("1男 2女")
|
||||||
|
private Integer sex;
|
||||||
|
@ApiModelProperty("身份证人像面url")
|
||||||
|
private String idCardFront;
|
||||||
|
@ApiModelProperty("身份证国徽面url")
|
||||||
|
private String idCardReverse;
|
||||||
|
@ApiModelProperty("身份证号")
|
||||||
|
private String idCardNo;
|
||||||
|
@ApiModelProperty("身份证地址")
|
||||||
|
private String idCardAddress;
|
||||||
|
@ApiModelProperty("现居住地")
|
||||||
|
private String currentResidence;
|
||||||
|
@ApiModelProperty("详细地址")
|
||||||
|
private String addressDetail;
|
||||||
|
@ApiModelProperty("营业执照图片")
|
||||||
|
private String businessLicense;
|
||||||
|
@ApiModelProperty("统一社会信用代码")
|
||||||
|
private String businessLicenseCode;
|
||||||
|
@ApiModelProperty("公司地址")
|
||||||
|
private String businessLicenseAddress;
|
||||||
|
|
||||||
|
|
||||||
|
public SigningBaseInfoDO toSigningBaseInfoDO() {
|
||||||
|
SigningBaseInfoDO signingBaseInfoDO = new SigningBaseInfoDO();
|
||||||
|
signingBaseInfoDO.setPartnerId(this.partnerId);
|
||||||
|
signingBaseInfoDO.setLineId(this.lineId);
|
||||||
|
signingBaseInfoDO.setSignName(this.signName);
|
||||||
|
signingBaseInfoDO.setMobile(this.mobile);
|
||||||
|
signingBaseInfoDO.setSex(this.sex);
|
||||||
|
signingBaseInfoDO.setIdCardFront(this.idCardFront);
|
||||||
|
signingBaseInfoDO.setIdCardReverse(this.idCardReverse);
|
||||||
|
signingBaseInfoDO.setIdCardNo(this.idCardNo);
|
||||||
|
signingBaseInfoDO.setIdCardAddress(this.idCardAddress);
|
||||||
|
signingBaseInfoDO.setCurrentResidence(this.currentResidence);
|
||||||
|
signingBaseInfoDO.setAddressDetail(this.addressDetail);
|
||||||
|
signingBaseInfoDO.setBusinessLicense(this.businessLicense);
|
||||||
|
signingBaseInfoDO.setBusinessLicenseCode(this.businessLicenseCode);
|
||||||
|
signingBaseInfoDO.setBusinessLicenseAddress(this.businessLicenseAddress);
|
||||||
|
return signingBaseInfoDO;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.cool.store.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BusinessLicenseInfoVO {
|
||||||
|
@ApiModelProperty("统一社会信用代码")
|
||||||
|
private String registerNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("公司地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
public BusinessLicenseInfoVO(String registerNumber, String address) {
|
||||||
|
this.registerNumber = registerNumber;
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.cool.store.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IdentityCardInfoVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("用户名")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@ApiModelProperty("地址")
|
||||||
|
private String liveAddress;
|
||||||
|
|
||||||
|
@ApiModelProperty("出生日期")
|
||||||
|
private String birthdate;
|
||||||
|
|
||||||
|
@ApiModelProperty("性别")
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
@ApiModelProperty("身份证号")
|
||||||
|
private String idCard;
|
||||||
|
|
||||||
|
@ApiModelProperty("民族")
|
||||||
|
private String nation;
|
||||||
|
|
||||||
|
public IdentityCardInfoVO(String username, String liveAddress, String birthdate, String sex, String idCard, String nation) {
|
||||||
|
this.username = username;
|
||||||
|
this.liveAddress = liveAddress;
|
||||||
|
this.birthdate = birthdate;
|
||||||
|
this.sex = sex;
|
||||||
|
this.idCard = idCard;
|
||||||
|
this.nation = nation;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.enums.IDCardSideEnum;
|
||||||
|
import com.cool.store.exception.ApiException;
|
||||||
|
import com.cool.store.vo.BusinessLicenseInfoVO;
|
||||||
|
import com.cool.store.vo.IdentityCardInfoVO;
|
||||||
|
|
||||||
|
public interface AliyunService {
|
||||||
|
/**
|
||||||
|
* ORC识别身份证信息
|
||||||
|
* @param faceImageUrl
|
||||||
|
* @param sideEnum
|
||||||
|
* @return
|
||||||
|
* @throws ApiException
|
||||||
|
*/
|
||||||
|
IdentityCardInfoVO getIdentityCardInfo(String faceImageUrl, IDCardSideEnum sideEnum) throws ApiException;
|
||||||
|
|
||||||
|
BusinessLicenseInfoVO getBusinessLicenseInfo(String imageUrl) throws ApiException;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.cool.store.service;
|
||||||
|
|
||||||
|
import com.cool.store.request.IntentAgreementSubmitRequest;
|
||||||
|
|
||||||
|
public interface IntentAgreementService {
|
||||||
|
/**
|
||||||
|
* 签署意向协议
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean submit(IntentAgreementSubmitRequest request);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.aliyun.ocr20191230.models.*;
|
||||||
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
|
import com.cool.store.enums.IDCardSideEnum;
|
||||||
|
import com.cool.store.exception.ApiException;
|
||||||
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.service.AliyunService;
|
||||||
|
import com.cool.store.utils.poi.StringUtils;
|
||||||
|
import com.cool.store.vo.BusinessLicenseInfoVO;
|
||||||
|
import com.cool.store.vo.IdentityCardInfoVO;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class AliyunServiceImpl implements AliyunService {
|
||||||
|
|
||||||
|
@Value("${aliyun.accessKeyId:null}")
|
||||||
|
private String accessKeyId;
|
||||||
|
|
||||||
|
@Value("${aliyun.accessKeySecret:null}")
|
||||||
|
private String accessKeySecret;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IdentityCardInfoVO getIdentityCardInfo(String faceImageUrl,
|
||||||
|
IDCardSideEnum sideEnum) throws ApiException {
|
||||||
|
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||||
|
.setAccessKeyId(accessKeyId)
|
||||||
|
.setAccessKeySecret(accessKeySecret);
|
||||||
|
// 访问的域名
|
||||||
|
config.endpoint = "ocr.cn-shanghai.aliyuncs.com";
|
||||||
|
try {
|
||||||
|
com.aliyun.ocr20191230.Client client = new com.aliyun.ocr20191230.Client(config);
|
||||||
|
URL url = new URL(faceImageUrl);
|
||||||
|
InputStream inputStream = url.openConnection().getInputStream();
|
||||||
|
com.aliyun.ocr20191230.models.RecognizeIdentityCardAdvanceRequest recognizeIdentityCardAdvanceRequest = new com.aliyun.ocr20191230.models.RecognizeIdentityCardAdvanceRequest()
|
||||||
|
.setImageURLObject(inputStream)
|
||||||
|
.setSide(sideEnum.getCode());
|
||||||
|
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||||
|
RecognizeIdentityCardResponse idCardResponse = client.recognizeIdentityCardAdvance(recognizeIdentityCardAdvanceRequest, runtime);
|
||||||
|
log.info("身份证解析结果:{}", JSONObject.toJSONString(idCardResponse));
|
||||||
|
RecognizeIdentityCardResponseBody.RecognizeIdentityCardResponseBodyDataFrontResult frontResult = Optional.ofNullable(idCardResponse).map(o -> o.getBody()).map(o -> o.data).map(o -> o.frontResult).orElse(null);
|
||||||
|
if(Objects.nonNull(frontResult)){
|
||||||
|
String username = frontResult.name;
|
||||||
|
String liveAddress = frontResult.address;
|
||||||
|
String birthdate = frontResult.birthDate;
|
||||||
|
if(StringUtils.isNotBlank(birthdate)){
|
||||||
|
birthdate = convertDate(birthdate, "yyyyMMdd");
|
||||||
|
}
|
||||||
|
String sex = frontResult.gender;
|
||||||
|
String idCard = frontResult.IDNumber;
|
||||||
|
String nation = frontResult.nationality;
|
||||||
|
IdentityCardInfoVO result = new IdentityCardInfoVO(username, liveAddress, birthdate, sex, idCard, nation);
|
||||||
|
log.info("身份证解析:{}", JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (com.aliyun.tea.TeaException e) {
|
||||||
|
log.error("身份证解析报错TeaException:{}", e);
|
||||||
|
throw new ApiException(e.getMessage());
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
log.error("身份证解析报错MalformedURLException:{}", e);
|
||||||
|
throw new ApiException(e.getMessage());
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("身份证解析报错IOException:{}", e);
|
||||||
|
throw new ApiException(e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("身份证解析报错Exception:{}", e);
|
||||||
|
throw new ApiException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertDate(String date, String format) {
|
||||||
|
try {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
|
||||||
|
LocalDate localDate = LocalDate.parse(date, formatter);
|
||||||
|
return localDate.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.DATA_CONVERT_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BusinessLicenseInfoVO getBusinessLicenseInfo(String imageUrl) throws ApiException {
|
||||||
|
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||||
|
.setAccessKeyId(accessKeyId)
|
||||||
|
.setAccessKeySecret(accessKeySecret);
|
||||||
|
config.endpoint = "ocr.cn-shanghai.aliyuncs.com";
|
||||||
|
try {
|
||||||
|
com.aliyun.ocr20191230.Client client = new com.aliyun.ocr20191230.Client(config);
|
||||||
|
//非上海区域OSS必须使用流转换后使用
|
||||||
|
URL url = new URL(imageUrl);
|
||||||
|
InputStream inputStream = url.openConnection().getInputStream();
|
||||||
|
RecognizeBusinessLicenseAdvanceRequest recognizeBusinessLicenseRequest = new RecognizeBusinessLicenseAdvanceRequest()
|
||||||
|
.setImageURLObject(inputStream);
|
||||||
|
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
|
||||||
|
// RecognizeBusinessLicenseResponse recognizeBusinessLicenseResponse = client.recognizeBusinessLicenseWithOptions(RecognizeBusinessLicenseAdvanceRequest, runtime);
|
||||||
|
RecognizeBusinessLicenseResponse recognizeBusinessLicenseResponse = client.recognizeBusinessLicenseAdvance(recognizeBusinessLicenseRequest, runtime);
|
||||||
|
log.info("营业执照解析结果:{}", JSONObject.toJSONString(recognizeBusinessLicenseResponse));
|
||||||
|
RecognizeBusinessLicenseResponseBody.RecognizeBusinessLicenseResponseBodyData result = Optional.ofNullable(recognizeBusinessLicenseResponse).map(o -> o.getBody()).map(o -> o.data).orElse(null);
|
||||||
|
if (Objects.nonNull(result)){
|
||||||
|
String address = result.address;
|
||||||
|
String registerNumber = result.registerNumber;
|
||||||
|
BusinessLicenseInfoVO response = new BusinessLicenseInfoVO(registerNumber,address);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (com.aliyun.tea.TeaException e) {
|
||||||
|
log.error("营业执照解析报错TeaException:{}", e);
|
||||||
|
throw new ApiException(e.getMessage());
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
log.error("营业执照解析报错MalformedURLException:{}", e);
|
||||||
|
throw new ApiException(e.getMessage());
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("营业执照解析报错IOException:{}", e);
|
||||||
|
throw new ApiException(e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("营业执照解析报错Exception:{}", e);
|
||||||
|
throw new ApiException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.cool.store.service.impl;
|
||||||
|
|
||||||
|
import com.cool.store.entity.LineInfoDO;
|
||||||
|
import com.cool.store.entity.SigningBaseInfoDO;
|
||||||
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
|
import com.cool.store.enums.WorkflowSubStageStatusEnum;
|
||||||
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.mapper.IntentAgreementMapper;
|
||||||
|
import com.cool.store.mapper.LineInfoMapper;
|
||||||
|
import com.cool.store.request.IntentAgreementSubmitRequest;
|
||||||
|
import com.cool.store.service.IntentAgreementService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class IntentAgreementServiceImpl implements IntentAgreementService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IntentAgreementMapper intentAgreementMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
LineInfoMapper lineInfoMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean submit(IntentAgreementSubmitRequest request) {
|
||||||
|
SigningBaseInfoDO signingBaseInfoDO = request.toSigningBaseInfoDO();
|
||||||
|
boolean submitStatus = intentAgreementMapper.insert(signingBaseInfoDO);
|
||||||
|
if (submitStatus){
|
||||||
|
LineInfoDO lineInfoDO = lineInfoMapper.getByPartnerId(request.getPartnerId());
|
||||||
|
if (Objects.isNull(lineInfoDO)){
|
||||||
|
throw new ServiceException(ErrorCodeEnum.INTERVIEW_PARTNER_NOT_EXIST);
|
||||||
|
}
|
||||||
|
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_60.getCode());
|
||||||
|
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
|
||||||
|
return Boolean.TRUE;
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,8 +46,9 @@ public class JoinIntentionServiceImpl extends LineFlowService implements JoinInt
|
|||||||
}
|
}
|
||||||
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.INTENT_5.getCode());
|
lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.INTENT_5.getCode());
|
||||||
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
|
lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO);
|
||||||
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
return Boolean.TRUE;
|
return Boolean.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -46,11 +46,20 @@ public class SignValidateFilter implements Filter {
|
|||||||
private static AntPathMatcher matcher = new AntPathMatcher();
|
private static AntPathMatcher matcher = new AntPathMatcher();
|
||||||
|
|
||||||
private static List<String> patternList =
|
private static List<String> patternList =
|
||||||
Lists.newArrayList("/web/check/ok","/check/ok",
|
Lists.newArrayList(
|
||||||
"/xfsg/doc.html","/xfsg/favicon.ico","/xfsg/v2/api-docs","/**/test/**",
|
"/web/check/ok",
|
||||||
|
"/check/ok",
|
||||||
|
"/xfsg/doc.html",
|
||||||
|
"/xfsg/favicon.ico",
|
||||||
|
"/xfsg/v2/api-docs","/**/test/**",
|
||||||
"/xfsg/mini/program/oss/getUploadFileConfig",
|
"/xfsg/mini/program/oss/getUploadFileConfig",
|
||||||
"/xfsg/mini/program/v1/partnerManage/partner/getIdentityCardInfo",
|
"/xfsg/mini/program/v1/partnerManage/partner/getIdentityCardInfo",
|
||||||
"/**/swagger*/**", "/**/webjars/**","/xfsg/mini/program/v1/partnerManage/openArea/areaApplyQuery");
|
"/**/swagger*/**",
|
||||||
|
"/**/webjars/**",
|
||||||
|
"/xfsg/mini/program/v1/partnerManage/openArea/areaApplyQuery",
|
||||||
|
"/xfsg/mini/**"
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.cool.store.controller.webc;
|
||||||
|
|
||||||
|
import com.cool.store.request.IntentAgreementSubmitRequest;
|
||||||
|
import com.cool.store.request.JoinIntentionRequest;
|
||||||
|
import com.cool.store.response.ResponseResult;
|
||||||
|
import com.cool.store.service.IntentAgreementService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping({"/mini/IntentAgreement"})
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "小程序意向协议")
|
||||||
|
public class MiniIntentAgreementController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
IntentAgreementService intentAgreementService;
|
||||||
|
|
||||||
|
@PostMapping(path = "/submit")
|
||||||
|
@ApiOperation("签署意向协议")
|
||||||
|
public ResponseResult<Boolean> submit(@RequestBody IntentAgreementSubmitRequest request) {
|
||||||
|
boolean resp = intentAgreementService.submit(request);
|
||||||
|
return ResponseResult.success(resp);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ public class MiniJoinIntentionController {
|
|||||||
@Resource
|
@Resource
|
||||||
private JoinIntentionService joinIntentionService;
|
private JoinIntentionService joinIntentionService;
|
||||||
|
|
||||||
@PostMapping(path = "/getOpenAreaList")
|
@PostMapping(path = "/submit")
|
||||||
@ApiOperation("填写加盟意向申请书")
|
@ApiOperation("填写加盟意向申请书")
|
||||||
public ResponseResult<Boolean> submit(@RequestBody @Valid JoinIntentionRequest request) {
|
public ResponseResult<Boolean> submit(@RequestBody @Valid JoinIntentionRequest request) {
|
||||||
return ResponseResult.success(joinIntentionService.submit(request));
|
return ResponseResult.success(joinIntentionService.submit(request));
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.cool.store.controller.webc;
|
||||||
|
|
||||||
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
|
import com.cool.store.enums.IDCardSideEnum;
|
||||||
|
import com.cool.store.exception.ServiceException;
|
||||||
|
import com.cool.store.response.ResponseResult;
|
||||||
|
import com.cool.store.service.AliyunService;
|
||||||
|
import com.cool.store.vo.BusinessLicenseInfoVO;
|
||||||
|
import com.cool.store.vo.IdentityCardInfoVO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://ocr.console.aliyun.com/overview?spm=5176.6660585.ocr_enterprisecard_public_cn-top.i1.3d657992vcDnCC
|
||||||
|
* 目前接入了身份证识别、营业执照识别
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping({"/mini/orc"})
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "文字识别OCR")
|
||||||
|
public class OcrController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
AliyunService aliyunService;
|
||||||
|
|
||||||
|
@GetMapping(path = "/getIdentityCardInfo")
|
||||||
|
@ApiOperation("根据身份证正面解析获取数据")
|
||||||
|
public ResponseResult<IdentityCardInfoVO> getIdentityCardInfo(@RequestParam(value = "faceImageUrl")String faceImageUrl,
|
||||||
|
@RequestParam("side") IDCardSideEnum sideEnum){
|
||||||
|
try {
|
||||||
|
IdentityCardInfoVO identityCardInfo = aliyunService.getIdentityCardInfo(faceImageUrl, sideEnum);
|
||||||
|
return ResponseResult.success(identityCardInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.IDENTITY_CARD_PARSE_FAIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(path = "/getBusinessLicenseInfo")
|
||||||
|
@ApiOperation("根据营业证照解析获取数据")
|
||||||
|
public ResponseResult<BusinessLicenseInfoVO> getBusinessLicenseInfo(@RequestParam(value = "imageUrl")String imageUrl){
|
||||||
|
try {
|
||||||
|
BusinessLicenseInfoVO businessLicenseInfo = aliyunService.getBusinessLicenseInfo(imageUrl);
|
||||||
|
return ResponseResult.success(businessLicenseInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.BUSINESS_LICENSE_PARSE_FAIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,4 +69,7 @@ xxl.job.accessToken=25365115eed84e9ba5e0040abb255a09
|
|||||||
exhibition.channel.id=52399
|
exhibition.channel.id=52399
|
||||||
recommended.channel.id=52400
|
recommended.channel.id=52400
|
||||||
|
|
||||||
wx.pay.privateKeyPath=D:\\weixin\\apiclient_key.pem
|
wx.pay.privateKeyPath=D:\\weixin\\apiclient_key.pem
|
||||||
|
|
||||||
|
aliyun.accessKeyId=LTAI5tQ6QBnWaB5LaJYz6zcD
|
||||||
|
aliyun.accessKeySecret=spqsOgtfr54cwK861O3N3fInydTgjA
|
||||||
@@ -57,4 +57,7 @@ wx.pay.privateKeyPath=/opt/apps/coolcollege/apiclient/apiclient_key.pem
|
|||||||
wx.pay.merchantSerialNumber=66B8E966AFE796BA06006664FCBFBC3F0E2F5A1B
|
wx.pay.merchantSerialNumber=66B8E966AFE796BA06006664FCBFBC3F0E2F5A1B
|
||||||
wx.pay.apiV3Key=wxpayzhenghu123JKJHkjafWXCertUt1
|
wx.pay.apiV3Key=wxpayzhenghu123JKJHkjafWXCertUt1
|
||||||
wx.pay.payNotifyUrl=https://abstore-api.coolstore.cn/xfsg/mini/wechatPay/payNotify
|
wx.pay.payNotifyUrl=https://abstore-api.coolstore.cn/xfsg/mini/wechatPay/payNotify
|
||||||
wx.pay.backNotifyUrl=https://abstore-api.coolstore.cn/xfsg/mini/wechatPay/refundNotify
|
wx.pay.backNotifyUrl=https://abstore-api.coolstore.cn/xfsg/mini/wechatPay/refundNotify
|
||||||
|
|
||||||
|
aliyun.accessKeyId=LTAI5tQ6QBnWaB5LaJYz6zcD
|
||||||
|
aliyun.accessKeySecret=spqsOgtfr54cwK861O3N3fInydTgjA
|
||||||
Reference in New Issue
Block a user