You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
6.6 KiB
1 lines
6.6 KiB
package com.cweb.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.hai.common.Base64Util;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.pay.util.XmlUtil;
import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.*;
import com.hai.config.*;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.*;
import com.hai.enum_type.LoginPlatform;
import com.hai.enum_type.MerchantStoreSourceType;
import com.hai.model.*;
import com.hai.pay.channel.huift.TradeService;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import org.bouncycastle.util.encoders.UrlBase64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.IdGenerator;
import org.springframework.web.bind.annotation.*;
import sun.nio.cs.StreamEncoder;
import javax.annotation.Resource;
import javax.net.ssl.SSLContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.security.KeyStore;
import java.util.*;
/**
* @Auther: 胡锐
* @Description:
* @Date: 2021/3/26 23:08
*/
@Controller
@RequestMapping(value = "/test")
@Api(value = "订单接口")
public class HighTestController {
private static Logger log = LoggerFactory.getLogger(HighTestController.class);
@Resource
private PayloService payloService;
@Resource
private HighGasService gasService;
@Resource
private HighUserService userService;
@Resource
private HighOrderService orderService;
@Resource
private HighMerchantStoreService merchantStoreService;
@RequestMapping(value = "/invalidCoupon", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "重庆CNPC电子券作废")
public ResponseData invalidCoupon(@RequestParam(name = "couponNo", required = true) String couponNo,
@RequestParam(name = "random", required = false) String random) {
try {
return ResponseMsgUtil.success(ChongQingCNPCService.invalidCoupon(couponNo, null));
} catch (Exception e) {
log.error("HighOrderController --> getBackendToken() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/ycShellPageQueryAllStation", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "订单退款")
public ResponseData ycShellPageQueryAllStation() {
try {
return ResponseMsgUtil.success(payloService.ycShellPageQueryAllStation(1, 50));
} catch (Exception e) {
log.error("HighOrderController --> getBackendToken() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/HuiLianTongConfigPayOrderByCouNo", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "")
public ResponseData HuiLianTongConfigPayOrderByCouNo(@RequestParam(name = "couNo", required = true) String couNo) {
try {
JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(couNo);
if (jsonObject.getString("respCode").equals("0000")) {
JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
return ResponseMsgUtil.success(data);
} else {
log.error("getRechargeProduct error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "查询失败");
}
} catch (Exception e) {
log.error("HighOrderController --> getBackendToken() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getPayloAllStation", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "paylo油站")
public ResponseData getPayloAllStation(HttpServletRequest request) {
try {
gasService.getPayloAllStation();
return ResponseMsgUtil.success("");
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@Resource
private TradeService tradeService;
@RequestMapping(value = "/huiftTrade", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "huiftTrade")
public ResponseData huiftTrade(HttpServletRequest request) {
try {
// return ResponseMsgUtil.success(tradeService.thirdPreOrder(orderService.getOrderByOrderNo("2024040215535447310")));
return ResponseMsgUtil.success(tradeService.thirdPayResult("P17124793186600955280"));
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/loginBySilence", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "【H5】根据手机号登录")
public ResponseData loginBySilence(@RequestParam(value = "phone", required = true) String phone ,
HttpServletRequest request, HttpServletResponse response) {
try {
// 客户端
LoginPlatform platform = LoginPlatform.getDataByType("H5");
if (platform == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知客户端");
}
return ResponseMsgUtil.success(userService.loginAndRegister(platform, phone, null, new HashMap<>(), request, response));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}
|