提交代码

dev-discount
胡锐 3 years ago
commit cf62e824fa
  1. 79
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  2. 11
      hai-bweb/src/main/java/com/bweb/model/ExportOutRechargeOrder.java
  3. 11
      hai-cweb/src/main/java/com/cweb/config/SysConfig.java
  4. 2
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  5. 3
      hai-cweb/src/main/resources/dev/config.properties
  6. 4
      hai-service/src/main/java/com/hai/dao/OutRechargeOrderMapperExt.java
  7. 4
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java

@ -1,6 +1,7 @@
package com.bweb.controller; package com.bweb.controller;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject;
import com.bweb.config.SysConst; import com.bweb.config.SysConst;
import com.bweb.model.ExportOutRechargeOrder; import com.bweb.model.ExportOutRechargeOrder;
import com.bweb.model.ExportOutRechargeOrderCount; import com.bweb.model.ExportOutRechargeOrderCount;
@ -14,6 +15,7 @@ import com.hai.common.pay.util.XmlUtil;
import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils; import com.hai.common.utils.WxUtils;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.entity.OutRechargeOrder; import com.hai.entity.OutRechargeOrder;
import com.hai.model.*; import com.hai.model.*;
import com.hai.service.OutRechargeOrderService; import com.hai.service.OutRechargeOrderService;
@ -124,6 +126,7 @@ public class OutRechargeOrderController {
@RequestParam(name = "rechargeModel", required = false) String rechargeModel, @RequestParam(name = "rechargeModel", required = false) String rechargeModel,
@RequestParam(name = "rechargeContent", required = false) String rechargeContent, @RequestParam(name = "rechargeContent", required = false) String rechargeContent,
@RequestParam(name = "userPhone", required = false) String userPhone, @RequestParam(name = "userPhone", required = false) String userPhone,
@RequestParam(name = "payType", required = false) Integer payType,
@RequestParam(name = "payTimeS", required = false) Long payTimeS, @RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE, @RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@ -150,7 +153,10 @@ public class OutRechargeOrderController {
if (StringUtils.isNotBlank(userPhone)) { if (StringUtils.isNotBlank(userPhone)) {
map.put("userPhone", userPhone); map.put("userPhone", userPhone);
} }
if (payType != null) {
map.put("payType" , payType.toString());
}
if (payTimeS != null) { if (payTimeS != null) {
map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS)); map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS));
} }
@ -189,6 +195,7 @@ public class OutRechargeOrderController {
@RequestParam(name = "rechargeModel", required = false) String rechargeModel, @RequestParam(name = "rechargeModel", required = false) String rechargeModel,
@RequestParam(name = "rechargeContent", required = false) String rechargeContent, @RequestParam(name = "rechargeContent", required = false) String rechargeContent,
@RequestParam(name = "userPhone", required = false) String userPhone, @RequestParam(name = "userPhone", required = false) String userPhone,
@RequestParam(name = "payType", required = false) Integer payType,
@RequestParam(name = "createTimeS", required = false) Long createTimeS, @RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE, @RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "payTimeS", required = false) Long payTimeS, @RequestParam(name = "payTimeS", required = false) Long payTimeS,
@ -201,6 +208,7 @@ public class OutRechargeOrderController {
map.put("rechargeModel", rechargeModel); map.put("rechargeModel", rechargeModel);
map.put("rechargeContent", rechargeContent); map.put("rechargeContent", rechargeContent);
map.put("userPhone", userPhone); map.put("userPhone", userPhone);
map.put("payType", payType);
map.put("createTimeS", createTimeS); map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE); map.put("createTimeE", createTimeE);
map.put("payTimeS", payTimeS); map.put("payTimeS", payTimeS);
@ -236,32 +244,53 @@ public class OutRechargeOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态");
} }
Map<String,String> param = new HashMap<>(); if (order.getPayType() == 2) {
param.put("appid", "wx637bd6f7314daa46"); JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo());
param.put("mch_id", "1289663601"); JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data"));
param.put("sub_mch_id" , "1609882817");
param.put("nonce_str", WxUtils.makeNonStr()); if (dataObject.getBoolean("success")) {
param.put("transaction_id", order.getPaySerialNo()); order.setStatus(5);
param.put("out_refund_no", "HFR"+new Date().getTime()); order.setRefundTime(new Date());
param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); order.setOutRefundNo("HFR"+new Date().getTime() );
param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue())); order.setRefundFee(order.getPayRealPrice());
param.put("sign_type", "HMAC-SHA256"); order.setRefundId(dataObject.getString("orderId"));
outRechargeOrderService.updateOrder(order);
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); return ResponseMsgUtil.success("退款成功");
param.put("sign", signStr); } else {
log.error("orderToPay error!", dataObject.getString("message"));
String resultXmL = doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param)); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message"));
OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class); }
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
order.setStatus(5); } else {
order.setRefundTime(new Date()); Map<String,String> param = new HashMap<>();
order.setOutRefundNo(orderRefundModel.getOut_refund_no()); param.put("appid", "wx637bd6f7314daa46");
order.setRefundId(orderRefundModel.getRefund_id()); param.put("mch_id", "1289663601");
order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100"))); param.put("sub_mch_id" , "1609882817");
outRechargeOrderService.updateOrder(order); param.put("nonce_str", WxUtils.makeNonStr());
return ResponseMsgUtil.success("退款成功"); param.put("transaction_id", order.getPaySerialNo());
param.put("out_refund_no", "HFR"+new Date().getTime());
param.put("total_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
param.put("refund_fee", String.valueOf(order.getPayRealPrice().multiply(new BigDecimal("100")).intValue()));
param.put("sign_type", "HMAC-SHA256");
String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256);
param.put("sign", signStr);
String resultXmL = doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param));
OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class);
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
order.setStatus(5);
order.setRefundTime(new Date());
order.setOutRefundNo(orderRefundModel.getOut_refund_no());
order.setRefundId(orderRefundModel.getRefund_id());
order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100")));
outRechargeOrderService.updateOrder(order);
return ResponseMsgUtil.success("退款成功");
}
return ResponseMsgUtil.success("退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des());
} }
return ResponseMsgUtil.success("退款失败!错误代码:"+orderRefundModel.getErr_code()+",错误描述"+orderRefundModel.getErr_code_des());
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e); log.error("HighOrderController --> getUserOrderList() error!", e);

