diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java index b5e7178..aa4445f 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/PayController.java @@ -8,12 +8,12 @@ import com.alipay.api.AlipayClient; import com.alipay.api.AlipayConfig; import com.alipay.api.DefaultAlipayClient; import com.alipay.api.request.AlipaySystemOauthTokenRequest; -import com.alipay.api.request.AlipayUserInfoShareRequest; import com.alipay.api.response.AlipaySystemOauthTokenResponse; -import com.alipay.api.response.AlipayUserInfoShareResponse; import com.chaozhanggui.system.cashierservice.annotation.LimitSubmit; +import com.chaozhanggui.system.cashierservice.dao.TbOrderInfoMapper; import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper; import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail; +import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo; import com.chaozhanggui.system.cashierservice.entity.TbShopInfo; import com.chaozhanggui.system.cashierservice.entity.dto.ReturnGroupOrderDto; import com.chaozhanggui.system.cashierservice.entity.dto.VipPayDTO; @@ -24,11 +24,9 @@ import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.Result; import com.chaozhanggui.system.cashierservice.util.IpUtil; import com.chaozhanggui.system.cashierservice.util.JSONUtil; -import com.chaozhanggui.system.cashierservice.util.RedisCst; import com.chaozhanggui.system.cashierservice.util.WechatUtil; import com.fasterxml.jackson.core.JsonProcessingException; import lombok.extern.slf4j.Slf4j; -import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; @@ -52,7 +50,9 @@ public class PayController { private ShopInfoService shopInfoService; @Autowired - TbShopInfoMapper tbShopInfoMapper; + private TbShopInfoMapper tbShopInfoMapper; + @Autowired + private TbOrderInfoMapper tbOrderInfoMapper; @RequestMapping("queryPayType") public Result queryPayType(@RequestHeader("token") String token, @@ -306,6 +306,23 @@ public class PayController { return payService.queryOrderPay(orderId); } + @GetMapping("/noToken/queryOrderInfo") + public Result noTokenQueryOrderInfo(String orderId) { + if(StrUtil.isBlank(orderId)){ + return Result.fail("订单id不能为空"); + } + TbOrderInfo orderInfo = tbOrderInfoMapper.selectByPrimaryKey(Integer.valueOf(orderId)); + if(orderInfo == null){ + return Result.fail("订单不存在"); + } + Map data = new HashMap<>(4); + data.put("id", orderInfo.getId()); + data.put("orderNo", orderInfo.getOrderNo()); + data.put("payAmount", orderInfo.getPayAmount()); + data.put("orderAmount", orderInfo.getOrderAmount()); + return Result.success(CodeEnum.SUCCESS, data); + } + @Value("${wx.ysk.appId}") private String appId; diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/interceptor/SignInterceptor.java b/src/main/java/com/chaozhanggui/system/cashierservice/interceptor/SignInterceptor.java index acf8bf3..91d41a3 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/interceptor/SignInterceptor.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/interceptor/SignInterceptor.java @@ -9,17 +9,13 @@ import com.chaozhanggui.system.cashierservice.util.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Component; -import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; @Component @@ -49,6 +45,10 @@ public class SignInterceptor implements HandlerInterceptor { return true; } + if (requestUri.contains("/pay/noToken/queryOrderInfo")) { + return true; + } + String token=request.getHeader("token"); String loginName=request.getHeader("loginName"); String clientType=request.getHeader("clientType");