package com.gxwebsoft.shop.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayConstants;
import com.alipay.api.CertAlipayRequest;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.internal.util.AlipayEncrypt;
import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.AlipayTradeCreateRequest;
import com.alipay.api.response.AlipayTradeCreateResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.core.config.ConfigProperties;
import com.gxwebsoft.common.core.web.*;
import com.gxwebsoft.common.system.service.OperationRecordService;
import com.gxwebsoft.shop.entity.Order;
import com.gxwebsoft.shop.entity.Payment;
import com.gxwebsoft.shop.param.PaymentParam;
import com.gxwebsoft.shop.service.OrderService;
import com.gxwebsoft.shop.service.PaymentService;
import com.gxwebsoft.shop.service.UserOauthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 定时任务
 *
 * @author 科技小王子
 * @since 2022-12-15 19:11:07
 */
@Api(tags = "定时任务")
@RestController
@RequestMapping("/api/shop/payment")
public class SchedulingController extends BaseController {
  @Resource
  private OrderService orderService;

//  /**
//   * 删除失效订单
//   */
//  @Scheduled(cron="0 0 */1 * * ?")
//  public void reportCurrentTime() {
//    System.out.println("定时任务开始 = " + new Date());
//    boolean remove = orderService.remove(new LambdaQueryWrapper<Order>()
//      .lt(Order::getExpirationTime, new Date())
//      .eq(Order::getPayStatus, 10)
//      .eq(Order::getOrderStatus, 10));
//    System.out.println("remove = " + remove);
//  }
}
