资质审核流程信息回调接口

This commit is contained in:
pserimal
2023-06-19 18:42:01 +08:00
parent 2820a86d80
commit dd7b77e3ae
18 changed files with 341 additions and 93 deletions

View File

@@ -2,7 +2,6 @@ package com.cool.store.utils;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.lowagie.text.Document; import com.lowagie.text.Document;
import com.lowagie.text.Image; import com.lowagie.text.Image;
@@ -12,8 +11,7 @@ import com.lowagie.text.pdf.PdfWriter;
import java.awt.*; import java.awt.*;
import java.io.*; import java.io.*;
import java.nio.file.Files; import java.util.Date;
import java.nio.file.Paths;
//生成资格面试通过函的工具 //生成资格面试通过函的工具
public class PassLetterUtils { public class PassLetterUtils {
@@ -26,7 +24,7 @@ public class PassLetterUtils {
* @param passCode 通过函编码 * @param passCode 通过函编码
* @param passTime 审批通过时间 * @param passTime 审批通过时间
*/ */
public static ByteArrayOutputStream genPassLetter(String partnerName, String passCode, String verifyCity, DateTime passTime) { public static ByteArrayOutputStream genPassLetter(String partnerName, String passCode, String verifyCity, Date passTime) {
String passTimeStr = DateUtil.format(passTime, "yyyy年MM月dd日"); String passTimeStr = DateUtil.format(passTime, "yyyy年MM月dd日");
Document document = new Document(); Document document = new Document();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
@@ -65,7 +63,7 @@ public class PassLetterUtils {
* 生成 passCode 的方法,拆分出来方便单独获取 passCode * 生成 passCode 的方法,拆分出来方便单独获取 passCode
* @return * @return
*/ */
public static String genPassCode(DateTime passTime) { public static String genPassCode(Date passTime) {
String randomNum = RandomUtil.randomNumbers(5); String randomNum = RandomUtil.randomNumbers(5);
String passCode = "HSAY" + DateUtil.format(passTime, "yyMMdd") + "-" + randomNum; String passCode = "HSAY" + DateUtil.format(passTime, "yyMMdd") + "-" + randomNum;
return passCode; return passCode;

View File

@@ -22,4 +22,11 @@ public interface HyPartnerCertificationInfoMapper {
* dateTime:2023-05-29 03:51 * dateTime:2023-05-29 03:51
*/ */
int updateByPrimaryKeySelective(@Param("record") HyPartnerCertificationInfoDO record); int updateByPrimaryKeySelective(@Param("record") HyPartnerCertificationInfoDO record);
/**
* 根据资质审核流程 id 获取面试会议 id
* @param qualifyVerifyId 资质审核流程 id
* @return 面试会议 id
*/
String getInterviewIdByQualifyVerifyId(@Param("qualifyVerifyId") String qualifyVerifyId);
} }

View File

@@ -79,4 +79,11 @@ public interface HyPartnerInterviewMapper {
* 根据面试 id 查询面试信息 * 根据面试 id 查询面试信息
*/ */
HyPartnerInterviewDO selectByPrimaryKeySelective(String interviewId); HyPartnerInterviewDO selectByPrimaryKeySelective(String interviewId);
/**
* 根据面试 id 获取意向区域
* @param interviewId
* @return
*/
String getVerifyCityByInterviewId(@Param("interviewId") String interviewId);
} }

View File

@@ -84,7 +84,7 @@ public interface HyPartnerInterviewPlanMapper {
/** /**
* 查询面试详情 * 查询面试详情
* *
* @param interviewId * @param interviewPlanId
* @return * @return
*/ */
InterviewVO getInterviewInfo(String interviewPlanId); InterviewVO getInterviewInfo(String interviewPlanId);

View File

@@ -169,6 +169,12 @@
<if test="record.partnership != null"> <if test="record.partnership != null">
partnership = #{record.partnership}, partnership = #{record.partnership},
</if> </if>
<if test="record.qualifyVerifyId != null">
qualify_verify_id = #{record.qualifyVerifyId},
</if>
<if test="record.intentionContractNo != null">
intention_contract_no = #{record.intentionContractNo},
</if>
<if test="record.wantSignTime != null"> <if test="record.wantSignTime != null">
want_sign_time = #{record.wantSignTime}, want_sign_time = #{record.wantSignTime},
</if> </if>
@@ -215,6 +221,21 @@
update_time = #{record.updateTime}, update_time = #{record.updateTime},
</if> </if>
</set> </set>
where id = #{record.id} <where>
1 = 0
<if test="record.id != null">
or id = #{record.id}
</if>
<if test="record.partnerLineId != null">
or partner_id_line_id = #{record.partnerLineId}
</if>
</where>
</update> </update>
<!-- 根据资质审核流程 id 获取面试会议 id -->
<select id="getInterviewIdByQualifyVerifyId" resultType="java.lang.String">
select partner_interview_id
from hy_partner_certification_info
where qualify_verify_id = #{qualifyVerifyId}
</select>
</mapper> </mapper>

View File

@@ -220,8 +220,17 @@
<if test="authCode != null"> <if test="authCode != null">
auth_code = #{authCode}, auth_code = #{authCode},
</if> </if>
<if test="passFileUrl != null"> <if test="passCode != null">
pass_file_url = #{passFileUrl}, pass_code = #{passCode},
</if>
<if test="passPdfUrl != null">
pass_pdf_url = #{passPdfUrl},
</if>
<if test="passImageUrl != null">
pass_image_url = #{passImageUrl},
</if>
<if test="passTime != null">
pass_time = #{passTime},
</if> </if>
<if test="expiryDate != null"> <if test="expiryDate != null">
expiry_date = #{expiryDate}, expiry_date = #{expiryDate},
@@ -250,11 +259,16 @@
<if test="interviewerEnterTime != null"> <if test="interviewerEnterTime != null">
interviewer_enter_time = #{interviewerEnterTime}, interviewer_enter_time = #{interviewerEnterTime},
</if> </if>
<if test="qualifyVerifyId != null">
qualify_verify_id = #{qualifyVerifyId},
</if>
</set> </set>
where id = #{id} <where>
1 = 0
<if test="id != null">
or id = #{id}
</if>
<if test="interviewPlanId != null">
or interview_plan_id = #{interviewPlanId}
</if>
</where>
</update> </update>
<!-- 根据加盟商id查询面试信息 --> <!-- 根据加盟商id查询面试信息 -->
@@ -338,7 +352,7 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from from
hy_partner_intent_info hy_partner_interview
where where
id = #{interviewId} id = #{interviewId}
@@ -364,4 +378,19 @@
WHERE id = #{interviewId} WHERE id = #{interviewId}
</update> </update>
<!-- 根据 interviewId 获取意向区域 -->
<select id="getVerifyCityByInterviewId" resultType="java.lang.String">
SELECT area_path
FROM hy_open_area_info
WHERE id = (
SELECT want_shop_area
FROM hy_partner_intent_info
WHERE partner_line_id = (
SELECT partner_line_id
FROM hy_partner_interview
WHERE id = #{interviewId}
)
)
</select>
</mapper> </mapper>

View File

@@ -247,41 +247,44 @@
<select id="getInterviewList" resultType="com.cool.store.vo.interview.InterviewVO"> <select id="getInterviewList" resultType="com.cool.store.vo.interview.InterviewVO">
select hpip.id as interviewPlanId, select hpip.id as interviewPlanId,
hpip.partner_id as partnerId,
hpui.username as partnerName, hpui.username as partnerName,
hpui.mobile as partnerMobile, hpui.mobile as partnerMobile,
hpip.room_id as roomId, hpip.room_id as roomId,
hpip.start_time as startTime, hpip.start_time as startTime,
hpui.username as interviewerName, hpip.interviewer as interviewerId,
hpui.mobile as interviewerMobile, eu.name as interviewerName,
eu.mobile as interviewerMobile,
hpip.room_status as roomStatus, hpip.room_status as roomStatus,
hpip.end_time as endTime hpip.end_time as endTime
from hy_partner_interview_plan hpip from hy_partner_interview_plan hpip
left join hy_partner_line_info hpll on hpip.partner_line_id = hpll.id left join hy_partner_line_info hpll on hpip.partner_line_id = hpll.id
left join hy_partner_user_info hpui on hpui.partner_id = hpip.partner_id left join hy_partner_user_info hpui on hpui.partner_id = hpip.partner_id
left join enterprise_user eu on hpip.interviewer = eu.user_id
<where> <where>
<if test="record.partnerName !=null and record.partnerName!=''"> <if test="record.partnerName !=null and record.partnerName!=''">
hpui.username like concat('%',#{record.partnerName},'%') hpui.username like concat('%',#{record.partnerName},'%')
</if> </if>
<if test="record.partnerMobile !=null and record.partnerMobile!=''"> <if test="record.partnerMobile !=null and record.partnerMobile!=''">
hpui.mobile like concat('%',#{record.partnerMobile},'%') and hpui.mobile like concat('%',#{record.partnerMobile},'%')
</if> </if>
<if test="record.roomId !=null and record.roomId!=''"> <if test="record.roomId !=null and record.roomId!=''">
hpip.room_id = #{record.roomId} and hpip.room_id = #{record.roomId}
</if> </if>
<if test="record.interviewerName !=null and record.interviewerName!=''"> <if test="record.interviewerName !=null and record.interviewerName!=''">
hpui.username like concat('%',#{record.interviewerName},'%') and hpui.username like concat('%',#{record.interviewerName},'%')
</if> </if>
<if test="record.interviewerMobile !=null and record.interviewerMobile!=''"> <if test="record.interviewerMobile !=null and record.interviewerMobile!=''">
hpui.mobile like concat('%',#{record.interviewerMobile},'%') and hpui.mobile like concat('%',#{record.interviewerMobile},'%')
</if> </if>
<if test="record.roomStatus !=null and record.roomStatus!=''"> <if test="record.roomStatus !=null and record.roomStatus!=''">
hpip.room_status = #{record.roomStatus} and hpip.room_status = #{record.roomStatus}
</if> </if>
<if test="record.startTime !=null and record.startTime!=''"> <if test="record.startTime !=null and record.startTime!=''">
hpip.start_time &lt;= #{record.startTime} and hpip.start_time &gt;= #{record.startTime}
</if> </if>
<if test="record.endTime !=null and record.endTime!=''"> <if test="record.endTime !=null and record.endTime!=''">
hpip.end_time &gt;= #{record.endTime} and hpip.end_time &lt;= #{record.endTime}
</if> </if>
</where> </where>
@@ -289,7 +292,8 @@
<select id="getInterviewInfo" resultType="com.cool.store.vo.interview.InterviewVO"> <select id="getInterviewInfo" resultType="com.cool.store.vo.interview.InterviewVO">
select hpip.id as interviewPlanId, select hpip.id as interviewPlanId,
hpi.id as interviewId, hpi.id as interviewId,
hpi.qualify_verify_id as qualifyVerifyId, hpci.qualify_verify_id as qualifyVerifyId,
hpci.intention_contract_no as intentionContractNo,
hpi.pass_time as passTime, hpi.pass_time as passTime,
hpi.pass_reason as passReason, hpi.pass_reason as passReason,
hpi.recorder as recorderId, hpi.recorder as recorderId,
@@ -317,6 +321,7 @@
left join hy_partner_line_info hpll on hpip.partner_line_id = hpll.id left join hy_partner_line_info hpll on hpip.partner_line_id = hpll.id
left join hy_partner_user_info hpui on hpui.partner_id = hpip.partner_id left join hy_partner_user_info hpui on hpui.partner_id = hpip.partner_id
left join hy_partner_interview hpi on hpip.id = hpi.interview_plan_id left join hy_partner_interview hpi on hpip.id = hpi.interview_plan_id
left join hy_partner_certification_info hpci on hpci.partner_interview_id = hpi.id
where hpip.id = #{interviewPlanId} where hpip.id = #{interviewPlanId}
</select> </select>
<select id="selectBySelective" resultType="com.cool.store.entity.HyPartnerInterviewPlanDO"> <select id="selectBySelective" resultType="com.cool.store.entity.HyPartnerInterviewPlanDO">

View File

@@ -0,0 +1,49 @@
package com.cool.store.dto.mdm;
import lombok.Data;
@Data
public class CallbackDto {
//
// private Owner owner;
//
// private long modifiedTime;
//
// private Creator creator;
//
// private CreatorDepartment creatorDepartment;
//
// private String authCode;
//
// private Modifier modifier;
//
// private int amtDeposit;
//
// private FraSource fraSource;
//
// private String intendedSignerTel;
//
// private String sequenceNo;
//
// private String sequenceStatus;
//
// private String instanceId;
//
// private OwnerDepartment ownerDepartment;
//
// private SelfObject selfObject;
//
// private String name;
//
// private long createdTime;
//
// private String id;
//
// private long intendedSignDate;
//
// private String intendedSigner;
//
// private String systemsource;
}

View File

@@ -33,6 +33,12 @@ public class HyPartnerCertificationInfoDO implements Serializable {
@ApiModelProperty("合作关系:1总部下属;2小区代直营;3县代直营;4县代下属;5区代直营;6区代下属") @ApiModelProperty("合作关系:1总部下属;2小区代直营;3县代直营;4县代下属;5区代直营;6区代下属")
private String partnership; private String partnership;
@ApiModelProperty("资质审核流程id")
private String qualifyVerifyId;
@ApiModelProperty("意向合同编号")
private String intentionContractNo;
@ApiModelProperty("意向签约时间") @ApiModelProperty("意向签约时间")
private Date wantSignTime; private Date wantSignTime;

View File

@@ -54,11 +54,17 @@ public class HyPartnerInterviewDO implements Serializable {
@ApiModelProperty("授权码") @ApiModelProperty("授权码")
private String authCode; private String authCode;
@ApiModelProperty("资质审核流程id") @ApiModelProperty("通过函编码")
private String qualifyVerifyId; private String passCode;
@ApiModelProperty("函文件url") @ApiModelProperty("函文件Pdf url")
private String passFileUrl; private String passPdfUrl;
@ApiModelProperty("函文件image url")
private String passImageUrl;
@ApiModelProperty("审核通过时间")
private Date passTime;
@ApiModelProperty("有效期") @ApiModelProperty("有效期")
private Date expiryDate; private Date expiryDate;

View File

@@ -12,9 +12,9 @@ import lombok.Data;
@Data @Data
@ApiModel @ApiModel
public class GetFreeBusyListReq { public class GetFreeBusyListReq {
@ApiModelProperty("开始时间") @ApiModelProperty(value = "开始时间", required = true)
private String startDate; private String startDate;
@ApiModelProperty("结束时间") @ApiModelProperty(value = "结束时间",required = true)
private String endDate; private String endDate;
@ApiModelProperty("加盟商用户ID") @ApiModelProperty("加盟商用户ID")
private String partnerId; private String partnerId;

View File

@@ -0,0 +1,23 @@
package com.cool.store.request;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api("资质审核回调入参")
public class QualificationCallbackReq {
@ApiModelProperty(value = "审核流程id", required = true)
private String instanceId;
@ApiModelProperty(value = "流程状态 已完成FINISHED, 已作废CANCELED", required = true)
private String sequenceStatus;
@ApiModelProperty(value = "意向签约人", required = true)
private String intendedSigner;
@ApiModelProperty(value = "审核通过时间", required = true)
private long modifiedTime;
}

View File

@@ -2,6 +2,7 @@ package com.cool.store.service;
import com.cool.store.exception.ApiException; import com.cool.store.exception.ApiException;
import com.cool.store.request.CreateQualifyVerifyReq; import com.cool.store.request.CreateQualifyVerifyReq;
import com.cool.store.request.QualificationCallbackReq;
/** /**
* @Author: young.yu * @Author: young.yu
@@ -10,4 +11,6 @@ import com.cool.store.request.CreateQualifyVerifyReq;
*/ */
public interface FlowService { public interface FlowService {
void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException; void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException;
void qualificationCallback(QualificationCallbackReq request);
} }

View File

@@ -2,13 +2,14 @@ package com.cool.store.service.impl;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.cool.store.dao.EnterpriseUserDAO; import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dto.login.UserIdInfoDTO;
import com.cool.store.dto.mdm.AccessTokenDTO; import com.cool.store.dto.mdm.AccessTokenDTO;
import com.cool.store.dto.response.MDMResultDTO; import com.cool.store.dto.response.MDMResultDTO;
import com.cool.store.entity.*; import com.cool.store.entity.*;
import com.cool.store.enums.DataSourceEnum;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.WorkflowStatusEnum; import com.cool.store.enums.WorkflowStatusEnum;
import com.cool.store.exception.ApiException; import com.cool.store.exception.ApiException;
@@ -17,18 +18,28 @@ import com.cool.store.mapper.DingdingUserMapper;
import com.cool.store.mapper.HyPartnerCertificationInfoMapper; import com.cool.store.mapper.HyPartnerCertificationInfoMapper;
import com.cool.store.mapper.HyPartnerInterviewMapper; import com.cool.store.mapper.HyPartnerInterviewMapper;
import com.cool.store.mapper.HyPartnerLineInfoMapper; import com.cool.store.mapper.HyPartnerLineInfoMapper;
import com.cool.store.oss.OSSServer;
import com.cool.store.request.CreateQualifyVerifyReq; import com.cool.store.request.CreateQualifyVerifyReq;
import com.cool.store.request.QualificationCallbackReq;
import com.cool.store.request.RpcCreateQualifyVerfyReq; import com.cool.store.request.RpcCreateQualifyVerfyReq;
import com.cool.store.request.RpcGetMdmTokenReq; import com.cool.store.request.RpcGetMdmTokenReq;
import com.cool.store.service.FlowService; import com.cool.store.service.FlowService;
import com.cool.store.utils.PDFUtils;
import com.cool.store.utils.PassLetterUtils;
import com.cool.store.utils.RedisUtilPool; import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.RestTemplateUtil; import com.cool.store.utils.RestTemplateUtil;
import com.cool.store.vo.PartnerPassLetterDetailVO;
import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -63,7 +74,11 @@ public class FlowServiceImpl implements FlowService {
@Autowired @Autowired
private HyPartnerCertificationInfoMapper hyPartnerCertificationInfoMapper; private HyPartnerCertificationInfoMapper hyPartnerCertificationInfoMapper;
@Autowired
private OSSServer ossServer;
@Override @Override
@Transactional
public void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException { public void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException {
//1.发起加盟商资质审核 //1.发起加盟商资质审核
RpcCreateQualifyVerfyReq rpcRequest = new RpcCreateQualifyVerfyReq(); RpcCreateQualifyVerfyReq rpcRequest = new RpcCreateQualifyVerfyReq();
@@ -96,7 +111,8 @@ public class FlowServiceImpl implements FlowService {
rpcRequest.setIntendedSigner(request.getIntentionSignerUsername()); rpcRequest.setIntendedSigner(request.getIntentionSignerUsername());
rpcRequest.setIntendedSignerTel(request.getIntentionSignerMobile()); rpcRequest.setIntendedSignerTel(request.getIntentionSignerMobile());
String qualifyVerifyId = createQualifyVerify(rpcRequest); //通过 rpc 请求审核系统获取返回数据
Map<String, String> qualifyVerifyRespData = JSON.parseObject(createQualifyVerify(rpcRequest), new TypeReference<HashMap<String,String>>() {});
//2.更新审核信息 //2.更新审核信息
HyPartnerCertificationInfoDO partnerCertificationInfoDO = new HyPartnerCertificationInfoDO(); HyPartnerCertificationInfoDO partnerCertificationInfoDO = new HyPartnerCertificationInfoDO();
partnerCertificationInfoDO.setPartnerId(request.getPartnerId()); partnerCertificationInfoDO.setPartnerId(request.getPartnerId());
@@ -118,6 +134,10 @@ public class FlowServiceImpl implements FlowService {
partnerCertificationInfoDO.setSignerRealControlRelationCert(request.getSignerRealControlRelationCert()); partnerCertificationInfoDO.setSignerRealControlRelationCert(request.getSignerRealControlRelationCert());
partnerCertificationInfoDO.setCreateTime(new Date()); partnerCertificationInfoDO.setCreateTime(new Date());
partnerCertificationInfoDO.setUpdateTime(new Date()); partnerCertificationInfoDO.setUpdateTime(new Date());
//set 资质审核流程id
partnerCertificationInfoDO.setQualifyVerifyId(qualifyVerifyRespData.get("id"));
//set 意向合同编号
partnerCertificationInfoDO.setIntentionContractNo(qualifyVerifyRespData.get("sequenceNo"));
hyPartnerCertificationInfoMapper.updateByPrimaryKeySelective(partnerCertificationInfoDO); hyPartnerCertificationInfoMapper.updateByPrimaryKeySelective(partnerCertificationInfoDO);
//3.更新面试信息 //3.更新面试信息
//根据面试id获取面试信息 //根据面试id获取面试信息
@@ -125,7 +145,6 @@ public class FlowServiceImpl implements FlowService {
if (Objects.isNull(hyPartnerInterviewDO)) { if (Objects.isNull(hyPartnerInterviewDO)) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST); throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST);
} }
hyPartnerInterviewDO.setQualifyVerifyId(qualifyVerifyId);
hyPartnerInterviewDO.setUpdateTime(new Date()); hyPartnerInterviewDO.setUpdateTime(new Date());
//更新 //更新
hyPartnerInterviewDO.setStatus(Integer.valueOf(WorkflowStatusEnum.INTERVIEW_4.getCode())); hyPartnerInterviewDO.setStatus(Integer.valueOf(WorkflowStatusEnum.INTERVIEW_4.getCode()));
@@ -133,15 +152,59 @@ public class FlowServiceImpl implements FlowService {
} }
@Override
@Transactional
public void qualificationCallback(QualificationCallbackReq request) {
//1. 信息是否完整
if (null == request.getSequenceStatus() || "".equals(request.getSequenceStatus())) {
log.error("MDM回调入参缺失request{}", JSON.toJSONString(request));
throw new ServiceException("MDM回调错误");
}
//根据审核流程 id 获取面试会议 id
String interviewId = hyPartnerCertificationInfoMapper.getInterviewIdByQualifyVerifyId(request.getInstanceId());
if (StringUtils.isEmpty(interviewId)) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST);
}
HyPartnerInterviewDO interviewDO = new HyPartnerInterviewDO();
interviewDO.setId(Long.parseLong(interviewId));
//审核通过
if ("FINISHED".equals(request.getSequenceStatus())) {
interviewDO.setStatus(Integer.valueOf(WorkflowStatusEnum.INTERVIEW_6.getCode()));
//2. 准备需要的信息
String partnerName = request.getIntendedSigner();
String verifyCity = hyPartnerInterviewMapper.getVerifyCityByInterviewId(interviewId);
String[] split = verifyCity.split("/");
//根据长度来取市级行政区域
if (split.length == 2) {
verifyCity = split[1];
} else if (split.length == 3) {
verifyCity = split[1];
} else if (split.length == 4) {
verifyCity = split[2];
} else {
throw new ServiceException(ErrorCodeEnum.INTENT_INFO_NOT_EXIST);
}
// TODO pass_reason 暂无
Date passDate = new Date(request.getModifiedTime());
//3. 生成通过函并修改数据库相关信息
genPassLetterAndUpdateDB(partnerName, verifyCity, passDate, interviewId);
//审核未通过
} else if ("CANCELED".equals(request.getSequenceStatus())) {
interviewDO.setStatus(Integer.valueOf(WorkflowStatusEnum.INTERVIEW_7.getCode()));
}
hyPartnerInterviewMapper.updateByPrimaryKeySelective(interviewDO);
}
public String createQualifyVerify(RpcCreateQualifyVerfyReq rpcRequest) throws ApiException{ public String createQualifyVerify(RpcCreateQualifyVerfyReq rpcRequest) throws ApiException{
String url = mdmBaseUrl + "/api/openapi/runtime/form/startFraQualExam"; String url = mdmBaseUrl + "/api/openapi/runtime/form/startFraQualExamWithData";
ResponseEntity<MDMResultDTO> responseEntity = null; ResponseEntity<MDMResultDTO> responseEntity = null;
try { try {
RpcGetMdmTokenReq rpcGetMDMTokenReq = new RpcGetMdmTokenReq(); RpcGetMdmTokenReq rpcGetMDMTokenReq = new RpcGetMdmTokenReq();
// TODO set appKey 与 appSecret
Map<String, String> headers = new HashMap<>(); Map<String, String> headers = new HashMap<>();
headers.put("Authorization", getMdmAccessToken(rpcGetMDMTokenReq)); headers.put("Authorization", getMdmAccessToken(rpcGetMDMTokenReq));
responseEntity = RestTemplateUtil.post(url, headers,rpcRequest, MDMResultDTO.class); responseEntity = RestTemplateUtil.post(url, headers, rpcRequest, MDMResultDTO.class);
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity)); log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
if (Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()) { if (Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()) {
return JSONObject.toJSONString(responseEntity.getBody().getData()); return JSONObject.toJSONString(responseEntity.getBody().getData());
@@ -185,4 +248,41 @@ public class FlowServiceImpl implements FlowService {
String prefix = jobNumber + DateUtil.format(new Date(), "yyyyMMdd"); String prefix = jobNumber + DateUtil.format(new Date(), "yyyyMMdd");
return prefix + redisUtilPool.incrby(prefix, 1, 60 * 60 * 25); return prefix + redisUtilPool.incrby(prefix, 1, 60 * 60 * 25);
} }
/**
* 生成通知函上传 OSS 和修改数据库相应数据
* @return passCode
*/
private void genPassLetterAndUpdateDB(String partnerName, String verifyCity, Date passTime, String interviewId) {
try {
String passCode = PassLetterUtils.genPassCode(passTime);
//生成的 pdf 通过函内存输出流
ByteArrayOutputStream pdfOut = PassLetterUtils.genPassLetter(partnerName, passCode, verifyCity, passTime);
//生成的 pdf 通过函内存输入流
ByteArrayInputStream inputStream = new ByteArrayInputStream(pdfOut.toByteArray());
String passPdfUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + passCode + ".pdf");
//转换为图片
inputStream.reset();
ByteArrayOutputStream imageOut = PDFUtils.pdf2Img(inputStream, 2.0f);
inputStream = new ByteArrayInputStream(imageOut.toByteArray());
//上传 OSS
String passImageUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + passCode + ".png");
//计算有效期截止日期
DateTime expiryDate = DateUtil.offsetDay(passTime, 60);
HyPartnerInterviewDO interviewDO = new HyPartnerInterviewDO();
interviewDO.setId(Long.parseLong(interviewId));
interviewDO.setPassCode(passCode);
interviewDO.setPassTime(passTime);
interviewDO.setExpiryDate(expiryDate);
interviewDO.setPassPdfUrl(passPdfUrl);
interviewDO.setPassImageUrl(passImageUrl);
hyPartnerInterviewMapper.updateByPrimaryKeySelective(interviewDO);
inputStream.close();
pdfOut.close();
imageOut.close();
} catch (Exception e) {
log.error("资格面试通过函生成失败 e{}", e.getMessage());
throw new ServiceException("通过函生成失败!");
}
}
} }

View File

@@ -3,9 +3,6 @@ package com.cool.store.service.impl;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.cool.store.dto.calendar.UpdateCalendarEventDTO;
import com.cool.store.dto.calendar.UserCalendarsEventDTO;
import com.cool.store.dto.partner.EnterInterviewDto; import com.cool.store.dto.partner.EnterInterviewDto;
import com.cool.store.entity.HyPartnerInterviewPlanDO; import com.cool.store.entity.HyPartnerInterviewPlanDO;
import com.cool.store.enums.ErrorCodeEnum; import com.cool.store.enums.ErrorCodeEnum;
@@ -14,27 +11,23 @@ import com.cool.store.exception.ApiException;
import com.cool.store.exception.ServiceException; import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.HyPartnerInterviewMapper; import com.cool.store.mapper.HyPartnerInterviewMapper;
import com.cool.store.mapper.HyPartnerInterviewPlanMapper; import com.cool.store.mapper.HyPartnerInterviewPlanMapper;
import com.cool.store.oss.OSSServer;
import com.cool.store.request.ModifyInterviewTimeReq; import com.cool.store.request.ModifyInterviewTimeReq;
import com.cool.store.service.PartnerInterviewService; import com.cool.store.service.PartnerInterviewService;
import com.cool.store.utils.PDFUtils;
import com.cool.store.utils.PassLetterUtils;
import com.cool.store.utils.TRTCUtils; import com.cool.store.utils.TRTCUtils;
import com.cool.store.vo.EnterInterviewVO; import com.cool.store.vo.EnterInterviewVO;
import com.cool.store.vo.PartnerInterviewInfoVO; import com.cool.store.vo.PartnerInterviewInfoVO;
import com.cool.store.vo.PartnerPassLetterDetailVO; import com.cool.store.vo.PartnerPassLetterDetailVO;
import com.cool.store.vo.interview.InterviewVO; import com.cool.store.vo.interview.InterviewVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.*;
import java.util.Date; import java.util.Date;
import static com.cool.store.utils.PDFUtils.pdf2Img;
@Service @Service
@Slf4j
public class PartnerInterviewServiceImpl implements PartnerInterviewService { public class PartnerInterviewServiceImpl implements PartnerInterviewService {
@Autowired @Autowired
@@ -43,9 +36,6 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
@Autowired @Autowired
private HyPartnerInterviewPlanMapper interviewPlanMapper; private HyPartnerInterviewPlanMapper interviewPlanMapper;
@Autowired
private OSSServer ossServer;
@Value("${trtc.sdkAppId}") @Value("${trtc.sdkAppId}")
private Long sdkAppId; private Long sdkAppId;
@@ -110,17 +100,8 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
} else if (split.length == 4) { } else if (split.length == 4) {
vo.setVerifyCity(split[2]); vo.setVerifyCity(split[2]);
} else { } else {
System.out.println("wrong"); throw new ServiceException(ErrorCodeEnum.INTENT_INFO_NOT_EXIST);
} }
verifyCity = vo.getVerifyCity();
// 调用生成通过函和修改数据库数据的方法
String passCode = genPassLetterAndUpdateDB(vo, interviewPlanId);
//再查一次 vo
vo = interviewMapper.getPassLetterDetail(interviewPlanId);
//有效期为审批通过次日起第 60 天的 23:59:59由此倒推 createTime
DateTime expiryDate = DateUtil.parseDate(vo.getExpiryDate());
DateTime createTime = DateUtil.offsetDay(expiryDate, -60);
vo.setCreateTime(DateUtil.format(createTime, "yyyy-MM-dd"));
vo.setVerifyCity((verifyCity)); vo.setVerifyCity((verifyCity));
return vo; return vo;
} }
@@ -143,37 +124,4 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
interviewPlanMapper.updateByPrimaryKeySelective(record); interviewPlanMapper.updateByPrimaryKeySelective(record);
} }
/**
* 生成通知函上传 OSS 和修改数据库相应数据
* @return passCode
*/
private String genPassLetterAndUpdateDB(PartnerPassLetterDetailVO passLetterDetail, String interviewId) {
//已经有文件 URL 的话就不要再生成了,默认上游全部数据都正确
if (ObjectUtil.isEmpty(passLetterDetail.getPassPdfUrl()) || ObjectUtil.isEmpty(passLetterDetail.getPassImageUrl())) {
try {
DateTime createTime = DateUtil.date();
String code = passLetterDetail.getPassCode() == null ? PassLetterUtils.genPassCode(createTime) : passLetterDetail.getPassCode();
//生成的 pdf 通过函内存输出流
ByteArrayOutputStream pdfOut = PassLetterUtils.genPassLetter(passLetterDetail.getPartnerName(), code, passLetterDetail.getVerifyCity(), createTime);
//生成的 pdf 通过函内存输入流
ByteArrayInputStream inputStream = new ByteArrayInputStream(pdfOut.toByteArray());
String passPdfUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + code + ".pdf");
//转换为图片
inputStream.reset();
ByteArrayOutputStream imageOut = PDFUtils.pdf2Img(inputStream, 2.0f);
inputStream = new ByteArrayInputStream(imageOut.toByteArray());
//上传 OSS
String passImageUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + code + ".png");
//计算有效期截止日期
DateTime expiryDate = DateUtil.offsetDay(createTime, 60);
String expiryDateStr = DateUtil.format(expiryDate, "yyyy-MM-dd") + " 23:59:59";
interviewMapper.updatePassLetterInfo(code, passPdfUrl, passImageUrl, expiryDateStr, interviewId);
inputStream.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return passLetterDetail.getPassCode();
}
} }

View File

@@ -9,6 +9,7 @@ import com.cool.store.service.ContentService;
import com.cool.store.vo.HyContentInfoVO; import com.cool.store.vo.HyContentInfoVO;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +19,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping("news") @RequestMapping("news")
@Api(tags = "动态")
@Slf4j @Slf4j
public class ContentController { public class ContentController {

View File

@@ -3,6 +3,7 @@ package com.cool.store.controller;
import com.cool.store.exception.ApiException; import com.cool.store.exception.ApiException;
import com.cool.store.request.CreateQualifyVerifyReq; import com.cool.store.request.CreateQualifyVerifyReq;
import com.cool.store.request.FinishInterviewReq; import com.cool.store.request.FinishInterviewReq;
import com.cool.store.request.QualificationCallbackReq;
import com.cool.store.response.ResponseResult; import com.cool.store.response.ResponseResult;
import com.cool.store.service.FlowService; import com.cool.store.service.FlowService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -34,8 +35,9 @@ public class FlowController {
@PostMapping("/qualificationReview/callback") @PostMapping("/qualificationReview/callback")
@ApiOperation("流程信息回调接口") @ApiOperation("流程信息回调接口")
public ResponseResult qualificationCallback() { public ResponseResult qualificationCallback(@RequestBody QualificationCallbackReq request) {
return null; flowService.qualificationCallback(request);
return ResponseResult.success();
} }
} }

View File

@@ -0,0 +1,42 @@
package com.cool.store.controller;
import com.cool.store.dto.content.ContentQueryListDto;
import com.cool.store.entity.HyContentInfoDO;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.ContentService;
import com.cool.store.vo.HyContentInfoVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("news")
@Api(tags = "动态")
@Slf4j
public class ContentController {
@Autowired
private ContentService contentService;
@PostMapping("/queryContentList")
@ApiOperation("查询动态列表")
public ResponseResult<PageInfo<HyContentInfoVO>> queryContentList(@RequestBody ContentQueryListDto dto) {
PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
List<HyContentInfoVO> list = contentService.queryContentList(dto);
PageInfo<HyContentInfoVO> page = new PageInfo<>(list);
return ResponseResult.success(page);
}
@PostMapping("/detail")
@ApiOperation("动态详情")
public ResponseResult<HyContentInfoDO> queryContentInfo(@RequestParam String contentId) {
return ResponseResult.success(contentService.queryContentInfo(contentId));
}
}