|
@@ -57,7 +57,7 @@ public class PayController {
|
|
@ApiOperation(value = "扫描完获取拉起支付的url")
|
|
@ApiOperation(value = "扫描完获取拉起支付的url")
|
|
@PostMapping("/getPayUrl")
|
|
@PostMapping("/getPayUrl")
|
|
public Object getListByScan(@RequestBody @Validated PayTypeUrl payTypeUrl) throws UnknownHostException, WxPayException {
|
|
public Object getListByScan(@RequestBody @Validated PayTypeUrl payTypeUrl) throws UnknownHostException, WxPayException {
|
|
- System.out.println("授权完成后带过来的openid-------------------------------------------------------------"+payTypeUrl.getOpenid()+"------------------------------------"+payTypeUrl.getOrderId());
|
|
|
|
|
|
+ System.out.println("授权完成后带过来的openid-------------------------------------------------------------" + payTypeUrl.getOpenid() + "------------------------------------" + payTypeUrl.getOrderId());
|
|
OrderDO aDo = orderManager.getById(payTypeUrl.getOrderId());
|
|
OrderDO aDo = orderManager.getById(payTypeUrl.getOrderId());
|
|
if (ObjectUtil.isNull(aDo)) {
|
|
if (ObjectUtil.isNull(aDo)) {
|
|
throw new ServiceException("未查询到订单信息");
|
|
throw new ServiceException("未查询到订单信息");
|
|
@@ -127,20 +127,19 @@ public class PayController {
|
|
|
|
|
|
@PostMapping("getOpenIdCode/{orderId}")
|
|
@PostMapping("getOpenIdCode/{orderId}")
|
|
public String getOpenIdCode(@PathVariable Long orderId, @RequestBody @Validated Map map) throws UnsupportedEncodingException {
|
|
public String getOpenIdCode(@PathVariable Long orderId, @RequestBody @Validated Map map) throws UnsupportedEncodingException {
|
|
- String openIdCode = wxPayServiceMy.getOpenIdCode(orderId,map.get("ip").toString());
|
|
|
|
- System.out.println("授权地址+“--------------------------------------------------------"+openIdCode+"ip-----------------"+map.get("ip").toString());
|
|
|
|
- return wxPayServiceMy.getOpenIdCode(orderId,map.get("ip").toString());
|
|
|
|
|
|
+ String openIdCode = wxPayServiceMy.getOpenIdCode(orderId, map.get("ip").toString());
|
|
|
|
+ System.out.println("授权地址+“--------------------------------------------------------" + openIdCode + "ip-----------------" + map.get("ip").toString());
|
|
|
|
+ return wxPayServiceMy.getOpenIdCode(orderId, map.get("ip").toString());
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/weixin/callback/openidCode")
|
|
@GetMapping("/weixin/callback/openidCode")
|
|
public String handleWeixinCallback(@RequestParam("code") String code, @RequestParam("state") String state, HttpSession session) throws UnsupportedEncodingException {
|
|
public String handleWeixinCallback(@RequestParam("code") String code, @RequestParam("state") String state, HttpSession session) throws UnsupportedEncodingException {
|
|
|
|
+ System.out.println("授权回调来了啊 code=" + code + "111111111111111111111111111111111111111111111state=" + state);
|
|
String[] split = state.split("--");
|
|
String[] split = state.split("--");
|
|
- String orderId= split[0];
|
|
|
|
- String ip = split[1];
|
|
|
|
|
|
+ String orderId = split[0];
|
|
|
|
+ String ip = split[1];
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
- System.out.println("回调来了啊 code="+code+"111111111111111111111111111111111111111111111state="+state);
|
|
|
|
// if (!state.equals((String) session.getAttribute("WEIXIN_OAUTH_STATE"))) {
|
|
// if (!state.equals((String) session.getAttribute("WEIXIN_OAUTH_STATE"))) {
|
|
// log.error("用户授权,state错误");
|
|
// log.error("用户授权,state错误");
|
|
// }
|
|
// }
|
|
@@ -152,15 +151,15 @@ public class PayController {
|
|
aDo.setOpenId(openId);
|
|
aDo.setOpenId(openId);
|
|
orderManager.updateById(aDo);
|
|
orderManager.updateById(aDo);
|
|
|
|
|
|
- double price ;
|
|
|
|
|
|
+ double price;
|
|
List<OrderCustomerFee> list = orderCustomerFeeManager.list(new LambdaQueryWrapper<OrderCustomerFee>().eq(OrderCustomerFee::getOrderId, aDo.getId()));
|
|
List<OrderCustomerFee> list = orderCustomerFeeManager.list(new LambdaQueryWrapper<OrderCustomerFee>().eq(OrderCustomerFee::getOrderId, aDo.getId()));
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
- price = new BigDecimal(aDo.getRealPrice()).add(list.stream().map(OrderCustomerFee::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add)).multiply(new BigDecimal(1 + aDo.getTaxRate() * 0.01)).doubleValue();
|
|
|
|
|
|
+ price = new BigDecimal(aDo.getRealPrice()).add(list.stream().map(OrderCustomerFee::getMoney).reduce(BigDecimal.ZERO, BigDecimal::add)).multiply(new BigDecimal(1 + aDo.getTaxRate() * 0.01)).doubleValue();
|
|
} else {
|
|
} else {
|
|
- price =aDo.getRealPrice() * (1 + aDo.getTaxRate() * 0.01);
|
|
|
|
|
|
+ price = aDo.getRealPrice() * (1 + aDo.getTaxRate() * 0.01);
|
|
}
|
|
}
|
|
- System.out.println( "redirect:"+ip+"#/payType?id="+aDo.getId()+"&sn="+aDo.getSn()+"&price="+price+"&openid="+openId+"8888888888888888888888888888888888888888888");
|
|
|
|
- String url = "redirect:"+ip+"#/payType?id="+aDo.getId()+"&sn="+aDo.getSn()+"&price="+price+"&openid="+openId;
|
|
|
|
|
|
+ System.out.println("redirect:" + ip + "#/payType?id=" + aDo.getId() + "&sn=" + aDo.getSn() + "&price=" + price + "&openid=" + openId + "8888888888888888888888888888888888888888888");
|
|
|
|
+ String url = "redirect:" + ip + "#/payType?id=" + aDo.getId() + "&sn=" + aDo.getSn() + "&price=" + price + "&openid=" + openId;
|
|
String encodedUrl = URLEncoder.encode(url, "UTF-8");
|
|
String encodedUrl = URLEncoder.encode(url, "UTF-8");
|
|
return "redirect:" + encodedUrl;
|
|
return "redirect:" + encodedUrl;
|
|
}
|
|
}
|