|
|
@ -101,14 +101,14 @@ 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"))) { |
|
|
|
|
|
|
|
map.put("price_gun", MapUtils.getString(map, "price_vip")); |
|
|
|
// 查询是否配置了【油站的】优惠比例
|
|
|
|
// 查询是否配置了【油站的】优惠比例
|
|
|
|
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); |
|
|
|
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, MapUtils.getLong(map, "id"), MapUtils.getString(map, "oil_no")); |
|
|
|
if (tyAgentPrice != null) { |
|
|
|
if (tyAgentPrice != null) { |
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
BigDecimal priceRate = tyAgentPrice.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_official")).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 { |
|
|
|
} else { |
|
|
|
// 查询是否配置了【油品】优惠比例
|
|
|
|
// 查询是否配置了【油品】优惠比例
|
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no")); |
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(MapUtils.getString(map, "oil_no")); |
|
|
@ -116,7 +116,7 @@ public class HighGasController { |
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_official")).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)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -127,7 +127,7 @@ public class HighGasController { |
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
map.put("price_vip", new BigDecimal(MapUtils.getString(map, "price_official")).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)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -212,6 +212,7 @@ public class HighGasController { |
|
|
|
if (oilNo != null && !oilNo.getStatus().equals(GasOilPriceStatusEnum.status1.getStatus())) { |
|
|
|
if (oilNo != null && !oilNo.getStatus().equals(GasOilPriceStatusEnum.status1.getStatus())) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
price.put("priceGun", price.getString("priceVip")); |
|
|
|
|
|
|
|
|
|
|
|
// 查询是否配置了【油站的】优惠比例
|
|
|
|
// 查询是否配置了【油站的】优惠比例
|
|
|
|
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, store.getId(), price.getString("oilNo")); |
|
|
|
HighTyAgentPrice tyAgentPrice = tyAgentPriceService.getDetail(1, store.getId(), price.getString("oilNo")); |
|
|
@ -219,7 +220,7 @@ public class HighGasController { |
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
BigDecimal priceRate = tyAgentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
price.put("priceVip", price.getBigDecimal("priceGun").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 查询是否配置了【油品】优惠比例
|
|
|
|
// 查询是否配置了【油品】优惠比例
|
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(price.getString("oilNo")); |
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNo(price.getString("oilNo")); |
|
|
@ -227,7 +228,7 @@ public class HighGasController { |
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
price.put("priceVip", price.getBigDecimal("priceGun").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -238,7 +239,7 @@ public class HighGasController { |
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
BigDecimal priceRate = agentPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
price.put("priceVip", price.getBigDecimal("priceGun").multiply(priceRate).setScale(2, BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
newOilPriceList.add(price); |
|
|
|
newOilPriceList.add(price); |
|
|
@ -317,55 +318,4 @@ public class HighGasController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/refuelingOrderPush",method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "手动推送订单") |
|
|
|
|
|
|
|
public ResponseData refuelingOrderPush() { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// {"app_key":"208241666939552","gunNo":"1","refuelingAmount":"1.02","thirdSerialNo":"HF2021062716143174807","sign":"83c7e8f70b984a04b937b28b8652aded","driverPhone":"15583658692","gasId":"CS000116587","priceVip":"7.31","oilNo":"90","timestamp":1624781755439,"priceGun":"7.31"}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
map.put("gasId", "CS000116587"); |
|
|
|
|
|
|
|
map.put("oilNo", "92"); |
|
|
|
|
|
|
|
map.put("gunNo", 2); |
|
|
|
|
|
|
|
BigDecimal priceGun = new BigDecimal("7.50"); |
|
|
|
|
|
|
|
BigDecimal priceVip = new BigDecimal("7.50"); |
|
|
|
|
|
|
|
// BigDecimal priceGun = new BigDecimal("5.58");
|
|
|
|
|
|
|
|
// BigDecimal priceVip = new BigDecimal("5.40");
|
|
|
|
|
|
|
|
map.put("priceGun", priceGun); // 枪单价
|
|
|
|
|
|
|
|
map.put("priceVip", priceVip); // 优惠价
|
|
|
|
|
|
|
|
map.put("driverPhone", "18581170527"); |
|
|
|
|
|
|
|
map.put("thirdSerialNo", "HF2021063009483541009"); |
|
|
|
|
|
|
|
BigDecimal refuelingAmount = new BigDecimal("1").divide(priceGun,10,BigDecimal.ROUND_DOWN).multiply(priceVip).setScale(2,BigDecimal.ROUND_HALF_UP); |
|
|
|
|
|
|
|
map.put("refuelingAmount", refuelingAmount); |
|
|
|
|
|
|
|
/*JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(map); |
|
|
|
|
|
|
|
if (orderPushObject == null || !orderPushObject.getString("code").equals("200")) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "提交订单,出现了未知错误"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
JSONObject result = orderPushObject.getJSONObject("result");*/ |
|
|
|
|
|
|
|
//return ResponseMsgUtil.success(TuanYouConfig.refuelingOrderPush(map));
|
|
|
|
|
|
|
|
JSONObject orderPushObject = TuanYouConfig.refuelingOrderPush(map); |
|
|
|
|
|
|
|
// 推送团油订单记录
|
|
|
|
|
|
|
|
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); |
|
|
|
|
|
|
|
highGasOrderPush.setType(OrderPushType.type1.getType()); |
|
|
|
|
|
|
|
highGasOrderPush.setOrderNo(MapUtils.getString(map, "thirdSerialNo")); |
|
|
|
|
|
|
|
highGasOrderPush.setCreateTime(new Date()); |
|
|
|
|
|
|
|
highGasOrderPush.setCode(orderPushObject.getString("code")); |
|
|
|
|
|
|
|
highGasOrderPush.setRequestContent(JSONObject.toJSONString(map)); |
|
|
|
|
|
|
|
highGasOrderPush.setReturnContent(orderPushObject.toJSONString()); |
|
|
|
|
|
|
|
highGasOrderPushMapper.insert(highGasOrderPush); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (orderPushObject != null && orderPushObject.getString("code").equals("200")) { |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(orderPushObject.getJSONObject("result").getString("orderNo")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighGasController -> refuelingOrderPush() error!",e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|