From f1aab27964b89d949763fdc2b84fdd93ca7f3233 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 14 Oct 2021 22:50:57 +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 --- .../java/com/cweb/controller/HighGasController.java | 7 ++++++- .../main/java/com/hai/schedule/HighGasSchedule.java | 2 ++ .../hai/service/impl/HighGasOilPriceServiceImpl.java | 11 +++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) 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 01ec3769..fff24cb9 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighGasController.java @@ -125,6 +125,7 @@ public class HighGasController { // 原始油品价格 JSONArray originalOilPriceList = result.getJSONArray("oilPriceList"); + // 新油品价格 JSONArray newOilPriceList = new JSONArray(); @@ -139,7 +140,11 @@ public class HighGasController { // 油品国标价 * 最终优惠比例 price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(2, BigDecimal.ROUND_DOWN)); } - newOilPriceList.add(price); + + // 过滤油品,只保留汽油 + if (price.getInteger("oilType") == 1) { + newOilPriceList.add(price); + } } result.put("oilPriceList", newOilPriceList); diff --git a/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java b/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java index bae704b1..1da76d92 100644 --- a/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java +++ b/hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java @@ -76,6 +76,8 @@ public class HighGasSchedule { JSONArray oilPriceList = object.getJSONArray("oilPriceList"); for (Object oilPrice : oilPriceList) { JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); + + // 查询门店油号 highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo")); if (highGasOilPrice == null) { diff --git a/hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceServiceImpl.java index af0c4b7e..0dcb3775 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceServiceImpl.java @@ -18,11 +18,14 @@ public class HighGasOilPriceServiceImpl implements HighGasOilPriceService { @Override public void editGasOilPrice(HighGasOilPrice highGasOilPrice) { - if (highGasOilPrice.getId() != null) { - highGasOilPriceMapper.updateByPrimaryKey(highGasOilPrice); - } else { - highGasOilPriceMapper.insert(highGasOilPrice); + if (highGasOilPrice.getOilType() != null && highGasOilPrice.getOilType() == 1) { + if (highGasOilPrice.getId() != null) { + highGasOilPriceMapper.updateByPrimaryKey(highGasOilPrice); + } else { + highGasOilPriceMapper.insert(highGasOilPrice); + } } + } @Override