|
@@ -14,6 +14,7 @@ import com.iamberry.wechat.core.entity.coupon.*;
|
|
|
import com.iamberry.wechat.core.entity.product.ProductColor;
|
|
|
import com.iamberry.wechat.face.coupon.ExchangeService;
|
|
|
import com.iamberry.wechat.face.porduct.ProductColorService;
|
|
|
+import org.apache.xpath.operations.Bool;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -337,20 +338,33 @@ public class OrderHandler {
|
|
|
}
|
|
|
|
|
|
if(temp.getExchangeColorId() != null && !"".equals(temp.getExchangeColorId())){
|
|
|
- ProductColor productColor = productColorService.selectProductColorById(Integer.valueOf(temp.getExchangeColorId()));
|
|
|
- CartDto cartDto = new CartDto();
|
|
|
- cartDto.setCartProductId(productColor.getColorProductId());
|
|
|
- cartDto.setCartColorId(productColor.getColorId());
|
|
|
- cartDto.setCartNum(1);
|
|
|
- cartDto.setProductName(productColor.getColorProductName());
|
|
|
- cartDto.setProductType(productColor.getColorProductType()); //colorProductType
|
|
|
- cartDto.setProductPrice(productColor.getColorDiscount());
|
|
|
- cartDto.setProductDiscount(productColor.getColorPrice());
|
|
|
- cartDto.setProductStatus(1);
|
|
|
- cartDto.setTotal(productColor.getColorDiscount());
|
|
|
- cartDto.setProductColor(productColor.getColorName());
|
|
|
- cartDto.setColorImg(productColor.getColorProductPic());
|
|
|
- cartDtos.add(cartDto);
|
|
|
+ boolean flag = false;
|
|
|
+ Integer exchangeColorId = Integer.valueOf(temp.getExchangeColorId());
|
|
|
+ if(exchangeColorId != 0){
|
|
|
+ for (CartDto cd : cartDtos) {
|
|
|
+ if(cd.getCartColorId().equals(exchangeColorId)){
|
|
|
+ cd.setCartNum(cd.getCartNum()+1);
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!flag){
|
|
|
+ ProductColor productColor = productColorService.selectProductColorById(exchangeColorId);
|
|
|
+ CartDto cartDto = new CartDto();
|
|
|
+ cartDto.setCartProductId(productColor.getColorProductId());
|
|
|
+ cartDto.setCartColorId(productColor.getColorId());
|
|
|
+ cartDto.setCartNum(1);
|
|
|
+ cartDto.setProductName(productColor.getColorProductName());
|
|
|
+ cartDto.setProductType(productColor.getColorProductType()); //colorProductType
|
|
|
+ cartDto.setProductPrice(productColor.getColorDiscount());
|
|
|
+ cartDto.setProductDiscount(productColor.getColorPrice());
|
|
|
+ cartDto.setProductStatus(1);
|
|
|
+ cartDto.setTotal(productColor.getColorDiscount());
|
|
|
+ cartDto.setProductColor(productColor.getColorName());
|
|
|
+ cartDto.setColorImg(productColor.getColorProductPic());
|
|
|
+ cartDtos.add(cartDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//根据openid查询该用户是否购买过订单
|