|
@@ -13,6 +13,7 @@ import com.fdkankan.sale.entity.RepairPay;
|
|
|
import com.fdkankan.sale.exception.BusinessException;
|
|
|
import com.fdkankan.sale.pay.wx.WXPayDefaultConfig;
|
|
|
import com.fdkankan.sale.pay.wx.WechatPayService;
|
|
|
+import com.fdkankan.sale.pay.wx.WxPayBean;
|
|
|
import com.fdkankan.sale.service.IPriceListService;
|
|
|
import com.fdkankan.sale.service.IRepairLogService;
|
|
|
import com.fdkankan.sale.service.IRepairPayService;
|
|
@@ -24,10 +25,7 @@ import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.io.BufferedOutputStream;
|
|
|
import java.io.InputStream;
|
|
@@ -60,8 +58,9 @@ public class OrderWechatPayController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @RequestMapping(value = "/wechatPreJsPay")
|
|
|
- public String wechatPreJsPay(String repairId,String openId) throws Exception {
|
|
|
+ @GetMapping(value = "/wechatPreJsPay")
|
|
|
+ @ResponseBody
|
|
|
+ public ResultData wechatPreJsPay(String repairId,String openId) throws Exception {
|
|
|
// 这个url链接地址和参数皆不能变
|
|
|
try {
|
|
|
if(StringUtils.isBlank(repairId)){
|
|
@@ -107,12 +106,20 @@ public class OrderWechatPayController extends BaseController {
|
|
|
amount =amount .multiply(new BigDecimal(100));
|
|
|
Map<String, String> resp = wechatPayService.wechatPay(orderSn,subject, subject+subject, amount, UrlUtils.getIpAddr(request), openId);
|
|
|
String timeStamp = String.valueOf(System.currentTimeMillis() / 1000);
|
|
|
- return "redirect:" + CacheUtil.mainUrl + ConstantUrl.WEIXIN_MOBILE_PAY_URL + timeStamp + "&signType=MD5&appId=" + resp.get("appid")
|
|
|
- + "&nonceStr=" + resp.get("nonce_str") + "&prepay_id=" + resp.get("prepay_id") + "&paySign=" + resp.get("paySign");
|
|
|
+
|
|
|
+ WxPayBean wxPayBean = new WxPayBean();
|
|
|
+ wxPayBean.setAppId(resp.get("appid"));
|
|
|
+ wxPayBean.setTimeStamp(timeStamp);
|
|
|
+ wxPayBean.setNonceStr(resp.get("nonce_str"));
|
|
|
+ wxPayBean.setPrepayId(resp.get("prepay_id"));
|
|
|
+ wxPayBean.setPaySign(resp.get("paySign"));
|
|
|
+ return ResultData.ok(wxPayBean);
|
|
|
+
|
|
|
}catch (Exception e){
|
|
|
log.debug("获取access_token发生异常",e);
|
|
|
}
|
|
|
- return "redirect:" + CacheUtil.mainUrl + "mobile.html#/payresult/fail";
|
|
|
+
|
|
|
+ return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
|