* 'dev' of http://139.159.177.244:3000/hurui/hai-server:
  提交代码
dev-discount
袁野 3 years ago
commit 47c5828309
  1. 1
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  2. 2
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  4. 33
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  5. 45
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  6. 6
      hai-cweb/src/test/common/test.java
  7. 50
      hai-cweb/src/test/common/test1.java
  8. 8
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  9. 2
      hai-service/src/main/java/com/hai/config/UnionPayConfig.java
  10. 34
      hai-service/src/main/java/com/hai/config/UnionStagingPayConfig.java

@ -128,6 +128,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/highBrand/*") .excludePathPatterns("/highBrand/*")
.excludePathPatterns("/highGoodsType/*") .excludePathPatterns("/highGoodsType/*")
.excludePathPatterns("/sendSms/*") .excludePathPatterns("/sendSms/*")
.excludePathPatterns("/test/*")
.excludePathPatterns("/sms/*") .excludePathPatterns("/sms/*")
.excludePathPatterns("/czOrder/*") .excludePathPatterns("/czOrder/*")
.excludePathPatterns("/outRechargeOrder/*") .excludePathPatterns("/outRechargeOrder/*")

@ -74,8 +74,6 @@ public class HighOrderController {
@Resource @Resource
private HighDiscountPackageActualService discountPackageActualService; private HighDiscountPackageActualService discountPackageActualService;
@Resource @Resource
private HighUserService highUserService; private HighUserService highUserService;

File diff suppressed because one or more lines are too long

@ -102,6 +102,9 @@ public class OrderController {
@Resource @Resource
private UnionPayConfig unionPayConfig; private UnionPayConfig unionPayConfig;
@Resource
private UnionStagingPayConfig unionStagingPayConfig;
/** /**
* *
* @Title: orderToPay * @Title: orderToPay
@ -487,28 +490,11 @@ public class OrderController {
// 商品类型 1:卡卷 2:金币充值 3:加油站 // 商品类型 1:卡卷 2:金币充值 3:加油站
for (HighChildOrder childOrder : order.getHighChildOrderList()) { for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if (childOrder.getGiveawayType() == false && childOrder.getGoodsType() == 1) { if (childOrder.getGiveawayType() == false && childOrder.getGoodsType() == 1) {
// 卡券详情
HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId()); HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId());
// 支付类型:1.微信支付 2.金币支付 if (coupon == null) {
// if (coupon.getPayType() != 1) { log.error("OrderController --> orderToPay() ERROR", "只支持微信支持");
// log.error("OrderController --> orderToPay() ERROR", "只支持微信支持"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持微信支付");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持微信支付");
// }
}
if (childOrder.getGoodsType() == 3) {
// 查询账号余额
JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD();
JSONArray result = accountInfo2JD.getJSONArray("result");
for (Object accountObject : result) {
JSONObject account = (JSONObject)accountObject;
// 1:汽油:2:柴油;3:天然气
if (account.getInteger("energyType").equals(childOrder.getGasOilType())) {
// 支付金额 大于 团油账号余额
if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){
log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服");
}
}
} }
} }
} }
@ -518,7 +504,10 @@ public class OrderController {
+ DateUtil.format(new Date(), DateUtil.YMDHMS) + DateUtil.format(new Date(), DateUtil.YMDHMS)
+ IDGenerator.nextId(6); + IDGenerator.nextId(6);
return ResponseMsgUtil.success(UnionStagingPayConfig.advancePay(order.getOrderNo(),order.getOrderNo(),order.getPayPrice(), "","", request)); order.setPaySerialNo(orgTrace);
highOrderService.updateOrderDetail(order);
return ResponseMsgUtil.success(unionStagingPayConfig.advancePay(order.getPaySerialNo(),order.getPaySerialNo(),order.getPayPrice(), "",request));
} catch (Exception e) { } catch (Exception e) {
log.error("orderToPay error!", e); log.error("orderToPay error!", e);

@ -6,10 +6,13 @@ import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongConfig; import com.hai.config.HuiLianTongConfig;
import com.hai.config.TuanYouConfig; import com.hai.config.TuanYouConfig;
import com.hai.config.UnionStagingPayConfig;
import com.hai.dao.HighCouponCodeOtherMapper; import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighGasOrderPushMapper; import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighPayRecordMapper; import com.hai.dao.HighPayRecordMapper;
@ -17,6 +20,7 @@ import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.OrderPushType; import com.hai.enum_type.OrderPushType;
import com.hai.model.HighMerchantStoreModel; import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResponseData;
import com.hai.service.*; import com.hai.service.*;
import com.hai.service.pay.NotifyService; import com.hai.service.pay.NotifyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -413,22 +417,39 @@ public class UnionPayController {
} }
} }
@RequestMapping(value = "/stagingNotify", method = RequestMethod.POST) @RequestMapping(value = "/refreshStagingOrder", method = RequestMethod.POST)
@ApiOperation(value = "银联分期支付 -> 异步回调") @ResponseBody
public void stagingNotify(@RequestBody String params,HttpServletRequest request, HttpServletResponse response) { @ApiOperation(value = "银联分期支付 -> 刷新分期订单")
public ResponseData refreshStagingOrder(@RequestBody JSONObject body, HttpServletRequest request, HttpServletResponse response) {
try { try {
System.out.println(params); if (body == null || StringUtils.isBlank(body.getString("orderNo"))) {
log.info(params); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询订单信息
HighOrder order = highOrderService.getOrderByOrderNo(body.getString("orderNo"));
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 6.退款中 7.拒绝退款
if (order.getOrderStatus().equals(1)) {
String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4)
+CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length())
+ DateUtil.format(new Date(), DateUtil.YMDHMS)
+ IDGenerator.nextId(6);
JSONObject responseObject = UnionStagingPayConfig.queryStaging(orgTrace, order.getPaySerialNo(), "", order.getCreateTime(), request);
if (responseObject.getString("sysRetCode").equals("000000")) {
}
return ResponseMsgUtil.success(responseObject);
}
return ResponseMsgUtil.success(order);
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
JSONObject result = new JSONObject();
result.put("tradeRetCode", "000000");
out.write(result.toJSONString().getBytes());
out.flush();
out.close();
} catch (Exception e) { } catch (Exception e) {
log.error("UnionPayController --> stagingNotify() error!", e); log.error("UnionPayController --> refreshStagingOrder() error!", e);
return ResponseMsgUtil.exception(e);
} }
} }

@ -59,8 +59,12 @@ public class test {
} }
public static void main(String[] args) {
public static void main(String[] args) {
// 获取当前正在执行线程的引用,当前正在执行的线程是主线程,也就是获取主线程的引用
Thread t1 = Thread.currentThread();
System.out.println("主线程的编号是:" + t1.getId() + ", 名称是:" + t1.getName());
requestOrder(); requestOrder();
} }

@ -0,0 +1,50 @@
package common;
import com.CWebApplication;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.HttpsUtils;
import com.hai.service.HighDiscountAgentCodeService;
import com.hai.service.HighDiscountUserRelService;
import com.hai.service.HighUserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName RegionTest
* @Description: TODO ()
* @Author 胡锐
* @Date 2020/12/29
**/
public class test1 implements Runnable {
/*
public static void main(String[] args) {
// 获取当前正在执行线程的引用,当前正在执行的线程是主线程,也就是获取主线程的引用
Runnable target;
System.out.println("主线程的编号是:" + thread.getId() + ", 名称是:" + thread.getName());
thread.setName("order1");
for (int i = 0; i <= 100; i++) {
Thread thread = new Thread();
}
}
*/
@Override
public void run() {
Thread t1 = Thread.currentThread();
System.out.println("子线程的编号是:" + t1.getId() + ", 名称是:" + t1.getName()); // 14 guanyu
t1.setName("zhangfei");
System.out.println("修改后子线程的编号是:" + t1.getId() + ", 名称是:" + t1.getName());
}
}

