提交修改
This commit is contained in:
parent
52dfad00ea
commit
7dadc9d88e
@ -50,7 +50,7 @@ public interface VvShoppingCartDao extends BaseMapper<VvShoppingCartEntity> {
|
|||||||
@IF @LIKE String buyerWeixin);
|
@IF @LIKE String buyerWeixin);
|
||||||
|
|
||||||
|
|
||||||
|
@OrderBy(VvShoppingCartEntity.id_)
|
||||||
List<VvShoppingCartEntity> selectAppByCondition(IPage page,
|
List<VvShoppingCartEntity> selectAppByCondition(IPage page,
|
||||||
@IF String productName,
|
@IF String productName,
|
||||||
Long buyerId
|
Long buyerId
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.heyu.api.alibaba.request.mm.order.resp;
|
package com.heyu.api.alibaba.request.mm.order.resp;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -16,4 +18,26 @@ public class VvTradeOrderDTO {
|
|||||||
|
|
||||||
private Long buyerAddressId;
|
private Long buyerAddressId;
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
VvTradeOrderDTO vvTradeOrderDTO = new VvTradeOrderDTO();
|
||||||
|
vvTradeOrderDTO.setBuyerId(2L);
|
||||||
|
vvTradeOrderDTO.setBuyerAddressId(2L);
|
||||||
|
List<VvTradeOrderLineDTO> vvTradeOrderLineDTOList = Lists.newArrayList();
|
||||||
|
VvTradeOrderLineDTO vvTradeOrderLineDTO = new VvTradeOrderLineDTO();
|
||||||
|
vvTradeOrderLineDTO.setSkuId(91L);
|
||||||
|
vvTradeOrderLineDTO.setNum(2);
|
||||||
|
|
||||||
|
vvTradeOrderLineDTOList.add(vvTradeOrderLineDTO);
|
||||||
|
|
||||||
|
|
||||||
|
VvTradeOrderLineDTO vvTradeOrderLineDTO2 = new VvTradeOrderLineDTO();
|
||||||
|
vvTradeOrderLineDTO2.setSkuId(92L);
|
||||||
|
vvTradeOrderLineDTO2.setNum(3);
|
||||||
|
|
||||||
|
vvTradeOrderLineDTOList.add(vvTradeOrderLineDTO2);
|
||||||
|
vvTradeOrderDTO.setVvTradeOrderLineDTOList(vvTradeOrderLineDTOList);
|
||||||
|
|
||||||
|
System.out.println(JSON.toJSONString(vvTradeOrderDTO));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,9 +7,9 @@ import lombok.Data;
|
|||||||
public class AppShippingCartRequest {
|
public class AppShippingCartRequest {
|
||||||
|
|
||||||
|
|
||||||
private Integer pageNum;
|
private Integer pageNum = 1;
|
||||||
|
|
||||||
private Integer pageSize;
|
private Integer pageSize = 10 ;
|
||||||
|
|
||||||
|
|
||||||
//商品标题
|
//商品标题
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.heyu.api.alibaba.request.vv;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VvShoppingCartAddRequest {
|
||||||
|
|
||||||
|
//买家id
|
||||||
|
private Long buyerId;
|
||||||
|
//sku_id
|
||||||
|
private Long skuId;
|
||||||
|
//数量
|
||||||
|
private Integer num;
|
||||||
|
}
|
||||||
@ -198,7 +198,7 @@ public class AppOrderController {
|
|||||||
|
|
||||||
vvTradeOrderLineEntity.setCreateTime(new Date());
|
vvTradeOrderLineEntity.setCreateTime(new Date());
|
||||||
vvTradeOrderLineEntity.setModifyTime(new Date());
|
vvTradeOrderLineEntity.setModifyTime(new Date());
|
||||||
allNum = vvTradeOrderLineEntity.getNum();
|
allNum =allNum + vvTradeOrderLineEntity.getNum();
|
||||||
|
|
||||||
VvSkuEntity vvSkuEntity = vvSkuDao.selectVvSkuById(vvTradeOrderLineDTO.getSkuId());
|
VvSkuEntity vvSkuEntity = vvSkuDao.selectVvSkuById(vvTradeOrderLineDTO.getSkuId());
|
||||||
|
|
||||||
@ -218,6 +218,7 @@ public class AppOrderController {
|
|||||||
|
|
||||||
|
|
||||||
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvSkuEntity.getProductId());
|
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvSkuEntity.getProductId());
|
||||||
|
vvTradeOrderLineEntity.setProductName(vvProduct.getTitle());
|
||||||
vvTradeOrderLineEntity.setProductMainImageUrl(vvProduct.getMainImageUrl());
|
vvTradeOrderLineEntity.setProductMainImageUrl(vvProduct.getMainImageUrl());
|
||||||
|
|
||||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvTradeOrderLineDTO.getSkuId());
|
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvTradeOrderLineDTO.getSkuId());
|
||||||
@ -237,7 +238,7 @@ public class AppOrderController {
|
|||||||
|
|
||||||
VvTradeOrderEntity vvTradeOrderEntity = new VvTradeOrderEntity();
|
VvTradeOrderEntity vvTradeOrderEntity = new VvTradeOrderEntity();
|
||||||
|
|
||||||
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(vvTradeOrderEntity.getBuyerId());
|
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(vvOrderRequest.getBuyerId());
|
||||||
//创建时间
|
//创建时间
|
||||||
vvTradeOrderEntity.setCreateTime(new Date());
|
vvTradeOrderEntity.setCreateTime(new Date());
|
||||||
vvTradeOrderEntity.setModifyTime(new Date());
|
vvTradeOrderEntity.setModifyTime(new Date());
|
||||||
|
|||||||
@ -6,22 +6,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.heyu.api.alibaba.request.mm.order.resp.PropertyNameValue;
|
import com.heyu.api.alibaba.request.mm.order.resp.PropertyNameValue;
|
||||||
import com.heyu.api.alibaba.request.vv.AppShippingCartDeleteRequest;
|
import com.heyu.api.alibaba.request.vv.AppShippingCartDeleteRequest;
|
||||||
import com.heyu.api.alibaba.request.vv.AppShippingCartRequest;
|
import com.heyu.api.alibaba.request.vv.AppShippingCartRequest;
|
||||||
import com.heyu.api.data.dao.vv.VvBuyerDao;
|
import com.heyu.api.alibaba.request.vv.VvShoppingCartAddRequest;
|
||||||
import com.heyu.api.data.dao.vv.VvProductDao;
|
import com.heyu.api.data.dao.vv.*;
|
||||||
import com.heyu.api.data.dao.vv.VvShoppingCartDao;
|
import com.heyu.api.data.entity.vv.*;
|
||||||
import com.heyu.api.data.dao.vv.VvSkuPropertyValueDao;
|
import com.heyu.api.data.utils.BigDecimalUtil;
|
||||||
import com.heyu.api.data.entity.vv.VvBuyerEntity;
|
|
||||||
import com.heyu.api.data.entity.vv.VvProductEntity;
|
|
||||||
import com.heyu.api.data.entity.vv.VvShoppingCartEntity;
|
|
||||||
import com.heyu.api.data.entity.vv.VvSkuPropertyValueEntity;
|
|
||||||
import com.heyu.api.data.utils.R;
|
import com.heyu.api.data.utils.R;
|
||||||
import com.heyu.api.utils.ISelect;
|
import com.heyu.api.utils.ISelect;
|
||||||
import com.heyu.api.utils.PPageUtils;
|
import com.heyu.api.utils.PPageUtils;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -45,11 +43,14 @@ public class AppShoppingCartController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private VvSkuPropertyValueDao vvSkuPropertyValueDao;
|
private VvSkuPropertyValueDao vvSkuPropertyValueDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VvSkuDao vvSkuDao;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public R list(AppShippingCartRequest appShippingCartRequest) {
|
public R list(@RequestBody AppShippingCartRequest appShippingCartRequest) {
|
||||||
PPageUtils pageUtils = PPageUtils.startPage(appShippingCartRequest.getPageNum(), appShippingCartRequest.getPageSize())
|
PPageUtils pageUtils = PPageUtils.startPage(appShippingCartRequest.getPageNum(), appShippingCartRequest.getPageSize())
|
||||||
.doSelect(new ISelect() {
|
.doSelect(new ISelect() {
|
||||||
@Override
|
@Override
|
||||||
@ -68,21 +69,32 @@ public class AppShoppingCartController {
|
|||||||
* 更新 或 添加 ,如数量更新
|
* 更新 或 添加 ,如数量更新
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/addOrUpdate")
|
@RequestMapping("/addOrUpdate")
|
||||||
public R add(VvShoppingCartEntity vvShoppingCartEntity) {
|
public R add(@RequestBody VvShoppingCartAddRequest VvShoppingCartAddRequest) {
|
||||||
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(vvShoppingCartEntity.getBuyerId());
|
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(VvShoppingCartAddRequest.getBuyerId());
|
||||||
|
|
||||||
|
VvShoppingCartEntity vvShoppingCartEntity = new VvShoppingCartEntity();
|
||||||
|
|
||||||
|
vvShoppingCartEntity.setNum(VvShoppingCartAddRequest.getNum());
|
||||||
vvShoppingCartEntity.setBuyerName(vvBuyerEntity.getBuyerName());
|
vvShoppingCartEntity.setBuyerName(vvBuyerEntity.getBuyerName());
|
||||||
vvShoppingCartEntity.setBuyerPhone(vvBuyerEntity.getBuyerPhone());
|
vvShoppingCartEntity.setBuyerPhone(vvBuyerEntity.getBuyerPhone());
|
||||||
vvShoppingCartEntity.setBuyerWeixin(vvBuyerEntity.getBuyerWeixin());
|
vvShoppingCartEntity.setBuyerWeixin(vvBuyerEntity.getBuyerWeixin());
|
||||||
|
vvShoppingCartEntity.setSkuId(VvShoppingCartAddRequest.getSkuId());
|
||||||
|
vvShoppingCartEntity.setBuyerId(VvShoppingCartAddRequest.getBuyerId());
|
||||||
|
|
||||||
|
VvSkuEntity vvSkuEntity = vvSkuDao.selectVvSkuById(VvShoppingCartAddRequest.getSkuId());
|
||||||
|
|
||||||
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvShoppingCartEntity.getProductId());
|
vvShoppingCartEntity.setProductId(vvSkuEntity.getProductId());
|
||||||
vvShoppingCartEntity.setProductName(vvProduct.getTitle());
|
|
||||||
|
|
||||||
|
vvShoppingCartEntity.setSinglePrice(vvSkuEntity.getSalePrice());
|
||||||
|
vvShoppingCartEntity.setAllPrice(BigDecimalUtil.multiply(vvSkuEntity.getSalePrice(), new BigDecimal(VvShoppingCartAddRequest.getNum())));
|
||||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvShoppingCartEntity.getSkuId());
|
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvShoppingCartEntity.getSkuId());
|
||||||
|
|
||||||
|
VvSkuPropertyValueEntity vvSkuPropertyValue = vvSkuPropertyValueEntities.get(0);
|
||||||
|
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvSkuPropertyValue.getProductId());
|
||||||
|
vvShoppingCartEntity.setProductName(vvProduct.getTitle());
|
||||||
|
|
||||||
List<PropertyNameValue> propertyNameValues = new ArrayList<>();
|
List<PropertyNameValue> propertyNameValues = new ArrayList<>();
|
||||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||||
|
|
||||||
PropertyNameValue propertyNameValue = new PropertyNameValue();
|
PropertyNameValue propertyNameValue = new PropertyNameValue();
|
||||||
propertyNameValue.setPropertyName(vvSkuPropertyValueEntity.getProductPropertyName());
|
propertyNameValue.setPropertyName(vvSkuPropertyValueEntity.getProductPropertyName());
|
||||||
propertyNameValue.setPropertyValue(vvSkuPropertyValueEntity.getProductPropertyValue());
|
propertyNameValue.setPropertyValue(vvSkuPropertyValueEntity.getProductPropertyValue());
|
||||||
@ -95,6 +107,7 @@ public class AppShoppingCartController {
|
|||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user