提交代码

master
胡锐 4 months ago
parent f758d75633
commit fbd4fa3931
  1. 19
      cweb/src/main/java/com/cweb/controller/BsGasController.java
  2. 2
      cweb/src/main/java/com/cweb/controller/order/BsOrderController.java
  3. 11
      service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java
  4. 10
      service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkRequestService.java
  5. 13
      service/src/main/java/com/hfkj/config/CommonSysConfig.java
  6. 21
      service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceTaskServiceImpl.java
  7. 3
      service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java
  8. 1
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  9. 4
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  10. 1
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java
  11. 6
      service/src/main/resources/dev/commonConfig.properties
  12. 3
      service/src/main/resources/prod/commonConfig.properties

@ -1,8 +1,10 @@
package com.cweb.controller; package com.cweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.hfkj.channel.gas.newlink.NewLinkGasService; import com.hfkj.channel.gas.newlink.NewLinkGasService;
import com.hfkj.channel.gas.newlink.NewLinkRequestService;
import com.hfkj.common.exception.ErrorCode; import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp; import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
@ -52,6 +54,19 @@ public class BsGasController {
} }
} }
@RequestMapping(value="/queryGasInfoByGasId",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "queryGasInfoByGasId")
public ResponseData queryGasInfoByGasId(@RequestParam(name = "gasId", required = true) String gasId) {
try {
return ResponseMsgUtil.success(NewLinkRequestService.queryGasInfoByGasId(gasId));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/oilPriceCompute",method = RequestMethod.GET) @RequestMapping(value="/oilPriceCompute",method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ -101,7 +116,7 @@ public class BsGasController {
discount = agentPrice.getPriceRate(); discount = agentPrice.getPriceRate();
} }
} }
gas.setPriceVip(gas.getPriceGun().multiply(discount.divide(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_UP)); gas.setPriceVip(gas.getPriceVip().multiply(discount.divide(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_UP));
} }
return ResponseMsgUtil.success(pageInfo); return ResponseMsgUtil.success(pageInfo);
@ -137,7 +152,7 @@ public class BsGasController {
discount = agentPrice.getPriceRate(); discount = agentPrice.getPriceRate();
} }
} }
oilPrice.setPriceVip(oilPrice.getPriceGun().multiply(discount.divide(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_UP)); oilPrice.setPriceVip(oilPrice.getPriceVip().multiply(discount.divide(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_UP));
} }
return ResponseMsgUtil.success(gasDetail); return ResponseMsgUtil.success(gasDetail);

@ -75,7 +75,7 @@ public class BsOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油站"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油站");
} }
// 除了自建站 其他需要登录 // 除了自建站 其他需要登录
if (!merchant.getSourceType().equals(1)) { if (!merchant.getSourceType().equals(1) && StringUtils.isBlank(body.getUserPhone())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, "");
} }
} }

@ -122,10 +122,11 @@ public class NewLinkGasService {
// 查询油站油价 // 查询油站油价
List<BsGasOilPrice> gasOilPriceList = gasOilPriceService.getGasOilPriceList(merchant.getId()); List<BsGasOilPrice> gasOilPriceList = gasOilPriceService.getGasOilPriceList(merchant.getId());
BsGasOilPrice oilPriceExample = new BsGasOilPrice(); if (!gasOilPriceList.isEmpty()) {
oilPriceExample.setStatus(GasOilPriceStatusEnum.status2.getNumber()); BsGasOilPrice oilPriceExample = new BsGasOilPrice();
gasOilPriceService.batchUpdate(merchant.getMerNo(), oilPriceExample); oilPriceExample.setStatus(GasOilPriceStatusEnum.status2.getNumber());
gasOilPriceService.batchUpdate(merchant.getMerNo(), oilPriceExample);
}
// 查询油站抢号 // 查询油站抢号
List<BsGasOilGunNo> oilGunNoList = gasOilGunNoService.getOilGunNoList(merchant.getMerNo()); List<BsGasOilGunNo> oilGunNoList = gasOilGunNoService.getOilGunNoList(merchant.getMerNo());
for (BsGasOilGunNo gunNo : oilGunNoList) { for (BsGasOilGunNo gunNo : oilGunNoList) {
@ -156,7 +157,7 @@ public class NewLinkGasService {
// 国标价 - 油站价 = 油站直降 // 国标价 - 油站价 = 油站直降
gasOilPrice.setGasStationDrop(oilPriceObject.getBigDecimal("priceOfficial").subtract(oilPriceObject.getBigDecimal("priceGun"))); gasOilPrice.setGasStationDrop(oilPriceObject.getBigDecimal("priceOfficial").subtract(oilPriceObject.getBigDecimal("priceGun")));
gasOilPrice.setPriceCost(oilPriceObject.getBigDecimal("priceVip")); gasOilPrice.setPriceCost(oilPriceObject.getBigDecimal("priceVip"));
gasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceGun")); gasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip"));
gasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); gasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun"));
gasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); gasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial"));
gasOilPriceService.editOilPrice(gasOilPrice); gasOilPriceService.editOilPrice(gasOilPrice);

