|
@@ -12,6 +12,7 @@ import javax.servlet.ServletException;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.iamberry.wechat.core.entity.product.SalesUserGift;
|
|
|
import com.iamberry.wechat.tools.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
@@ -144,7 +145,7 @@ public class OrderHandler {
|
|
|
return msg;
|
|
|
}
|
|
|
// 根据购物车ID,查询数据库中对应的产品信息(ID、产品状态)
|
|
|
- List<CartDto> cartDtos = cartService.selectCartItemByListId(cartIntList);
|
|
|
+ List<CartDto> cartDtos = cartService.listCartByIds(cartIntList);
|
|
|
if (cartDtos == null || cartDtos.size() <= 0) {
|
|
|
msg.setMessage(ResultInfo.cartEmptyError);
|
|
|
return msg;
|
|
@@ -155,11 +156,22 @@ public class OrderHandler {
|
|
|
|
|
|
List<CartDto> tempCarts = new ArrayList<CartDto>();
|
|
|
for (CartDto cartDto : cartDtos) {
|
|
|
+ switch (cartDto.getCartIsSource()) {
|
|
|
+ case 1:
|
|
|
+ cartDto = cartService.selectCartProductColor(cartDto);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ cartDto = cartService.getCartProductFitting(cartDto);
|
|
|
+ }
|
|
|
if (cartDto.getProductStatus() != null && cartDto.getProductStatus().intValue() == 1) {
|
|
|
total += cartDto.getCartNum() * cartDto.getProductPrice();
|
|
|
sum++;
|
|
|
tempCarts.add(cartDto);
|
|
|
}
|
|
|
+ //查询产品赠品信息
|
|
|
+ List<SalesUserGift> giftList = cartService.listGift(cartDto.getCartColorId());
|
|
|
+ cartDto.setSalesUserGiftList(giftList);
|
|
|
+
|
|
|
}
|
|
|
if (sum <= 0) {
|
|
|
msg.setMessage(ResultInfo.cartEmptyError);
|
|
@@ -167,7 +179,7 @@ public class OrderHandler {
|
|
|
}
|
|
|
|
|
|
//未使用的优惠券
|
|
|
- CouponItemDto cDto = new CouponItemDto();
|
|
|
+ CouponItemDto cDto = new CouponItemDto();
|
|
|
cDto.setUseropenid(member.getUserOpenid());
|
|
|
cDto.setCouponUseStatus(1);
|
|
|
cDto.setBeginDate(new Date());
|
|
@@ -309,6 +321,26 @@ public class OrderHandler {
|
|
|
item.setItemIsSource(cartDto.getCartIsSource());
|
|
|
list.add(item);
|
|
|
}
|
|
|
+ //查询产品赠品信息
|
|
|
+ List<SalesUserGift> giftList = cartService.listGift(cartDto.getCartColorId());
|
|
|
+ if (giftList != null && giftList.size() > 0) {
|
|
|
+ for (SalesUserGift gift : giftList) {
|
|
|
+ OrderItem item = new OrderItem();
|
|
|
+ item.setItemNum(gift.getUserGiftCount());
|
|
|
+ item.setItemProductDiscount(0);
|
|
|
+ item.setItemProductId(gift.getUserProductId());
|
|
|
+ item.setItemProductName(gift.getGiftName());
|
|
|
+ item.setItemProductPic(gift.getGiftProductPic());
|
|
|
+ item.setItemSalesOrderid(order.getSalesOrderid());
|
|
|
+ item.setItemTotal(0);
|
|
|
+ item.setItemProductPrice(0);
|
|
|
+ item.setItemColorId(gift.getUserColorId());
|
|
|
+ item.setItemProductColor(gift.getGiftColorName());
|
|
|
+ item.setItemProductChildType(gift.getGiftChildType());
|
|
|
+ item.setItemIsSource(1);
|
|
|
+ list.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 准备订单对象
|