|
|
|
@ -33,6 +33,8 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.math.MathContext; |
|
|
|
|
import java.math.RoundingMode; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@ -83,6 +85,9 @@ public class HighOrderController { |
|
|
|
|
@Resource |
|
|
|
|
private HighTyAgentPriceService tyAgentPriceService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private HighGasDiscountOilPriceService gasDiscountOilPriceService; |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/addOrder",method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "增加订单") |
|
|
|
@ -228,6 +233,7 @@ public class HighOrderController { |
|
|
|
|
} |
|
|
|
|
highOrder.setPayType(2); // 第三方平台
|
|
|
|
|
|
|
|
|
|
BigDecimal discount = new BigDecimal("1"); |
|
|
|
|
if (highOrder.getIsTyAgent() != null && highOrder.getIsTyAgent() == true) { |
|
|
|
|
// 查询加油站
|
|
|
|
|
HighTyAgentOilStation oilStation = tyAgentOilStationService.getDetailByOilStationId(childOrder.getGoodsId()); |
|
|
|
@ -238,7 +244,17 @@ public class HighOrderController { |
|
|
|
|
childOrder.setGasAgentName(oilStation.getTyAgentName()); |
|
|
|
|
childOrder.setGasOrgId(oilStation.getOrganizationId()); |
|
|
|
|
childOrder.setGasOrgName(oilStation.getOrganizationName()); |
|
|
|
|
|
|
|
|
|
// 价格
|
|
|
|
|
HighTyAgentPrice priceRate = tyAgentPriceService.getDetail(oilStation.getId(), childOrder.getGasOilNo()); |
|
|
|
|
if (priceRate == null) { |
|
|
|
|
discount = gasDiscountOilPriceService.getDetailByOilNo(childOrder.getGasOilNo()).getPriceRate(); |
|
|
|
|
} else { |
|
|
|
|
discount = priceRate.getPriceRate(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
discount = gasDiscountOilPriceService.getDetailByOilNo(childOrder.getGasOilNo()).getPriceRate(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 获取当前加油价格
|
|
|
|
@ -256,7 +272,8 @@ public class HighOrderController { |
|
|
|
|
|
|
|
|
|
// 平台的价格
|
|
|
|
|
childOrder.setExt1(childOrder.getGasPriceVip().toString()); |
|
|
|
|
childOrder.setGoodsActualPrice(new BigDecimal(childOrder.getGoodsPrice().toString()).divide(childOrder.getGasPriceGun(),10,BigDecimal.ROUND_DOWN).multiply(childOrder.getGasPriceVip()).setScale(2,BigDecimal.ROUND_DOWN)); |
|
|
|
|
// childOrder.setGoodsActualPrice(new BigDecimal(childOrder.getGoodsPrice().toString()).divide(childOrder.getGasPriceGun(),10,BigDecimal.ROUND_DOWN).multiply(childOrder.getGasPriceVip()).setScale(2,BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice().multiply(discount.divide(new BigDecimal("100"))).setScale(2,BigDecimal.ROUND_HALF_UP)); |
|
|
|
|
|
|
|
|
|
// 团油的价格
|
|
|
|
|
childOrder.setGasPriceGun(priceDetail.getBigDecimal("priceGun")); |
|
|
|
@ -422,7 +439,6 @@ public class HighOrderController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getOrderById", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "根据id查询订单详情") |
|
|
|
|