'提交代码'

dev-discount
= 3 years ago
parent 4185b7916b
commit 27d2ae09aa
  1. 14
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  2. 21
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  3. 1
      hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java
  4. 17
      hai-service/src/main/java/com/hai/config/TuanYouConfig.java

@ -7,6 +7,7 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.*;
import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.QianZhuConfig;
import com.hai.config.TuanYouConfig;
@ -82,6 +83,7 @@ public class HighTestController {
store.setAddress(object.getString("gasAddress"));
store.setLongitude(object.getString("gasAddressLongitude"));
store.setLatitude(object.getString("gasAddressLatitude"));
store.setStatus(object.getInteger("gasStatus"));
store.setOperatorId(0L);
store.setOperatorName("系统创建");
store.setUpdateTime(new Date());
@ -205,4 +207,16 @@ public class HighTestController {
}
}
@RequestMapping(value = "/queryOilCardAccount", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "测试")
public ResponseData queryOilCardAccount() {
try {
return ResponseMsgUtil.success(TuanYouConfig.queryCompanyAccountInfo2JD());
} catch (Exception e) {
log.error("HighOrderController --> queryOilCardAccount() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,6 +1,7 @@
package com.cweb.controller.pay;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.hai.common.exception.ErrorCode;
@ -17,6 +18,7 @@ import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.MathUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.QianZhuConfig;
import com.hai.config.TuanYouConfig;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighCoupon;
import com.hai.entity.HighOrder;
@ -128,7 +130,7 @@ public class OrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, "");
}
// 商品类型 1:卡卷 2:金币充值
// 商品类型 1:卡卷 2:金币充值 3:加油站
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if (childOrder.getGiveawayType() == false && childOrder.getGoodsType() == 1) {
HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId());
@ -138,6 +140,23 @@ public class OrderController {
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") == childOrder.getGasOilType()) {
// 支付金额 大于 团油账号余额
if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){
log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服");
}
}
}
}
}
Map<String,Object> map = new HashMap<>();

@ -66,6 +66,7 @@ public class HighGasSchedule {
store.setAddress(object.getString("gasAddress"));
store.setLongitude(object.getString("gasAddressLongitude"));
store.setLatitude(object.getString("gasAddressLatitude"));
store.setStatus(object.getInteger("gasStatus"));
store.setOperatorId(0L);
store.setOperatorName("系统创建");
store.setUpdateTime(new Date());

@ -103,6 +103,20 @@ public class TuanYouConfig {
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getTuanYouUrl()+"/services/vp/openapi/refuelingOrderRefund", JSON.toJSONString(paramMap));
}
/**
* queryCompanyAccountBalance
* @return 企业余额查询多能源类型
* @throws Exception
*/
public static JSONObject queryCompanyAccountInfo2JD() throws Exception {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("app_key", CommonSysConst.getSysConfig().getTuanYouAppKey());
paramMap.put("timestamp", new Date().getTime());
paramMap.put("companyCode", CommonSysConst.getSysConfig().getTuanYouAppKey());
paramMap.put("sign", MD5Util.encode(generateTuanYouSignature(paramMap,CommonSysConst.getSysConfig().getTuanYouAppSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getTuanYouUrl()+"/services/vp/openapi/queryCompanyAccountInfo2JD", JSON.toJSONString(paramMap));
}
/**
* 订单结果查询
* @param thirdSerialNo 三方订单号
@ -113,9 +127,10 @@ public class TuanYouConfig {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("app_key", CommonSysConst.getSysConfig().getTuanYouAppKey());
paramMap.put("timestamp", new Date().getTime());
paramMap.put("companyCode", "new Date().getTime()");
paramMap.put("thirdSerialNo", thirdSerialNo);
paramMap.put("sign", MD5Util.encode(generateTuanYouSignature(paramMap,CommonSysConst.getSysConfig().getTuanYouAppSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getTuanYouUrl()+"/services/vp/openapi/queryThirdOrderDetail", JSON.toJSONString(paramMap));
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getTuanYouUrl()+"/services/vp/openapi/queryCompanyAccountInfo2JD", JSON.toJSONString(paramMap));
}
/**

Loading…
Cancel
Save