|
|
|
@ -169,7 +169,7 @@ public class HighOrderController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (childOrder.getGoodsType() == 3) { |
|
|
|
|
if (childOrder.getGoodsPrice() == null || StringUtils.isBlank(childOrder.getGasGunNo()) || StringUtils.isBlank(childOrder.getGasOilNo()) || childOrder.getGasOilType() == null) { |
|
|
|
|
if (childOrder.getGoodsPrice() == null || childOrder.getGasPriceGun() == null || childOrder.getGasPriceVip() == null || StringUtils.isBlank(childOrder.getGasGunNo()) || StringUtils.isBlank(childOrder.getGasOilNo()) || childOrder.getGasOilType() == null) { |
|
|
|
|
log.error("HighOrderController --> addOrder() error!", "参数错误"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
@ -180,33 +180,8 @@ public class HighOrderController { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到门店信息"); |
|
|
|
|
} |
|
|
|
|
highOrder.setPayType(2); // 第三方平台
|
|
|
|
|
|
|
|
|
|
// 获取当前加油价格
|
|
|
|
|
JSONObject jsonObject = TuanYouConfig.queryCompanyPriceDetail(store.getStoreKey(), childOrder.getGasOilNo()); |
|
|
|
|
if (jsonObject == null || !jsonObject.getString("code").equals("200")) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到加油价格"); |
|
|
|
|
} |
|
|
|
|
if(jsonObject.getJSONArray("result").size() == 0) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未获取到加油价格"); |
|
|
|
|
} |
|
|
|
|
/* // 处理油品价格
|
|
|
|
|
for (Object oilPriceObject : originalOilPriceList) { |
|
|
|
|
JSONObject price = JSON.parseObject(JSONObject.toJSONString(oilPriceObject), JSONObject.class); |
|
|
|
|
// 查询是否配置了优惠比例
|
|
|
|
|
HighGasDiscountOilPrice gasDiscountOilPrice = highGasDiscountOilPriceService.getDetailByOilNoName(price.getString("oilNoName")); |
|
|
|
|
if (gasDiscountOilPrice != null) { |
|
|
|
|
// 优惠比例 / 100 = 最终优惠比例
|
|
|
|
|
BigDecimal priceRate = gasDiscountOilPrice.getPriceRate().divide(new BigDecimal("100").setScale(2, BigDecimal.ROUND_DOWN)); |
|
|
|
|
// 油品国标价 * 最终优惠比例
|
|
|
|
|
price.put("priceVip", price.getBigDecimal("priceOfficial").multiply(priceRate).setScale(1, BigDecimal.ROUND_DOWN)); |
|
|
|
|
} |
|
|
|
|
newOilPriceList.add(price); |
|
|
|
|
}*/ |
|
|
|
|
JSONObject priceDetail = JSONObject.parseObject(JSONObject.toJSONString(jsonObject.getJSONArray("result").get(0)), JSONObject.class); |
|
|
|
|
childOrder.setGoodsName(store.getStoreName()); |
|
|
|
|
childOrder.setGoodsImg(store.getStoreLogo()); |
|
|
|
|
childOrder.setGasPriceGun(priceDetail.getBigDecimal("priceGun")); |
|
|
|
|
childOrder.setGasPriceVip(priceDetail.getBigDecimal("priceVip")); |
|
|
|
|
childOrder.setGoodsActualPrice(new BigDecimal(childOrder.getGoodsPrice().toString()).divide(childOrder.getGasPriceGun(),10,BigDecimal.ROUND_DOWN).multiply(childOrder.getGasPriceVip()).setScale(2,BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
childOrder.setGoodsSpecName("默认"); |
|
|
|
|
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); |
|
|
|
@ -431,4 +406,11 @@ public class HighOrderController { |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/* |
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
BigDecimal bigDecimal1 = new BigDecimal("1200").divide(new BigDecimal("5.58"), 10, BigDecimal.ROUND_DOWN); |
|
|
|
|
System.out.println(bigDecimal1); |
|
|
|
|
BigDecimal bigDecimal2 = bigDecimal1.multiply(new BigDecimal("5.40")).setScale(2, BigDecimal.ROUND_HALF_UP); |
|
|
|
|
System.out.println(bigDecimal2); |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|