From fbd4fa3931b44227a532cf2a0b5d6b71cf810b66 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 15 Jul 2024 09:50:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cweb/controller/BsGasController.java | 19 +++++++++++++++-- .../controller/order/BsOrderController.java | 2 +- .../gas/newlink/NewLinkGasService.java | 11 +++++----- .../gas/newlink/NewLinkRequestService.java | 10 +++++---- .../java/com/hfkj/config/CommonSysConfig.java | 13 +++++++++++- .../impl/BsGasOilPriceTaskServiceImpl.java | 21 +++++++------------ .../service/gas/impl/BsGasServiceImpl.java | 3 +++ .../service/order/OrderCreateService.java | 1 + .../service/order/OrderPaySuccessService.java | 4 ++-- .../order/impl/BsOrderServiceImpl.java | 1 + .../resources/dev/commonConfig.properties | 6 ++++++ .../resources/prod/commonConfig.properties | 3 +++ 12 files changed, 65 insertions(+), 29 deletions(-) diff --git a/cweb/src/main/java/com/cweb/controller/BsGasController.java b/cweb/src/main/java/com/cweb/controller/BsGasController.java index 77842ff..494a619 100644 --- a/cweb/src/main/java/com/cweb/controller/BsGasController.java +++ b/cweb/src/main/java/com/cweb/controller/BsGasController.java @@ -1,8 +1,10 @@ package com.cweb.controller; +import com.alibaba.fastjson.JSONObject; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; 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.ErrorHelp; 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) @ResponseBody @@ -101,7 +116,7 @@ public class BsGasController { 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); @@ -137,7 +152,7 @@ public class BsGasController { 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); diff --git a/cweb/src/main/java/com/cweb/controller/order/BsOrderController.java b/cweb/src/main/java/com/cweb/controller/order/BsOrderController.java index 80ddcfd..2aabc29 100644 --- a/cweb/src/main/java/com/cweb/controller/order/BsOrderController.java +++ b/cweb/src/main/java/com/cweb/controller/order/BsOrderController.java @@ -75,7 +75,7 @@ public class BsOrderController { 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, ""); } } diff --git a/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java b/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java index 65c8b72..ed84ab0 100644 --- a/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java +++ b/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkGasService.java @@ -122,10 +122,11 @@ public class NewLinkGasService { // 查询油站油价 List gasOilPriceList = gasOilPriceService.getGasOilPriceList(merchant.getId()); - BsGasOilPrice oilPriceExample = new BsGasOilPrice(); - oilPriceExample.setStatus(GasOilPriceStatusEnum.status2.getNumber()); - gasOilPriceService.batchUpdate(merchant.getMerNo(), oilPriceExample); - + if (!gasOilPriceList.isEmpty()) { + BsGasOilPrice oilPriceExample = new BsGasOilPrice(); + oilPriceExample.setStatus(GasOilPriceStatusEnum.status2.getNumber()); + gasOilPriceService.batchUpdate(merchant.getMerNo(), oilPriceExample); + } // 查询油站抢号 List oilGunNoList = gasOilGunNoService.getOilGunNoList(merchant.getMerNo()); for (BsGasOilGunNo gunNo : oilGunNoList) { @@ -156,7 +157,7 @@ public class NewLinkGasService { // 国标价 - 油站价 = 油站直降 gasOilPrice.setGasStationDrop(oilPriceObject.getBigDecimal("priceOfficial").subtract(oilPriceObject.getBigDecimal("priceGun"))); gasOilPrice.setPriceCost(oilPriceObject.getBigDecimal("priceVip")); - gasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceGun")); + gasOilPrice.setPriceVip(oilPriceObject.getBigDecimal("priceVip")); gasOilPrice.setPriceGun(oilPriceObject.getBigDecimal("priceGun")); gasOilPrice.setPriceOfficial(oilPriceObject.getBigDecimal("priceOfficial")); gasOilPriceService.editOilPrice(gasOilPrice); diff --git a/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkRequestService.java b/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkRequestService.java index 873f1d2..a6e5304 100644 --- a/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkRequestService.java +++ b/service/src/main/java/com/hfkj/channel/gas/newlink/NewLinkRequestService.java @@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject; import com.hfkj.common.pay.util.sdk.WXPayConstants; import com.hfkj.common.utils.HttpsUtils; import com.hfkj.common.utils.MD5Util; +import com.hfkj.config.CommonSysConfig; +import com.hfkj.config.CommonSysConst; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -16,9 +18,9 @@ import java.util.*; */ public class NewLinkRequestService { private static final Logger log = LoggerFactory.getLogger(NewLinkRequestService.class); - private static final String REQ_URL = "https://hcs.czb365.com"; - private static final String APP_KEY = "305490138943968"; - private static final String APP_SECRET = "dbf7dca3de20c2f2a41fd64cfb682be8"; + private static final String REQ_URL = CommonSysConst.getSysConfig().getNewLinkReqUrl(); + private static final String APP_KEY = CommonSysConst.getSysConfig().getNewLinkAppKey(); + private static final String APP_SECRET = CommonSysConst.getSysConfig().getNewLinkAppSecret(); /** * 分页获取(全量)油站信息 @@ -80,7 +82,7 @@ public class NewLinkRequestService { paramMap.put("app_key", APP_KEY); paramMap.put("timestamp", System.currentTimeMillis()); for (Map.Entry 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()); return HttpsUtils.doPost(REQ_URL+"/services/vp/openapi/refuelingOrderPush", JSON.toJSONString(paramMap)); diff --git a/service/src/main/java/com/hfkj/config/CommonSysConfig.java b/service/src/main/java/com/hfkj/config/CommonSysConfig.java index 87f9ee3..21fa1d9 100644 --- a/service/src/main/java/com/hfkj/config/CommonSysConfig.java +++ b/service/src/main/java/com/hfkj/config/CommonSysConfig.java @@ -14,7 +14,18 @@ public class CommonSysConfig { * 文件存放地址 可访问 */ private String filesystem; - + /** + * 能链【团油】请求地址 + */ + private String newLinkReqUrl; + /** + * 能链【团油】AppKey + */ + private String newLinkAppKey; + /** + * 能链【团油】AppSecret + */ + private String newLinkAppSecret; /** * 【惠支付】支付渠道回调地址 */ diff --git a/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceTaskServiceImpl.java b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceTaskServiceImpl.java index 2c8ea75..dcca1c1 100644 --- a/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceTaskServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/gas/impl/BsGasOilPriceTaskServiceImpl.java @@ -81,24 +81,21 @@ public class BsGasOilPriceTaskServiceImpl implements BsGasOilPriceTaskService { } @Override - @Transactional(propagation= Propagation.REQUIRED) public void businessHandle(BsGasOilPriceTask gasOilPriceTask) { // 立刻执行 gasOilPriceTask.setStartTime(new Date()); gasOilPriceTask.setStatus(GasTaskStatusEnum.status2.getStatus()); editData(gasOilPriceTask); - // 国标价 if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type1.getStatus())) { + // 国标价 // 更新国标价 gasOilPriceOfficialService.editPrice(gasOilPriceTask.getRegionId(),gasOilPriceTask.getOilPriceZoneId(), gasOilPriceTask.getOilNo(), gasOilPriceTask.getPrice()); // 更新自建站的国标价 gasOilPriceOfficialService.refreshGasPriceOfficial(gasOilPriceTask.getRegionId(), gasOilPriceTask.getOilNo()); - } - - // 油站价 - if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type2.getStatus())) { + } else if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type2.getStatus())) { + // 油站价 // 查询油品价格 BsGasOilPrice price = gasOilPriceService.getGasOilPrice(gasOilPriceTask.getMerId(), gasOilPriceTask.getOilNo()); if (price == null) { @@ -107,10 +104,8 @@ public class BsGasOilPriceTaskServiceImpl implements BsGasOilPriceTaskService { price.setPriceGun(gasOilPriceTask.getPrice().subtract(price.getGasStationDrop())); price.setPriceVip(price.getPriceGun().subtract(price.getPreferentialMargin())); gasOilPriceService.editOilPrice(price); - } - - // 平台优惠 - if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())) { + } else if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type3.getStatus())) { + // 平台优惠 // 查询油品价格 BsGasOilPrice price = gasOilPriceService.getGasOilPrice(gasOilPriceTask.getMerId(), gasOilPriceTask.getOilNo()); if (price == null) { @@ -119,10 +114,8 @@ public class BsGasOilPriceTaskServiceImpl implements BsGasOilPriceTaskService { price.setPreferentialMargin(gasOilPriceTask.getPrice()); price.setPriceVip(price.getPriceGun().subtract(price.getPreferentialMargin())); gasOilPriceService.editOilPrice(price); - } - - // 油站直降 - if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type4.getStatus())) { + } else if (gasOilPriceTask.getPriceType().equals(GasTaskPriceTypeEnum.type4.getStatus())) { + // 油站直降 // 查询油品价格 BsGasOilPrice price = gasOilPriceService.getGasOilPrice(gasOilPriceTask.getMerId(), gasOilPriceTask.getOilNo()); if (price == null) { diff --git a/service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java b/service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java index 79e0bb0..40bf017 100644 --- a/service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java @@ -106,6 +106,9 @@ public class BsGasServiceImpl implements BsGasService { // 加油金额 payPriceModel.setOilingPrice(refuelPrice); + // 成本价 + payPriceModel.setPriceCost(gasOilPrice.getPriceCost()); + // 油站枪价 payPriceModel.setPriceGun(priceGun); diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index 978ec8b..77985a5 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -106,6 +106,7 @@ public class OrderCreateService { gasOrder.setGasOilType(Integer.parseInt(gasOilType.getExt1())); gasOrder.setGasPriceGun(priceModel.getPriceGun()); gasOrder.setGasPriceVip(priceModel.getPriceVip()); + gasOrder.setGasPriceCost(priceModel.getPriceCost()); gasOrder.setGasPriceOfficial(priceModel.getPriceOfficial()); gasOrder.setGasPricePlatform(priceModel.getPricePlatform()); gasOrder.setGasOilLiters(priceModel.getOilLiters()); diff --git a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java index 0594ec3..6652f80 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java @@ -60,7 +60,7 @@ public class OrderPaySuccessService { oilHandle(order); } } catch (Exception e) { - + System.out.println(e.getMessage()); } } } @@ -100,7 +100,7 @@ public class OrderPaySuccessService { Map param = new HashMap<>(); param.put("gasId", gasOrder.getMerNo()); param.put("oilNo", gasOrder.getGasOilNo()); - param.put("gunNo", gasOrder.getGasGunNo()); + param.put("gunNo", Integer.parseInt(gasOrder.getGasGunNo())); param.put("priceGun", gasOrder.getGasPriceGun()); // 油站价 param.put("priceVip", gasOrder.getGasPriceCost()); // 成本价 param.put("driverPhone", gasOrder.getUserPhone()); diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java index 5ba9902..70b8e7d 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java @@ -136,6 +136,7 @@ public class BsOrderServiceImpl implements BsOrderService { deduction.setCouponDiscountPrice(new BigDecimal("0")); deduction.setCouponDiscountActualPrice(new BigDecimal("0")); deduction.setTotalDeductionPrice(deduction.getCouponDiscountActualPrice().add(new BigDecimal(deduction.getIntegralDiscountPrice().toString()).divide(new BigDecimal("100")))); + orderDeductionService.editData(deduction); order.setDeduction(deduction); /* BsOrderDeduction deduction = order.getDeduction()==null?new BsOrderDeduction():order.getDeduction(); deduction.setOrderId(order.getId()); diff --git a/service/src/main/resources/dev/commonConfig.properties b/service/src/main/resources/dev/commonConfig.properties index d3b35e9..56d2d9c 100644 --- a/service/src/main/resources/dev/commonConfig.properties +++ b/service/src/main/resources/dev/commonConfig.properties @@ -1,3 +1,9 @@ filesystem=/home/project/oil/filesystem huiPayPreorderNotifyUrl=https://test-oil.dctpay.com/crest/notify/huipay 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 diff --git a/service/src/main/resources/prod/commonConfig.properties b/service/src/main/resources/prod/commonConfig.properties index 1efe9bd..9e25961 100644 --- a/service/src/main/resources/prod/commonConfig.properties +++ b/service/src/main/resources/prod/commonConfig.properties @@ -1,3 +1,6 @@ filesystem=/home/project/oil/filesystem huiPayPreorderNotifyUrl=https://oil.dctpay.com/crest/notify/huipay domainName=https://oil.dctpay.com +newLinkReqUrl=https://hcs.czb365.com +newLinkAppKey=305490138943968 +newLinkAppSecret=dbf7dca3de20c2f2a41fd64cfb682be8