@ -22,9 +22,6 @@ public class ExportOutRechargeOrder {
@ExcelProperty("充值内容") @ExcelProperty("充值内容")
private String rechargeContent; private String rechargeContent;
@ExcelProperty("中石油持卡人姓名")
private String rechargeName;
@ExcelProperty("备注") @ExcelProperty("备注")
private String remarks; private String remarks;
@ -107,14 +104,6 @@ public class ExportOutRechargeOrder {
this.rechargeContent = rechargeContent; this.rechargeContent = rechargeContent;
} }
public String getRechargeName() {
return rechargeName;
}
public void setRechargeName(String rechargeName) {
this.rechargeName = rechargeName;
}
public String getRemarks() { public String getRemarks() {
return remarks; return remarks;
} }

@ -27,6 +27,9 @@ public class SysConfig {
private String notifyUrl; private String notifyUrl;
private String qzNotifyUrl; private String qzNotifyUrl;
// 重庆惠兑电子商务有限公司
private String HDAppId;
public String getQzNotifyUrl() { public String getQzNotifyUrl() {
return qzNotifyUrl; return qzNotifyUrl;
} }
@ -138,4 +141,12 @@ public class SysConfig {
public void setNotifyUrl(String notifyUrl) { public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl; this.notifyUrl = notifyUrl;
} }
public String getHDAppId() {
return HDAppId;
}
public void setHDAppId(String HDAppId) {
this.HDAppId = HDAppId;
}
} }

@ -263,7 +263,7 @@ public class OutRechargeOrderController {
weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); //公众号id weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); //公众号id
weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号 weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号
weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId()); //商户号 weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId()); //商户号
weChatPayReqInfo.setSub_mch_id("1614670195"); //子商户号 weChatPayReqInfo.setSub_mch_id("1614670195");
// weChatPayReqInfo.setOpenid(openId); // weChatPayReqInfo.setOpenid(openId);
weChatPayReqInfo.setSub_openid(openId); weChatPayReqInfo.setSub_openid(openId);

@ -12,6 +12,9 @@ wxSubAppId=wx8d49e2f83025229d
wxSubMchId=1609882817 wxSubMchId=1609882817
wxUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder wxUnifiedOrderUrl=https://api.mch.weixin.qq.com/pay/unifiedorder
# ????????????
HDAppId = 1614670195
notifyUrl=https://hsgcs.dctpay.com/crest/wechatpay/notify notifyUrl=https://hsgcs.dctpay.com/crest/wechatpay/notify
fileUrl=/home/project/hsg/filesystem fileUrl=/home/project/hsg/filesystem

@ -64,12 +64,12 @@ public interface OutRechargeOrderMapperExt {
" a.order_no orderNo," + " a.order_no orderNo," +
" a.user_name userName," + " a.user_name userName," +
" a.user_phone userPhone," + " a.user_phone userPhone," +
" case a.recharge_model when 1 then '话费充值' when 2 then '中石化' when 3 then '中石油' end rechargeModelName," + " case a.recharge_model when 1 then '电信话费' when 2 then '移动话费' when 3 then '联通话费' end rechargeModelName," +
" a.recharge_content rechargeContent," + " a.recharge_content rechargeContent," +
" a.recharge_name rechargeName," + " a.recharge_name rechargeName," +
" a.id_card rechargeIdCard," + " a.id_card rechargeIdCard," +
" a.remarks remarks," + " a.remarks remarks," +
" case a.pay_type when 1 then '微信' end payTypeName," + " case a.pay_type when 1 then '微信' when 2 then '工会卡' when 3 then '积分' end payTypeName," +
" a.order_price orderPrice," + " a.order_price orderPrice," +
" a.pay_price payPrice," + " a.pay_price payPrice," +
" a.pay_real_price payRealPrice," + " a.pay_real_price payRealPrice," +

@ -62,6 +62,10 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
} }
if (MapUtils.getInteger(map, "payType") != null) {
criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType"));
}
if (MapUtils.getString(map, "orderNo") != null) { if (MapUtils.getString(map, "orderNo") != null) {
criteria.andOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%"); criteria.andOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%");
} }

Loading…
Cancel
Save