bug fix:county name is not unique value
This commit is contained in:
@@ -227,6 +227,7 @@ public class BuyOrderController {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/placeOrder", method = RequestMethod.POST)
|
@RequestMapping(value = "/placeOrder", method = RequestMethod.POST)
|
||||||
|
@Transactional
|
||||||
public R placeOrder(@RequestBody BuyOrder buyOrder) throws IOException {
|
public R placeOrder(@RequestBody BuyOrder buyOrder) throws IOException {
|
||||||
List<BuyOrderProduct> buyOrderProductList = buyOrder.getProductList();
|
List<BuyOrderProduct> buyOrderProductList = buyOrder.getProductList();
|
||||||
// 订单总金额
|
// 订单总金额
|
||||||
@@ -241,13 +242,6 @@ public class BuyOrderController {
|
|||||||
return R.error(500, "库存不足");
|
return R.error(500, "库存不足");
|
||||||
}
|
}
|
||||||
totalPrice = totalPrice.add(price.multiply(BigDecimal.valueOf(quantity)));
|
totalPrice = totalPrice.add(price.multiply(BigDecimal.valueOf(quantity)));
|
||||||
int originWeight = product.getWeight();
|
|
||||||
int originWeightIntValue = originWeight / 100;
|
|
||||||
int originWeightDecimalValue = originWeightIntValue % 100;
|
|
||||||
//buyOrderProduct.setWeight(BigDecimal.valueOf(originWeightIntValue).add(BigDecimal.valueOf(originWeightDecimalValue).divide(new BigDecimal(100),
|
|
||||||
//MathContext.DECIMAL64)));
|
|
||||||
// buyOrderDetail.setProductUrl(product.getProductImages());
|
|
||||||
// buyOrderDetail.setOrderStatus(Constants.ORDER_STATUS_TO_BE_PAID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
totalPrice = totalPrice.subtract(useCouponAmount(buyOrder));
|
totalPrice = totalPrice.subtract(useCouponAmount(buyOrder));
|
||||||
@@ -268,12 +262,10 @@ public class BuyOrderController {
|
|||||||
|
|
||||||
for (BuyOrderProduct buyOrderDetail : buyOrderProductList) {
|
for (BuyOrderProduct buyOrderDetail : buyOrderProductList) {
|
||||||
buyOrderDetail.setOrderId(buyOrder.getId());
|
buyOrderDetail.setOrderId(buyOrder.getId());
|
||||||
//buyOrderDetail.setUserId(buyOrder.getUserId());
|
|
||||||
if (Constants.BUY_TYPE_CART.equals(buyOrder.getBuyType())) {
|
if (Constants.BUY_TYPE_CART.equals(buyOrder.getBuyType())) {
|
||||||
handleBuyCart(buyOrder, buyOrderDetail);
|
handleBuyCart(buyOrder, buyOrderDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// buyOrderDetailService.saveBatch(buyOrderDetails);
|
|
||||||
buyOrderProductService.saveBatch(buyOrderProductList);
|
buyOrderProductService.saveBatch(buyOrderProductList);
|
||||||
// 1. 虚拟币支付
|
// 1. 虚拟币支付
|
||||||
if (Constants.PAYMENT_METHOD_VIRTUAL.equals(buyOrder.getPaymentMethod())) {
|
if (Constants.PAYMENT_METHOD_VIRTUAL.equals(buyOrder.getPaymentMethod())) {
|
||||||
@@ -364,7 +356,7 @@ public class BuyOrderController {
|
|||||||
}
|
}
|
||||||
// 库存回滚
|
// 库存回滚
|
||||||
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
|
||||||
buyOrderProductQueryWrapper.eq("order_id",buyOrder.getId());
|
buyOrderProductQueryWrapper.eq("order_id", buyOrder.getId());
|
||||||
List<BuyOrderProduct> buyOrderProductList = buyOrderProductService.list(buyOrderProductQueryWrapper);
|
List<BuyOrderProduct> buyOrderProductList = buyOrderProductService.list(buyOrderProductQueryWrapper);
|
||||||
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
|
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
|
||||||
Integer productId = buyOrderProduct.getProductId();
|
Integer productId = buyOrderProduct.getProductId();
|
||||||
@@ -626,7 +618,7 @@ public class BuyOrderController {
|
|||||||
* 分包发货
|
* 分包发货
|
||||||
*
|
*
|
||||||
* @param expressCompanyCode 快递公司编码
|
* @param expressCompanyCode 快递公司编码
|
||||||
* @param buyOrderProductId 订单商品
|
* @param buyOrderProductId 订单商品
|
||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/delivery", method = RequestMethod.POST)
|
@RequestMapping(value = "/delivery", method = RequestMethod.POST)
|
||||||
|
|||||||
@@ -67,8 +67,10 @@ public class ExpressController {
|
|||||||
List<PrintTemplateVo> data = new ArrayList<>();
|
List<PrintTemplateVo> data = new ArrayList<>();
|
||||||
for (ExpressOrder expressOrder : expressOrderList) {
|
for (ExpressOrder expressOrder : expressOrderList) {
|
||||||
PrintTemplateVo vo = new PrintTemplateVo();
|
PrintTemplateVo vo = new PrintTemplateVo();
|
||||||
|
vo.setExpressCompanyCode(expressOrder.getExpressCompanyCode());
|
||||||
vo.setPrintTemplate(expressOrder.getPrintTemplate());
|
vo.setPrintTemplate(expressOrder.getPrintTemplate());
|
||||||
vo.setExpressOrderSn(expressOrder.getExpressOrderSn());
|
vo.setExpressOrderSn(expressOrder.getExpressOrderSn());
|
||||||
|
vo.setTemplatedPrinted(vo.getTemplatedPrinted());
|
||||||
data.add(vo);
|
data.add(vo);
|
||||||
}
|
}
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class BuyOrderProduct {
|
|||||||
/**
|
/**
|
||||||
* 商品价格
|
* 商品价格
|
||||||
*/
|
*/
|
||||||
private BigDecimal realPrice;
|
// private BigDecimal realPrice;
|
||||||
/**
|
/**
|
||||||
* 快递订单 ID
|
* 快递订单 ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BuyOrderProductService buyOrderProductService;
|
private BuyOrderProductService buyOrderProductService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProvinceService provinceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CityService cityService;
|
||||||
|
|
||||||
|
|
||||||
protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class);
|
protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class);
|
||||||
|
|
||||||
@@ -423,6 +429,29 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
|||||||
consigneeVo.setCity(buyOrder.getCity());
|
consigneeVo.setCity(buyOrder.getCity());
|
||||||
consigneeVo.setCounty(buyOrder.getDistrict());
|
consigneeVo.setCounty(buyOrder.getDistrict());
|
||||||
consigneeVo.setAddress(buyOrder.getAddress());
|
consigneeVo.setAddress(buyOrder.getAddress());
|
||||||
|
QueryWrapper<Province> provinceQueryWrapper = new QueryWrapper<>();
|
||||||
|
provinceQueryWrapper.eq("prov_name", buyOrder.getProvince());
|
||||||
|
Province province = provinceService.getOne(provinceQueryWrapper);
|
||||||
|
if (province != null) {
|
||||||
|
consigneeVo.setProvinceCode(province.getRegionCode());
|
||||||
|
}
|
||||||
|
QueryWrapper<City> cityQueryWrapper = new QueryWrapper<>();
|
||||||
|
cityQueryWrapper.eq("city_name", buyOrder.getCity());
|
||||||
|
City city = cityService.getOne(cityQueryWrapper);
|
||||||
|
Long cityId = null;
|
||||||
|
if (city != null) {
|
||||||
|
consigneeVo.setCityCode(city.getRegionCode());
|
||||||
|
cityId = city.getCityId();
|
||||||
|
}
|
||||||
|
QueryWrapper<County> countyQueryWrapper = new QueryWrapper<>();
|
||||||
|
countyQueryWrapper.eq("county_name", buyOrder.getDistrict());
|
||||||
|
if (countyService.count(countyQueryWrapper) > 1) {
|
||||||
|
countyQueryWrapper.eq("city_id", cityId);
|
||||||
|
}
|
||||||
|
County county = countyService.getOne(countyQueryWrapper);
|
||||||
|
if (county != null) {
|
||||||
|
consigneeVo.setCountyCode(county.getRegionCode());
|
||||||
|
}
|
||||||
responseVo.setConsignee(consigneeVo);
|
responseVo.setConsignee(consigneeVo);
|
||||||
QueryWrapper<BuyOrderProduct> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<BuyOrderProduct> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("order_id", buyOrder.getId());
|
queryWrapper.eq("order_id", buyOrder.getId());
|
||||||
|
|||||||
@@ -33,5 +33,17 @@ public class ConsigneeVo {
|
|||||||
* 详细地址
|
* 详细地址
|
||||||
*/
|
*/
|
||||||
private String address;
|
private String address;
|
||||||
|
/**
|
||||||
|
* 省份代码
|
||||||
|
*/
|
||||||
|
private String provinceCode;
|
||||||
|
/**
|
||||||
|
* 城市代码
|
||||||
|
*/
|
||||||
|
private String cityCode;
|
||||||
|
/**
|
||||||
|
* 区县代码
|
||||||
|
*/
|
||||||
|
private String countyCode;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,12 @@ public class PrintTemplateVo {
|
|||||||
* 面单
|
* 面单
|
||||||
*/
|
*/
|
||||||
private String printTemplate;
|
private String printTemplate;
|
||||||
|
/**
|
||||||
|
* 快递公司代码
|
||||||
|
*/
|
||||||
|
private String expressCompanyCode;
|
||||||
|
/**
|
||||||
|
* 是否打印过
|
||||||
|
*/
|
||||||
|
private int templatedPrinted;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user