Commit 6e1df475 by YG8999

去掉充值代码

parent 9b36552f
...@@ -30,6 +30,6 @@ public interface OrderPayService { ...@@ -30,6 +30,6 @@ public interface OrderPayService {
* @param recharge 支付参数 * @param recharge 支付参数
* @return OrderPayResultResponse * @return OrderPayResultResponse
*/ */
RechargePayResultResponse saobeiRechargePayment(Recharge recharge); // RechargePayResultResponse saobeiRechargePayment(Recharge recharge);
} }
...@@ -108,33 +108,33 @@ public class OrderPayServiceImpl implements OrderPayService { ...@@ -108,33 +108,33 @@ public class OrderPayServiceImpl implements OrderPayService {
return response; return response;
} }
/** // /**
* 充值支付(扫呗-微信支付) // * 充值支付(扫呗-微信支付)
* @param recharge 支付参数 // * @param recharge 支付参数
* @return // * @return
*/ // */
@Override // @Override
public RechargePayResultResponse saobeiRechargePayment(Recharge recharge) { // public RechargePayResultResponse saobeiRechargePayment(Recharge recharge) {
RechargePayResultResponse response = new RechargePayResultResponse(); // RechargePayResultResponse response = new RechargePayResultResponse();
response.setRechargeNo(recharge.getRechargeNo()); // response.setRechargeNo(recharge.getRechargeNo());
response.setPayType(PayTypeEnum.getEnumByCode(recharge.getPayType()).getValue()); // response.setPayType(PayTypeEnum.getEnumByCode(recharge.getPayType()).getValue());
response.setStatus(YesNoEnum.no.getFlag()); // response.setStatus(YesNoEnum.no.getFlag());
// 扫呗支付 // // 扫呗支付
ConcurrentHashMap<String, String> unifiedorder = saobeiUnifiedRecharge(recharge); // ConcurrentHashMap<String, String> unifiedorder = saobeiUnifiedRecharge(recharge);
WxPayJsResultVo vo = new WxPayJsResultVo(); // WxPayJsResultVo vo = new WxPayJsResultVo();
vo.setAppId(unifiedorder.get("appId")); // vo.setAppId(unifiedorder.get("appId"));
vo.setNonceStr(unifiedorder.get("nonceStr")); // vo.setNonceStr(unifiedorder.get("nonceStr"));
vo.setPackages(unifiedorder.get("package")); // vo.setPackages(unifiedorder.get("package"));
vo.setSignType(unifiedorder.get("signType")); // vo.setSignType(unifiedorder.get("signType"));
vo.setTimeStamp(unifiedorder.get("timeStamp")); // vo.setTimeStamp(unifiedorder.get("timeStamp"));
vo.setPaySign(unifiedorder.get("paySign")); // vo.setPaySign(unifiedorder.get("paySign"));
// 更新商户订单号 // // 更新商户订单号
recharge.setOutTradeNo(unifiedorder.get("outTradeNo")); // recharge.setOutTradeNo(unifiedorder.get("outTradeNo"));
recharge.setTerminalTrace(unifiedorder.get("terminalTrace")); // recharge.setTerminalTrace(unifiedorder.get("terminalTrace"));
rechargeService.updateById(recharge); // rechargeService.updateById(recharge);
response.setJsConfig(vo); // response.setJsConfig(vo);
return response; // return response;
} // }
/** /**
...@@ -259,64 +259,64 @@ public class OrderPayServiceImpl implements OrderPayService { ...@@ -259,64 +259,64 @@ public class OrderPayServiceImpl implements OrderPayService {
return vo; return vo;
} }
/** // /**
* 预下单 (扫呗-微信) // * 预下单 (扫呗-微信)
* @param recharge 充值对象 // * @param recharge 充值对象
* @return 预下单返回对象 // * @return 预下单返回对象
*/ // */
private ConcurrentHashMap<String, String> saobeiUnifiedRecharge(Recharge recharge) { // private ConcurrentHashMap<String, String> saobeiUnifiedRecharge(Recharge recharge) {
// 获取用户openId // // 获取用户openId
SConsumerToken userToken = consumerTokenService.getTokenByUserId(recharge.getConsumerId()); // SConsumerToken userToken = consumerTokenService.getTokenByUserId(recharge.getConsumerId());
if (ObjectUtil.isNull(userToken)) { // if (ObjectUtil.isNull(userToken)) {
throw new BaseException("该用户没有openId"); // throw new BaseException("该用户没有openId");
} // }
// 获取appid、mch_id // // 获取appid、mch_id
// 微信签名key // // 微信签名key
String appId = weChatConfig.getAppId(); // String appId = weChatConfig.getAppId();
String mchId = weChatConfig.getMchId(); // String mchId = weChatConfig.getMchId();
String signKey = weChatConfig.getSignKey(); // String signKey = weChatConfig.getSignKey();
// 获取扫呗微信预下单对象 // // 获取扫呗微信预下单对象
SaobeiMiniPayRequestVo unifiedorderVo = getSaobeiUnifiedRechargeVo(recharge, userToken.getToken(), appId, mchId, signKey); // SaobeiMiniPayRequestVo unifiedorderVo = getSaobeiUnifiedRechargeVo(recharge, userToken.getToken(), appId, mchId, signKey);
// 预下单(统一下单) // // 预下单(统一下单)
SaobeiMiniPayResponse response = saobeiService.wechatMinipay(unifiedorderVo); // SaobeiMiniPayResponse response = saobeiService.wechatMinipay(unifiedorderVo);
logger.info("SaobeiMiniPayResponse :", JsonConvertUtil.write2JsonStr(response)); // logger.info("SaobeiMiniPayResponse :", JsonConvertUtil.write2JsonStr(response));
// 组装前端预下单参数 // // 组装前端预下单参数
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(); // ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
map.put("appId", response.getAppId()); // map.put("appId", response.getAppId());
map.put("nonceStr", response.getNonceStr()); // map.put("nonceStr", response.getNonceStr());
map.put("package", response.getPackage_str()); // map.put("package", response.getPackage_str());
map.put("signType", response.getSignType()); // map.put("signType", response.getSignType());
map.put("timeStamp", response.getTimeStamp()); // map.put("timeStamp", response.getTimeStamp());
map.put("paySign", response.getPaySign()); // map.put("paySign", response.getPaySign());
map.put("prepayTime", DateUtil.nowDateTimeStr()); // map.put("prepayTime", DateUtil.nowDateTimeStr());
map.put("outTradeNo", response.getOut_trade_no()); // map.put("outTradeNo", response.getOut_trade_no());
map.put("terminalTrace", unifiedorderVo.getTerminal_trace()); // map.put("terminalTrace", unifiedorderVo.getTerminal_trace());
return map; // return map;
} // }
//
/** // /**
* 获取预下单对象 (扫呗-微信) // * 获取预下单对象 (扫呗-微信)
* 充值 // * 充值
* @return 预下单对象 // * @return 预下单对象
*/ // */
private SaobeiMiniPayRequestVo getSaobeiUnifiedRechargeVo(Recharge recharge, String openid, String appId, String mchId, String signKey) { // private SaobeiMiniPayRequestVo getSaobeiUnifiedRechargeVo(Recharge recharge, String openid, String appId, String mchId, String signKey) {
AttachVo attachVo = new AttachVo(OrderTypeEnum.RECHARGE.getValue(), recharge.getConsumerId()); // AttachVo attachVo = new AttachVo(OrderTypeEnum.RECHARGE.getValue(), recharge.getConsumerId());
//
SaobeiMiniPayRequestVo vo = new SaobeiMiniPayRequestVo(); // SaobeiMiniPayRequestVo vo = new SaobeiMiniPayRequestVo();
vo.setSub_appid(appId); // vo.setSub_appid(appId);
vo.setMerchant_no(saobeiConfig.getMerchantNo()); // vo.setMerchant_no(saobeiConfig.getMerchantNo());
vo.setTerminal_id(saobeiConfig.getTerminalId()); // vo.setTerminal_id(saobeiConfig.getTerminalId());
vo.setAttach(JSONObject.toJSONString(attachVo)); // vo.setAttach(JSONObject.toJSONString(attachVo));
vo.setTerminal_trace(BaseUtil.getOrderNo("WXNO")); // vo.setTerminal_trace(BaseUtil.getOrderNo("WXNO"));
vo.setTerminal_time(DateUtil.nowDate(Constants.DATE_TIME_FORMAT_NUM)); // vo.setTerminal_time(DateUtil.nowDate(Constants.DATE_TIME_FORMAT_NUM));
vo.setOrder_body(StrUtil.concat(true,recharge.getRechargeAmount().toString(),"元充值!")); // vo.setOrder_body(StrUtil.concat(true,recharge.getRechargeAmount().toString(),"元充值!"));
// 订单中使用的是BigDecimal,这里要转为Integer类型 // // 订单中使用的是BigDecimal,这里要转为Integer类型
vo.setTotal_fee(String.valueOf(recharge.getRechargeAmount().multiply(BigDecimal.TEN).multiply(BigDecimal.TEN).intValue())); // vo.setTotal_fee(String.valueOf(recharge.getRechargeAmount().multiply(BigDecimal.TEN).multiply(BigDecimal.TEN).intValue()));
vo.setNotify_url(apiDomain + PayConstants.SAOBEI_PAY_NOTIFY_API_URI); // vo.setNotify_url(apiDomain + PayConstants.SAOBEI_PAY_NOTIFY_API_URI);
vo.setTrade_type(PayConstants.WX_PAY_TRADE_TYPE_JS); // vo.setTrade_type(PayConstants.WX_PAY_TRADE_TYPE_JS);
vo.setOpen_id(openid); // vo.setOpen_id(openid);
vo.setDevice_no("WEB"); // vo.setDevice_no("WEB");
return vo; // return vo;
} // }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment