添加新版开放平台支付
This commit is contained in:
@@ -21,6 +21,13 @@ public class TbMerchantThirdApply implements Serializable {
|
|||||||
|
|
||||||
private String appToken;
|
private String appToken;
|
||||||
|
|
||||||
|
private String smallAppid;
|
||||||
|
|
||||||
|
private String storeId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
@@ -94,4 +101,20 @@ public class TbMerchantThirdApply implements Serializable {
|
|||||||
public void setAppToken(String appToken) {
|
public void setAppToken(String appToken) {
|
||||||
this.appToken = appToken == null ? null : appToken.trim();
|
this.appToken = appToken == null ? null : appToken.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSmallAppid() {
|
||||||
|
return smallAppid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSmallAppid(String smallAppid) {
|
||||||
|
this.smallAppid = smallAppid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStoreId() {
|
||||||
|
return storeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStoreId(String storeId) {
|
||||||
|
this.storeId = storeId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -21,10 +21,7 @@ import com.chaozhanggui.system.cashierservice.thirdpay.resp.OrderStatusQueryResp
|
|||||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.PublicResp;
|
import com.chaozhanggui.system.cashierservice.thirdpay.resp.PublicResp;
|
||||||
import com.chaozhanggui.system.cashierservice.thirdpay.resp.WxScanPayResp;
|
import com.chaozhanggui.system.cashierservice.thirdpay.resp.WxScanPayResp;
|
||||||
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
|
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
|
||||||
import com.chaozhanggui.system.cashierservice.util.BeanUtil;
|
import com.chaozhanggui.system.cashierservice.util.*;
|
||||||
import com.chaozhanggui.system.cashierservice.util.MD5Util;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.N;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.SnowFlakeUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
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;
|
||||||
@@ -236,7 +233,7 @@ public class PayService {
|
|||||||
reqbody=body.toString();
|
reqbody=body.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
PublicResp<WxScanPayResp> publicResp= thirdPayService.scanpay(thirdUrl,thirdApply.getAppId(),reqbody,reqbody,payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),"wx212769170d2c6b2a","wx212769170d2c6b2a",openId,ip,orderInfo.getOrderNo(),"S2405103298",callBack,null,thirdApply.getAppToken());
|
PublicResp<WxScanPayResp> publicResp= thirdPayService.scanpay(thirdUrl,thirdApply.getAppId(),reqbody,reqbody,payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),"WECHAT",thirdApply.getSmallAppid(),openId,ip,orderInfo.getOrderNo(),thirdApply.getStoreId(),callBack,null,thirdApply.getAppToken());
|
||||||
if(ObjectUtil.isNotNull(publicResp)&&ObjectUtil.isNotEmpty(publicResp)){
|
if(ObjectUtil.isNotNull(publicResp)&&ObjectUtil.isNotEmpty(publicResp)){
|
||||||
if("000000".equals(publicResp.getCode())){
|
if("000000".equals(publicResp.getCode())){
|
||||||
WxScanPayResp wxScanPayResp= publicResp.getObjData();
|
WxScanPayResp wxScanPayResp= publicResp.getObjData();
|
||||||
@@ -385,7 +382,7 @@ public class PayService {
|
|||||||
reqbody=body.toString();
|
reqbody=body.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
PublicResp<WxScanPayResp> publicResp= thirdPayService.scanpay(thirdUrl,thirdApply.getAppId(),reqbody,reqbody,payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),"wx212769170d2c6b2a","wx212769170d2c6b2a",userId,ip,orderInfo.getOrderNo(),"S2405103298",callBack,null,thirdApply.getAppToken());
|
PublicResp<WxScanPayResp> publicResp= thirdPayService.scanpay(thirdUrl,thirdApply.getAppId(),reqbody,reqbody,payment.getAmount().setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),"WECHAT",thirdApply.getSmallAppid(),userId,ip,orderInfo.getOrderNo(),thirdApply.getStoreId(),callBack,null,thirdApply.getAppToken());
|
||||||
if(ObjectUtil.isNotNull(publicResp)&&ObjectUtil.isNotEmpty(publicResp)){
|
if(ObjectUtil.isNotNull(publicResp)&&ObjectUtil.isNotEmpty(publicResp)){
|
||||||
if("000000".equals(publicResp.getCode())){
|
if("000000".equals(publicResp.getCode())){
|
||||||
WxScanPayResp wxScanPayResp= publicResp.getObjData();
|
WxScanPayResp wxScanPayResp= publicResp.getObjData();
|
||||||
@@ -430,6 +427,7 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(groupOrderInfo.getMerchantId());
|
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(groupOrderInfo.getMerchantId());
|
||||||
MsgException.checkNull(thirdApply, "支付参数配置错误");
|
MsgException.checkNull(thirdApply, "支付参数配置错误");
|
||||||
|
|
||||||
ReturnOrderReq req = new ReturnOrderReq();
|
ReturnOrderReq req = new ReturnOrderReq();
|
||||||
req.setAppId(thirdApply.getAppId());
|
req.setAppId(thirdApply.getAppId());
|
||||||
req.setTimestamp(System.currentTimeMillis());
|
req.setTimestamp(System.currentTimeMillis());
|
||||||
@@ -547,7 +545,7 @@ public class PayService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
PublicResp<OrderStatusQueryResp> publicResp=thirdPayService.queryOrder(thirdUrl,thirdApply.getAppId(),orderInfo.getOrderNo(),null,thirdApply.getAppToken());
|
PublicResp<OrderStatusQueryResp> publicResp=thirdPayService.queryOrder(thirdUrl,thirdApply.getAppId(),payment.getTradeNumber(),null,thirdApply.getAppToken());
|
||||||
if(ObjectUtil.isNotNull(publicResp)&&ObjectUtil.isNotEmpty(publicResp)){
|
if(ObjectUtil.isNotNull(publicResp)&&ObjectUtil.isNotEmpty(publicResp)){
|
||||||
if("000000".equals(publicResp.getCode())){
|
if("000000".equals(publicResp.getCode())){
|
||||||
String cartStatus="";
|
String cartStatus="";
|
||||||
@@ -641,7 +639,7 @@ public class PayService {
|
|||||||
tbMemberInMapper.insert(memberIn);
|
tbMemberInMapper.insert(memberIn);
|
||||||
|
|
||||||
|
|
||||||
|
if("ysk".equals(thirdPayType)){
|
||||||
PayReq req=new PayReq();
|
PayReq req=new PayReq();
|
||||||
|
|
||||||
req.setAppId(thirdApply.getAppId());
|
req.setAppId(thirdApply.getAppId());
|
||||||
@@ -672,6 +670,28 @@ public class PayService {
|
|||||||
return Result.fail(object.getString("msg"));
|
return Result.fail(object.getString("msg"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
PublicResp<WxScanPayResp> publicResp= thirdPayService.scanpay(thirdUrl,thirdApply.getAppId(),"会员充值","会员充值",new BigDecimal(amount).setScale(2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).longValue(),"WECHAT",thirdApply.getSmallAppid(),userId,ip, DateUtils.getsdfTimesSS(),thirdApply.getStoreId(),callBack,null,thirdApply.getAppToken());
|
||||||
|
if(ObjectUtil.isNotNull(publicResp)&&ObjectUtil.isNotEmpty(publicResp)){
|
||||||
|
if("000000".equals(publicResp.getCode())){
|
||||||
|
WxScanPayResp wxScanPayResp= publicResp.getObjData();
|
||||||
|
if("TRADE_SUCCESS".equals(wxScanPayResp.getState())){
|
||||||
|
|
||||||
|
memberIn.setOrderNo(wxScanPayResp.getPayOrderId());
|
||||||
|
memberIn.setUpdateTime(new Date());
|
||||||
|
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
|
||||||
|
|
||||||
|
return Result.success(CodeEnum.SUCCESS,wxScanPayResp.getPayInfo());
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return Result.fail(publicResp.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return Result.fail("失败");
|
return Result.fail("失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ public class DateUtils {
|
|||||||
private final static SimpleDateFormat sdfTimeSS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
private final static SimpleDateFormat sdfTimeSS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
private final static SimpleDateFormat sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss");
|
private final static SimpleDateFormat sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
|
||||||
|
private final static SimpleDateFormat sdfTimesSS = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||||
|
|
||||||
private final static SimpleDateFormat sdfday = new SimpleDateFormat("MM-dd HH:mm");
|
private final static SimpleDateFormat sdfday = new SimpleDateFormat("MM-dd HH:mm");
|
||||||
|
|
||||||
|
|
||||||
@@ -77,6 +79,12 @@ public class DateUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static String getsdfTimesSS(){
|
||||||
|
return sdfTimesSS.format(new Date());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getNextSdfTimes(Date date){
|
public static String getNextSdfTimes(Date date){
|
||||||
return sdfTimes.format(date);
|
return sdfTimes.format(date);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,14 @@
|
|||||||
<result column="applyment_state" jdbcType="VARCHAR" property="applymentState" />
|
<result column="applyment_state" jdbcType="VARCHAR" property="applymentState" />
|
||||||
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
<result column="created_at" jdbcType="BIGINT" property="createdAt" />
|
||||||
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
<result column="updated_at" jdbcType="BIGINT" property="updatedAt" />
|
||||||
|
<result column="small_appid" jdbcType="VARCHAR" property="smallAppid" />
|
||||||
|
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbMerchantThirdApply">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chaozhanggui.system.cashierservice.entity.TbMerchantThirdApply">
|
||||||
<result column="app_token" jdbcType="LONGVARCHAR" property="appToken" />
|
<result column="app_token" jdbcType="LONGVARCHAR" property="appToken" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, type, app_id, status, pay_password, applyment_state, created_at, updated_at
|
id, type, app_id, status, pay_password, applyment_state, created_at, updated_at,small_appid,store_id
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
app_token
|
app_token
|
||||||
|
|||||||
Reference in New Issue
Block a user