--修改待支付订单
This commit is contained in:
@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.soap.Text;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.file.Files;
|
||||
@@ -36,6 +37,12 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@@ -99,6 +106,37 @@ public class WeChatPayController {
|
||||
@RequestMapping(value = "/placeAnOrder/app")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R pay(@RequestBody WechatDto dto ) throws Exception{
|
||||
// Date afterDate = new Date(nowDate.getTime()+300000*3);
|
||||
|
||||
|
||||
//
|
||||
// Date nowDate = new Date();
|
||||
// Date afterDate = new Date(nowDate.getTime() + 60000);
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ssXXX");
|
||||
// sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
|
||||
//
|
||||
// String dateString = sdf.format(afterDate); // 将修改后的时间转换为字符串
|
||||
|
||||
//
|
||||
// ZoneId zoneId = ZoneId.of("Asia/Shanghai");
|
||||
// Instant now = Instant.now();
|
||||
// Instant after = now.plus(60, ChronoUnit.SECONDS);
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ssXXX");
|
||||
//// .withZone(zoneId);
|
||||
// sdf.setTimeZone(TimeZone.getTimeZone(zoneId));
|
||||
//
|
||||
// String afterString = sdf.format(after);
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// System.out.println("修改后时间:" + afterString);
|
||||
|
||||
|
||||
|
||||
|
||||
System.out.println("==========ordersn================"+dto.getOrderSn());
|
||||
log.info("生成订单");
|
||||
List<BuyOrderEntity> one = this.buyOrderService.getBaseMapper().selectList(new QueryWrapper<BuyOrderEntity>().eq("order_sn", dto.getOrderSn()));
|
||||
@@ -112,7 +150,8 @@ public class WeChatPayController {
|
||||
paramMap.put("out_trade_no",order.getOrderSn());
|
||||
// paramMap.put("attach",""); //自定义数据 支付完成后才能显示 在查询API和支付通知中原样返回,可作为自定义参数使用
|
||||
paramMap.put("notify_url",wechatPayConfig.getNotifyUrl());
|
||||
// paramMap.put("time_expire","");
|
||||
|
||||
// paramMap.put("time_expire",afterString);
|
||||
// 实收金额0.38乘100=38
|
||||
BigDecimal realsmoney= order.getRealMoney();
|
||||
BigDecimal hand=new BigDecimal("100");
|
||||
@@ -170,7 +209,9 @@ public class WeChatPayController {
|
||||
wechat.setPayType(order.getOrderType()); //交易类型
|
||||
wechat.setOrderId(order.getOrderSn()); //订单号
|
||||
wechat.setBuyOrderId(dto.getBuyOrderId()); //购买配置id
|
||||
// wechat.setEndtime(after);
|
||||
this.payWechatOrderService.save(wechat); //微信订单表拿到数据保存数据库
|
||||
|
||||
} else if (statusCode == 204) { //处理成功,无返回Body
|
||||
System.out.println("成功");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user