Commit 6e1df475 by YG8999

去掉充值代码

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