|
@@ -61,29 +61,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
private void getOrderData(List<OrderVo> orderList) {
|
|
|
for (OrderVo order : orderList) {
|
|
|
//111,待付待收待发
|
|
|
- if ("11".equals(order.getStatus()) && "1".equals(order.getPayStatus())) {
|
|
|
- order.setStatus("111");
|
|
|
- }
|
|
|
- //判断交易全退情况下,是否发过货,77,交易全退可以查看物流
|
|
|
- List<LogisticsBatchVo> batchList = orderMapper.findLogistics(order.getOrderId());
|
|
|
- if ("7".equals(order.getStatus()) && batchList != null && batchList.size() > 0) {
|
|
|
- order.setStatus("77");
|
|
|
- }
|
|
|
- //部分付款/已付款订单,设置拼团状态
|
|
|
- if ((order.getStatus().startsWith("2") || order.getStatus().startsWith("3")) && null != order.getCollageStatus()) {
|
|
|
- if (1 == order.getCollageStatus()) {
|
|
|
- // 拼团中
|
|
|
- order.setStatus("81");
|
|
|
- } else if (2 == order.getCollageStatus()) {
|
|
|
- if (order.getStatus().endsWith("1") || order.getStatus().endsWith("2")) {
|
|
|
- // 拼团成功,待发货
|
|
|
- order.setStatus("82");
|
|
|
- } else if (order.getStatus().endsWith("3")) {
|
|
|
- // 拼团成功,已发货
|
|
|
- order.setStatus("83");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ setOrderStatus(order);
|
|
|
List<ShopOrderVo> shopOrderList = orderMapper.findAllShopOrder(order.getOrderId());
|
|
|
for (ShopOrderVo shopOrder : shopOrderList) {
|
|
|
List<OrderProductVo> orderProductList = orderMapper.findOrderProduct(shopOrder.getShopOrderId());
|
|
@@ -95,7 +73,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderProduct.setPrice(MathUtil.add(orderProduct.getPrice(), valueTax));
|
|
|
orderProduct.setDiscountPrice(MathUtil.add(orderProduct.getPrice(), orderProduct.getAddedValueTax()));
|
|
|
}
|
|
|
- if (order.getStatus().startsWith("8")) {
|
|
|
+ if (order.getCollageFlag()) {
|
|
|
orderProduct.setCollagePriceFlag(1);
|
|
|
}
|
|
|
}
|
|
@@ -121,15 +99,7 @@ public class OrderServiceImpl implements OrderService {
|
|
|
return ResponseJson.error("该订单已删除", null);
|
|
|
}
|
|
|
order.setOrderMark("#" + order.getOrderId() + "#");
|
|
|
- //111,待付待收待发
|
|
|
- if ("11".equals(order.getStatus()) && "1".equals(order.getPayStatus())) {
|
|
|
- order.setStatus("111");
|
|
|
- }
|
|
|
- //判断交易全退情况下,是否发过货,77,交易全退可以查看物流
|
|
|
- List<LogisticsBatchVo> batchList = orderMapper.findLogistics(orderId);
|
|
|
- if ("7".equals(order.getStatus()) && batchList != null && batchList.size() > 0) {
|
|
|
- order.setStatus("77");
|
|
|
- }
|
|
|
+ setOrderStatus(order);
|
|
|
//商品信息
|
|
|
List<ShopOrderVo> shopOrderList = orderMapper.findAllShopOrder(orderId);
|
|
|
BigDecimal expensesOfTaxation = new BigDecimal(0);
|
|
@@ -172,6 +142,10 @@ public class OrderServiceImpl implements OrderService {
|
|
|
orderProduct.setPrice(MathUtil.add(orderProduct.getPrice(), valueTax));
|
|
|
orderProduct.setDiscountPrice(MathUtil.add(orderProduct.getDiscountPrice(), orderProduct.getAddedValueTax()));
|
|
|
}
|
|
|
+ // 拼团价标识
|
|
|
+ if (order.getCollageFlag()) {
|
|
|
+ orderProduct.setCollagePriceFlag(1);
|
|
|
+ }
|
|
|
}
|
|
|
shopOrder.setOrderProductList(orderProductList);
|
|
|
shopOrder.setShopLogo(ProductUtils.getImageURL("shopLogo", shopOrder.getShopLogo(), 0, domain));
|
|
@@ -192,6 +166,37 @@ public class OrderServiceImpl implements OrderService {
|
|
|
return ResponseJson.success(map);
|
|
|
}
|
|
|
|
|
|
+ private void setOrderStatus(OrderVo order) {
|
|
|
+ Integer orderId = order.getOrderId();
|
|
|
+ //111,待付待收待发
|
|
|
+ if ("11".equals(order.getStatus()) && "1".equals(order.getPayStatus())) {
|
|
|
+ order.setStatus("111");
|
|
|
+ }
|
|
|
+ //判断交易全退情况下,是否发过货,77,交易全退可以查看物流
|
|
|
+ List<LogisticsBatchVo> batchList = orderMapper.findLogistics(orderId);
|
|
|
+ if ("7".equals(order.getStatus()) && batchList != null && batchList.size() > 0) {
|
|
|
+ order.setStatus("77");
|
|
|
+ }
|
|
|
+ //部分付款/已付款订单,设置拼团状态
|
|
|
+ if ((order.getStatus().startsWith("2") || order.getStatus().startsWith("3")) && null != order.getCollageStatus()) {
|
|
|
+ if (1 == order.getCollageStatus()) {
|
|
|
+ // 拼团中
|
|
|
+ order.setStatus("81");
|
|
|
+ } else if (2 == order.getCollageStatus()) {
|
|
|
+ if (order.getStatus().endsWith("1") || order.getStatus().endsWith("2")) {
|
|
|
+ // 拼团成功,待发货
|
|
|
+ order.setStatus("82");
|
|
|
+ } else if (order.getStatus().endsWith("3")) {
|
|
|
+ // 拼团成功,已发货
|
|
|
+ order.setStatus("83");
|
|
|
+ }
|
|
|
+ } else if (0 == order.getCollageStatus() && new Date().compareTo(order.getCollageEndTime()) > 0) {
|
|
|
+ // 拼团结束,关闭订单
|
|
|
+ order.setStatus("6");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public ResponseJson<List<LogisticsBatchVo>> logistics(Integer orderId) {
|
|
|
OrderVo order = orderMapper.findOrder(orderId);
|
|
@@ -405,13 +410,35 @@ public class OrderServiceImpl implements OrderService {
|
|
|
@Override
|
|
|
public ResponseJson<CollageDetailsVo> collageDetails(Integer collageId, Integer userId) {
|
|
|
CollageDetailsVo collageDetails = collageMapper.getCollageDetails(collageId);
|
|
|
+ ProductDetailsVo product = productMapper.findProductByProductId(collageDetails.getProductId());
|
|
|
+ // 拼团价
|
|
|
+ product.setPrice(collageDetails.getPrice());
|
|
|
+ collageDetails.setUnit(product.getUnit());
|
|
|
if (null != userId && userId > 0) {
|
|
|
Integer orderId = collageMapper.getMemberOrderId(collageId, userId);
|
|
|
collageDetails.setOrderId(orderId);
|
|
|
- ProductDetailsVo product = productMapper.findProductByProductId(collageDetails.getProductId());
|
|
|
- productService.setProductDetails(product, userId);
|
|
|
+ // 内部优惠
|
|
|
+ Integer discount = productMapper.findProductDiscount(product.getProductId(), userId);
|
|
|
+ if (null != discount && discount > 0) {
|
|
|
+ product.setPrice(MathUtil.div(MathUtil.mul(product.getPrice(), discount), 100));
|
|
|
+ if (null != product.getNormalPrice()) {
|
|
|
+ product.setNormalPrice(MathUtil.div(MathUtil.mul(product.getNormalPrice(), discount), 100));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //税费
|
|
|
+ boolean addTaxFlag = ("0".equals(product.getIncludedTax()) && ("1".equals(product.getInvoiceType()) || "2".equals(product.getInvoiceType())));
|
|
|
+ if (addTaxFlag) {
|
|
|
+ BigDecimal addedValueTax = MathUtil.div(MathUtil.mul(product.getPrice(), product.getClubTaxPoint()), BigDecimal.valueOf(100), 2);
|
|
|
+ BigDecimal price = MathUtil.add(product.getPrice(), addedValueTax);
|
|
|
+ product.setPrice(price);
|
|
|
+ if (null != product.getNormalPrice()) {
|
|
|
+ addedValueTax = MathUtil.div(MathUtil.mul(product.getNormalPrice(), product.getClubTaxPoint()), BigDecimal.valueOf(100), 2);
|
|
|
+ price = MathUtil.add(product.getNormalPrice(), addedValueTax);
|
|
|
+ product.setNormalPrice(price);
|
|
|
+ }
|
|
|
+ }
|
|
|
collageDetails.setPrice(product.getPrice());
|
|
|
- collageDetails.setUnit(product.getUnit());
|
|
|
+ collageDetails.setNormalPrice(product.getNormalPrice());
|
|
|
}
|
|
|
return ResponseJson.success(collageDetails);
|
|
|
}
|