From 43c04a657f688399ac2f2bee5bdc8c792ebdd198 Mon Sep 17 00:00:00 2001 From: guohb Date: Mon, 25 Mar 2024 17:54:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E7=BD=B2=E6=84=8F=E5=90=91=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cool/store/enums/ErrorCodeEnum.java | 1 + .../enums/WorkflowSubStageStatusEnum.java | 11 +- .../store/mapper/IntentAgreementMapper.java | 12 ++ .../mapper/IntentAgreementMapper.xml | 79 ++++++++++ .../cool/store/entity/SigningBaseInfoDO.java | 46 ++++++ .../request/IntentAgreementSubmitRequest.java | 60 ++++++++ .../cool/store/vo/BusinessLicenseInfoVO.java | 18 +++ .../com/cool/store/vo/IdentityCardInfoVO.java | 35 +++++ .../com/cool/store/service/AliyunService.java | 19 +++ .../store/service/IntentAgreementService.java | 13 ++ .../store/service/impl/AliyunServiceImpl.java | 136 ++++++++++++++++++ .../impl/IntentAgreementServiceImpl.java | 46 ++++++ .../impl/JoinIntentionServiceImpl.java | 3 +- .../cool/store/config/SignValidateFilter.java | 15 +- .../webc/MiniIntentAgreementController.java | 32 +++++ .../webc/MiniJoinIntentionController.java | 2 +- .../store/controller/webc/OcrController.java | 55 +++++++ .../resources/application-local.properties | 5 +- .../src/main/resources/application.properties | 5 +- 19 files changed, 585 insertions(+), 8 deletions(-) create mode 100644 coolstore-partner-dao/src/main/java/com/cool/store/mapper/IntentAgreementMapper.java create mode 100644 coolstore-partner-dao/src/main/resources/mapper/IntentAgreementMapper.xml create mode 100644 coolstore-partner-model/src/main/java/com/cool/store/entity/SigningBaseInfoDO.java create mode 100644 coolstore-partner-model/src/main/java/com/cool/store/request/IntentAgreementSubmitRequest.java create mode 100644 coolstore-partner-model/src/main/java/com/cool/store/vo/BusinessLicenseInfoVO.java create mode 100644 coolstore-partner-model/src/main/java/com/cool/store/vo/IdentityCardInfoVO.java create mode 100644 coolstore-partner-service/src/main/java/com/cool/store/service/AliyunService.java create mode 100644 coolstore-partner-service/src/main/java/com/cool/store/service/IntentAgreementService.java create mode 100644 coolstore-partner-service/src/main/java/com/cool/store/service/impl/AliyunServiceImpl.java create mode 100644 coolstore-partner-service/src/main/java/com/cool/store/service/impl/IntentAgreementServiceImpl.java create mode 100644 coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniIntentAgreementController.java create mode 100644 coolstore-partner-web/src/main/java/com/cool/store/controller/webc/OcrController.java diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java index cfbc8a065..92465f730 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/ErrorCodeEnum.java @@ -52,6 +52,7 @@ public enum ErrorCodeEnum { GET_PHONENUMBER_INFO_ERROR(1021079, "手机号归属地获取异常", null), IDENTITY_CARD_PARSE_FAIL(1021080, "身份证解析失败", null), WECHAT_BIND_OTHER_MOBILE(1021081, "授权号码有误,请核对", null), + BUSINESS_LICENSE_PARSE_FAIL(1021082, "营业证照解析失败", null), PARAMS_REQUIRED(400002, "参数缺失!", null), DATA_CONVERT_ERROR(400002, "日期转换异常!", null), PARENT_NODE_NOT_EXIST(400002, "父节点不存在", null), diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowSubStageStatusEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowSubStageStatusEnum.java index 57a6fa91e..608110a4a 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowSubStageStatusEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowSubStageStatusEnum.java @@ -33,7 +33,7 @@ public enum WorkflowSubStageStatusEnum { SIGN_INTENT_AGREEMENT_60(60,"待补充"), SIGN_INTENT_AGREEMENT_65(65,"不通过"), SIGN_INTENT_AGREEMENT_70(70,"待提交"), - SIGN_INTENT_AGREEMENT_75(75,"待审核"), + SIGN_INTENT_AGREEMENT_75(75,"待OA审核"), 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); } + public WorkflowSubStageStatusEnum getNextStatus(WorkflowSubStageStatusEnum workflowSubStageStatusEnum) { + switch (workflowSubStageStatusEnum) { + case INTENT_0: + return INTENT_5; + default: + return null; + } + } + } diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/mapper/IntentAgreementMapper.java b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/IntentAgreementMapper.java new file mode 100644 index 000000000..d9fdb8a97 --- /dev/null +++ b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/IntentAgreementMapper.java @@ -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); +} diff --git a/coolstore-partner-dao/src/main/resources/mapper/IntentAgreementMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/IntentAgreementMapper.xml new file mode 100644 index 000000000..0b5bb082a --- /dev/null +++ b/coolstore-partner-dao/src/main/resources/mapper/IntentAgreementMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + insert into xfsg_signing_base_info + + partner_id, + line_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, + + + #{request.partnerId}, + #{request.lineId}, + #{request.signName}, + #{request.mobile}, + #{request.sex}, + #{request.idCardFront}, + #{request.idCardReverse}, + #{request.idCardNo}, + #{request.idCardAddress}, + #{request.currentResidence}, + #{request.addressDetail}, + #{request.businessLicense}, + #{request.businessLicenseCode}, + #{request.businessLicenseAddress}, + + + + + \ No newline at end of file diff --git a/coolstore-partner-model/src/main/java/com/cool/store/entity/SigningBaseInfoDO.java b/coolstore-partner-model/src/main/java/com/cool/store/entity/SigningBaseInfoDO.java new file mode 100644 index 000000000..97bef00e7 --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/entity/SigningBaseInfoDO.java @@ -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; + +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/request/IntentAgreementSubmitRequest.java b/coolstore-partner-model/src/main/java/com/cool/store/request/IntentAgreementSubmitRequest.java new file mode 100644 index 000000000..8b5370af1 --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/request/IntentAgreementSubmitRequest.java @@ -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; + } +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/vo/BusinessLicenseInfoVO.java b/coolstore-partner-model/src/main/java/com/cool/store/vo/BusinessLicenseInfoVO.java new file mode 100644 index 000000000..3c192cd9a --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/vo/BusinessLicenseInfoVO.java @@ -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; + } +} diff --git a/coolstore-partner-model/src/main/java/com/cool/store/vo/IdentityCardInfoVO.java b/coolstore-partner-model/src/main/java/com/cool/store/vo/IdentityCardInfoVO.java new file mode 100644 index 000000000..4307cec8c --- /dev/null +++ b/coolstore-partner-model/src/main/java/com/cool/store/vo/IdentityCardInfoVO.java @@ -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; + } +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/AliyunService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/AliyunService.java new file mode 100644 index 000000000..44f76e21c --- /dev/null +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/AliyunService.java @@ -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; +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/IntentAgreementService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/IntentAgreementService.java new file mode 100644 index 000000000..d364848d7 --- /dev/null +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/IntentAgreementService.java @@ -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); + +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/AliyunServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/AliyunServiceImpl.java new file mode 100644 index 000000000..480cfbb33 --- /dev/null +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/AliyunServiceImpl.java @@ -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()); + } + } +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/IntentAgreementServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/IntentAgreementServiceImpl.java new file mode 100644 index 000000000..8bbdc8eaf --- /dev/null +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/IntentAgreementServiceImpl.java @@ -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; + } +} diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/JoinIntentionServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/JoinIntentionServiceImpl.java index 517a41b08..8b5e48b5f 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/JoinIntentionServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/JoinIntentionServiceImpl.java @@ -46,8 +46,9 @@ public class JoinIntentionServiceImpl extends LineFlowService implements JoinInt } lineInfoDO.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.INTENT_5.getCode()); lineInfoMapper.updateByPrimaryKeySelective(lineInfoDO); + return Boolean.TRUE; } - return Boolean.TRUE; + return Boolean.FALSE; } @Override diff --git a/coolstore-partner-web/src/main/java/com/cool/store/config/SignValidateFilter.java b/coolstore-partner-web/src/main/java/com/cool/store/config/SignValidateFilter.java index a200523df..e9cb840c8 100644 --- a/coolstore-partner-web/src/main/java/com/cool/store/config/SignValidateFilter.java +++ b/coolstore-partner-web/src/main/java/com/cool/store/config/SignValidateFilter.java @@ -46,11 +46,20 @@ public class SignValidateFilter implements Filter { private static AntPathMatcher matcher = new AntPathMatcher(); private static List patternList = - Lists.newArrayList("/web/check/ok","/check/ok", - "/xfsg/doc.html","/xfsg/favicon.ico","/xfsg/v2/api-docs","/**/test/**", + Lists.newArrayList( + "/web/check/ok", + "/check/ok", + "/xfsg/doc.html", + "/xfsg/favicon.ico", + "/xfsg/v2/api-docs","/**/test/**", "/xfsg/mini/program/oss/getUploadFileConfig", "/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/**" + + ); /** diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniIntentAgreementController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniIntentAgreementController.java new file mode 100644 index 000000000..8b317ab89 --- /dev/null +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniIntentAgreementController.java @@ -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 submit(@RequestBody IntentAgreementSubmitRequest request) { + boolean resp = intentAgreementService.submit(request); + return ResponseResult.success(resp); + } +} diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniJoinIntentionController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniJoinIntentionController.java index 1a88ea612..73b9ca4e6 100644 --- a/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniJoinIntentionController.java +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniJoinIntentionController.java @@ -24,7 +24,7 @@ public class MiniJoinIntentionController { @Resource private JoinIntentionService joinIntentionService; - @PostMapping(path = "/getOpenAreaList") + @PostMapping(path = "/submit") @ApiOperation("填写加盟意向申请书") public ResponseResult submit(@RequestBody @Valid JoinIntentionRequest request) { return ResponseResult.success(joinIntentionService.submit(request)); diff --git a/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/OcrController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/OcrController.java new file mode 100644 index 000000000..b635db76a --- /dev/null +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webc/OcrController.java @@ -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 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 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); + } + } +} diff --git a/coolstore-partner-web/src/main/resources/application-local.properties b/coolstore-partner-web/src/main/resources/application-local.properties index 56d4f4a29..0f677b006 100644 --- a/coolstore-partner-web/src/main/resources/application-local.properties +++ b/coolstore-partner-web/src/main/resources/application-local.properties @@ -69,4 +69,7 @@ xxl.job.accessToken=25365115eed84e9ba5e0040abb255a09 exhibition.channel.id=52399 recommended.channel.id=52400 -wx.pay.privateKeyPath=D:\\weixin\\apiclient_key.pem \ No newline at end of file +wx.pay.privateKeyPath=D:\\weixin\\apiclient_key.pem + +aliyun.accessKeyId=LTAI5tQ6QBnWaB5LaJYz6zcD +aliyun.accessKeySecret=spqsOgtfr54cwK861O3N3fInydTgjA \ No newline at end of file diff --git a/coolstore-partner-web/src/main/resources/application.properties b/coolstore-partner-web/src/main/resources/application.properties index 99e93b130..b5c433f1b 100644 --- a/coolstore-partner-web/src/main/resources/application.properties +++ b/coolstore-partner-web/src/main/resources/application.properties @@ -57,4 +57,7 @@ wx.pay.privateKeyPath=/opt/apps/coolcollege/apiclient/apiclient_key.pem wx.pay.merchantSerialNumber=66B8E966AFE796BA06006664FCBFBC3F0E2F5A1B wx.pay.apiV3Key=wxpayzhenghu123JKJHkjafWXCertUt1 wx.pay.payNotifyUrl=https://abstore-api.coolstore.cn/xfsg/mini/wechatPay/payNotify -wx.pay.backNotifyUrl=https://abstore-api.coolstore.cn/xfsg/mini/wechatPay/refundNotify \ No newline at end of file +wx.pay.backNotifyUrl=https://abstore-api.coolstore.cn/xfsg/mini/wechatPay/refundNotify + +aliyun.accessKeyId=LTAI5tQ6QBnWaB5LaJYz6zcD +aliyun.accessKeySecret=spqsOgtfr54cwK861O3N3fInydTgjA \ No newline at end of file