意向加盟合同审核结果回调
This commit is contained in:
@@ -70,6 +70,11 @@
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun.openservices</groupId>
|
||||
<artifactId>ons-client</artifactId>
|
||||
|
||||
@@ -0,0 +1,285 @@
|
||||
package com.cool.store.utils;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class EncryptUtil {
|
||||
|
||||
/** Base64 编码 */
|
||||
private static final Base64 B64 = new Base64();
|
||||
/** 安全的随机数源 */
|
||||
private static final SecureRandom RANDOM = new SecureRandom();
|
||||
/** AES加密算法 */
|
||||
private static final String AES_ALGORITHM = "AES";
|
||||
|
||||
private static final String AES = "AES/ECB/PKCS5Padding";
|
||||
|
||||
|
||||
public static String MD5(String str) {
|
||||
String re_md5 = "";
|
||||
try {
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(str.getBytes());
|
||||
byte b[] = md.digest();
|
||||
|
||||
int i;
|
||||
|
||||
StringBuilder buf = new StringBuilder("");
|
||||
for (byte aB : b) {
|
||||
i = aB;
|
||||
if (i < 0) {
|
||||
i += 256;
|
||||
}
|
||||
if (i < 16) {
|
||||
buf.append("0");
|
||||
}
|
||||
buf.append(Integer.toHexString(i));
|
||||
}
|
||||
re_md5 = buf.toString();
|
||||
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return re_md5;
|
||||
}
|
||||
|
||||
public static String maskMail(String mail) {
|
||||
if (Strings.isNullOrEmpty(mail)) {
|
||||
return mail;
|
||||
}
|
||||
if (!mail.contains("@")) {
|
||||
return mail;
|
||||
}
|
||||
String[] arrays = mail.split("@");
|
||||
String account = arrays[0];
|
||||
String domain = arrays[1];
|
||||
Integer len = account.length();
|
||||
if (len <= 2) return mail;
|
||||
if (len <= 4) {
|
||||
account = account.substring(0, 2) + "****";
|
||||
} else {
|
||||
String left = account.substring(0, 2);
|
||||
String right = account.substring(len - 2, len);
|
||||
account = left + "****" + right;
|
||||
}
|
||||
return account + "@" + domain;
|
||||
}
|
||||
|
||||
public static String maskMobile(String mobile) {
|
||||
if (Strings.isNullOrEmpty(mobile)) {
|
||||
return mobile;
|
||||
}
|
||||
if (mobile.length() < 11) {
|
||||
return mobile;
|
||||
}
|
||||
return mobile.substring(0, 3) + "****" + mobile.substring(7, 11);
|
||||
}
|
||||
|
||||
public static String mask(String str) {
|
||||
if (Strings.isNullOrEmpty(str)) {
|
||||
return str;
|
||||
}
|
||||
|
||||
int len = str.length();
|
||||
|
||||
if (len < 5) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return str.substring(0, 2) + "****" + str.substring(len - 2, len);
|
||||
}
|
||||
|
||||
/**
|
||||
* AES加密
|
||||
*
|
||||
* @param str
|
||||
* 需要加密的明文
|
||||
* @param key
|
||||
* 密钥
|
||||
* @return 加密后的密文(str / key为null返回null)
|
||||
*/
|
||||
public static String aesEncryp(String str, String key) {
|
||||
return aesEncryp(str, key, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AES加密
|
||||
*
|
||||
* @param str
|
||||
* 需要加密的明文
|
||||
* @param key
|
||||
* 密钥
|
||||
* @param urlSafety
|
||||
* 密文是否需要Url安全
|
||||
* @return 加密后的密文(str / key为null返回null)
|
||||
*/
|
||||
public static String aesEncryp(String str, String key, boolean urlSafety) {
|
||||
if (null != str && null != key) {
|
||||
try {
|
||||
Cipher c = Cipher.getInstance(AES);
|
||||
c.init(Cipher.ENCRYPT_MODE, aesKey(key), RANDOM);
|
||||
// 加密
|
||||
byte[] bytes = c.doFinal(str.getBytes("UTF-8"));
|
||||
if (urlSafety) {
|
||||
return Base64.encodeBase64URLSafeString(bytes);
|
||||
} else {
|
||||
return new String(B64.encode(bytes));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return new BaseOut(2, "AES加密失败, 密文:" + str + ", key:" + key, null).toString();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* AES解密
|
||||
*
|
||||
* @param str
|
||||
* 需要解密的密文(base64编码字符串)
|
||||
* @param key
|
||||
* 密钥
|
||||
* @return 解密后的明文
|
||||
*/
|
||||
public static BaseOut aesDecrypt(String str, String key) {
|
||||
if (null != str && null != key) {
|
||||
try {
|
||||
Cipher c = Cipher.getInstance(AES);
|
||||
c.init(Cipher.DECRYPT_MODE, aesKey(key), RANDOM);
|
||||
// 解密
|
||||
return new BaseOut(0, "解密成功", new String(c.doFinal(B64.decode(str)), "UTF-8"));
|
||||
} catch (BadPaddingException e) {
|
||||
return new BaseOut(2, "AES解密失败, 密文:" + str + ", key:" + key, null);
|
||||
} catch (Exception e) {
|
||||
return new BaseOut(2, "AES解密失败, 密文:" + str + ", key:" + key, null);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/** AES密钥 */
|
||||
private static SecretKeySpec aesKey(String key) {
|
||||
byte[] bs = key.getBytes();
|
||||
if (bs.length != 16) {
|
||||
bs = Arrays.copyOf(bs, 16);// 处理数组长度为16
|
||||
}
|
||||
return new SecretKeySpec(bs, AES_ALGORITHM);
|
||||
}
|
||||
|
||||
public static String oaMd5() {
|
||||
String key = "coolcollege20201211sc";
|
||||
String thirdSecret = "135990bd839c5fe0a1ca9cbee2475431";
|
||||
return MD5(key + thirdSecret);
|
||||
}
|
||||
|
||||
public static String oaB2gnMd5() {
|
||||
String key = "coolStore_buErJia_20220425";
|
||||
String thirdSecret = "d14cc076b44b435ea0ab06d0b7e04ea8";
|
||||
return MD5(key + thirdSecret);
|
||||
}
|
||||
|
||||
public static String oaMd5(String param) {
|
||||
String key = "coolstore20220329";
|
||||
String thirdSecret = "d14cc076b44b435ea0ab06d0b7e04ea8";
|
||||
return MD5(key + thirdSecret + param);
|
||||
}
|
||||
|
||||
public static String xfsgMd5(String param) {
|
||||
String key = "coolstorexfsg20240329";
|
||||
return MD5(key + param);
|
||||
}
|
||||
|
||||
public static String getData(String ticket) {
|
||||
BaseOut result = aesDecrypt(ticket, oaMd5());
|
||||
if(result == null || result.getCode() != 0){
|
||||
return null;
|
||||
}
|
||||
return result.getData().toString();
|
||||
}
|
||||
|
||||
public static String getB2gnData(String ticket) {
|
||||
BaseOut result = aesDecrypt(ticket, oaB2gnMd5());
|
||||
if(result == null || result.getCode() != 0){
|
||||
return null;
|
||||
}
|
||||
return result.getData().toString();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
//签名
|
||||
StringBuffer sb = new StringBuffer();
|
||||
//用户唯一标识id
|
||||
sb.append("userId=132537313837929006").append("&");
|
||||
//企业唯一标识enterpriseId
|
||||
sb.append("enterpriseId=45f92210375346858b6b6694967f44de").append("&");
|
||||
sb.append("bizContent={\"taskList\":[{\"taskName\":\"阿斯顿\",\"taskType\":\"QUESTION_ORDER\",\"taskDesc\":\"测试\",\"attachUrl\":\"{\\\"id\\\":149,\\\"fileName\\\":\\\"新建 DOC 文档.doc\\\",\\\"url\\\":\\\"https://oss-store.coolcollege.cn/doc/sop/45471386126883973.doc\\\",\\\"type\\\":\\\"doc\\\",\\\"category\\\":\\\"doc\\\",\\\"createUserId\\\":\\\"0327344625645542\\\",\\\"createUser\\\":\\\"不易\\\",\\\"createTime\\\":1642692983000,\\\"visibleUser\\\":\\\"\\\",\\\"visibleRole\\\":\\\"\\\",\\\"visibleUserName\\\":\\\"\\\",\\\"visibleRoleName\\\":\\\"\\\"}\",\"taskInfo\":\"{\\\"photos\\\":[\\\"https://oss-store.coolcollege.cn/eid/45f92210375346858b6b6694967f44de/2203/5fc6b6f2cd2243588272992382452bb4.jpg\\\"],\\\"videos\\\":\\\"{\\\\\\\"videoList\\\\\\\":[]}\\\",\\\"contentLearnFirst\\\":false,\\\"courseList\\\":[]}\",\"beginTime\":1648546065361,\"endTime\":1649150454152,\"beginTime\":1648546065361,\"endTime\":1649150454152,\"form\":[{\"type\":\"STANDARD_COLUMN\",\"value\":4324,\"name\":\"奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员奥尔业务员\"}],\"storeIds\":[{\"type\":\"store\",\"value\":\"c61119bf721940f098169ec4d065e79a\"}],\"process\":[{\"nodeNo\":1,\"user\":[{\"type\":\"person\",\"value\":\"132537313837929006\"}],\"approveType\":\"any\"},{\"nodeNo\":2,\"user\":[{\"type\":\"person\",\"value\":\"132537313837929006\"}],\"approveType\":\"any\"},{\"nodeNo\":3,\"user\":[{\"type\":\"person\",\"value\":\"132537313837929006\"}],\"approveType\":\"any\"},{\"nodeNo\":\"cc\",\"user\":[{\"type\":\"person\",\"value\":\"132537313837929006\"}],\"approveType\":\"any\"}]}]}");
|
||||
//sb.append("bizContent={\"pageNumber\":\"1\",\"pageSize\":\"10\",\"storeId\":\"888ab0bddac5432e9b037078366598d6\"}");
|
||||
//加密
|
||||
String sign = oaMd5(sb.toString());
|
||||
System.out.println("sign:" + sign);
|
||||
}
|
||||
}
|
||||
|
||||
class BaseOut {
|
||||
|
||||
private int code = 0;
|
||||
|
||||
private String msg;
|
||||
|
||||
private Object data;
|
||||
|
||||
public BaseOut() {
|
||||
}
|
||||
|
||||
public BaseOut(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public BaseOut(int code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public BaseOut(int code, String msg, Object data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@ public interface IntentAgreementMapper {
|
||||
*/
|
||||
SigningBaseInfoDO judge(@Param("request") IntentAgreementSubmitRequest request);
|
||||
|
||||
void updateAuditId(@Param("lineId") Long id,
|
||||
@Param("auditId") Long auditId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询签约信息
|
||||
* @param lineIds
|
||||
|
||||
@@ -53,5 +53,9 @@ public interface LineInfoMapper extends Mapper<LineInfoDO> {
|
||||
*/
|
||||
List<LineInfoDO> publicLineList(@Param("request") PublicLineListRequest publicLineListRequest);
|
||||
|
||||
/**
|
||||
* 根据lineId判断是更新还是插入
|
||||
* @param lineInfoParam
|
||||
*/
|
||||
void insertOrUpdate(@Param("param") LineInfoDO lineInfoParam);
|
||||
}
|
||||
@@ -76,6 +76,11 @@
|
||||
<if test="request.businessLicenseAddress != null">#{request.businessLicenseAddress},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateAuditId">
|
||||
update xfsg_signing_base_info
|
||||
set audit_id = #{auditId}
|
||||
where line_id = #{lineId}
|
||||
</update>
|
||||
<select id="selectByPartnerIdOrLineId" resultType="com.cool.store.entity.SigningBaseInfoDO">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cool.store.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("意向加盟合同审核结果请求体")
|
||||
public class AuditResultRequest {
|
||||
|
||||
@ApiModelProperty("kdz业务id唯一标识")
|
||||
private String kdzBusinessId;
|
||||
|
||||
@ApiModelProperty("审核结果 1:成功 0:失败")
|
||||
private Integer auditResult;
|
||||
|
||||
@ApiModelProperty("失败真实原因(审核结果为0时填写)")
|
||||
private String failureCause;
|
||||
|
||||
@ApiModelProperty("通过/失败原因")
|
||||
private String cause;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.cool.store.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class XfsgOpenApiRequest {
|
||||
|
||||
private String sign;
|
||||
|
||||
private Long timestamp;
|
||||
|
||||
private String bizContent;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.request.AuditResultRequest;
|
||||
|
||||
public interface KdzApiService {
|
||||
boolean auditResult(AuditResultRequest request);
|
||||
}
|
||||
@@ -89,8 +89,8 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
|
||||
@Override
|
||||
protected Boolean auditPass(Long auditId, LineInfoDO lineInfo) {
|
||||
//校验是否是审核节点
|
||||
if ((lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) ||
|
||||
lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))){
|
||||
if (!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) &&
|
||||
!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())){
|
||||
throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE);
|
||||
}
|
||||
//待审核code 63 处理逻辑
|
||||
@@ -104,14 +104,22 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
|
||||
WorkflowSubStageEnum nextStage = workflowSubStageEnum.getNextStage();
|
||||
//更新线索阶段
|
||||
lineInfoDAO.updateWorkflowStage(lineInfo.getId(), nextStage, nextStage.getInitStatus());
|
||||
//更新auditId
|
||||
SigningBaseInfoDO signingBaseInfoDO = intentAgreementMapper.selectByPartnerIdOrLineId(null, lineInfo.getId());
|
||||
if (Objects.nonNull(signingBaseInfoDO)){
|
||||
intentAgreementMapper.updateAuditId(lineInfo.getId(),auditId);
|
||||
}else {
|
||||
throw new ServiceException("无法更新,没有对应的签约基本信息");
|
||||
}
|
||||
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean auditReject(Long auditId, LineInfoDO lineInfo) {
|
||||
if ((lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) ||
|
||||
lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))){
|
||||
if ((!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_63.getCode()) &&
|
||||
!lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode()))){
|
||||
throw new ServiceException(ErrorCodeEnum.NOT_APPROVE_NODE);
|
||||
}
|
||||
//待审核code 63 处理逻辑
|
||||
@@ -123,6 +131,8 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
|
||||
if(lineInfo.getWorkflowStage().equals(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_75.getCode())){
|
||||
lineInfo.setWorkflowSubStageStatus(WorkflowSubStageStatusEnum.SIGN_INTENT_AGREEMENT_80.getCode());
|
||||
lineInfoDAO.updateLineInfo(lineInfo);
|
||||
//更新auditId
|
||||
intentAgreementMapper.updateAuditId(lineInfo.getId(),auditId);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.entity.LineInfoDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.LineInfoMapper;
|
||||
import com.cool.store.request.AuditPassRequest;
|
||||
import com.cool.store.request.AuditRejectRequest;
|
||||
import com.cool.store.request.AuditResultRequest;
|
||||
import com.cool.store.service.KdzApiService;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.cool.store.utils.poi.constant.Constants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class KdzApiServiceImpl implements KdzApiService {
|
||||
|
||||
@Resource
|
||||
LineInfoMapper lineInfoMapper;
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@Override
|
||||
public boolean auditResult(AuditResultRequest request) {
|
||||
if (Objects.isNull(request) || StringUtil.isBlank(request.getKdzBusinessId())){
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
}
|
||||
String kdzBusinessId = request.getKdzBusinessId();
|
||||
String lineId = splitMethod(kdzBusinessId);
|
||||
if (StringUtil.isBlank(lineId)){
|
||||
throw new ServiceException("kdzBusinessId解析异常,请检查");
|
||||
}
|
||||
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(Long.valueOf(lineId));
|
||||
try {
|
||||
if (request.getAuditResult() == 1){
|
||||
AuditPassRequest auditPassRequest = new AuditPassRequest();
|
||||
auditPassRequest.setLineId(lineInfoDO.getId());
|
||||
auditPassRequest.setPassReason(request.getCause());
|
||||
auditPassRequest.setWorkflowSubStage(lineInfoDO.getWorkflowSubStage());
|
||||
commonService.getLineFlowService(auditPassRequest.getWorkflowSubStage()).auditPass(auditPassRequest);
|
||||
}else if (request.getAuditResult() == 0){
|
||||
AuditRejectRequest auditRejectRequest = new AuditRejectRequest();
|
||||
auditRejectRequest.setLineId(lineInfoDO.getId());
|
||||
auditRejectRequest.setWorkflowSubStage(lineInfoDO.getWorkflowSubStage());
|
||||
auditRejectRequest.setRejectPublicReason(request.getCause());
|
||||
auditRejectRequest.setRejectRealReason(request.getFailureCause());
|
||||
commonService.getLineFlowService(auditRejectRequest.getWorkflowSubStage()).auditReject(auditRejectRequest);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String splitMethod(String kdzBusinessId){
|
||||
String[] split = kdzBusinessId.split(Constants.D_LINE);
|
||||
if (split.length >= 2){
|
||||
return split[0];
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.request.AuditResultRequest;
|
||||
import com.cool.store.request.XfsgOpenApiRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.KdzApiService;
|
||||
import com.cool.store.utils.EncryptUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Api(tags = "酷店掌API")
|
||||
@RestController
|
||||
@RequestMapping("/{enterprise-id}/api")
|
||||
@Slf4j
|
||||
public class KdzApiController {
|
||||
|
||||
String allowEnterpriseId = "45f92210375346858b6b6694967f44de,e17cd2dc350541df8a8b0af9bd27f77d";
|
||||
|
||||
@Resource
|
||||
KdzApiService kdzApiService;
|
||||
|
||||
@ApiOperation("意向加盟合同审核结果")
|
||||
@PostMapping("/audit/result")
|
||||
public ResponseResult<Boolean> auditResult(@PathVariable(value = "enterprise-id") String eid,
|
||||
@RequestBody XfsgOpenApiRequest request) {
|
||||
log.info("auditResult requestBody :{}", JSONObject.toJSONString(request));
|
||||
if(!verifyMD5(request,eid)){
|
||||
return ResponseResult.fail(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
}
|
||||
if(eid == null || request.getBizContent() == null){
|
||||
return ResponseResult.fail(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
}
|
||||
AuditResultRequest auditResultRequest = JSONObject.parseObject(request.getBizContent(), AuditResultRequest.class);
|
||||
return ResponseResult.success(kdzApiService.auditResult(auditResultRequest));
|
||||
}
|
||||
|
||||
public static boolean verifyMD5(XfsgOpenApiRequest request, String eid){
|
||||
//签名
|
||||
StringBuffer sb = new StringBuffer();
|
||||
//用户唯一标识id
|
||||
sb.append("timestamp=").append(request.getTimestamp()).append("&");
|
||||
//企业唯一标识enterpriseId
|
||||
sb.append("enterpriseId=").append(eid).append("&");
|
||||
sb.append("bizContent=").append(request.getBizContent());
|
||||
|
||||
String md5 = EncryptUtil.xfsgMd5(sb.toString());
|
||||
|
||||
return md5.equals(request.getSign());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user