@ -269,4 +269,12 @@ public class HighOrderSchedule {
} }
} }
@Scheduled(cron="1 * * * * * ?") //每1分钟执行一次
public void unionStagingPayOrder() {
List<Map<String, Object>> mapList = highOrderService.getFinishGasOrder();
if (mapList != null && mapList.size() > 0) {
}
}
} }

@ -76,6 +76,7 @@ public class UnionPayConfig {
// 记录请求参数 // 记录请求参数
HighPayRecord payRecord = new HighPayRecord(); HighPayRecord payRecord = new HighPayRecord();
payRecord.setCreateTime(new Date()); payRecord.setCreateTime(new Date());
payRecord.setPaySerialNo(orderNo);
payRecord.setResType(1); payRecord.setResType(1);
payRecord.setPayType(3); payRecord.setPayType(3);
payRecord.setPayMoney(payPrice); payRecord.setPayMoney(payPrice);
@ -87,6 +88,7 @@ public class UnionPayConfig {
// 记录响应参数 // 记录响应参数
payRecord = new HighPayRecord(); payRecord = new HighPayRecord();
payRecord.setCreateTime(new Date()); payRecord.setCreateTime(new Date());
payRecord.setPaySerialNo(orderNo);
payRecord.setResType(3); payRecord.setResType(3);
payRecord.setPayType(3); payRecord.setPayType(3);
payRecord.setPayMoney(payPrice); payRecord.setPayMoney(payPrice);

@ -3,12 +3,16 @@ package com.hai.config;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.common.utils.RequestUtils; import com.hai.common.utils.RequestUtils;
import com.hai.dao.HighPayRecordMapper;
import com.hai.entity.HighPayRecord;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil; import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.HttpsUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.*; import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -23,19 +27,23 @@ import java.util.*;
* 银联分期 * 银联分期
* @author hurui * @author hurui
*/ */
@Component
public class UnionStagingPayConfig { public class UnionStagingPayConfig {
@Resource
private HighPayRecordMapper highPayRecordMapper;
/** /**
* 银联分期支付H5预下单-标准 * 银联分期支付H5预下单-标准
* 文档地址 https://doc.eycard.cn/web/#/222?page_id=3183 * 文档地址 https://doc.eycard.cn/web/#/222?page_id=3183
* @param prodTrace 产品流水 可重复记录订单生命周期无特殊需求同交易流水号 * @param prodTrace 产品流水 可重复记录订单生命周期无特殊需求同交易流水号
* @param orgTrace 订单号 * @param orgTrace 订单号
* @param openId 支付宝微信云闪付用户授权唯一标识(如果没有:-)
* @param payPrice 支付金额 单位 * @param payPrice 支付金额 单位
* @return 响应信息 * @return 响应信息
* @throws Exception * @throws Exception
*/ */
public static JSONObject advancePay(String prodTrace, String orgTrace, BigDecimal payPrice, String openId, String notifyUrl, HttpServletRequest request) throws Exception { public JSONObject advancePay(String prodTrace, String orgTrace, BigDecimal payPrice, String notifyUrl, HttpServletRequest request) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId());
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode());
@ -51,12 +59,32 @@ public class UnionStagingPayConfig {
Map<String, Object> bizDataMap = new HashMap<>(); Map<String, Object> bizDataMap = new HashMap<>();
bizDataMap.put("transAmt", payPrice.multiply(new BigDecimal("100")).intValue()); bizDataMap.put("transAmt", payPrice.multiply(new BigDecimal("100")).intValue());
bizDataMap.put("openId", openId); bizDataMap.put("openId", "-");
bizDataMap.put("notifyUrl", notifyUrl); bizDataMap.put("notifyUrl", notifyUrl);
paramMap.put("bizData", bizDataMap); paramMap.put("bizData", bizDataMap);
paramMap.put("sign", generateSign(bizDataMap)); paramMap.put("sign", generateSign(bizDataMap));
// 记录请求参数
HighPayRecord payRecord = new HighPayRecord();
payRecord.setCreateTime(new Date());
payRecord.setPaySerialNo(prodTrace);
payRecord.setResType(1);
payRecord.setPayType(4);
payRecord.setPayMoney(payPrice);
payRecord.setBodyInfo(JSONObject.toJSONString(paramMap));
highPayRecordMapper.insert(payRecord);
JSONObject responseParam = HttpsUtils.doPost(CommonSysConst.getSysConfig().getUnionStagingPayUrl()+"cashier/apply/advancePay", paramMap, new HashMap<>()); JSONObject responseParam = HttpsUtils.doPost(CommonSysConst.getSysConfig().getUnionStagingPayUrl()+"cashier/apply/advancePay", paramMap, new HashMap<>());
// 记录响应参数
payRecord = new HighPayRecord();
payRecord.setCreateTime(new Date());
payRecord.setPaySerialNo(prodTrace);
payRecord.setResType(3);
payRecord.setPayType(4);
payRecord.setPayMoney(payPrice);
payRecord.setBodyInfo(responseParam.toString());
highPayRecordMapper.insert(payRecord);
return responseParam; return responseParam;
} }

Loading…
Cancel
Save