@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.pay.util.sdk.WXPayConstants; import com.hfkj.common.pay.util.sdk.WXPayConstants;
import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.common.utils.MD5Util; import com.hfkj.common.utils.MD5Util;
import com.hfkj.config.CommonSysConfig;
import com.hfkj.config.CommonSysConst;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -16,9 +18,9 @@ import java.util.*;
*/ */
public class NewLinkRequestService { public class NewLinkRequestService {
private static final Logger log = LoggerFactory.getLogger(NewLinkRequestService.class); private static final Logger log = LoggerFactory.getLogger(NewLinkRequestService.class);
private static final String REQ_URL = "https://hcs.czb365.com"; private static final String REQ_URL = CommonSysConst.getSysConfig().getNewLinkReqUrl();
private static final String APP_KEY = "305490138943968"; private static final String APP_KEY = CommonSysConst.getSysConfig().getNewLinkAppKey();
private static final String APP_SECRET = "dbf7dca3de20c2f2a41fd64cfb682be8"; private static final String APP_SECRET = CommonSysConst.getSysConfig().getNewLinkAppSecret();
/** /**
* 分页获取(全量)油站信息 * 分页获取(全量)油站信息
@ -80,7 +82,7 @@ public class NewLinkRequestService {
paramMap.put("app_key", APP_KEY); paramMap.put("app_key", APP_KEY);
paramMap.put("timestamp", System.currentTimeMillis()); paramMap.put("timestamp", System.currentTimeMillis());
for (Map.Entry<String, Object> entry : map.entrySet()) { for (Map.Entry<String, Object> entry : map.entrySet()) {
paramMap.put(entry.getKey(), entry.getValue().toString()); paramMap.put(entry.getKey(), entry.getValue());
} }
paramMap.put("sign", MD5Util.encode(generateTuanYouSignature(paramMap, APP_SECRET).getBytes()).toLowerCase()); paramMap.put("sign", MD5Util.encode(generateTuanYouSignature(paramMap, APP_SECRET).getBytes()).toLowerCase());
return HttpsUtils.doPost(REQ_URL+"/services/vp/openapi/refuelingOrderPush", JSON.toJSONString(paramMap)); return HttpsUtils.doPost(REQ_URL+"/services/vp/openapi/refuelingOrderPush", JSON.toJSONString(paramMap));

@ -14,7 +14,18 @@ public class CommonSysConfig {
* 文件存放地址 可访问 * 文件存放地址 可访问
*/ */
private String filesystem; private String filesystem;
/**
* 能链团油请求地址
*/
private String newLinkReqUrl;
/**
* 能链团油AppKey
*/
private String newLinkAppKey;
/**
* 能链团油AppSecret
*/
private String newLinkAppSecret;
/** /**
* 惠支付支付渠道回调地址 * 惠支付支付渠道回调地址
*/ */

@ -81,24 +81,21 @@ public class BsGasOilPriceTaskServiceImpl implements BsGasOilPriceTaskService {
} }
@Override @Override
@Transactional(propagation= Propagation.REQUIRED)
public void businessHandle(BsGasOilPriceTask gasOilPriceTask) { public void businessHandle(BsGasOilPriceTask gasOilPriceTask) {
// 立刻执行 // 立刻执行
gasOilPriceTask.setStartTime(new Date()); gasOilPriceTask.setStartTime(new Date());
gasOilPriceTask.setStatus(GasTaskStatusEnum.status2.getStatus()); gasOilPriceTask.setStatus(GasTaskStatusEnum.status2.getStatus());
editData(gasOilPriceTask); editData(gasOilPriceTask);
// 国标价
if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type1.getStatus())) { if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type1.getStatus())) {
// 国标价
// 更新国标价 // 更新国标价
gasOilPriceOfficialService.editPrice(gasOilPriceTask.getRegionId(),gasOilPriceTask.getOilPriceZoneId(), gasOilPriceTask.getOilNo(), gasOilPriceTask.getPrice()); gasOilPriceOfficialService.editPrice(gasOilPriceTask.getRegionId(),gasOilPriceTask.getOilPriceZoneId(), gasOilPriceTask.getOilNo(), gasOilPriceTask.getPrice());
// 更新自建站的国标价 // 更新自建站的国标价
gasOilPriceOfficialService.refreshGasPriceOfficial(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo()); gasOilPriceOfficialService.refreshGasPriceOfficial(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo());
} } else if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type2.getStatus())) {
// 油站价
// 油站价
if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type2.getStatus())) {
// 查询油品价格 // 查询油品价格
BsGasOilPrice price = gasOilPriceService.getGasOilPrice(gasOilPriceTask.getMerId(), gasOilPriceTask.getOilNo()); BsGasOilPrice price = gasOilPriceService.getGasOilPrice(gasOilPriceTask.getMerId(), gasOilPriceTask.getOilNo());
if (price == null) { if (price == null) {
@ -107,10 +104,8 @@ public class BsGasOilPriceTaskServiceImpl implements BsGasOilPriceTaskService {
price.setPriceGun(gasOilPriceTask.getPrice().subtract(price.getGasStationDrop())); price.setPriceGun(gasOilPriceTask.getPrice().subtract(price.getGasStationDrop()));
price.setPriceVip(price.getPriceGun().subtract(price.getPreferentialMargin())); price.setPriceVip(price.getPriceGun().subtract(price.getPreferentialMargin()));
gasOilPriceService.editOilPrice(price); gasOilPriceService.editOilPrice(price);
} } else if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())) {
// 平台优惠
// 平台优惠
if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())) {
// 查询油品价格 // 查询油品价格
BsGasOilPrice price = gasOilPriceService.getGasOilPrice(gasOilPriceTask.getMerId(), gasOilPriceTask.getOilNo()); BsGasOilPrice price = gasOilPriceService.getGasOilPrice(gasOilPriceTask.getMerId(), gasOilPriceTask.getOilNo());
if (price == null) { if (price == null) {
@ -119,10 +114,8 @@ public class BsGasOilPriceTaskServiceImpl implements BsGasOilPriceTaskService {
price.setPreferentialMargin(gasOilPriceTask.getPrice()); price.setPreferentialMargin(gasOilPriceTask.getPrice());
price.setPriceVip(price.getPriceGun().subtract(price.getPreferentialMargin())); price.setPriceVip(price.getPriceGun().subtract(price.getPreferentialMargin()));
gasOilPriceService.editOilPrice(price); gasOilPriceService.editOilPrice(price);
} } else if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type4.getStatus())) {
// 油站直降
// 油站直降
if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type4.getStatus())) {
// 查询油品价格 // 查询油品价格
BsGasOilPrice price = gasOilPriceService.getGasOilPrice(gasOilPriceTask.getMerId(), gasOilPriceTask.getOilNo()); BsGasOilPrice price = gasOilPriceService.getGasOilPrice(gasOilPriceTask.getMerId(), gasOilPriceTask.getOilNo());
if (price == null) { if (price == null) {

@ -106,6 +106,9 @@ public class BsGasServiceImpl implements BsGasService {
// 加油金额 // 加油金额
payPriceModel.setOilingPrice(refuelPrice); payPriceModel.setOilingPrice(refuelPrice);
// 成本价
payPriceModel.setPriceCost(gasOilPrice.getPriceCost());
// 油站枪价 // 油站枪价
payPriceModel.setPriceGun(priceGun); payPriceModel.setPriceGun(priceGun);

@ -106,6 +106,7 @@ public class OrderCreateService {
gasOrder.setGasOilType(Integer.parseInt(gasOilType.getExt1())); gasOrder.setGasOilType(Integer.parseInt(gasOilType.getExt1()));
gasOrder.setGasPriceGun(priceModel.getPriceGun()); gasOrder.setGasPriceGun(priceModel.getPriceGun());
gasOrder.setGasPriceVip(priceModel.getPriceVip()); gasOrder.setGasPriceVip(priceModel.getPriceVip());
gasOrder.setGasPriceCost(priceModel.getPriceCost());
gasOrder.setGasPriceOfficial(priceModel.getPriceOfficial()); gasOrder.setGasPriceOfficial(priceModel.getPriceOfficial());
gasOrder.setGasPricePlatform(priceModel.getPricePlatform()); gasOrder.setGasPricePlatform(priceModel.getPricePlatform());
gasOrder.setGasOilLiters(priceModel.getOilLiters()); gasOrder.setGasOilLiters(priceModel.getOilLiters());

@ -60,7 +60,7 @@ public class OrderPaySuccessService {
oilHandle(order); oilHandle(order);
} }
} catch (Exception e) { } catch (Exception e) {
System.out.println(e.getMessage());
} }
} }
} }
@ -100,7 +100,7 @@ public class OrderPaySuccessService {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("gasId", gasOrder.getMerNo()); param.put("gasId", gasOrder.getMerNo());
param.put("oilNo", gasOrder.getGasOilNo()); param.put("oilNo", gasOrder.getGasOilNo());
param.put("gunNo", gasOrder.getGasGunNo()); param.put("gunNo", Integer.parseInt(gasOrder.getGasGunNo()));
param.put("priceGun", gasOrder.getGasPriceGun()); // 油站价 param.put("priceGun", gasOrder.getGasPriceGun()); // 油站价
param.put("priceVip", gasOrder.getGasPriceCost()); // 成本价 param.put("priceVip", gasOrder.getGasPriceCost()); // 成本价
param.put("driverPhone", gasOrder.getUserPhone()); param.put("driverPhone", gasOrder.getUserPhone());

@ -136,6 +136,7 @@ public class BsOrderServiceImpl implements BsOrderService {
deduction.setCouponDiscountPrice(new BigDecimal("0")); deduction.setCouponDiscountPrice(new BigDecimal("0"));
deduction.setCouponDiscountActualPrice(new BigDecimal("0")); deduction.setCouponDiscountActualPrice(new BigDecimal("0"));
deduction.setTotalDeductionPrice(deduction.getCouponDiscountActualPrice().add(new BigDecimal(deduction.getIntegralDiscountPrice().toString()).divide(new BigDecimal("100")))); deduction.setTotalDeductionPrice(deduction.getCouponDiscountActualPrice().add(new BigDecimal(deduction.getIntegralDiscountPrice().toString()).divide(new BigDecimal("100"))));
orderDeductionService.editData(deduction);
order.setDeduction(deduction); order.setDeduction(deduction);
/* BsOrderDeduction deduction = order.getDeduction()==null?new BsOrderDeduction():order.getDeduction(); /* BsOrderDeduction deduction = order.getDeduction()==null?new BsOrderDeduction():order.getDeduction();
deduction.setOrderId(order.getId()); deduction.setOrderId(order.getId());

@ -1,3 +1,9 @@
filesystem=/home/project/oil/filesystem filesystem=/home/project/oil/filesystem
huiPayPreorderNotifyUrl=https://test-oil.dctpay.com/crest/notify/huipay huiPayPreorderNotifyUrl=https://test-oil.dctpay.com/crest/notify/huipay
domainName=https://test-oil.dctpay.com domainName=https://test-oil.dctpay.com
# newLinkReqUrl=https://hcs.czb365.com
# newLinkAppKey=305490138943968
# newLinkAppSecret=dbf7dca3de20c2f2a41fd64cfb682be8
newLinkReqUrl=https://test01-motorcade-hcs.czb365.com
newLinkAppKey=297046381248288
newLinkAppSecret=3ef5320dd36e178ce2502fae1a8acd2b

@ -1,3 +1,6 @@
filesystem=/home/project/oil/filesystem filesystem=/home/project/oil/filesystem
huiPayPreorderNotifyUrl=https://oil.dctpay.com/crest/notify/huipay huiPayPreorderNotifyUrl=https://oil.dctpay.com/crest/notify/huipay
domainName=https://oil.dctpay.com domainName=https://oil.dctpay.com
newLinkReqUrl=https://hcs.czb365.com
newLinkAppKey=305490138943968
newLinkAppSecret=dbf7dca3de20c2f2a41fd64cfb682be8

Loading…
Cancel
Save