kdz -> xfsg 发起意向协议流程
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
package com.cool.store.utils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
public class SecureUtil {
|
||||
private static final String API_KEY = "c344cbe01972777dcfe7f9767e3d2e7f";
|
||||
private static final String API_SECRET = "fAIgCJc3kPmSzD3SgEHU";
|
||||
|
||||
/**
|
||||
* 利用java原生的摘要实现SHA256加密
|
||||
* @param source 加密内容
|
||||
* @param salt 盐
|
||||
* @return
|
||||
*/
|
||||
public static String sha256(String source, String salt) {
|
||||
String encodeStr = "";
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("SHA-256");
|
||||
if (salt != null) {
|
||||
digest.reset();
|
||||
digest.update(salt.getBytes("UTF-8"));
|
||||
}
|
||||
digest.update(source.getBytes("UTF-8"));
|
||||
encodeStr = byte2Hex(digest.digest());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return encodeStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将byte转为16进制
|
||||
* @param bytes
|
||||
* @return
|
||||
*/
|
||||
private static String byte2Hex(byte[] bytes){
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
for (int i=0;i<bytes.length;i++) {
|
||||
String temp = Integer.toHexString(bytes[i] & 0xFF);
|
||||
if (temp.length() == 1) {
|
||||
// 一位的进行补0操作
|
||||
stringBuffer.append("0");
|
||||
}
|
||||
stringBuffer.append(temp);
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static String getSignature(long timestamp) {
|
||||
return SecureUtil.sha256(timestamp + "$%^&" + API_KEY, API_SECRET);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
System.out.println(getSignature(timestamp));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.cool.store.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* https://apifox.com/apidoc/shared-c48218f7-4a34-4422-8689-927502f171ff/api-160442266
|
||||
* 密码:aJJq9F7k
|
||||
*/
|
||||
@Builder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class InitiatingDO {
|
||||
|
||||
private String kdzBusinessId;
|
||||
|
||||
private String title;
|
||||
|
||||
private String apply_user;
|
||||
|
||||
private String apply_user_name;
|
||||
|
||||
private String apply_date;
|
||||
|
||||
private String jms_id_card;
|
||||
|
||||
private String jms_id_card_address;
|
||||
|
||||
private String jms_name;
|
||||
|
||||
private BigDecimal lybzj;
|
||||
|
||||
private BigDecimal lybzjwb;
|
||||
|
||||
private String lybzjdx;
|
||||
|
||||
private String jms_mobile;
|
||||
|
||||
private String annex1;
|
||||
|
||||
private String annex2;
|
||||
|
||||
private String annex3;
|
||||
|
||||
private Integer qy_year;
|
||||
|
||||
private Integer qy_month;
|
||||
|
||||
private Integer qy_day;
|
||||
|
||||
private Integer jy_year;
|
||||
|
||||
private Integer jy_month;
|
||||
|
||||
private Integer jy_day;
|
||||
|
||||
private String yxjzz;
|
||||
|
||||
private Integer xyqx_month;
|
||||
|
||||
private BigDecimal jmf;
|
||||
|
||||
private BigDecimal jmfwb;
|
||||
|
||||
private String jmfdx;
|
||||
|
||||
private BigDecimal jmyxj;
|
||||
|
||||
private BigDecimal jmyxjwb;
|
||||
|
||||
private String csfz;
|
||||
|
||||
private String jmsxx;
|
||||
|
||||
private String annex4;
|
||||
|
||||
private String annex5;
|
||||
|
||||
private String annex6;
|
||||
|
||||
private String annex7;
|
||||
|
||||
private String dkr;
|
||||
|
||||
private String dkrq;
|
||||
|
||||
private Integer jm_type;
|
||||
|
||||
private Integer jms_type;
|
||||
|
||||
private String jm_csgs;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
package com.cool.store.request;
|
||||
|
||||
import com.cool.store.entity.InitiatingDO;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@Data
|
||||
public class InitiatingRequest {
|
||||
|
||||
private Long lineId;
|
||||
|
||||
private String signName;
|
||||
|
||||
private String idCardNo;
|
||||
|
||||
private String businessLicenseCode;
|
||||
|
||||
private String mobile;
|
||||
|
||||
private String idCardAddress;
|
||||
|
||||
private String businessLicenseAddress;
|
||||
|
||||
private String title;
|
||||
|
||||
private String apply_user;
|
||||
|
||||
private String apply_user_name;
|
||||
|
||||
private String apply_date;
|
||||
|
||||
private String jms_id_card;
|
||||
|
||||
private String jms_id_card_address;
|
||||
|
||||
private String jms_name;
|
||||
|
||||
private BigDecimal lybzj;
|
||||
|
||||
private BigDecimal lybzjwb;
|
||||
|
||||
private String lybzjdx;
|
||||
|
||||
private String jms_mobile;
|
||||
|
||||
private String annex1;
|
||||
|
||||
private String annex2;
|
||||
|
||||
private String annex3;
|
||||
|
||||
private Integer qy_year;
|
||||
|
||||
private Integer qy_month;
|
||||
|
||||
private Integer qy_day;
|
||||
|
||||
private Integer jy_year;
|
||||
|
||||
private Integer jy_month;
|
||||
|
||||
private Integer jy_day;
|
||||
|
||||
private String yxjzz;
|
||||
|
||||
private Integer xyqx_month;
|
||||
|
||||
private BigDecimal jmf;
|
||||
|
||||
private BigDecimal jmfwb;
|
||||
|
||||
private String jmfdx;
|
||||
|
||||
private BigDecimal jmyxj;
|
||||
|
||||
private BigDecimal jmyxjwb;
|
||||
|
||||
private String csfz;
|
||||
|
||||
private String jmsxx;
|
||||
|
||||
private String annex4;
|
||||
|
||||
private String annex5;
|
||||
|
||||
private String annex6;
|
||||
|
||||
private String annex7;
|
||||
|
||||
private String dkr;
|
||||
|
||||
private String dkrq;
|
||||
|
||||
private Integer jm_type;
|
||||
|
||||
private Integer jms_type;
|
||||
|
||||
private String jm_csgs;
|
||||
|
||||
|
||||
public InitiatingDO toInitiatingDO() {
|
||||
InitiatingDO initiatingDO = new InitiatingDO();
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
// 格式化日期并输出
|
||||
String dateTime = currentDate.format(formatter);
|
||||
initiatingDO.setTitle("加盟意向协议-" + this.signName + "-" + dateTime);
|
||||
initiatingDO.setApply_user(this.apply_user);
|
||||
initiatingDO.setApply_user_name(this.signName);
|
||||
initiatingDO.setApply_date(this.apply_date);
|
||||
initiatingDO.setJms_id_card(this.idCardNo);
|
||||
if (StringUtil.isNotBlank(this.businessLicenseAddress)){
|
||||
initiatingDO.setJms_id_card_address(this.businessLicenseAddress);
|
||||
}else if (StringUtil.isNotBlank(this.businessLicenseCode)){
|
||||
initiatingDO.setJms_id_card_address(this.businessLicenseCode);
|
||||
}
|
||||
if (StringUtil.isNotBlank(this.businessLicenseCode)){
|
||||
initiatingDO.setJms_id_card(this.businessLicenseCode);
|
||||
}else if (StringUtil.isNotBlank(this.idCardNo)){
|
||||
initiatingDO.setJms_id_card(this.idCardNo);
|
||||
}
|
||||
initiatingDO.setJms_name(this.jms_name);
|
||||
initiatingDO.setLybzj(this.lybzj);
|
||||
initiatingDO.setLybzjwb(this.lybzj);
|
||||
initiatingDO.setLybzjdx(this.lybzjdx);
|
||||
initiatingDO.setJms_mobile(this.mobile);
|
||||
initiatingDO.setAnnex1(this.annex1);
|
||||
initiatingDO.setAnnex2(this.annex2);
|
||||
initiatingDO.setAnnex3(this.annex3);
|
||||
initiatingDO.setQy_year(this.qy_year);
|
||||
initiatingDO.setQy_month(this.qy_month);
|
||||
initiatingDO.setQy_day(this.qy_day);
|
||||
initiatingDO.setJy_year(this.jy_year);
|
||||
initiatingDO.setJy_month(this.jy_month);
|
||||
initiatingDO.setJy_day(this.jy_day);
|
||||
initiatingDO.setYxjzz(this.yxjzz);
|
||||
initiatingDO.setXyqx_month(this.xyqx_month);
|
||||
initiatingDO.setJmf(this.jmf);
|
||||
initiatingDO.setJmfwb(this.jmf);
|
||||
initiatingDO.setJmfdx(this.jmfdx);
|
||||
initiatingDO.setJmyxj(this.jmyxj);
|
||||
initiatingDO.setJmyxjwb(this.jmyxj);
|
||||
initiatingDO.setCsfz(this.csfz);
|
||||
initiatingDO.setJmsxx(this.jmsxx);
|
||||
initiatingDO.setAnnex4(this.annex4);
|
||||
initiatingDO.setAnnex5(this.annex5);
|
||||
initiatingDO.setAnnex6(this.annex6);
|
||||
initiatingDO.setAnnex7(this.annex7);
|
||||
initiatingDO.setDkr(this.dkr);
|
||||
initiatingDO.setDkrq(this.dkrq);
|
||||
initiatingDO.setJm_type(this.jm_type);
|
||||
initiatingDO.setJms_type(this.jms_type);
|
||||
initiatingDO.setJm_csgs(this.jm_csgs);
|
||||
return initiatingDO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.cool.store.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class InitiatingResponse {
|
||||
/**
|
||||
* 返回结果代码
|
||||
*/
|
||||
private long code;
|
||||
/**
|
||||
* oa流程id
|
||||
*/
|
||||
private String data;
|
||||
/**
|
||||
* 提示信息
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
private long serverTime;
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.request.InitiatingRequest;
|
||||
import com.cool.store.request.IntentAgreementSubmitRequest;
|
||||
import com.cool.store.response.InitiatingResponse;
|
||||
import com.cool.store.response.SigningBaseInfoResponse;
|
||||
|
||||
public interface IntentAgreementService {
|
||||
@@ -18,4 +20,6 @@ public interface IntentAgreementService {
|
||||
* @return
|
||||
*/
|
||||
SigningBaseInfoResponse getMiniIntentAgreement(String partnerId, Long lineId);
|
||||
|
||||
InitiatingResponse initiating(InitiatingRequest request);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dao.LineInfoDAO;
|
||||
import com.cool.store.entity.InitiatingDO;
|
||||
import com.cool.store.entity.LineInfoDO;
|
||||
import com.cool.store.entity.MemberQuestionDO;
|
||||
import com.cool.store.entity.SigningBaseInfoDO;
|
||||
@@ -9,16 +11,27 @@ import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.mapper.IntentAgreementMapper;
|
||||
import com.cool.store.mapper.JoinIntentionMapper;
|
||||
import com.cool.store.mapper.LineInfoMapper;
|
||||
import com.cool.store.mq.util.HttpRestTemplateService;
|
||||
import com.cool.store.request.InitiatingRequest;
|
||||
import com.cool.store.request.IntentAgreementSubmitRequest;
|
||||
import com.cool.store.response.InitiatingResponse;
|
||||
import com.cool.store.response.SigningBaseInfoResponse;
|
||||
import com.cool.store.service.IntentAgreementService;
|
||||
import com.cool.store.utils.SecureUtil;
|
||||
import com.cool.store.utils.StringUtil;
|
||||
import com.cool.store.utils.poi.StringUtils;
|
||||
import com.cool.store.utils.poi.constant.Constants;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.cool.store.enums.ErrorCodeEnum.PARAMS_VALIDATE_ERROR;
|
||||
@@ -40,6 +53,12 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
|
||||
@Resource
|
||||
LineInfoDAO lineInfoDAO;
|
||||
|
||||
@Resource
|
||||
private HttpRestTemplateService httpRestTemplateService;
|
||||
|
||||
@Value("${xfsg.url}")
|
||||
private String xfsgUrl;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -141,4 +160,28 @@ public class IntentAgreementServiceImpl extends LineFlowService implements Inten
|
||||
protected Boolean auditClose(Long auditId, LineInfoDO lineInfo) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InitiatingResponse initiating(InitiatingRequest request) {
|
||||
log.info("initiating request:{}", JSONObject.toJSONString(request));
|
||||
if (Objects.isNull(request)){
|
||||
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
|
||||
}
|
||||
Map<String, Object> requestMap = new HashMap<>();
|
||||
fillSignatureInfo(requestMap);
|
||||
String url = xfsgUrl + Constants.INTENTION_CONTRACT_URL + "?timestamp="+requestMap.get("timestamp") + "&signature=" + requestMap.get("signature");
|
||||
InitiatingDO initiatingDO = request.toInitiatingDO();
|
||||
LineInfoDO lineInfoDO = lineInfoMapper.getByLineId(request.getLineId());
|
||||
initiatingDO.setKdzBusinessId(lineInfoDO.getId() + "_" + lineInfoDO.getWorkflowSubStageStatus());
|
||||
InitiatingResponse initiatingResponse = httpRestTemplateService.postForObject(url, initiatingDO, InitiatingResponse.class);
|
||||
return initiatingResponse;
|
||||
|
||||
}
|
||||
|
||||
private void fillSignatureInfo(Map<String, Object> requestMap) {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
String signature = SecureUtil.getSignature(timestamp);
|
||||
requestMap.put("timestamp", timestamp);
|
||||
requestMap.put("signature", signature);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,4 +167,9 @@ public class Constants
|
||||
public static final String CONTENT_ENCODING = "Content-Encoding";
|
||||
|
||||
|
||||
public static final String INTENTION_CONTRACT_URL = "/api/coolstore/start-flow/intention-contract";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.cool.store.controller.webb;
|
||||
|
||||
import com.cool.store.request.InitiatingRequest;
|
||||
import com.cool.store.response.InitiatingResponse;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.response.SigningBaseInfoResponse;
|
||||
import com.cool.store.service.IntentAgreementService;
|
||||
@@ -27,4 +29,11 @@ public class PCIntentAgreementController {
|
||||
SigningBaseInfoResponse resp = intentAgreementService.getMiniIntentAgreement(partnerId, lineId);
|
||||
return ResponseResult.success(resp);
|
||||
}
|
||||
|
||||
@PostMapping(path = "/initiating")
|
||||
@ApiOperation("kdz -> xfsg 发起意向协议流程")
|
||||
public ResponseResult<InitiatingResponse> initiating(@RequestParam
|
||||
@RequestBody InitiatingRequest request) {
|
||||
return ResponseResult.success(intentAgreementService.initiating(request));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,4 +74,6 @@ wx.pay.privateKeyPath=D:\\weixin\\apiclient_key.pem
|
||||
aliyun.accessKeyId=LTAI5tQ6QBnWaB5LaJYz6zcD
|
||||
aliyun.accessKeySecret=spqsOgtfr54cwK861O3N3fInydTgjA
|
||||
|
||||
coolstore.page.domain=https://t2store.coolstore.cn/
|
||||
coolstore.page.domain=https://t2store.coolstore.cn/
|
||||
|
||||
xfsg.url=https://inf-test.xianfengsg.com/InfService
|
||||
@@ -77,4 +77,6 @@ xxl.job.executor.logretentiondays=3
|
||||
xxl.job.accessToken=25365115eed84e9ba5e0040abb255a09
|
||||
|
||||
exhibition.channel.id=52399
|
||||
recommended.channel.id=52400
|
||||
recommended.channel.id=52400
|
||||
|
||||
xfsg.url=https://inf-test.xianfengsg.com/InfService
|
||||
@@ -79,4 +79,6 @@ xxl.job.accessToken =
|
||||
exhibition.channel.id=52399
|
||||
recommended.channel.id=52400
|
||||
|
||||
coolstore.page.domain=https://t2store.coolstore.cn/
|
||||
coolstore.page.domain=https://t2store.coolstore.cn/
|
||||
|
||||
xfsg.url=https://inf-test.xianfengsg.com/InfService
|
||||
Reference in New Issue
Block a user