提交代码

dev-discount
胡锐 3 years ago
parent 2d80423225
commit f1aab27964
  1. 7
      hai-cweb/src/main/java/com/cweb/controller/HighGasController.java
  2. 2
      hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java
  3. 11
      hai-service/src/main/java/com/hai/service/impl/HighGasOilPriceServiceImpl.java

@ -125,6 +125,7 @@ public class HighGasController {
// 原始油品价格 // 原始油品价格
JSONArray originalOilPriceList = result.getJSONArray("oilPriceList"); JSONArray originalOilPriceList = result.getJSONArray("oilPriceList");
// 新油品价格 // 新油品价格
JSONArray newOilPriceList = new JSONArray(); JSONArray newOilPriceList = new JSONArray();
@ -139,7 +140,11 @@ public class HighGasController {
// 油品国标价 * 最终优惠比例 // 油品国标价 * 最终优惠比例
price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(2, BigDecimal.ROUND_DOWN)); 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); result.put("oilPriceList", newOilPriceList);

@ -76,6 +76,8 @@ public class HighGasSchedule {
JSONArray oilPriceList = object.getJSONArray("oilPriceList"); JSONArray oilPriceList = object.getJSONArray("oilPriceList");
for (Object oilPrice : oilPriceList) { for (Object oilPrice : oilPriceList) {
JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice)); JSONObject oilPriceObject = JSONObject.parseObject(JSONObject.toJSONString(oilPrice));
// 查询门店油号 // 查询门店油号
highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo")); highGasOilPrice = highGasOilPriceService.getGasOilPriceByStoreAndOilNo(store.getId(), oilPriceObject.getInteger("oilNo"));
if (highGasOilPrice == null) { if (highGasOilPrice == null) {

@ -18,11 +18,14 @@ public class HighGasOilPriceServiceImpl implements HighGasOilPriceService {
@Override @Override
public void editGasOilPrice(HighGasOilPrice highGasOilPrice) { public void editGasOilPrice(HighGasOilPrice highGasOilPrice) {
if (highGasOilPrice.getId() != null) { if (highGasOilPrice.getOilType() != null && highGasOilPrice.getOilType() == 1) {
highGasOilPriceMapper.updateByPrimaryKey(highGasOilPrice); if (highGasOilPrice.getId() != null) {
} else { highGasOilPriceMapper.updateByPrimaryKey(highGasOilPrice);
highGasOilPriceMapper.insert(highGasOilPrice); } else {
highGasOilPriceMapper.insert(highGasOilPrice);
}
} }
} }
@Override @Override

Loading…
Cancel
Save