|
|
@ -112,32 +112,72 @@ public class HighGasController { |
|
|
|
PageInfo<Map<String, Object>> mapPageInfo = PageUtil.initPageInfoObj(pageNum, distance.size(), pageSize, new PageInfo<>(distance)); |
|
|
|
PageInfo<Map<String, Object>> mapPageInfo = PageUtil.initPageInfoObj(pageNum, distance.size(), pageSize, new PageInfo<>(distance)); |
|
|
|
for (Map<String, Object> map : mapPageInfo.getList()) { |
|
|
|
for (Map<String, Object> map : mapPageInfo.getList()) { |
|
|
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "oil_no"))) { |
|
|
|
if (StringUtils.isNotBlank(MapUtils.getString(map, "oil_no"))) { |
|
|
|
// 查询是否配置了【油站的】优惠比例
|
|
|
|
|
|
|
|
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); |
|
|
|
if (MapUtils.getInteger(map, "source_type").equals(1)) { |
|
|
|
if (tyAgentPrice != null) { |
|
|
|
// 查询是否配置了【油站的】优惠比例
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); |
|
|
|
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
if (tyAgentPrice != null) { |
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
|
|
|
|
map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_gun")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 查询是否配置了【油品】优惠比例
|
|
|
|
|
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no")); |
|
|
|
|
|
|
|
if (gasDiscountOilPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
// 油枪价 - 优惠幅度
|
|
|
|
map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_gun")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
BigDecimal price = new BigDecimal(MapUtils.getString(map, "price_gun")).subtract(new BigDecimal(MapUtils.getString(map, "preferential_margin"))); |
|
|
|
|
|
|
|
// (油枪价 - 优惠幅度) * 系统折扣
|
|
|
|
|
|
|
|
map.put("price_vip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 查询是否配置了【油品】优惠比例
|
|
|
|
|
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no")); |
|
|
|
|
|
|
|
if (gasDiscountOilPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油枪价 - 优惠幅度
|
|
|
|
|
|
|
|
BigDecimal price = new BigDecimal(MapUtils.getString(map, "price_gun")).subtract(new BigDecimal(MapUtils.getString(map, "preferential_margin"))); |
|
|
|
|
|
|
|
// (油枪价 - 优惠幅度) * 系统折扣
|
|
|
|
|
|
|
|
map.put("price_vip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询是否配置了【代理商】优惠比例
|
|
|
|
// 查询是否配置了【代理商】优惠比例
|
|
|
|
if (isTyAgent != null && isTyAgent == true) { |
|
|
|
if (isTyAgent != null && isTyAgent == true) { |
|
|
|
HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); |
|
|
|
HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); |
|
|
|
if (agentPrice != null) { |
|
|
|
if (agentPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油枪价 - 优惠幅度
|
|
|
|
|
|
|
|
BigDecimal price = new BigDecimal(MapUtils.getString(map, "price_gun")).subtract(new BigDecimal(MapUtils.getString(map, "preferential_margin"))); |
|
|
|
|
|
|
|
// (油枪价 - 优惠幅度) * 系统折扣
|
|
|
|
|
|
|
|
map.put("price_vip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (MapUtils.getInteger(map, "source_type").equals(2)) { |
|
|
|
|
|
|
|
// 查询是否配置了【油站的】优惠比例
|
|
|
|
|
|
|
|
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); |
|
|
|
|
|
|
|
if (tyAgentPrice != null) { |
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_gun")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_gun")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 查询是否配置了【油品】优惠比例
|
|
|
|
|
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no")); |
|
|
|
|
|
|
|
if (gasDiscountOilPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
|
|
|
|
map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_gun")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询是否配置了【代理商】优惠比例
|
|
|
|
|
|
|
|
if (isTyAgent != null && isTyAgent == true) { |
|
|
|
|
|
|
|
HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); |
|
|
|
|
|
|
|
if (agentPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
|
|
|
|
map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_gun")).multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -271,6 +311,43 @@ public class HighGasController { |
|
|
|
oilPriceMap.put("priceVip", oilPrice.getPriceVip()); |
|
|
|
oilPriceMap.put("priceVip", oilPrice.getPriceVip()); |
|
|
|
oilPriceMap.put("priceGun", oilPrice.getPriceGun()); |
|
|
|
oilPriceMap.put("priceGun", oilPrice.getPriceGun()); |
|
|
|
oilPriceMap.put("priceOfficial", oilPrice.getPriceOfficial()); |
|
|
|
oilPriceMap.put("priceOfficial", oilPrice.getPriceOfficial()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询是否配置了【油站的】优惠比例
|
|
|
|
|
|
|
|
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, store.getId(), oilPrice.getOilNo().toString()); |
|
|
|
|
|
|
|
if (tyAgentPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油枪价 - 优惠幅度
|
|
|
|
|
|
|
|
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin()); |
|
|
|
|
|
|
|
// (油枪价 - 优惠幅度) * 系统折扣
|
|
|
|
|
|
|
|
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 查询是否配置了【油品】优惠比例
|
|
|
|
|
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(oilPrice.getOilNo().toString()); |
|
|
|
|
|
|
|
if (gasDiscountOilPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油枪价 - 优惠幅度
|
|
|
|
|
|
|
|
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin()); |
|
|
|
|
|
|
|
// (油枪价 - 优惠幅度) * 系统折扣
|
|
|
|
|
|
|
|
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询是否配置了【代理商】优惠比例
|
|
|
|
|
|
|
|
if (isTyAgent != null && isTyAgent == true) { |
|
|
|
|
|
|
|
HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, store.getId(), oilPrice.getOilNo().toString()); |
|
|
|
|
|
|
|
if (agentPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油枪价 - 优惠幅度
|
|
|
|
|
|
|
|
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin()); |
|
|
|
|
|
|
|
// (油枪价 - 优惠幅度) * 系统折扣
|
|
|
|
|
|
|
|
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
oilPriceMapList.add(oilPriceMap); |
|
|
|
oilPriceMapList.add(oilPriceMap); |
|
|
|
} |
|
|
|
} |
|
|
|
param.put("oilPriceList", oilPriceMapList); |
|
|
|
param.put("oilPriceList", oilPriceMapList); |
|
|
@ -418,6 +495,43 @@ public class HighGasController { |
|
|
|
oilPriceMap.put("priceVip", oilPrice.getPriceVip()); |
|
|
|
oilPriceMap.put("priceVip", oilPrice.getPriceVip()); |
|
|
|
oilPriceMap.put("priceGun", oilPrice.getPriceGun()); |
|
|
|
oilPriceMap.put("priceGun", oilPrice.getPriceGun()); |
|
|
|
oilPriceMap.put("priceOfficial", oilPrice.getPriceOfficial()); |
|
|
|
oilPriceMap.put("priceOfficial", oilPrice.getPriceOfficial()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询是否配置了【油站的】优惠比例
|
|
|
|
|
|
|
|
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, store.getId(), oilPrice.getOilNo().toString()); |
|
|
|
|
|
|
|
if (tyAgentPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油枪价 - 优惠幅度
|
|
|
|
|
|
|
|
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin()); |
|
|
|
|
|
|
|
// (油枪价 - 优惠幅度) * 系统折扣
|
|
|
|
|
|
|
|
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 查询是否配置了【油品】优惠比例
|
|
|
|
|
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = gasDiscountOilPriceService.getDetailByOilNo(oilPrice.getOilNo().toString()); |
|
|
|
|
|
|
|
if (gasDiscountOilPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油枪价 - 优惠幅度
|
|
|
|
|
|
|
|
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin()); |
|
|
|
|
|
|
|
// (油枪价 - 优惠幅度) * 系统折扣
|
|
|
|
|
|
|
|
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询是否配置了【代理商】优惠比例
|
|
|
|
|
|
|
|
if (isTyAgent != null && isTyAgent == true) { |
|
|
|
|
|
|
|
HighTyAgentPrice agentPrice = tyAgentPriceService.getDetail(2, store.getId(), oilPrice.getOilNo().toString()); |
|
|
|
|
|
|
|
if (agentPrice != null) { |
|
|
|
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
|
|
|
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
|
|
|
// 油枪价 - 优惠幅度
|
|
|
|
|
|
|
|
BigDecimal price = oilPrice.getPriceGun().subtract(oilPrice.getPreferentialMargin()); |
|
|
|
|
|
|
|
// (油枪价 - 优惠幅度) * 系统折扣
|
|
|
|
|
|
|
|
oilPriceMap.put("priceVip", price.multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
oilPriceMapList.add(oilPriceMap); |
|
|
|
oilPriceMapList.add(oilPriceMap); |
|
|
|
} |
|
|
|
} |
|
|
|
param.put("oilPriceList", oilPriceMapList); |
|
|
|
param.put("oilPriceList", oilPriceMapList); |
|
|
|