记得上下班打卡 | git大法好,push需谨慎

Commit 96cb3e71 authored by jiangxiulong's avatar jiangxiulong

Merge remote-tracking branch 'origin/dev' into dev

parents aa9cc936 32c4e700
package com.liquidnet.service.dragon.dto;
import lombok.Data;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: DragonPayOrderQueryRespDto
* @Package com.liquidnet.service.dragon.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/7/13 15:39
*/
@Data
public class DragonPayOrderQueryRespDto {
private String code;
private String orderCode;
private String status;
}
...@@ -10,31 +10,17 @@ import java.io.Serializable; ...@@ -10,31 +10,17 @@ import java.io.Serializable;
public class PayDataVo implements Serializable { public class PayDataVo implements Serializable {
private static final long serialVersionUID = -5841205289132250565L; private static final long serialVersionUID = -5841205289132250565L;
@JsonProperty("appId")
private String appid;
@JsonProperty("appid")
private String appId; private String appId;
@JsonProperty("nonceStr")
private String noncestr;
@JsonProperty("noncestr")
private String nonceStr; private String nonceStr;
@JsonProperty("timeStamp")
private String timestamp;
@JsonProperty("timestamp")
private String timeStamp; private String timeStamp;
@JsonProperty("package") @JsonProperty("package")
private String packageOther;
private String packages; private String packages;
private String partnerId;
private String partnerid; private String prepayId;
private String prepayid;
private String sign; private String sign;
private String mweb_url; private String mwebUrl;
private String paySign; private String paySign;
private String signType; private String signType;
private String redirectUrl;
private String redirect_url; private String orderStr;
private String order_str;
} }
package com.liquidnet.service.kylin.dto.vo.returns;
import com.liquidnet.service.kylin.dto.vo.middle.PayDataVo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class PayInnerResultVo implements Serializable {
private String code;
private String orderCode;
private Integer status;
private String orderId;
private String showUrl;
private String returnUrl;
private BigDecimal price;
private PayDataVo payData;
}
...@@ -12,19 +12,6 @@ public class PayResultVo implements Serializable { ...@@ -12,19 +12,6 @@ public class PayResultVo implements Serializable {
private static final long serialVersionUID = 1541552316829686035L; private static final long serialVersionUID = 1541552316829686035L;
private String code; private String code;
private String message;
private String order_code; private PayInnerResultVo data;
private Integer status;
private String order_id;
private String showUrl;
private String returnUrl;
private BigDecimal price;
private PayDataVo pay_data;
} }
...@@ -20,10 +20,10 @@ import java.util.List; ...@@ -20,10 +20,10 @@ import java.util.List;
public interface IKylinOrderTicketsOrderService { public interface IKylinOrderTicketsOrderService {
// 下单前判断接口(判断是否可锁定库存)(无订单->待支付->可支付) // 下单前判断接口(判断是否可锁定库存)(无订单->待支付->可支付)
ResponseDto<PayResultVo> checkCanOrder(PayOrderParam payOrderParam); ResponseDto<PayInnerResultVo> checkCanOrder(PayOrderParam payOrderParam);
// 再次支付(待支付->可支付->倒计时结束释放库存) // 再次支付(待支付->可支付->倒计时结束释放库存)
ResponseDto<PayResultVo> payAgain(PayAgainParam payAgainParam); ResponseDto<PayInnerResultVo> payAgain(PayAgainParam payAgainParam);
// 支付回调(待支付->已支付->中断倒计时) // 支付回调(待支付->已支付->中断倒计时)
String syncOrder(SyncOrderParam syncOrderParam); String syncOrder(SyncOrderParam syncOrderParam);
......
...@@ -54,8 +54,8 @@ liquidnet: ...@@ -54,8 +54,8 @@ liquidnet:
url: http://devservice.zhengzai.tv/ url: http://devservice.zhengzai.tv/
order: order:
url-pay: url-pay:
pay: http://devpay.zhengzai.tv/ pay: http://devdragon.zhengzai.tv/dragon/pay/dragonPay
check: http://devpay.zhengzai.tv/order/verify check: http://devdragon.zhengzai.tv/dragon/pay/checkOrder
localUrl: http://devorder.zhengzai.tv/order/order/syncOrder localUrl: http://devorder.zhengzai.tv/order/order/syncOrder
url-service: url-service:
url: http://devservice.zhengzai.tv/ url: http://devservice.zhengzai.tv/
......
...@@ -138,6 +138,11 @@ public class KylinOrderTickets implements Serializable { ...@@ -138,6 +138,11 @@ public class KylinOrderTickets implements Serializable {
*/ */
private String paymentType; private String paymentType;
/**
* 支付的订单号
*/
private String paymentId;
/** /**
* 支付时间 * 支付时间
*/ */
...@@ -240,7 +245,7 @@ public class KylinOrderTickets implements Serializable { ...@@ -240,7 +245,7 @@ public class KylinOrderTickets implements Serializable {
*/ */
public Object[] getSynOrderObject(LocalDateTime updateTime,LocalDateTime createTime) { public Object[] getSynOrderObject(LocalDateTime updateTime,LocalDateTime createTime) {
return new Object[]{ return new Object[]{
paymentType, payCode, timePay, qrCode, updatedAt, orderTicketsId,updateTime,createTime paymentId,paymentType, payCode, timePay, qrCode, updatedAt, orderTicketsId,updateTime,createTime
}; };
} }
......
package com.liquidnet.service.dragon.channel.alipay.strategy.impl; package com.liquidnet.service.dragon.channel.alipay.strategy.impl;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.dragon.channel.alipay.biz.AlipayBiz; import com.liquidnet.service.dragon.channel.alipay.biz.AlipayBiz;
import com.liquidnet.service.dragon.channel.alipay.req.AlipayTradePayReq; import com.liquidnet.service.dragon.channel.alipay.req.AlipayTradePayReq;
...@@ -40,7 +41,9 @@ public abstract class AbstractAlipayStrategy implements IAlipayStrategy { ...@@ -40,7 +41,9 @@ public abstract class AbstractAlipayStrategy implements IAlipayStrategy {
alipayTradePayReq.setBody(dragonPayBaseReqDto.getDetail()); alipayTradePayReq.setBody(dragonPayBaseReqDto.getDetail());
//dragon中支付编号 //dragon中支付编号
alipayTradePayReq.setOutTradeNo(dragonPayBaseReqDto.getCode()); alipayTradePayReq.setOutTradeNo(dragonPayBaseReqDto.getCode());
alipayTradePayReq.setTimeExpire(dragonPayBaseReqDto.getExpireTime()); //设置订单过期时间
String timeExpire = DateUtil.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(dragonPayBaseReqDto.getCreateDate()).plusMinutes(Long.parseLong(dragonPayBaseReqDto.getExpireTime())),DateUtil.Formatter.yyyyMMddHHmmss);
alipayTradePayReq.setTimeExpire(timeExpire);
alipayTradePayReq.setNotifyUrl(this.getNotifyUrl()); alipayTradePayReq.setNotifyUrl(this.getNotifyUrl());
alipayTradePayReq.setTimestamp(dragonPayBaseReqDto.getCreateDate()); alipayTradePayReq.setTimestamp(dragonPayBaseReqDto.getCreateDate());
//调用支付 //调用支付
......
...@@ -4,7 +4,7 @@ import com.thoughtworks.xstream.annotations.XStreamAlias; ...@@ -4,7 +4,7 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data; import lombok.Data;
@Data @Data
@XStreamAlias("xml") @XStreamAlias("root")
public class WePayRefundReturnCallBackInfoDto { public class WePayRefundReturnCallBackInfoDto {
@XStreamAlias("out_refund_no") @XStreamAlias("out_refund_no")
private String outRefundNo; private String outRefundNo;
......
...@@ -106,7 +106,8 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy { ...@@ -106,7 +106,8 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
parameters.put("body", dragonPayBaseReqDto.getName()); parameters.put("body", dragonPayBaseReqDto.getName());
parameters.put("detail", dragonPayBaseReqDto.getDetail()); parameters.put("detail", dragonPayBaseReqDto.getDetail());
parameters.put("out_trade_no", dragonPayBaseReqDto.getCode()); parameters.put("out_trade_no", dragonPayBaseReqDto.getCode());
parameters.put("time_expire", "203110908103456"); String timeExpire = DateUtil.format(DateUtil.Formatter.yyyyMMddHHmmss.parse(dragonPayBaseReqDto.getCreateDate()).plusMinutes(Long.parseLong(dragonPayBaseReqDto.getExpireTime())),DateUtil.Formatter.yyyyMMddHHmmssTrim);
parameters.put("time_expire", timeExpire);
parameters.put("notify_url", this.getNotifyUrl()); parameters.put("notify_url", this.getNotifyUrl());
return parameters; return parameters;
}; };
......
...@@ -5,6 +5,7 @@ import com.liquidnet.service.base.ResponseDto; ...@@ -5,6 +5,7 @@ import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.dragon.constant.DragonConstant; import com.liquidnet.service.dragon.constant.DragonConstant;
import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto; import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto; import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
import com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto;
import com.liquidnet.service.dragon.service.IDragonOrdersService; import com.liquidnet.service.dragon.service.IDragonOrdersService;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -47,7 +48,9 @@ public class PayController { ...@@ -47,7 +48,9 @@ public class PayController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "detail", value = "订单描述", example = "测试订单001"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "detail", value = "订单描述", example = "测试订单001"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "orderCode", value = "订单编号", example = "ORDER0001"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "orderCode", value = "订单编号", example = "ORDER0001"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "clientIp", value = "客户端ip", example = "127.0.0.1"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "clientIp", value = "客户端ip", example = "127.0.0.1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "notifyUrl", value = "通知url", example = "testdragon.zhengzai.tv"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "notifyUrl", value = "通知url", example = "devdragon.zhengzai.tv"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "createDate", value = "订单创建时间", example = "2021-07-13 13:00:00"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "expireTime", value = "订单过期时间", example = "5"),
}) })
@ResponseBody @ResponseBody
public ResponseDto<DragonPayBaseRespDto> dragonPay( public ResponseDto<DragonPayBaseRespDto> dragonPay(
...@@ -65,8 +68,8 @@ public class PayController { ...@@ -65,8 +68,8 @@ public class PayController {
// @RequestParam(value = "quitUrl",required = false) String quitUrl, // @RequestParam(value = "quitUrl",required = false) String quitUrl,
// @RequestParam(value = "showUrl",required = false) String showUrl, // @RequestParam(value = "showUrl",required = false) String showUrl,
// @RequestParam(value = "code",required = false) String code, // @RequestParam(value = "code",required = false) String code,
@RequestParam(value = "createDate",required = false) String createDate, @RequestParam(value = "createDate",required = true) String createDate,
@RequestParam(value = "expireTime",required = false) String expireTime){ @RequestParam(value = "expireTime",required = true) String expireTime){
//为什么在js和applet中才需要判断open_id? //为什么在js和applet中才需要判断open_id?
if(payType.equalsIgnoreCase(DragonConstant.PayChannelEnum.WEPAY.getCode())){ if(payType.equalsIgnoreCase(DragonConstant.PayChannelEnum.WEPAY.getCode())){
if(StringUtil.isEmpty(openId)){ if(StringUtil.isEmpty(openId)){
...@@ -92,4 +95,18 @@ public class PayController { ...@@ -92,4 +95,18 @@ public class PayController {
dragonPayBaseReqDto.setExpireTime(expireTime); dragonPayBaseReqDto.setExpireTime(expireTime);
return dragonOrdersService.dragonPay(dragonPayBaseReqDto); return dragonOrdersService.dragonPay(dragonPayBaseReqDto);
} }
@PostMapping("/checkOrder")
@ApiOperation("订单查询")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "code", value = "", example = "PAY202107131522368438531155")
})
@ResponseBody
public ResponseDto<DragonPayOrderQueryRespDto> checkOrder(@RequestParam(value = "code") @NotNull(message = "支付编号不能为空!") String code){
DragonPayOrderQueryRespDto respDto = new DragonPayOrderQueryRespDto();
respDto.setCode(code);
respDto.setOrderCode("");
respDto.setStatus(DragonConstant.PayStatusEnum.STATUS_PAID.getCode());
return ResponseDto.success(respDto);
}
} }
...@@ -394,6 +394,80 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService ...@@ -394,6 +394,80 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
} }
} }
public String aliPayRefundCallBack(HttpServletRequest request, HttpServletResponse response) {
InputStream inStream;
ByteArrayOutputStream outSteam;
LocalDateTime nowTime = LocalDateTime.now();
try {
inStream = request.getInputStream();
outSteam = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = inStream.read(buffer)) != -1) {
outSteam.write(buffer, 0, len);
}
// 获取微信调用我们notify_url的返回信息
String jsonStr = new String(outSteam.toByteArray(), "utf-8");
outSteam.close();
inStream.close();
log.debug("JSON = " + jsonStr);
WePayRefundReturnCallBackDto callBackDto = XmlUtil.toBean(jsonStr, WePayRefundReturnCallBackDto.class);
log.debug("DATA = " + callBackDto);
if (callBackDto.getReturnCode().equalsIgnoreCase("SUCCESS")) {
String reqInfo = PayWepayUtils.getInstance().unCodeReqInfo(callBackDto.getReqInfo());
log.debug("REQINFO = " + reqInfo);
WePayRefundReturnCallBackInfoDto info = XmlUtil.toBean(reqInfo, WePayRefundReturnCallBackInfoDto.class);
String outRefundNo = info.getOutRefundNo();
String refundAt = info.getSuccessTime();
try {
sendMySqlRedis(
SqlMapping.get("dragon_order_refund_log.insert"),
new Object[]{outRefundNo, info.getRefundRequestSource(), JSON.toJSONString(info), nowTime, nowTime}
);
sendMySqlRedis(
SqlMapping.get("dragon_order_refund_success.update"),
new Object[]{nowTime, refundAt, DragonConstant.RefundStatusEnum.STATUS_REFUNDED.getCode(), outRefundNo}
);
NotifyUrlDto dto = new NotifyUrlDto();
if (info.getRefundStatus().equalsIgnoreCase("SUCCESS")) {
dto.setStatus(1);
} else {
dto.setStatus(0);
}
// dto.setOrderCode();
// dto.setCode();
// dto.setType();
// dto.setPrice();
// dto.setPaymentType();
// dto.setPaymentId();
// dto.setPaymentAt();
dto.setOrderRefundCode(info.getOutRefundNo());
dto.setRefundCode(info.getOutTradeNo());
dto.setRefundPrice(info.getRefundFee());
// dto.setRefundReason();
dto.setRefundId(info.getRefundId());
// dto.setRefundType(info.getrefund);
dto.setRefundAt(refundAt);
dto.setRefundError(callBackDto.getReturnMsg());
sendNotifyUrl(dto);
return "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
} catch (Exception e) {
e.printStackTrace();
log.error("");
return "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[ERROR]]></return_msg></xml>";
}
} else {
return "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[ERROR]]></return_msg></xml>";
}
} catch (Exception e) {
e.printStackTrace();
log.error("");
return "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[ERROR]]></return_msg></xml>";
}
}
/** /**
* 给 REDIS 队列发送消息 数据库相关 * 给 REDIS 队列发送消息 数据库相关
* *
...@@ -432,6 +506,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService ...@@ -432,6 +506,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
params.add("refundPrice", notifyUrlDto.getRefundPrice()); params.add("refundPrice", notifyUrlDto.getRefundPrice());
params.add("status", notifyUrlDto.getStatus().toString()); params.add("status", notifyUrlDto.getStatus().toString());
String response = HttpUtil.post((String) redisUtil.get(DragonConstant.REFUND_REDIS_KET + notifyUrlDto.getOrderRefundCode()), params); String response = HttpUtil.post((String) redisUtil.get(DragonConstant.REFUND_REDIS_KET + notifyUrlDto.getOrderRefundCode()), params);
log.debug("RETURN RESPONSE="+response);
if (response.equals("success")) { if (response.equals("success")) {
sendMySqlRedis( sendMySqlRedis(
SqlMapping.get("dragon_order_refund_call_back.update"), SqlMapping.get("dragon_order_refund_call_back.update"),
......
...@@ -494,6 +494,7 @@ CREATE TABLE `kylin_order_tickets` ...@@ -494,6 +494,7 @@ CREATE TABLE `kylin_order_tickets`
`refund_number` int(32) NOT NULL DEFAULT 0 COMMENT '退款张数', `refund_number` int(32) NOT NULL DEFAULT 0 COMMENT '退款张数',
`pay_type` varchar(255) NOT NULL DEFAULT '' COMMENT '选择支付方式', `pay_type` varchar(255) NOT NULL DEFAULT '' COMMENT '选择支付方式',
`payment_type` varchar(255) NULL DEFAULT '' COMMENT '实际支付方式', `payment_type` varchar(255) NULL DEFAULT '' COMMENT '实际支付方式',
`payment_id` varchar(255) NULL DEFAULT '' COMMENT '支付的订单号',
`time_pay` varchar(255) NULL DEFAULT '' COMMENT '支付时间', `time_pay` varchar(255) NULL DEFAULT '' COMMENT '支付时间',
`express_contacts` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人', `express_contacts` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人',
`express_address` varchar(255) NOT NULL DEFAULT '' COMMENT '收货地址', `express_address` varchar(255) NOT NULL DEFAULT '' COMMENT '收货地址',
......
...@@ -41,7 +41,7 @@ public class KylinOrderTicketsController { ...@@ -41,7 +41,7 @@ public class KylinOrderTicketsController {
@PostMapping("pre") @PostMapping("pre")
@ApiOperation("下单") @ApiOperation("下单")
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<PayResultVo> checkCanOrder(@RequestBody @Valid PayOrderParam payOrderParam) { public ResponseDto<PayInnerResultVo> checkCanOrder(@RequestBody @Valid PayOrderParam payOrderParam) {
return orderTicketsOrderService.checkCanOrder(payOrderParam); return orderTicketsOrderService.checkCanOrder(payOrderParam);
} }
...@@ -49,7 +49,7 @@ public class KylinOrderTicketsController { ...@@ -49,7 +49,7 @@ public class KylinOrderTicketsController {
@PostMapping("pre2") @PostMapping("pre2")
@ApiOperation("下单2") @ApiOperation("下单2")
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<PayResultVo> checkCanOrder2(@RequestBody @Valid EncryptedReq<PayOrderParam> encryptedReq) { public ResponseDto<PayInnerResultVo> checkCanOrder2(@RequestBody @Valid EncryptedReq<PayOrderParam> encryptedReq) {
PayOrderParam payOrderParam = encryptedReq.getData(); PayOrderParam payOrderParam = encryptedReq.getData();
return orderTicketsOrderService.checkCanOrder(payOrderParam); return orderTicketsOrderService.checkCanOrder(payOrderParam);
} }
...@@ -57,8 +57,8 @@ public class KylinOrderTicketsController { ...@@ -57,8 +57,8 @@ public class KylinOrderTicketsController {
@PostMapping("payAgain") @PostMapping("payAgain")
@ApiOperation("再次支付") @ApiOperation("再次支付")
@ApiResponse(code = 200, message = "接口返回对象参数") @ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<PayResultVo> payAgain(@RequestBody @Valid PayAgainParam payAgainParam) { public ResponseDto<PayInnerResultVo> payAgain(@RequestBody @Valid PayAgainParam payAgainParam) {
PayResultVo vo = orderTicketsOrderService.payAgain(payAgainParam).getData(); PayInnerResultVo vo = orderTicketsOrderService.payAgain(payAgainParam).getData();
if (null == vo) { if (null == vo) {
return ResponseDto.failure(ErrorMapping.get("20024")); return ResponseDto.failure(ErrorMapping.get("20024"));
} else { } else {
......
...@@ -18,6 +18,7 @@ import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketVo; ...@@ -18,6 +18,7 @@ import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketEntitiesVo; import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketEntitiesVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo; import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo; import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.kylin.dto.vo.returns.PayInnerResultVo;
import com.liquidnet.service.kylin.dto.vo.returns.PayResultVo; import com.liquidnet.service.kylin.dto.vo.returns.PayResultVo;
import com.liquidnet.service.kylin.entity.KylinOrderTicketEntities; import com.liquidnet.service.kylin.entity.KylinOrderTicketEntities;
import com.liquidnet.service.kylin.entity.KylinOrderTicketRelations; import com.liquidnet.service.kylin.entity.KylinOrderTicketRelations;
...@@ -100,7 +101,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -100,7 +101,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}}; }};
@Override @Override
public ResponseDto<PayResultVo> checkCanOrder(PayOrderParam payOrderParam) { public ResponseDto<PayInnerResultVo> checkCanOrder(PayOrderParam payOrderParam) {
Long currentTime; Long currentTime;
boolean isDownGeneral = false; boolean isDownGeneral = false;
List<AdamEntersVo> entersVoList = new ArrayList<>(); List<AdamEntersVo> entersVoList = new ArrayList<>();
...@@ -305,7 +306,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -305,7 +306,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
} }
ResponseDto<PayResultVo> resultData = order(payOrderParam, uid, isMember, isTrueName, performanceData, ticketData, entersVoList, isStudent, ticketTimesData, currentTime); ResponseDto<PayInnerResultVo> resultData = order(payOrderParam, uid, isMember, isTrueName, performanceData, ticketData, entersVoList, isStudent, ticketTimesData, currentTime);
isDownGeneral = false; isDownGeneral = false;
redisLockUtil.unlock(lock); redisLockUtil.unlock(lock);
return resultData; return resultData;
...@@ -333,7 +334,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -333,7 +334,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
} }
} }
private ResponseDto<PayResultVo> order(PayOrderParam payOrderParam, String uid, boolean isMember, int isTrueName, KylinPerformanceVo performanceData, KylinTicketVo ticketData, List<AdamEntersVo> entersVoList, Integer isStudent, KylinTicketTimesVo ticketTimesData, Long currentTime) { private ResponseDto<PayInnerResultVo> order(PayOrderParam payOrderParam, String uid, boolean isMember, int isTrueName, KylinPerformanceVo performanceData, KylinTicketVo ticketData, List<AdamEntersVo> entersVoList, Integer isStudent, KylinTicketTimesVo ticketTimesData, Long currentTime) {
LinkedList<String> sqls = new LinkedList<>(); LinkedList<String> sqls = new LinkedList<>();
String source = CurrentUtil.getCliSource() == null ? "" : CurrentUtil.getCliSource(); String source = CurrentUtil.getCliSource() == null ? "" : CurrentUtil.getCliSource();
String version = CurrentUtil.getCliVersion() == null ? "" : CurrentUtil.getCliVersion(); String version = CurrentUtil.getCliVersion() == null ? "" : CurrentUtil.getCliVersion();
...@@ -534,36 +535,39 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -534,36 +535,39 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
httpData.add("price", orderTickets.getPriceActual().toString()); httpData.add("price", orderTickets.getPriceActual().toString());
httpData.add("name", useTime + ticketData.getTitle() + "-" + performanceData.getTitle()); httpData.add("name", useTime + ticketData.getTitle() + "-" + performanceData.getTitle());
httpData.add("detail", performanceData.getTitle() + "-" + ticketData.getTitle() + "-" + useTime); httpData.add("detail", performanceData.getTitle() + "-" + ticketData.getTitle() + "-" + useTime);
httpData.add("order_code", orderTickets.getOrderCode()); httpData.add("orderCode", orderTickets.getOrderCode());
httpData.add("client_ip", CurrentUtil.getCliIpAddr()); httpData.add("clientIp", CurrentUtil.getCliIpAddr());
httpData.add("notify_url", synUrl); httpData.add("notifyUrl", synUrl);
httpData.add("create_date", orderTickets.getCreatedAt().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); httpData.add("createDate", orderTickets.getCreatedAt().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
httpData.add("expire_time", (orderTickets.getPayCountdownMinute()) + ""); httpData.add("expireTime", (orderTickets.getPayCountdownMinute()) + "");
httpData.add("payType", payOrderParam.getPayType());
httpData.add("deviceFrom", payOrderParam.getDeviceFrom());
if (payOrderParam.getDeviceFrom().equals("js") || payOrderParam.getDeviceFrom().equals("applet")) { if (payOrderParam.getDeviceFrom().equals("js") || payOrderParam.getDeviceFrom().equals("applet")) {
httpData.add("open_id", payOrderParam.getOpenId()); httpData.add("openId", payOrderParam.getOpenId());
} }
if (payOrderParam.getPayType().equals("alipay") && payOrderParam.getDeviceFrom().equals("wap")) { if (payOrderParam.getPayType().equals("alipay") && payOrderParam.getDeviceFrom().equals("wap")) {
httpData.add("show_url", payOrderParam.getShowUrl() + orderTicketId); httpData.add("showUrl", payOrderParam.getShowUrl() + orderTicketId);
httpData.add("return_url", payOrderParam.getReturnUrl() + orderTicketId); httpData.add("returnUrl", payOrderParam.getReturnUrl() + orderTicketId);
} }
currentTime = System.currentTimeMillis(); currentTime = System.currentTimeMillis();
String returnData = HttpUtil.post(payUrl + payOrderParam.getDeviceFrom() + "/" + payOrderParam.getPayType(), httpData); String returnData = HttpUtil.post(payUrl, httpData);
log.debug("NOTIFY_URL = " + synUrl); log.debug("NOTIFY_URL = " + synUrl);
currentTime = System.currentTimeMillis() - currentTime; currentTime = System.currentTimeMillis() - currentTime;
log.debug("调用 PHP 支付 -> time:" + (currentTime) + "毫秒"); log.debug("调用 PHP 支付 -> time:" + (currentTime) + "毫秒");
PayResultVo payResultVo = JsonUtils.fromJson(returnData, PayResultVo.class); PayResultVo payResultVo = JsonUtils.fromJson(returnData, PayResultVo.class);
payResultVo.setOrder_id(orderTicketId); payResultVo.getData().setOrderId(orderTicketId);
payResultVo.setPrice(orderTickets.getPriceActual()); payResultVo.getData().setPrice(orderTickets.getPriceActual());
orderTickets.setPayCode(payResultVo.getCode()); orderTickets.setPayCode(payResultVo.getData().getCode());
sqls.add(SqlMapping.get("kylin_order_ticket.add")); sqls.add(SqlMapping.get("kylin_order_ticket.add"));
LinkedList<Object[]> sqlsDataA = new LinkedList<>(); LinkedList<Object[]> sqlsDataA = new LinkedList<>();
sqlsDataA.add(orderTickets.getAddObject()); sqlsDataA.add(orderTickets.getAddObject());
if (payOrderParam.getPayType().equals("alipay") && payOrderParam.getDeviceFrom().equals("wap")) { if (payOrderParam.getPayType().equals("alipay") && payOrderParam.getDeviceFrom().equals("wap")) {
payResultVo.setShowUrl(payOrderParam.getShowUrl() + orderTicketId); payResultVo.getData().setShowUrl(payOrderParam.getShowUrl() + orderTicketId);
payResultVo.setReturnUrl(payOrderParam.getReturnUrl() + orderTicketId); payResultVo.getData().setReturnUrl(payOrderParam.getReturnUrl() + orderTicketId);
} }
// 生成vo // 生成vo
KylinOrderTicketVo orderTicketVo = new KylinOrderTicketVo(); KylinOrderTicketVo orderTicketVo = new KylinOrderTicketVo();
...@@ -594,12 +598,12 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -594,12 +598,12 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
sqlData); sqlData);
currentTime = System.currentTimeMillis() - currentTime; currentTime = System.currentTimeMillis() - currentTime;
log.debug("MQ 发送 -> time:" + (currentTime) + "毫秒"); log.debug("MQ 发送 -> time:" + (currentTime) + "毫秒");
log.info(UserPathDto.setData("下单(唤起支付)", payOrderParam, payResultVo)); log.info(UserPathDto.setData("下单(唤起支付)", payOrderParam, payResultVo.getData()));
return ResponseDto.success(payResultVo); return ResponseDto.success(payResultVo.getData());
} }
@Override @Override
public ResponseDto<PayResultVo> payAgain(PayAgainParam payAgainParam) { public ResponseDto<PayInnerResultVo> payAgain(PayAgainParam payAgainParam) {
try { try {
String uid = CurrentUtil.getCurrentUid(); String uid = CurrentUtil.getCurrentUid();
// checkOrderTime(uid); // checkOrderTime(uid);
...@@ -621,7 +625,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -621,7 +625,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
} }
String returnCheckData = HttpUtil.get(checkUrl + "?code=" + orderTicketData.getPayCode(), null); String returnCheckData = HttpUtil.get(checkUrl + "?code=" + orderTicketData.getPayCode(), null);
PayResultVo checkVo = JsonUtils.fromJson(returnCheckData, PayResultVo.class); PayResultVo checkVo = JsonUtils.fromJson(returnCheckData, PayResultVo.class);
if (checkVo.getStatus() == 1) { if (checkVo.getData().getStatus() == 1) {
return ResponseDto.failure(ErrorMapping.get("20027")); return ResponseDto.failure(ErrorMapping.get("20027"));
} }
if (!orderTicketData.getPayType().equals("no")) { if (!orderTicketData.getPayType().equals("no")) {
...@@ -636,26 +640,31 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -636,26 +640,31 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
httpData.add("price", orderTicketData.getPriceActual().toString()); httpData.add("price", orderTicketData.getPriceActual().toString());
httpData.add("name", entitiesData.getUseStart() + "" + entitiesData.getPerformanceTitle()); httpData.add("name", entitiesData.getUseStart() + "" + entitiesData.getPerformanceTitle());
httpData.add("detail", entitiesData.getPerformanceTitle() + "-" + entitiesData.getTicketTitle() + "-" + entitiesData.getUseStart()); httpData.add("detail", entitiesData.getPerformanceTitle() + "-" + entitiesData.getTicketTitle() + "-" + entitiesData.getUseStart());
httpData.add("order_code", orderTicketData.getOrderCode()); httpData.add("orderCode", orderTicketData.getOrderCode());
httpData.add("client_ip", CurrentUtil.getCliIpAddr()); httpData.add("clientIp", CurrentUtil.getCliIpAddr());
httpData.add("notify_url", synUrl); httpData.add("notifyUrl", synUrl);
httpData.add("create_date", orderTicketData.getCreatedAt()); httpData.add("createDate", orderTicketData.getCreatedAt());
httpData.add("expire_time", orderTicketData.getPayCountdownMinute().toString()); httpData.add("expireTime", orderTicketData.getPayCountdownMinute().toString());
httpData.add("open_id", payAgainParam.getOpenId()); httpData.add("payType", payAgainParam.getPayType());
httpData.add("deviceFrom", payAgainParam.getDeviceFrom());
if (payAgainParam.getDeviceFrom().equals("js") || payAgainParam.getDeviceFrom().equals("applet")) {
httpData.add("openId", payAgainParam.getOpenId());
}
if (payAgainParam.getPayType().equals("alipay") && payAgainParam.getDeviceFrom().equals("wap")) { if (payAgainParam.getPayType().equals("alipay") && payAgainParam.getDeviceFrom().equals("wap")) {
httpData.add("show_url", payAgainParam.getShowUrl() + payAgainParam.getOrderId()); httpData.add("showUrl", payAgainParam.getShowUrl() + payAgainParam.getOrderId());
httpData.add("return_url", payAgainParam.getReturnUrl() + payAgainParam.getOrderId()); httpData.add("returnUrl", payAgainParam.getReturnUrl() + payAgainParam.getOrderId());
} }
String returnData = HttpUtil.post(payUrl + payAgainParam.getDeviceFrom() + "/" + payAgainParam.getPayType(), httpData); String returnData = HttpUtil.post(payUrl + payAgainParam.getDeviceFrom() + "/" + payAgainParam.getPayType(), httpData);
PayResultVo payResultVo = JsonUtils.fromJson(returnData, PayResultVo.class); PayResultVo payResultVo = JsonUtils.fromJson(returnData, PayResultVo.class);
payResultVo.setOrder_id(orderTicketData.getOrderTicketsId()); payResultVo.getData().setOrderId(orderTicketData.getOrderTicketsId());
payResultVo.setPrice(orderTicketData.getPriceActual()); payResultVo.getData().setPrice(orderTicketData.getPriceActual());
if (payAgainParam.getPayType().equals("alipay") && payAgainParam.getDeviceFrom().equals("wap")) { if (payAgainParam.getPayType().equals("alipay") && payAgainParam.getDeviceFrom().equals("wap")) {
payResultVo.setShowUrl(payAgainParam.getShowUrl()); payResultVo.getData().setShowUrl(payAgainParam.getShowUrl());
payResultVo.setReturnUrl(payAgainParam.getReturnUrl()); payResultVo.getData().setReturnUrl(payAgainParam.getReturnUrl());
} }
KylinOrderTickets orderTickets = new KylinOrderTickets(); KylinOrderTickets orderTickets = new KylinOrderTickets();
...@@ -694,8 +703,8 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -694,8 +703,8 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
String sqlData = SqlMapping.gets(sqls, sqlsDataA, sqlsDataB, sqlsDataC, sqlsDataD); String sqlData = SqlMapping.gets(sqls, sqlsDataA, sqlsDataB, sqlsDataC, sqlsDataD);
rabbitTemplate.convertAndSend(MQConst.EXCHANGES_LIQUIDNET_SQL_ORDER_AGAIN, MQConst.ROUTING_KEY_SQL_ORDER_AGAIN, sqlData); rabbitTemplate.convertAndSend(MQConst.EXCHANGES_LIQUIDNET_SQL_ORDER_AGAIN, MQConst.ROUTING_KEY_SQL_ORDER_AGAIN, sqlData);
log.info(UserPathDto.setData("再次支付", payAgainParam, payResultVo)); log.info(UserPathDto.setData("再次支付", payAgainParam, payResultVo.getData()));
return ResponseDto.success(payResultVo); return ResponseDto.success(payResultVo.getData());
} }
return ResponseDto.failure(ErrorMapping.get("20029")); return ResponseDto.failure(ErrorMapping.get("20029"));
} catch (Exception e) { } catch (Exception e) {
...@@ -765,6 +774,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -765,6 +774,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
orderTickets.setTimePay(timePay); orderTickets.setTimePay(timePay);
orderTickets.setQrCode(IDGenerator.ticketQrCode(orderTicketData.getOrderTicketsId())); orderTickets.setQrCode(IDGenerator.ticketQrCode(orderTicketData.getOrderTicketsId()));
orderTickets.setUpdatedAt(now); orderTickets.setUpdatedAt(now);
orderTickets.setPaymentId(syncOrderParam.getPayment_id());
sqls.add(SqlMapping.get("kylin_order_ticket.synPay")); sqls.add(SqlMapping.get("kylin_order_ticket.synPay"));
sqlsDataA.add(orderTickets.getSynOrderObject(strTime, strTime)); sqlsDataA.add(orderTickets.getSynOrderObject(strTime, strTime));
...@@ -890,7 +900,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -890,7 +900,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
} else { } else {
String returnCheckData = HttpUtil.get(checkUrl + "?code=" + orderTicketData.getPayCode(), null); String returnCheckData = HttpUtil.get(checkUrl + "?code=" + orderTicketData.getPayCode(), null);
PayResultVo checkVo = JsonUtils.fromJson(returnCheckData, PayResultVo.class); PayResultVo checkVo = JsonUtils.fromJson(returnCheckData, PayResultVo.class);
if (checkVo.getStatus() == 1) { if (checkVo.getData().getStatus() == 1) {
return ResponseDto.success(1); return ResponseDto.success(1);
} else { } else {
return ResponseDto.success(0); return ResponseDto.success(0);
......
...@@ -18,7 +18,7 @@ kylin_order_ticket_entities.payAgain=UPDATE kylin_order_ticket_entities SET upda ...@@ -18,7 +18,7 @@ kylin_order_ticket_entities.payAgain=UPDATE kylin_order_ticket_entities SET upda
# ------------------------支付回调---------------------------- # ------------------------支付回调----------------------------
kylin_order_ticket.synPay=UPDATE kylin_order_tickets SET payment_type = ? ,pay_code = ? , time_pay = ?, qr_code = ? , updated_at = ? WHERE order_tickets_id = ? and (updated_at <= ? or created_at = ?) kylin_order_ticket.synPay=UPDATE kylin_order_tickets SET payment_id =? ,payment_type = ? ,pay_code = ? , time_pay = ?, qr_code = ? , updated_at = ? WHERE order_tickets_id = ? and (updated_at <= ? or created_at = ?)
kylin_order_ticket_status.synPay=UPDATE kylin_order_ticket_status SET `status` = ?,pay_status = ?,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ?) kylin_order_ticket_status.synPay=UPDATE kylin_order_ticket_status SET `status` = ?,pay_status = ?,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ?)
kylin_order_ticket_relation.synPay=UPDATE kylin_order_ticket_relations SET updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ?) kylin_order_ticket_relation.synPay=UPDATE kylin_order_ticket_relations SET updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ?)
kylin_order_ticket_entities.synPay=UPDATE kylin_order_ticket_entities SET is_payment = ?,updated_at = ?,sys_damai = 1 WHERE order_id = ? and (updated_at <= ? or created_at = ?) kylin_order_ticket_entities.synPay=UPDATE kylin_order_ticket_entities SET is_payment = ?,updated_at = ?,sys_damai = 1 WHERE order_id = ? and (updated_at <= ? or created_at = ?)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment