|
@@ -14,6 +14,7 @@ import com.fdkankan.sale.service.IRepairLogService;
|
|
|
import com.fdkankan.sale.service.IRepairPayService;
|
|
|
import com.fdkankan.sale.service.IRepairService;
|
|
|
import com.fdkankan.sale.util.DateUtil;
|
|
|
+import com.fdkankan.sale.util.UrlUtils;
|
|
|
import com.fdkankan.sale.vo.request.WechatMobileParam;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -25,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.BufferedOutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.net.URLEncoder;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.Random;
|
|
@@ -84,7 +86,10 @@ public class WechatPayService {
|
|
|
|
|
|
BigDecimal totalFee = amount.multiply(new BigDecimal(100));
|
|
|
String body = subject;
|
|
|
- return this.wechatH5Pay(param.getRepairId(),orderSn, subject, body, totalFee, ip);
|
|
|
+ if(param.getWxPayType() == 0){
|
|
|
+ return this.wechatH5Pay(param.getRepairId(),orderSn, subject, body, totalFee, ip);
|
|
|
+ }
|
|
|
+ return this.wechatPay(orderSn,subject, subject+subject, amount, ip, param.getOpenId());
|
|
|
}
|
|
|
|
|
|
public JSONObject wechatH5Pay(String repairId,String orderSn, String subject, String body, BigDecimal totalFee, String ipAddress) throws Exception {
|
|
@@ -105,7 +110,7 @@ public class WechatPayService {
|
|
|
|
|
|
String mweb_url = "";
|
|
|
Map<String, String> resp = WXPay.unifiedOrder(data);
|
|
|
- log.info("微信支付{}",resp);
|
|
|
+ log.warn("wechatPay" + resp);
|
|
|
String return_code = resp.get("return_code");
|
|
|
String return_msg = resp.get("return_msg");
|
|
|
if ("SUCCESS".equals(return_code) && "OK".equals(return_msg)) {
|
|
@@ -139,16 +144,18 @@ public class WechatPayService {
|
|
|
Map<String, String> resp = WXPay.unifiedOrder(data);
|
|
|
log.warn("wechatPay" + resp);
|
|
|
|
|
|
+ String timeStamp = String.valueOf(System.currentTimeMillis() / 1000);
|
|
|
Map<String, String> sign = new HashMap<>();
|
|
|
sign.put("package", "prepay_id="+resp.get("prepay_id"));
|
|
|
sign.put("appId", WXPayDefaultConfig.appId);
|
|
|
- sign.put("timeStamp",String.valueOf(System.currentTimeMillis() / 1000));
|
|
|
+ sign.put("timeStamp",timeStamp);
|
|
|
sign.put("nonceStr", resp.get("nonce_str"));
|
|
|
sign.put("signType", "MD5");
|
|
|
String paySign = WXPayUtil.generateSignature(sign, WXPayDefaultConfig.key);
|
|
|
|
|
|
resp.put("signType", "MD5");
|
|
|
resp.put("paySign", paySign);
|
|
|
+ resp.put("timeStamp",timeStamp);
|
|
|
log.warn("wechatPay" + resp);
|
|
|
return resp;
|
|
|
}
|