|
@@ -1643,6 +1643,12 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
return orderInfoMapper.getCommissionMoney(orderInfo);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer getFzMoney(QuerySchoolOrderListDTO orderInfo) {
|
|
|
+ return orderInfoMapper.getFzMoney(orderInfo);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<QuerySchoolOrderListVo> selectSchoolOrderInfoExcel(QuerySchoolOrderListDTO schoolOrderListDTO) {
|
|
|
return orderInfoMapper.selectSchoolOrderInfoExcel(schoolOrderListDTO);
|
|
@@ -2247,7 +2253,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
sortMap.put("nonce_str", nonceStr);
|
|
|
sortMap.put("sign_type", "HMAC-SHA256");
|
|
|
sortMap.put("transaction_id", orderInfo.getTransactionId());
|
|
|
- String orderCode = getOrderCode(orderInfo.getUserId()); //商户分账单号
|
|
|
+ String orderCode = "P"+getOrderCode(orderInfo.getUserId()); //商户分账单号
|
|
|
sortMap.put("out_order_no", orderCode);
|
|
|
|
|
|
Map<String, Object> receiverMap = new TreeMap<String, Object>();
|
|
@@ -2285,8 +2291,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
orderSplit.setOrderId(orderId);
|
|
|
orderSplit.setOutTradeNo(orderInfo.getOutTradeNo());
|
|
|
orderSplit.setAmount(orderInfo.getFzPrice());
|
|
|
+ orderSplit.setTransactionId(orderInfo.getTransactionId());
|
|
|
orderSplit.setOpenId(fzConfig.getAccount());
|
|
|
orderSplit.setOpenIdType(1);
|
|
|
+ orderSplit.setStatus(1);
|
|
|
orderSplit.setDescription(fzConfig.getDescription());
|
|
|
return orderSplitService.save(orderSplit);
|
|
|
}
|
|
@@ -2301,56 +2309,53 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
-// @Override
|
|
|
-// @Transactional
|
|
|
-// public boolean wxProfitsharingRetrun(OrderSplit orderSplit) throws Exception {
|
|
|
-// String url = "https://api.mch.weixin.qq.com/secapi/pay/profitsharingreturn";
|
|
|
-// String nonceStr = RandomStringUtils.randomAlphanumeric(32);
|
|
|
-// //用于签名
|
|
|
-// Map<String, String> sortMap = new TreeMap<String, String>();
|
|
|
-// sortMap.put("mch_id", wxpayConfig.getMerchantId());
|
|
|
-// sortMap.put("sub_mch_id", wxpayConfig.getMerchantId());
|
|
|
-// sortMap.put("appid", appConfig.getAppid());
|
|
|
-// sortMap.put("nonce_str", nonceStr);
|
|
|
-// sortMap.put("sign_type", "HMAC-SHA256");
|
|
|
-// sortMap.put("order_id", "order_id");
|
|
|
-// sortMap.put("out_return_no", "order_id");
|
|
|
-// sortMap.put("return_account_type", "MERCHANT_ID");
|
|
|
-// sortMap.put("return_account", fzConfig.getAccount());
|
|
|
-// sortMap.put("return_amount", String.valueOf(orderSplit.getAmount()));
|
|
|
-// sortMap.put("description","用户退款");
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// WXPayConfig config = new WxPayConfigImpl();
|
|
|
-// String sign = WXPayUtil.generateSignature(sortMap, config.getKey(), WXPayConstants.SignType.HMACSHA256);
|
|
|
-// sortMap.put("sign", sign);
|
|
|
-//
|
|
|
-// WXPay pay = new WXPay(config);
|
|
|
-// String xmlStr = pay.requestWithCert(url, sortMap, config.getHttpConnectTimeoutMs(), config.getHttpReadTimeoutMs());
|
|
|
-// Map<String, String> resMap = XmlUtil.xmlToMap(xmlStr);
|
|
|
-// if (!"SUCCESS".equals(resMap.get("return_code")) || !"SUCCESS".equals(resMap.get("result_code"))) {
|
|
|
-// //throw new CustomException("微信分账出错");
|
|
|
-// log.info("微信分账出错");
|
|
|
-// log.info(resMap.toString());
|
|
|
-// orderSplitService.updateById(orderSplit);
|
|
|
-// return false;
|
|
|
-// } else {
|
|
|
-// //更新成交订单表
|
|
|
-// orderInfo.setIsFz(2);
|
|
|
-// this.updateById(orderInfo);
|
|
|
-//
|
|
|
-// OrderSplit orderSplit = new OrderSplit();
|
|
|
-// orderSplit.setOutSplitNo(orderCode);
|
|
|
-// orderSplit.setOutTradeNo(orderInfo.getOutTradeNo());
|
|
|
-// orderSplit.setAmount(orderInfo.getFzPrice());
|
|
|
-// orderSplit.setOpenId(fzConfig.getAccount());
|
|
|
-// orderSplit.setOpenIdType(1);
|
|
|
-// orderSplit.setDescription(fzConfig.getDescription());
|
|
|
-// return orderSplitService.save(orderSplit);
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public boolean wxProfitsharingRetrun(OrderInfo orderInfo,OrderSplit orderSplit) throws Exception {
|
|
|
+ String url = "https://api.mch.weixin.qq.com/secapi/pay/profitsharingreturn";
|
|
|
+ String nonceStr = RandomStringUtils.randomAlphanumeric(32);
|
|
|
+ //用于签名
|
|
|
+ Map<String, String> sortMap = new TreeMap<String, String>();
|
|
|
+ sortMap.put("mch_id", wxpayConfig.getMerchantId());
|
|
|
+ sortMap.put("sub_mch_id", wxpayConfig.getMerchantId());
|
|
|
+ sortMap.put("appid", appConfig.getAppid());
|
|
|
+ sortMap.put("nonce_str", nonceStr);
|
|
|
+ sortMap.put("sign_type", "HMAC-SHA256");
|
|
|
+ sortMap.put("out_order_no", orderSplit.getOutSplitNo());
|
|
|
+ String outReturnNo = "R" + getOrderCode(orderInfo.getUserId());
|
|
|
+ sortMap.put("out_return_no", outReturnNo);
|
|
|
+ sortMap.put("return_account_type", fzConfig.getType());
|
|
|
+ sortMap.put("return_account", fzConfig.getAccount());
|
|
|
+ sortMap.put("return_amount", String.valueOf(orderSplit.getAmount()));
|
|
|
+ sortMap.put("description","用户退款");
|
|
|
+
|
|
|
+
|
|
|
+ WXPayConfig config = new WxPayConfigImpl();
|
|
|
+ String sign = WXPayUtil.generateSignature(sortMap, config.getKey(), WXPayConstants.SignType.HMACSHA256);
|
|
|
+ sortMap.put("sign", sign);
|
|
|
+
|
|
|
+ WXPay pay = new WXPay(config);
|
|
|
+ String xmlStr = pay.requestWithCert(url, sortMap, config.getHttpConnectTimeoutMs(), config.getHttpReadTimeoutMs());
|
|
|
+ Map<String, String> resMap = XmlUtil.xmlToMap(xmlStr);
|
|
|
+ if (!"SUCCESS".equals(resMap.get("return_code")) || !"SUCCESS".equals(resMap.get("result"))) {
|
|
|
+ //throw new CustomException("微信分账出错");
|
|
|
+ log.info("微信分账退回出错");
|
|
|
+ log.info(resMap.toString());
|
|
|
+ orderSplit.setStatus(3);
|
|
|
+ orderSplit.setFailReason(resMap.get("fail_reason"));
|
|
|
+ orderSplitService.updateById(orderSplit);
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ //更新成交订单表
|
|
|
+ String returnNo = resMap.get("return_no");
|
|
|
+ orderSplit.setStatus(2); //分账回退成功
|
|
|
+ orderSplit.setOutReturnNo(outReturnNo);
|
|
|
+ orderSplit.setReturnNo(returnNo);
|
|
|
+ orderSplitService.updateById(orderSplit);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|