|
|
|
|
@@ -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.WxScanPayResp;
|
|
|
|
|
import com.chaozhanggui.system.cashierservice.thirdpay.service.ThirdPayService;
|
|
|
|
|
import com.chaozhanggui.system.cashierservice.util.BeanUtil;
|
|
|
|
|
import com.chaozhanggui.system.cashierservice.util.MD5Util;
|
|
|
|
|
import com.chaozhanggui.system.cashierservice.util.N;
|
|
|
|
|
import com.chaozhanggui.system.cashierservice.util.SnowFlakeUtil;
|
|
|
|
|
import com.chaozhanggui.system.cashierservice.util.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
@@ -236,7 +233,7 @@ public class PayService {
|
|
|
|
|
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("000000".equals(publicResp.getCode())){
|
|
|
|
|
WxScanPayResp wxScanPayResp= publicResp.getObjData();
|
|
|
|
|
@@ -385,7 +382,7 @@ public class PayService {
|
|
|
|
|
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("000000".equals(publicResp.getCode())){
|
|
|
|
|
WxScanPayResp wxScanPayResp= publicResp.getObjData();
|
|
|
|
|
@@ -430,6 +427,7 @@ public class PayService {
|
|
|
|
|
}
|
|
|
|
|
TbMerchantThirdApply thirdApply = tbMerchantThirdApplyMapper.selectByPrimaryKey(groupOrderInfo.getMerchantId());
|
|
|
|
|
MsgException.checkNull(thirdApply, "支付参数配置错误");
|
|
|
|
|
|
|
|
|
|
ReturnOrderReq req = new ReturnOrderReq();
|
|
|
|
|
req.setAppId(thirdApply.getAppId());
|
|
|
|
|
req.setTimestamp(System.currentTimeMillis());
|
|
|
|
|
@@ -547,7 +545,7 @@ public class PayService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}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("000000".equals(publicResp.getCode())){
|
|
|
|
|
String cartStatus="";
|
|
|
|
|
@@ -641,37 +639,59 @@ public class PayService {
|
|
|
|
|
tbMemberInMapper.insert(memberIn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if("ysk".equals(thirdPayType)){
|
|
|
|
|
PayReq req=new PayReq();
|
|
|
|
|
|
|
|
|
|
PayReq req=new PayReq();
|
|
|
|
|
|
|
|
|
|
req.setAppId(thirdApply.getAppId());
|
|
|
|
|
req.setTimestamp(System.currentTimeMillis());
|
|
|
|
|
req.setIp(ip);
|
|
|
|
|
req.setMercOrderNo(SnowFlakeUtil.generateOrderNo());
|
|
|
|
|
req.setNotifyUrl(callBackIn);
|
|
|
|
|
req.setPayAmt(amount);
|
|
|
|
|
req.setPayType("03");
|
|
|
|
|
req.setPayWay("WXZF");
|
|
|
|
|
req.setSubject("充值");
|
|
|
|
|
req.setUserId(openId);
|
|
|
|
|
req.setAppId(thirdApply.getAppId());
|
|
|
|
|
req.setTimestamp(System.currentTimeMillis());
|
|
|
|
|
req.setIp(ip);
|
|
|
|
|
req.setMercOrderNo(SnowFlakeUtil.generateOrderNo());
|
|
|
|
|
req.setNotifyUrl(callBackIn);
|
|
|
|
|
req.setPayAmt(amount);
|
|
|
|
|
req.setPayType("03");
|
|
|
|
|
req.setPayWay("WXZF");
|
|
|
|
|
req.setSubject("充值");
|
|
|
|
|
req.setUserId(openId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> map= BeanUtil.transBeanMap(req);
|
|
|
|
|
req.setSign(MD5Util.encrypt(map,thirdApply.getAppToken(),true));
|
|
|
|
|
Map<String,Object> map= BeanUtil.transBeanMap(req);
|
|
|
|
|
req.setSign(MD5Util.encrypt(map,thirdApply.getAppToken(),true));
|
|
|
|
|
|
|
|
|
|
ResponseEntity<String> response= restTemplate.postForEntity(url.concat("trans/pay"),req,String.class);
|
|
|
|
|
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
|
|
|
|
|
JSONObject object=JSONObject.parseObject(response.getBody());
|
|
|
|
|
if(object.get("code").equals("0")){
|
|
|
|
|
memberIn.setOrderNo(object.getJSONObject("data").get("orderNumber").toString());
|
|
|
|
|
memberIn.setUpdateTime(new Date());
|
|
|
|
|
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
|
|
|
|
|
ResponseEntity<String> response= restTemplate.postForEntity(url.concat("trans/pay"),req,String.class);
|
|
|
|
|
if(response.getStatusCodeValue()==200&&ObjectUtil.isNotEmpty(response.getBody())){
|
|
|
|
|
JSONObject object=JSONObject.parseObject(response.getBody());
|
|
|
|
|
if(object.get("code").equals("0")){
|
|
|
|
|
memberIn.setOrderNo(object.getJSONObject("data").get("orderNumber").toString());
|
|
|
|
|
memberIn.setUpdateTime(new Date());
|
|
|
|
|
tbMemberInMapper.updateByPrimaryKeySelective(memberIn);
|
|
|
|
|
|
|
|
|
|
return Result.success(CodeEnum.SUCCESS,object.getJSONObject("data"));
|
|
|
|
|
}else {
|
|
|
|
|
return Result.fail(object.getString("msg"));
|
|
|
|
|
return Result.success(CodeEnum.SUCCESS,object.getJSONObject("data"));
|
|
|
|
|
}else {
|
|
|
|
|
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("失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|