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 dfd1268ab..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), @@ -78,31 +79,31 @@ public enum ErrorCodeEnum { TIME_OCCUPIED(500018, "预约时间被占用", null), - INTERVIEW_ENTER_FAIL(1021101, "进入面试间失败", null), + INTERVIEW_ENTER_FAIL(1021101, "进入面审间失败", null), DINGDING_USER_NOT_EXIST(1021102, "用户钉钉信息不存在,无法发起资质审核!", null), - INTERVIEW_NOT_EXIST(1021103, "面试信息不存在!", null), - INTERVIEW_AND_PARTNER_ID_IS_NULL(1021104, "加盟商用户ID&线索ID和面试官ID不能同时为空!", null), - INTERVIEW_PLAN_IS_NULL(1021105, "未查询到相关面试安排!", null), + INTERVIEW_NOT_EXIST(1021103, "面审信息不存在!", null), + INTERVIEW_AND_PARTNER_ID_IS_NULL(1021104, "加盟商用户ID&线索ID和面审官ID不能同时为空!", null), + INTERVIEW_PLAN_IS_NULL(1021105, "未查询到相关面审安排!", null), DATE_PARAMS_IS_ERROR(1021106, "日期参数错误!", null), - INTERVIEW_PLAN_NOT_EXIST(1021107, "面试计划不存在!", null), - FEISHU_DELETE_SCHEDULE_ERROR(1021108, "删除原面试安排失败!", null), - CREATE_CALENDAR_EVENT_FAIL(1021109, "创建面试安排失败!", null), - FEISHU_UPDATE_SCHEDULE_ERROR(1021110, "修改面试安排失败!", null), - INTERVIEW_STATUS_ERROR(1021111, "当前面试状态不允许该操作!", null), - INTERVIEW_PLAN_ALREADY_EXIST(1021112, "面试计划已存在,请勿重复申请!", null), + INTERVIEW_PLAN_NOT_EXIST(1021107, "面审计划不存在!", null), + FEISHU_DELETE_SCHEDULE_ERROR(1021108, "删除原面审安排失败!", null), + CREATE_CALENDAR_EVENT_FAIL(1021109, "创建面审安排失败!", null), + FEISHU_UPDATE_SCHEDULE_ERROR(1021110, "修改面审安排失败!", null), + INTERVIEW_STATUS_ERROR(1021111, "当前面审状态不允许该操作!", null), + INTERVIEW_PLAN_ALREADY_EXIST(1021112, "面审计划已存在,请勿重复申请!", null), INTERVIEW_LINE_ID_IS_NULL(1021113, "线索id为空!", null), - INTERVIEW_INTERVIEW_TIME_IS_UNUSABLE(1021114, "当前预约时间不可用,请和线索用户协商其他时间后确定预约时间\n面试人:{0} 手机号:{1}", null), + INTERVIEW_INTERVIEW_TIME_IS_UNUSABLE(1021114, "当前预约时间不可用,请和线索用户协商其他时间后确定预约时间\n面审人:{0} 手机号:{1}", null), INTERVIEW_PARTNER_NOT_EXIST(1021115, "线索下的加盟商不存在!", null), - INTERVIEW_STATUS_NOT_TRANSFER(1021116, "当前面试状态不允许转让! 面试状态:{0}", null), + INTERVIEW_STATUS_NOT_TRANSFER(1021116, "当前面审状态不允许转让! 面审状态:{0}", null), MOBILE_WECHAT_EXIST(1021116, "此号码已绑定其他微信", null), - ROOM_STATUS_ERROR(10211156, "当前面试房间状态不允许进行该操作!", null), + ROOM_STATUS_ERROR(10211156, "当前面审房间状态不允许进行该操作!", null), MOBILE_APP_NOT_ONLINE_ERROR(10211157, "呼叫失败,请确认呼出号码正确并检查是否安装并打开呼叫插件", null), CALL_RECORD_NOT_EXIST_ERROR(10211158, "通话记录不存在!", null), CALL_UP_ERROR(10211159, "拨出电话异常!", null), CREATE_CALL_REQUEST_ERROR(10211160, "创建电话请求失败!", null), - CREATE_APPOINTMENT_TIME_ERROR(10211161, "当前时间不可预约面试,请选择其他时间", null), + CREATE_APPOINTMENT_TIME_ERROR(10211161, "当前时间不可预约面审,请选择其他时间", null), USER_CHANNEL_NOT_EXISTS(10211162, "当前用户渠道不存在", null), LINE_ALREADY_EXISTS(10211163, "该线索已存在,跟进人为{0}", null), @@ -129,7 +130,7 @@ public enum ErrorCodeEnum { EXHIBITION_NOT_EXIST(106003, "会销不存在或被删除", null), EXHIBITION_NOT_SIGNED(106004, "线索未进行会销签到", null), EXHIBITION_NOT_SUBMIT_INTENTION(106005, "线索未提交意向申请", null), - EXHIBITION_LINE_INTERVIEWED(106006, "线索已预约面试", null), + EXHIBITION_LINE_INTERVIEWED(106006, "线索已预约面审", null), ; diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/InterviewTypeEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/InterviewTypeEnum.java index 2fe72d9e1..75dd2d6dc 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/InterviewTypeEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/InterviewTypeEnum.java @@ -17,7 +17,7 @@ import java.util.List; */ public enum InterviewTypeEnum { - MEET(0, "面谈", 120, 8, 19), + MEET(0, "面谈", 120, 9, 19), INTERVIEW(1, "一面", 30, 9, 18), @@ -91,4 +91,17 @@ public enum InterviewTypeEnum { return result; } + public static WorkflowSubStageStatusEnum getWorkflowSubStageStatus(InterviewTypeEnum interviewType){ + if(MEET.equals(interviewType)){ + return WorkflowSubStageStatusEnum.INVITING_INTERVIEWS_15; + } + if(INTERVIEW.equals(interviewType)){ + return WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_30; + } + if(SECOND_INTERVIEW.equals(interviewType)){ + return WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_105; + } + return null; + } + } diff --git a/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowStageEnum.java b/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowStageEnum.java index c48e5fa77..fb9595acd 100644 --- a/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowStageEnum.java +++ b/coolstore-partner-common/src/main/java/com/cool/store/enums/WorkflowStageEnum.java @@ -13,20 +13,20 @@ import java.util.stream.Collectors; */ public enum WorkflowStageEnum { - INTENT("1","意向申请阶段"), - STORE("2","新店进展"), + INTENT(1,"意向申请阶段"), + STORE(2,"新店进展"), ; - private String code; + private Integer code; private String message; - WorkflowStageEnum(String code, String message) { + WorkflowStageEnum(Integer code, String message) { this.code = code; this.message = message; } - public String getCode() { + public Integer getCode() { return code; } @@ -34,7 +34,7 @@ public enum WorkflowStageEnum { return message; } - protected static final Map map = Arrays.stream(values()).collect( + protected static final Map map = Arrays.stream(values()).collect( Collectors.toMap(WorkflowStageEnum::getCode, Function.identity())); public static WorkflowStageEnum getWorkflowStageByCode(String code) { 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/dao/LineCalendarsEventDAO.java b/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineCalendarsEventDAO.java index 48622a9c0..d37ea717c 100644 --- a/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineCalendarsEventDAO.java +++ b/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineCalendarsEventDAO.java @@ -49,8 +49,8 @@ public class LineCalendarsEventDAO { * @param endTime * @return */ - public Boolean isOccupied(Integer interviewType, Long regionId, String interviewerUserId, String startTime, String endTime){ - return lineCalendarsEventMapper.getOccupiedCount(interviewType, regionId, interviewerUserId, startTime, endTime) > 0; + public Boolean isOccupied(Integer interviewType, Long regionId, String interviewerUserId, String startTime, String endTime, Long excludeInterviewId){ + return lineCalendarsEventMapper.getOccupiedCount(interviewType, regionId, interviewerUserId, startTime, endTime, excludeInterviewId) > 0; } /** diff --git a/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineInfoDAO.java b/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineInfoDAO.java index 9618c79c7..d9dc5abfc 100644 --- a/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineInfoDAO.java +++ b/coolstore-partner-dao/src/main/java/com/cool/store/dao/LineInfoDAO.java @@ -1,6 +1,11 @@ package com.cool.store.dao; import com.cool.store.entity.LineInfoDO; +import com.cool.store.enums.ErrorCodeEnum; +import com.cool.store.enums.WorkflowStageEnum; +import com.cool.store.enums.WorkflowSubStageEnum; +import com.cool.store.enums.WorkflowSubStageStatusEnum; +import com.cool.store.exception.ServiceException; import com.cool.store.mapper.LineInfoMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Repository; @@ -38,6 +43,28 @@ public class LineInfoDAO { return lineInfoMapper.updateByPrimaryKeySelective(param); } + public Integer updateWorkflowStage(Long lineId, WorkflowSubStageEnum workflowSubStage, WorkflowSubStageStatusEnum workflowSubStageStatus) { + if(Objects.isNull(workflowSubStage) && Objects.isNull(workflowSubStageStatus)){ + log.info("更新线索阶段,子阶段 和 子阶段状态不能同时为空"); + throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED); + } + LineInfoDO lineInfo = new LineInfoDO(); + lineInfo.setId(lineId); + lineInfo.setWorkflowSubStage(workflowSubStage.getCode()); + lineInfo.setWorkflowSubStageStatus(workflowSubStageStatus.getCode()); + return lineInfoMapper.updateByPrimaryKeySelective(lineInfo); + } + + public Integer updateWorkflowStageAndInterviewer(Long lineId, WorkflowSubStageStatusEnum workflowSubStageStatus, String firstInterviewer, String secondInterviewer) { + LineInfoDO lineInfo = new LineInfoDO(); + lineInfo.setId(lineId); + lineInfo.setWorkflowSubStageStatus(workflowSubStageStatus.getCode()); + lineInfo.setFirstInterviewer(firstInterviewer); + lineInfo.setSecondInterviewer(secondInterviewer); + return lineInfoMapper.updateByPrimaryKeySelective(lineInfo); + } + + public LineInfoDO getByPartnerId(String partnerId) { LineInfoDO lineInfo = lineInfoMapper.getByPartnerId(partnerId); if(Objects.nonNull(lineInfo) && !lineInfo.getDeleted()){ 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/java/com/cool/store/mapper/LineCalendarsEventMapper.java b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/LineCalendarsEventMapper.java index a20f560d9..c43c6bd40 100644 --- a/coolstore-partner-dao/src/main/java/com/cool/store/mapper/LineCalendarsEventMapper.java +++ b/coolstore-partner-dao/src/main/java/com/cool/store/mapper/LineCalendarsEventMapper.java @@ -16,12 +16,14 @@ public interface LineCalendarsEventMapper extends Mapper { * 被占用次数 * @param interviewType * @param regionId - * @param interviewer + * @param interviewerUserId * @param startTime * @param endTime + * @param excludeInterviewId * @return */ - Integer getOccupiedCount(@Param("interviewType") Integer interviewType, @Param("regionId") Long regionId, @Param("interviewerUserId") String interviewerUserId, @Param("startTime") String startTime, @Param("endTime") String endTime); + Integer getOccupiedCount(@Param("interviewType") Integer interviewType, @Param("regionId") Long regionId, @Param("interviewerUserId") String interviewerUserId, + @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("excludeInterviewId")Long excludeInterviewId); } \ No newline at end of file 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-dao/src/main/resources/mapper/LineCalendarsEventMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/LineCalendarsEventMapper.xml index d8fe1810e..4ccaa3a09 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/LineCalendarsEventMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/LineCalendarsEventMapper.xml @@ -40,5 +40,8 @@ and region_id = #{regionId} + + and id != #{excludeInterviewId} + \ No newline at end of file diff --git a/coolstore-partner-dao/src/main/resources/mapper/LineInterviewMapper.xml b/coolstore-partner-dao/src/main/resources/mapper/LineInterviewMapper.xml index 3bb5c3ded..cd04de858 100644 --- a/coolstore-partner-dao/src/main/resources/mapper/LineInterviewMapper.xml +++ b/coolstore-partner-dao/src/main/resources/mapper/LineInterviewMapper.xml @@ -71,6 +71,9 @@ and b.line_source = #{lineSource} + + and a.start_time between #{interviewStartTime} and #{interviewEndTime} + and a.interviewer_user_id = #{interviewerUserId} 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/LineInterviewService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/LineInterviewService.java index 6778690b9..a603873a2 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/LineInterviewService.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/LineInterviewService.java @@ -89,7 +89,7 @@ public interface LineInterviewService { * @param videoUrlList * @return */ - Boolean uploadVideo(Long interviewId, List videoUrlList); + Integer uploadVideo(Long interviewId, List videoUrlList); /** * 重新预约面审 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/CommonService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/CommonService.java index da0ec6be1..f02063c96 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/CommonService.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/CommonService.java @@ -1,10 +1,14 @@ package com.cool.store.service.impl; +import com.cool.store.dao.EnterpriseUserDAO; +import com.cool.store.enums.UserRoleEnum; import com.cool.store.enums.WorkflowSubStageEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; +import javax.annotation.Resource; + /** * @author zhangchenbiao * @FileName: CommonService @@ -16,9 +20,22 @@ public class CommonService { @Autowired private ApplicationContext applicationContext; + @Resource + private EnterpriseUserDAO enterpriseUserDAO; public LineFlowService getLineFlowService(Integer workflowSubStage){ WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(workflowSubStage); return (LineFlowService)applicationContext.getBean(workflowSubStageEnum.getClazz()); } + + /** + * 获取用户id + * @param areaId 城市id + * @param userRole + * @return + */ + public String getUserIdByAreaAndUserRole(Long areaId, UserRoleEnum userRole){ + //随机一个 + return enterpriseUserDAO.getUserInfoByUserIds(null).stream().findAny().get().getUserId(); + } } 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-service/src/main/java/com/cool/store/service/impl/LineFlowService.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineFlowService.java index 72d477c12..6396e76d3 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineFlowService.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineFlowService.java @@ -12,6 +12,7 @@ import com.cool.store.exception.ServiceException; import com.cool.store.request.AuditPassRequest; import com.cool.store.request.AuditRejectRequest; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; @@ -34,6 +35,7 @@ public abstract class LineFlowService { * @param request * @return */ + @Transactional(rollbackFor = Exception.class) public Boolean auditPass(AuditPassRequest request){ LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId()); if(!lineInfo.getWorkflowSubStage().equals(request.getWorkflowSubStage())){ @@ -55,6 +57,7 @@ public abstract class LineFlowService { * @param request * @return */ + @Transactional(rollbackFor = Exception.class) public Boolean auditReject(AuditRejectRequest request){ LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId()); if(!lineInfo.getWorkflowSubStage().equals(request.getWorkflowSubStage())){ @@ -77,6 +80,7 @@ public abstract class LineFlowService { * @param request * @return */ + @Transactional(rollbackFor = Exception.class) public Boolean auditClose(AuditRejectRequest request){ LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId()); if(!lineInfo.getWorkflowSubStage().equals(request.getWorkflowSubStage())){ @@ -91,8 +95,10 @@ public abstract class LineFlowService { auditInfo.setRejectRealReason(request.getRejectRealReason()); auditInfo.setCertifyFile(JSONObject.toJSONString(request.getCertifyFile())); Long auditId = lineAuditInfoDAO.addAuditInfo(auditInfo); - lineInfo.setLineStatus(LineStatusEnum.PUBLIC_SEAS.getCode()); - lineInfoDAO.updateLineInfo(lineInfo); + LineInfoDO updateLineInfo = new LineInfoDO(); + updateLineInfo.setId(request.getLineId()); + updateLineInfo.setLineStatus(LineStatusEnum.PUBLIC_SEAS.getCode()); + lineInfoDAO.updateLineInfo(updateLineInfo); return auditClose(auditId, lineInfo); } diff --git a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineInterviewServiceImpl.java b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineInterviewServiceImpl.java index 9b77a5155..ff6b309a4 100644 --- a/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineInterviewServiceImpl.java +++ b/coolstore-partner-service/src/main/java/com/cool/store/service/impl/LineInterviewServiceImpl.java @@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.time.LocalDate; @@ -63,6 +64,8 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt private HyOpenAreaInfoDAO hyOpenAreaInfoDAO; @Resource private LineAuditInfoDAO lineAuditInfoDAO; + @Resource + private CommonService commonService; @Override public List getAppointmentTime(Long lineId, Integer interviewType, LocalDate appointmentDate) { @@ -84,6 +87,7 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt } @Override + @Transactional(rollbackFor = Exception.class) public Boolean appointmentTime(AppointmentTimeRequest request) { //查询线索信息 //如果是面谈获取招商经理 如果是面试获取大区经理 @@ -97,17 +101,22 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt throw new ServiceException(ErrorCodeEnum.LINE_STATUS_NOT_ALLOW_OPERATE); } InterviewTypeEnum interviewType = WorkflowSubStageEnum.getInterviewType(lineInfo.getWorkflowSubStage()); - String interviewer = InterviewTypeEnum.MEET.equals(interviewType) ? lineInfo.getInvestmentManager() : InterviewTypeEnum.INTERVIEW.equals(interviewType) ? lineInfo.getFirstInterviewer() : lineInfo.getSecondInterviewer(); - Boolean occupied = lineCalendarsEventDAO.isOccupied(interviewType.getCode(), lineInfo.getRegionId(), interviewer, request.getStartTime(), request.getEndTime()); + UserRoleEnum userRole = InterviewTypeEnum.MEET.equals(interviewType) ? UserRoleEnum.INVESTMENT_MANAGER : UserRoleEnum.REGION_MANAGER; + //获取面试官 + String interviewerUserId = InterviewTypeEnum.MEET.equals(interviewType) ? lineInfo.getInvestmentManager() : commonService.getUserIdByAreaAndUserRole(lineInfo.getWantShopAreaId(), userRole); + String firstInterviewer = InterviewTypeEnum.INTERVIEW.equals(interviewType) ? interviewerUserId : null; + String secondInterviewer = InterviewTypeEnum.SECOND_INTERVIEW.equals(interviewType) ? interviewerUserId : null; + Boolean occupied = lineCalendarsEventDAO.isOccupied(interviewType.getCode(), lineInfo.getRegionId(), interviewerUserId, request.getStartTime(), request.getEndTime(), null); if(occupied){ throw new ServiceException(ErrorCodeEnum.TIME_OCCUPIED); } Date startTime = DateUtils.strToDate(request.getStartTime(), DateUtils.YYYY_MM_DD_HH_MM_SS); Date endTime = DateUtils.strToDate(request.getEndTime(), DateUtils.YYYY_MM_DD_HH_MM_SS); - LineCalendarsEventDO calendarsEvent = LineCalendarsEventDO.convertDO(lineInfo, interviewType.getCode(), startTime, endTime, interviewer); + LineCalendarsEventDO calendarsEvent = LineCalendarsEventDO.convertDO(lineInfo, interviewType.getCode(), startTime, endTime, interviewerUserId); Long eventId = lineCalendarsEventDAO.addCalendarsEvent(calendarsEvent); + WorkflowSubStageStatusEnum workflowSubStageStatus = InterviewTypeEnum.getWorkflowSubStageStatus(interviewType); //跟新线索状态为已预约 - lineInfoDAO.updateLineInfo(lineInfo); + lineInfoDAO.updateWorkflowStageAndInterviewer(lineInfo.getId(), workflowSubStageStatus, firstInterviewer, secondInterviewer); LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfo(lineInfo.getId(), interviewType); if(Objects.nonNull(interviewInfo)){ if(!WorkflowSubStageStatusEnum.isReappointmentStatus(lineInfo.getWorkflowSubStageStatus())){ @@ -117,12 +126,13 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt //删除该面试记录 lineInterviewDAO.deleteInterviewInfo(interviewInfo.getId()); } - LineInterviewDO addInterview = LineInterviewDO.convertDO(lineInfo, startTime, endTime, UUIDUtils.get8UUID(), interviewer, interviewType.getCode(), eventId); + LineInterviewDO addInterview = LineInterviewDO.convertDO(lineInfo, startTime, endTime, UUIDUtils.get8UUID(), interviewerUserId, interviewType.getCode(), eventId); lineInterviewDAO.addInterviewInfo(addInterview); return Boolean.TRUE; } @Override + @Transactional(rollbackFor = Exception.class) public Boolean modifyAppointmentTime(AppointmentTimeRequest request) { LineInfoDO lineInfo = lineInfoDAO.getLineInfo(request.getLineId()); if(Objects.isNull(lineInfo)){ @@ -144,6 +154,10 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt } Date startTime = DateUtils.strToDate(request.getStartTime(), DateUtils.YYYY_MM_DD_HH_MM_SS); Date endTime = DateUtils.strToDate(request.getEndTime(), DateUtils.YYYY_MM_DD_HH_MM_SS); + Boolean occupied = lineCalendarsEventDAO.isOccupied(interviewType.getCode(), lineInfo.getRegionId(), interviewInfo.getInterviewerUserId(), request.getStartTime(), request.getEndTime(), interviewInfo.getId()); + if(occupied){ + throw new ServiceException(ErrorCodeEnum.TIME_OCCUPIED); + } interviewInfo.setInterviewDate(startTime); interviewInfo.setStartTime(startTime); interviewInfo.setEndTime(endTime); @@ -227,6 +241,7 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt } @Override + @Transactional(rollbackFor = Exception.class) public Integer finishInterview(Long interviewId, String userId) { LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfoById(interviewId); if(Objects.isNull(interviewInfo)){ @@ -236,20 +251,25 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt if (interviewInfo.getRoomStatus().equals(RoomStatus.CLOSED.getCode())) { throw new ServiceException(ErrorCodeEnum.ROOM_STATUS_ERROR); } - interviewInfo.setRoomStatus(RoomStatus.CLOSED.getCode()); - interviewInfo.setActualEndTime(new Date()); - interviewInfo.setInterviewStatus(InterviewStatusEnum.WAIT_AUDIT.getCode()); + LineInfoDO lineInfo = lineInfoDAO.getLineInfo(interviewInfo.getLineId()); + if(!WorkflowSubStageEnum.isReappointmentStage(lineInfo.getWorkflowSubStage())){ + throw new ServiceException(ErrorCodeEnum.LINE_STATUS_NOT_ALLOW_OPERATE); + } + LineInterviewDO updateInterviewInfo = new LineInterviewDO(); + updateInterviewInfo.setId(interviewId); + updateInterviewInfo.setRoomStatus(RoomStatus.CLOSED.getCode()); + updateInterviewInfo.setActualEndTime(new Date()); + updateInterviewInfo.setInterviewStatus(InterviewStatusEnum.WAIT_AUDIT.getCode()); //更新线索状态 - LineInfoDO lineInfo = new LineInfoDO(); - lineInfo.setId(interviewInfo.getLineId()); + WorkflowSubStageStatusEnum workflowSubStageStatus = null; if(InterviewTypeEnum.INTERVIEW.getCode().equals(interviewInfo.getInterviewType())){ - lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_35.getCode()); + workflowSubStageStatus = WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_35; } if(InterviewTypeEnum.SECOND_INTERVIEW.getCode().equals(interviewInfo.getInterviewType())){ - lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_110.getCode()); + workflowSubStageStatus = WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_110; } - lineInfoDAO.updateLineInfo(lineInfo); - return lineInterviewDAO.updateInterviewInfo(interviewInfo); + lineInfoDAO.updateWorkflowStage(interviewInfo.getLineId(), null, workflowSubStageStatus); + return lineInterviewDAO.updateInterviewInfo(updateInterviewInfo); } @Override @@ -271,7 +291,7 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt } @Override - public Boolean uploadVideo(Long interviewId, List videoUrlList) { + public Integer uploadVideo(Long interviewId, List videoUrlList) { LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfoById(interviewId); if(Objects.isNull(interviewInfo)){ throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST); @@ -281,8 +301,10 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt videoList = new ArrayList<>(); } videoList.addAll(videoUrlList); - interviewInfo.setVideoUrl(JSONObject.toJSONString(videoList.stream().distinct().collect(Collectors.toList()))); - return lineInterviewDAO.updateInterviewInfo(interviewInfo) > 0; + LineInterviewDO updateInterviewInfo = new LineInterviewDO(); + updateInterviewInfo.setId(interviewId); + updateInterviewInfo.setVideoUrl(JSONObject.toJSONString(videoList.stream().distinct().collect(Collectors.toList()))); + return lineInterviewDAO.updateInterviewInfo(updateInterviewInfo); } @Override @@ -295,15 +317,14 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt log.info("当前线索状态不允许重新预约"); throw new ServiceException(ErrorCodeEnum.LINE_STATUS_NOT_ALLOW_OPERATE); } - Integer workflowSubStageStatus = null; + WorkflowSubStageStatusEnum workflowSubStageStatus = null; if(WorkflowSubStageEnum.FIRST_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - workflowSubStageStatus = WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_41.getCode(); + workflowSubStageStatus = WorkflowSubStageStatusEnum.FIRST_INTERVIEWS_41; } if(WorkflowSubStageEnum.SECOND_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - workflowSubStageStatus = WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_120.getCode(); + workflowSubStageStatus = WorkflowSubStageStatusEnum.SECOND_INTERVIEWS_120; } - lineInfo.setWorkflowSubStageStatus(workflowSubStageStatus); - return lineInfoDAO.updateLineInfo(lineInfo); + return lineInfoDAO.updateWorkflowStage(lineInfo.getId(), null, workflowSubStageStatus); } @@ -314,44 +335,33 @@ public class LineInterviewServiceImpl extends LineFlowService implements LineInt @Override protected Boolean auditPass(Long auditId, LineInfoDO lineInfo) { - InterviewTypeEnum interviewType = null; + InterviewTypeEnum interviewType = WorkflowSubStageEnum.getInterviewType(lineInfo.getWorkflowSubStage()); WorkflowSubStageEnum workflowSubStageEnum = WorkflowSubStageEnum.getWorkflowSubStageEnum(lineInfo.getWorkflowSubStage()); WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage(); - Integer nextStageInitStatus = nextStage.getInitStatus().getCode(); - if(WorkflowSubStageEnum.INVITING_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.MEET; - } - if(WorkflowSubStageEnum.FIRST_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.INTERVIEW; - } - if(WorkflowSubStageEnum.SECOND_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.SECOND_INTERVIEW; - nextStageInitStatus = InterviewStatusEnum.PASS.getCode(); - } LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfo(lineInfo.getId(), interviewType); - interviewInfo.setAuditId(auditId); - interviewInfo.setInterviewStatus(InterviewStatusEnum.PASS.getCode()); - lineInfo.setWorkflowSubStage(nextStage.getCode()); - lineInfo.setWorkflowSubStageStatus(nextStageInitStatus); - lineInfoDAO.updateLineInfo(lineInfo); - return lineInterviewDAO.updateInterviewInfo(interviewInfo) > 0; + if(Objects.isNull(interviewInfo)){ + throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST); + } + LineInterviewDO updateInterviewInfo = new LineInterviewDO(); + updateInterviewInfo.setId(interviewInfo.getId()); + updateInterviewInfo.setAuditId(auditId); + updateInterviewInfo.setInterviewStatus(InterviewStatusEnum.PASS.getCode()); + //更新线索阶段 + lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus()); + return lineInterviewDAO.updateInterviewInfo(updateInterviewInfo) > 0; } @Override protected Boolean auditReject(Long auditId, LineInfoDO lineInfo) { - InterviewTypeEnum interviewType = null; - if(WorkflowSubStageEnum.INVITING_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.MEET; - } - if(WorkflowSubStageEnum.FIRST_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.INTERVIEW; - } - if(WorkflowSubStageEnum.SECOND_INTERVIEWS.getCode().equals(lineInfo.getWorkflowSubStage())){ - interviewType = InterviewTypeEnum.SECOND_INTERVIEW; - } + InterviewTypeEnum interviewType = WorkflowSubStageEnum.getInterviewType(lineInfo.getWorkflowSubStage()); LineInterviewDO interviewInfo = lineInterviewDAO.getInterviewInfo(lineInfo.getId(), interviewType); - interviewInfo.setAuditId(auditId); - interviewInfo.setInterviewStatus(InterviewStatusEnum.NOT_PASS.getCode()); + if(Objects.isNull(interviewInfo)){ + throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST); + } + LineInterviewDO updateInterviewInfo = new LineInterviewDO(); + updateInterviewInfo.setId(interviewInfo.getId()); + updateInterviewInfo.setAuditId(auditId); + updateInterviewInfo.setInterviewStatus(InterviewStatusEnum.NOT_PASS.getCode()); return lineInterviewDAO.updateInterviewInfo(interviewInfo) > 0; } 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/webb/PCLineInterviewController.java b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCLineInterviewController.java index 1cfc7c2e5..366341a1f 100644 --- a/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCLineInterviewController.java +++ b/coolstore-partner-web/src/main/java/com/cool/store/controller/webb/PCLineInterviewController.java @@ -78,8 +78,7 @@ public class PCLineInterviewController { @ApiOperation("上传文件") @GetMapping("/upload/video") public ResponseResult uploadVideo(@RequestParam("interviewId")Long interviewId, @RequestParam("videoUrlList") List videoUrlList) throws ApiException { - Boolean result = lineInterviewService.uploadVideo(interviewId, videoUrlList); - return ResponseResult.success(result); + return ResponseResult.success(lineInterviewService.uploadVideo(interviewId, videoUrlList)); } @ApiOperation("重新面审") 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