From 6d838a7ed99a61b489911e64468b7972d4f6e8dd Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 19 May 2022 15:02:30 +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 --- .../src/main/resources/dev/application.yml | 2 +- .../cweb/controller/HighGasController.java | 2 +- .../com/hai/config/SpPrinterTemplate.java | 8 +-- .../java/com/hai/dao/HighOrderMapperExt.java | 1 + .../java/com/hai/model/GasOrderModel.java | 9 +++ .../HighGasDiscountOilPriceServiceImpl.java | 45 ++++++++++----- .../service/impl/HighOrderServiceImpl.java | 55 ++++--------------- 7 files changed, 58 insertions(+), 64 deletions(-) diff --git a/hai-bweb/src/main/resources/dev/application.yml b/hai-bweb/src/main/resources/dev/application.yml index 6dbeaaea..b3326583 100644 --- a/hai-bweb/src/main/resources/dev/application.yml +++ b/hai-bweb/src/main/resources/dev/application.yml @@ -28,7 +28,7 @@ spring: poolPreparedStatements: true maxOpenPreparedStatements: 20 redis: - database: 5 + database: 0 host: 139.159.177.244 port: 36379 password: HF123456.Redis diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java index 06d6afeb..39172ef9 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -238,7 +238,7 @@ public class HighGasController { // 查询油枪 List> gasGunMapList = new ArrayList<>(); Map gasGunMap; - List oilGunNoList = gasOilGunNoService.getGunNoListByOilPrice(store.getId()); + List oilGunNoList = gasOilGunNoService.getGunNoListByStoreId(store.getId()); for (HighGasOilGunNo oilGunNo : oilGunNoList) { gasGunMap = new HashMap<>(); gasGunMap.put("gunNo", oilGunNo.getGunNo()); diff --git a/hai-service/src/main/java/com/hai/config/SpPrinterTemplate.java b/hai-service/src/main/java/com/hai/config/SpPrinterTemplate.java index 901a195a..89a175f7 100644 --- a/hai-service/src/main/java/com/hai/config/SpPrinterTemplate.java +++ b/hai-service/src/main/java/com/hai/config/SpPrinterTemplate.java @@ -56,8 +56,8 @@ public class SpPrinterTemplate { "升数:" + oilLiters +"升
" + "实际加油升数以油站加油机为准!
" + "------------------------------
" + - "加油金额
" + - "¥" + orderPrice + "元
" + + "加油金额
" + + "¥" + orderPrice + "元
" + "------------------------------
" + "来"嗨森逛“;开心又省钱"; return str; @@ -95,8 +95,8 @@ public class SpPrinterTemplate { "升数:" + oilLiters +"升
" + "实际加油升数以油站加油机为准!
" + "------------------------------
" + - "加油金额
" + - "¥" + orderPrice + "元
" + + "加油金额
" + + "¥" + orderPrice + "元
" + "------------------------------
" + "来"嗨森逛“;开心又省钱"; return str; diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index 5dffb289..c39bb737 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -1094,6 +1094,7 @@ public interface HighOrderMapperExt { " a.goods_name gasName," + " (select address from high_merchant_store where id = a.goods_id) gasAddress," + " (select store_logo from high_merchant_store where id = a.goods_id) gasLogo," + + " a.gas_oil_type gasOilType," + " a.gas_oil_no gasOilNo," + " a.gas_gun_no gasGunNo," + " a.gas_price_gun gasPriceGun," + diff --git a/hai-service/src/main/java/com/hai/model/GasOrderModel.java b/hai-service/src/main/java/com/hai/model/GasOrderModel.java index 641e0f3b..137c217d 100644 --- a/hai-service/src/main/java/com/hai/model/GasOrderModel.java +++ b/hai-service/src/main/java/com/hai/model/GasOrderModel.java @@ -19,6 +19,7 @@ public class GasOrderModel { private String gasLogo; private String gasName; private String gasAddress; + private String gasOilType; private String gasOilNo; private String gasGunNo; private String gasOilLiters; @@ -31,6 +32,14 @@ public class GasOrderModel { private Date payTime; private Date refundTime; + public String getGasOilType() { + return gasOilType; + } + + public void setGasOilType(String gasOilType) { + this.gasOilType = gasOilType; + } + public String getOrderNo() { return orderNo; } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java index 09571332..5a77d3fc 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasDiscountOilPriceServiceImpl.java @@ -105,6 +105,10 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri if (store == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站"); } + // 是否是加油站 + if (!store.getType().equals(1)) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站"); + } // 优惠比例 BigDecimal discount = new BigDecimal("100"); @@ -129,26 +133,39 @@ public class HighGasDiscountOilPriceServiceImpl implements HighGasDiscountOilPri } } discount = discount.divide(new BigDecimal("100")); - - // 查询油站油品价格 - JSONObject oilPriceObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), oilNo); - if (oilPriceObject == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); - } - JSONArray oilPriceObjectArray = oilPriceObject.getJSONArray("result"); - if (oilPriceObjectArray.size() == 0) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); + // 枪价 + BigDecimal priceGun = null; + // 优惠价 + BigDecimal priceVip = null; + + // 来源类型 1:平台自建 2:团油 + if (store.getSourceType().equals(2)) { + // 查询油站油品价格 + JSONObject oilPriceObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), oilNo); + if (oilPriceObject == null) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); + } + JSONArray oilPriceObjectArray = oilPriceObject.getJSONArray("result"); + if (oilPriceObjectArray.size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); + } + JSONObject priceDetail = (JSONObject) oilPriceObjectArray.get(0); + // 团油枪价 + priceGun = priceDetail.getBigDecimal("priceGun"); + // 团油优惠价 + priceVip = priceDetail.getBigDecimal("priceVip"); } HighGasOilPrice gasOilPrice = gasOilPriceService.getGasOilPriceByStoreAndOilNo(goodsId, Integer.parseInt(oilNo)); if (gasOilPrice == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站价格"); } + if (priceGun == null) { + priceGun = gasOilPrice.getPriceGun(); + } + if (priceVip == null) { + priceVip = gasOilPrice.getPriceVip(); + } - JSONObject priceDetail = (JSONObject) oilPriceObjectArray.get(0); - // 团油枪价 - BigDecimal priceGun = priceDetail.getBigDecimal("priceGun"); - // 团油优惠价 - BigDecimal priceVip = priceDetail.getBigDecimal("priceVip"); // 团油国标价 BigDecimal priceOfficial = gasOilPrice.getPriceOfficial(); // 嗨森逛平台价 国标价 * 折扣 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index bf92738d..fa8ab6d7 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -357,6 +357,7 @@ public class HighOrderServiceImpl implements HighOrderService { if (highChildOrder.getGoodsType() == 3) { highChildOrder.setChildOrdeStatus(3); + highOrder.setOrderStatus(3); HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); // 来源类型 1:平台自建 2:团油 @@ -439,43 +440,6 @@ public class HighOrderServiceImpl implements HighOrderService { } } } - /* if (highChildOrder.getGoodsType() == 3) { - highChildOrder.setChildOrdeStatus(3); - HighMerchantStoreModel store = highMerchantStoreService.getMerchantStoreById(highChildOrder.getGoodsId()); - // 推送团油订单 - Map paramMap = new HashMap<>(); - paramMap.put("gasId", store.getStoreKey()); - paramMap.put("oilNo", highChildOrder.getGasOilNo()); - paramMap.put("gunNo", highChildOrder.getGasGunNo()); - BigDecimal priceGun = highChildOrder.getGasPriceGun(); - BigDecimal priceVip = highChildOrder.getGasPriceVip(); - paramMap.put("priceGun", priceGun); // 枪单价 - paramMap.put("priceVip", priceVip); // 优惠价 - paramMap.put("driverPhone", highOrder.getMemPhone()); - paramMap.put("thirdSerialNo", highOrder.getOrderNo()); - paramMap.put("refuelingAmount", highChildOrder.getTotalPrice()); - - // 油品类型 1:汽油:2:柴油;3:天然气 - if (highChildOrder.getGasOilType() == 1) { - paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouGasolineAccount()); - } else if (highChildOrder.getGasOilType() == 2) { - paramMap.put("accountNo", CommonSysConst.getSysConfig().getTuanYouDieselAccount()); - } - JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(paramMap); - // 推送团油订单记录 - HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); - highGasOrderPush.setType(OrderPushType.type1.getType()); - highGasOrderPush.setOrderNo(highOrder.getOrderNo()); - highGasOrderPush.setCreateTime(new Date()); - highGasOrderPush.setCode(orderPushObject.getString("code")); - highGasOrderPush.setRequestContent(JSONObject.toJSONString(paramMap)); - highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); - highGasOrderPushMapper.insert(highGasOrderPush); - - if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { - highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo")); - } - }*/ if (highChildOrder.getGoodsType() == 7) { HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId()); @@ -506,13 +470,16 @@ public class HighOrderServiceImpl implements HighOrderService { updateOrder(highOrder); - if (highOrder.getHighChildOrderList().get(0).getGoodsType().equals(3)) { - Map message = new HashMap<>(); - message.put("order", highOrderService.getOrderByOrderNo(highOrder.getOrderNo())); - message.put("voice", baiduVoiceService.text2audio(highOrder.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + highOrder.getTotalPrice())); - webSocket.SenderMessage(highOrder.getHighChildOrderList().get(0).getGoodsId().toString() - , JSONObject.toJSONString(message)); - } + + new Thread(() -> { + if (highOrder.getHighChildOrderList().get(0).getGoodsType().equals(3)) { + Map message = new HashMap<>(); + message.put("order", highOrderService.getGasOrderDetail(highOrder.getOrderNo())); + message.put("voice", baiduVoiceService.text2audio(highOrder.getHighChildOrderList().get(0).getGoodsName() + "加油站,收款:" + highOrder.getTotalPrice())); + webSocket.SenderMessage(highOrder.getHighChildOrderList().get(0).getGoodsId().toString() + , JSONObject.toJSONString(message)); + } + }).start(); } @Override