提交修改
This commit is contained in:
parent
439032e44d
commit
2cc9d6707e
@ -7,10 +7,14 @@ package com.heyu.api.data.dao.vv;
|
||||
* @author quyixiao
|
||||
* @since 2025-08-23
|
||||
*/
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.heyu.api.data.entity.vv.VvBuyerAddressEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface VvBuyerAddressDao extends BaseMapper<VvBuyerAddressEntity> {
|
||||
|
||||
@ -33,4 +37,5 @@ public interface VvBuyerAddressDao extends BaseMapper<VvBuyerAddressEntity> {
|
||||
int deleteVvBuyerAddressById(@Param("id")Long id);
|
||||
|
||||
|
||||
List<VvBuyerAddressEntity> selectAppByCondition(IPage page, Long buyerId);
|
||||
}
|
||||
@ -54,13 +54,16 @@ public interface VvTradeOrderDao extends BaseMapper<VvTradeOrderEntity> {
|
||||
@OrderBy(VvTradeOrderEntity.create_timestamp) String createTimestampSort);
|
||||
|
||||
|
||||
|
||||
|
||||
@OrderBy(VvTradeOrderEntity.id_)
|
||||
List<VvTradeOrderEntity> selectAppByCondition(IPage page,
|
||||
@IF@IN List<Long> orderIds,
|
||||
@IF String status,
|
||||
@IF @GE Long minCreateTimestamp,
|
||||
@IF@LE Long maxCreateTimestamp,
|
||||
@IF @NE @Column(VvTradeOrderEntity.status_) String deleteStatus,
|
||||
@IF String createTimestampSort);
|
||||
|
||||
|
||||
|
||||
void updateByBuerIdAndIds(String status,@By Long buyerId,@By List<Long> ids);
|
||||
}
|
||||
@ -34,6 +34,7 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String buyer_id = CLASS_NAME + "buyer_id"; // 买家id
|
||||
public final static String buyer_weixin = CLASS_NAME + "buyer_weixin"; // 买家微信
|
||||
public final static String buyer_phone = CLASS_NAME + "buyer_phone"; // 买家手机号
|
||||
public final static String status_ = CLASS_NAME + "status"; // 地址状态 ,delete 已经删除,default 默认,common 普通
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -61,6 +62,8 @@ private static final long serialVersionUID = 1L;
|
||||
private String buyerWeixin;
|
||||
//买家手机号
|
||||
private String buyerPhone;
|
||||
//地址状态 ,delete 已经删除,default 默认,common 普通
|
||||
private String status;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -256,6 +259,21 @@ private static final long serialVersionUID = 1L;
|
||||
this.buyerPhone = buyerPhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地址状态 ,delete 已经删除,default 默认,common 普通
|
||||
* @return
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* 地址状态 ,delete 已经删除,default 默认,common 普通
|
||||
* @param status
|
||||
*/
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvBuyerAddressEntity{" +
|
||||
@ -272,6 +290,7 @@ private static final long serialVersionUID = 1L;
|
||||
",buyerId=" + buyerId +
|
||||
",buyerWeixin=" + buyerWeixin +
|
||||
",buyerPhone=" + buyerPhone +
|
||||
",status=" + status +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -34,6 +34,8 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String buyer_weixin = CLASS_NAME + "buyer_weixin"; // 买家微信
|
||||
public final static String all_price = CLASS_NAME + "all_price"; // 总价
|
||||
public final static String buyer_id = CLASS_NAME + "buyer_id"; // 买家id
|
||||
public final static String sku_id = CLASS_NAME + "sku_id"; // sku_id
|
||||
public final static String product_id = CLASS_NAME + "product_id"; // 商品id
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -61,6 +63,10 @@ private static final long serialVersionUID = 1L;
|
||||
private BigDecimal allPrice;
|
||||
//买家id
|
||||
private Long buyerId;
|
||||
//sku_id
|
||||
private Long skuId;
|
||||
//商品id
|
||||
private Long productId;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -256,6 +262,36 @@ private static final long serialVersionUID = 1L;
|
||||
this.buyerId = buyerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* sku_id
|
||||
* @return
|
||||
*/
|
||||
public Long getSkuId() {
|
||||
return skuId;
|
||||
}
|
||||
/**
|
||||
* sku_id
|
||||
* @param skuId
|
||||
*/
|
||||
public void setSkuId(Long skuId) {
|
||||
this.skuId = skuId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
* @return
|
||||
*/
|
||||
public Long getProductId() {
|
||||
return productId;
|
||||
}
|
||||
/**
|
||||
* 商品id
|
||||
* @param productId
|
||||
*/
|
||||
public void setProductId(Long productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvShoppingCartEntity{" +
|
||||
@ -272,6 +308,8 @@ private static final long serialVersionUID = 1L;
|
||||
",buyerWeixin=" + buyerWeixin +
|
||||
",allPrice=" + allPrice +
|
||||
",buyerId=" + buyerId +
|
||||
",skuId=" + skuId +
|
||||
",productId=" + productId +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -37,6 +37,11 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String buyer_id = CLASS_NAME + "buyer_id"; // 买家id
|
||||
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间撮
|
||||
public final static String modify_timestamp = CLASS_NAME + "modify_timestamp"; // 修改时间撮
|
||||
public final static String contry_ = CLASS_NAME + "contry"; // 国家
|
||||
public final static String province_ = CLASS_NAME + "province"; // 省
|
||||
public final static String city_ = CLASS_NAME + "city"; // 市
|
||||
public final static String district_ = CLASS_NAME + "district"; // 区
|
||||
public final static String buyer_detail_address = CLASS_NAME + "buyer_detail_address"; // 买家详细地址
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -70,6 +75,16 @@ private static final long serialVersionUID = 1L;
|
||||
private Long createTimestamp;
|
||||
//修改时间撮
|
||||
private Long modifyTimestamp;
|
||||
//国家
|
||||
private String contry;
|
||||
//省
|
||||
private String province;
|
||||
//市
|
||||
private String city;
|
||||
//区
|
||||
private String district;
|
||||
//买家详细地址
|
||||
private String buyerDetailAddress;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -310,6 +325,81 @@ private static final long serialVersionUID = 1L;
|
||||
this.modifyTimestamp = modifyTimestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 国家
|
||||
* @return
|
||||
*/
|
||||
public String getContry() {
|
||||
return contry;
|
||||
}
|
||||
/**
|
||||
* 国家
|
||||
* @param contry
|
||||
*/
|
||||
public void setContry(String contry) {
|
||||
this.contry = contry;
|
||||
}
|
||||
|
||||
/**
|
||||
* 省
|
||||
* @return
|
||||
*/
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
/**
|
||||
* 省
|
||||
* @param province
|
||||
*/
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
/**
|
||||
* 市
|
||||
* @return
|
||||
*/
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
/**
|
||||
* 市
|
||||
* @param city
|
||||
*/
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
/**
|
||||
* 区
|
||||
* @return
|
||||
*/
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
/**
|
||||
* 区
|
||||
* @param district
|
||||
*/
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
/**
|
||||
* 买家详细地址
|
||||
* @return
|
||||
*/
|
||||
public String getBuyerDetailAddress() {
|
||||
return buyerDetailAddress;
|
||||
}
|
||||
/**
|
||||
* 买家详细地址
|
||||
* @param buyerDetailAddress
|
||||
*/
|
||||
public void setBuyerDetailAddress(String buyerDetailAddress) {
|
||||
this.buyerDetailAddress = buyerDetailAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvTradeOrderEntity{" +
|
||||
@ -329,6 +419,11 @@ private static final long serialVersionUID = 1L;
|
||||
",buyerId=" + buyerId +
|
||||
",createTimestamp=" + createTimestamp +
|
||||
",modifyTimestamp=" + modifyTimestamp +
|
||||
",contry=" + contry +
|
||||
",province=" + province +
|
||||
",city=" + city +
|
||||
",district=" + district +
|
||||
",buyerDetailAddress=" + buyerDetailAddress +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -37,6 +37,8 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String product_name = CLASS_NAME + "product_name"; // 商品名称
|
||||
public final static String sku_info = CLASS_NAME + "sku_info"; // sku信息json
|
||||
public final static String product_main_image_url = CLASS_NAME + "product_main_image_url"; // 商品主图
|
||||
public final static String sku_id = CLASS_NAME + "sku_id"; // skuid
|
||||
public final static String sku_image_url = CLASS_NAME + "sku_image_url"; // sku图片
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -70,6 +72,10 @@ private static final long serialVersionUID = 1L;
|
||||
private String skuInfo;
|
||||
//商品主图
|
||||
private String productMainImageUrl;
|
||||
//skuid
|
||||
private Long skuId;
|
||||
//sku图片
|
||||
private String skuImageUrl;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -310,6 +316,36 @@ private static final long serialVersionUID = 1L;
|
||||
this.productMainImageUrl = productMainImageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* skuid
|
||||
* @return
|
||||
*/
|
||||
public Long getSkuId() {
|
||||
return skuId;
|
||||
}
|
||||
/**
|
||||
* skuid
|
||||
* @param skuId
|
||||
*/
|
||||
public void setSkuId(Long skuId) {
|
||||
this.skuId = skuId;
|
||||
}
|
||||
|
||||
/**
|
||||
* sku图片
|
||||
* @return
|
||||
*/
|
||||
public String getSkuImageUrl() {
|
||||
return skuImageUrl;
|
||||
}
|
||||
/**
|
||||
* sku图片
|
||||
* @param skuImageUrl
|
||||
*/
|
||||
public void setSkuImageUrl(String skuImageUrl) {
|
||||
this.skuImageUrl = skuImageUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvTradeOrderLineEntity{" +
|
||||
@ -329,6 +365,8 @@ private static final long serialVersionUID = 1L;
|
||||
",productName=" + productName +
|
||||
",skuInfo=" + skuInfo +
|
||||
",productMainImageUrl=" + productMainImageUrl +
|
||||
",skuId=" + skuId +
|
||||
",skuImageUrl=" + skuImageUrl +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class MysqlMain_update {
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
|
||||
String a = "vv_shopping_cart";
|
||||
String a = "vv_buyer_address";
|
||||
for (String s : a.split(",")) {
|
||||
list.add(new TablesBean(s));
|
||||
}
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
package com.heyu.api.alibaba.request.mm;
|
||||
|
||||
public enum OrderStatusEnums {
|
||||
|
||||
|
||||
wait_pay("wait_pay","待支付"),
|
||||
wait_shipping("wait_shipping","待发货"),
|
||||
shipping("shipping","已发货"),
|
||||
delivered("delivered","已签收"),
|
||||
all_refund("all_refund","全部退款"),
|
||||
part_refund("part_refund","部分退款"),
|
||||
delete("delete","删除"),
|
||||
;
|
||||
|
||||
|
||||
OrderStatusEnums(String status, String desc) {
|
||||
this.status = status;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
private String status;
|
||||
|
||||
private String desc;
|
||||
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.heyu.api.alibaba.request.mm.order.resp;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PropertyNameValue {
|
||||
|
||||
private String propertyName;
|
||||
|
||||
private String propertyValue;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.heyu.api.alibaba.request.mm.order.resp;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VvTradeOrderDTO {
|
||||
|
||||
|
||||
private Long buyerId;
|
||||
|
||||
private List<VvTradeOrderLineDTO> vvTradeOrderLineDTOList;
|
||||
|
||||
|
||||
private Long buyerAddressId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.heyu.api.alibaba.request.mm.order.resp;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VvTradeOrderDeleteDTO {
|
||||
|
||||
|
||||
private List<Long> ids ;
|
||||
|
||||
|
||||
|
||||
private Long buyerId ;
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.heyu.api.alibaba.request.mm.order.resp;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VvTradeOrderLineDTO {
|
||||
|
||||
//数量
|
||||
private Integer num;
|
||||
|
||||
// sku id
|
||||
private Long skuId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.heyu.api.alibaba.request.vv;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AppBuyerAddressRequest {
|
||||
|
||||
|
||||
private int pageNum = 1;
|
||||
|
||||
|
||||
private int pageSize = 10;
|
||||
|
||||
|
||||
/***
|
||||
* 买家id
|
||||
*/
|
||||
private Long buyerId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.heyu.api.controller.vv;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.heyu.api.alibaba.request.vv.AppBuyerAddressRequest;
|
||||
import com.heyu.api.data.dao.vv.VvBuyerAddressDao;
|
||||
import com.heyu.api.data.dao.vv.VvBuyerDao;
|
||||
import com.heyu.api.data.entity.vv.VvBuyerAddressEntity;
|
||||
import com.heyu.api.data.entity.vv.VvBuyerEntity;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.utils.ISelect;
|
||||
import com.heyu.api.utils.PPageUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/app/buyer/address")
|
||||
public class AppBuyerAddressManagerController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvBuyerAddressDao vvBuyerAddressDao;
|
||||
|
||||
@Autowired
|
||||
private VvBuyerDao vvBuyerDao;
|
||||
|
||||
/***
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(AppBuyerAddressRequest appBuyerAddressRequest) {
|
||||
|
||||
|
||||
PPageUtils pageUtils = PPageUtils.startPage(appBuyerAddressRequest.getPageNum(), appBuyerAddressRequest.getPageSize())
|
||||
.doSelect(new ISelect() {
|
||||
@Override
|
||||
public List doSelect(IPage page) {
|
||||
return vvBuyerAddressDao.selectAppByCondition(page,
|
||||
appBuyerAddressRequest.getBuyerId()
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return R.ok().setData(pageUtils);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/update")
|
||||
public R list(VvBuyerAddressEntity vvBuyerAddressEntity) {
|
||||
|
||||
|
||||
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(vvBuyerAddressEntity.getBuyerId());
|
||||
|
||||
vvBuyerAddressEntity.setBuyerName(vvBuyerEntity.getBuyerName());
|
||||
vvBuyerAddressEntity.setBuyerPhone(vvBuyerEntity.getBuyerPhone());
|
||||
vvBuyerAddressEntity.setBuyerWeixin(vvBuyerEntity.getBuyerWeixin());
|
||||
vvBuyerAddressDao.insertOrUpdateVvBuyerAddress(vvBuyerAddressEntity);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,16 +1,14 @@
|
||||
package com.heyu.api.controller.vv;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.heyu.api.alibaba.request.mm.order.resp.PackageDTO;
|
||||
import com.heyu.api.alibaba.request.mm.order.resp.VVOrderListResp;
|
||||
import com.heyu.api.alibaba.request.mm.OrderStatusEnums;
|
||||
import com.heyu.api.alibaba.request.mm.order.resp.*;
|
||||
import com.heyu.api.alibaba.request.vv.AppOrderRequest;
|
||||
import com.heyu.api.data.dao.vv.VvPackageDao;
|
||||
import com.heyu.api.data.dao.vv.VvTradeOrderDao;
|
||||
import com.heyu.api.data.dao.vv.VvTradeOrderLineDao;
|
||||
import com.heyu.api.data.entity.vv.VvPackageEntity;
|
||||
import com.heyu.api.data.entity.vv.VvTradeOrderEntity;
|
||||
import com.heyu.api.data.entity.vv.VvTradeOrderLineEntity;
|
||||
import com.heyu.api.data.dao.vv.*;
|
||||
import com.heyu.api.data.entity.vv.*;
|
||||
import com.heyu.api.data.utils.BigDecimalUtil;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.utils.ISelect;
|
||||
@ -19,13 +17,12 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@ -45,12 +42,30 @@ public class AppOrderController {
|
||||
@Autowired
|
||||
private VvPackageDao vvPackageDao;
|
||||
|
||||
@Autowired
|
||||
private VvSkuDao vvSkuDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvProductDao vvProductDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvSkuPropertyValueDao vvSkuPropertyValueDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvBuyerDao vvBuyerDao;
|
||||
|
||||
@Autowired
|
||||
private VvBuyerAddressDao vvBuyerAddressDao;
|
||||
|
||||
|
||||
/***
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(AppOrderRequest vvOrderRequest) {
|
||||
|
||||
public R list(@RequestBody AppOrderRequest vvOrderRequest) {
|
||||
if (StringUtils.isNotBlank(vvOrderRequest.getProductName())) {
|
||||
List<VvTradeOrderLineEntity> list = vvTradeOrderLineDao.selectVvTradeOrderLineByProductName(vvOrderRequest.getProductName());
|
||||
List<Long> orderIds = new ArrayList<>();
|
||||
@ -72,6 +87,7 @@ public class AppOrderController {
|
||||
vvOrderRequest.getStatus(),
|
||||
vvOrderRequest.getMinCreateTimestamp(),
|
||||
vvOrderRequest.getMaxCreateTimestamp(),
|
||||
OrderStatusEnums.delete.getStatus(),
|
||||
vvOrderRequest.getCreateTimestampSort()
|
||||
);
|
||||
}
|
||||
@ -163,4 +179,100 @@ public class AppOrderController {
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/add")
|
||||
public R add(@RequestBody VvTradeOrderDTO vvOrderRequest) {
|
||||
List<VvTradeOrderLineEntity> vvTradeOrderLineEntityList = new ArrayList<>();
|
||||
|
||||
BigDecimal allPrice = BigDecimal.ZERO;
|
||||
int allNum = 0;
|
||||
|
||||
for (VvTradeOrderLineDTO vvTradeOrderLineDTO : vvOrderRequest.getVvTradeOrderLineDTOList()) {
|
||||
VvTradeOrderLineEntity vvTradeOrderLineEntity = new VvTradeOrderLineEntity();
|
||||
|
||||
vvTradeOrderLineEntity.setSkuId(vvTradeOrderLineDTO.getSkuId());
|
||||
vvTradeOrderLineEntity.setNum(vvTradeOrderLineDTO.getNum());
|
||||
|
||||
|
||||
vvTradeOrderLineEntity.setCreateTime(new Date());
|
||||
vvTradeOrderLineEntity.setModifyTime(new Date());
|
||||
allNum = vvTradeOrderLineEntity.getNum();
|
||||
|
||||
VvSkuEntity vvSkuEntity = vvSkuDao.selectVvSkuById(vvTradeOrderLineDTO.getSkuId());
|
||||
|
||||
vvTradeOrderLineEntity.setSinglePrice(vvSkuEntity.getSalePrice());
|
||||
vvTradeOrderLineEntity.setSkuImageUrl(vvSkuEntity.getImageUrl());
|
||||
|
||||
BigDecimal tradeOrderLineAllPrice = BigDecimalUtil.multiply(vvSkuEntity.getSalePrice(), new BigDecimal(vvTradeOrderLineDTO.getNum()));
|
||||
|
||||
vvTradeOrderLineEntity.setAllPrice(tradeOrderLineAllPrice);
|
||||
|
||||
allPrice = BigDecimalUtil.add(tradeOrderLineAllPrice, allPrice);
|
||||
|
||||
vvTradeOrderLineEntity.setStatus(OrderStatusEnums.wait_pay.getStatus());
|
||||
|
||||
|
||||
vvTradeOrderLineEntity.setProductId(vvSkuEntity.getProductId());
|
||||
|
||||
|
||||
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvSkuEntity.getProductId());
|
||||
vvTradeOrderLineEntity.setProductMainImageUrl(vvProduct.getMainImageUrl());
|
||||
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvTradeOrderLineDTO.getSkuId());
|
||||
|
||||
List<PropertyNameValue> propertyNameValues = new ArrayList<>();
|
||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||
|
||||
PropertyNameValue propertyNameValue = new PropertyNameValue();
|
||||
propertyNameValue.setPropertyName(vvSkuPropertyValueEntity.getPropertyName());
|
||||
propertyNameValue.setPropertyValue(vvSkuPropertyValueEntity.getPropertyValue());
|
||||
propertyNameValues.add(propertyNameValue);
|
||||
}
|
||||
|
||||
vvTradeOrderLineEntity.setSkuInfo(JSON.toJSONString(propertyNameValues));
|
||||
vvTradeOrderLineEntityList.add(vvTradeOrderLineEntity);
|
||||
}
|
||||
|
||||
VvTradeOrderEntity vvTradeOrderEntity = new VvTradeOrderEntity();
|
||||
|
||||
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(vvTradeOrderEntity.getBuyerId());
|
||||
//创建时间
|
||||
vvTradeOrderEntity.setCreateTime(new Date());
|
||||
vvTradeOrderEntity.setModifyTime(new Date());
|
||||
vvTradeOrderEntity.setNum(allNum);
|
||||
vvTradeOrderEntity.setBuyerPhone(vvBuyerEntity.getBuyerPhone());
|
||||
vvTradeOrderEntity.setBuyerName(vvBuyerEntity.getBuyerName());
|
||||
vvTradeOrderEntity.setBuyerWeixin(vvBuyerEntity.getBuyerWeixin());
|
||||
|
||||
VvBuyerAddressEntity vvBuyerAddress = vvBuyerAddressDao.selectVvBuyerAddressById(vvOrderRequest.getBuyerAddressId());
|
||||
|
||||
|
||||
vvTradeOrderEntity.setContry(vvBuyerAddress.getContry());
|
||||
vvTradeOrderEntity.setProvince(vvBuyerAddress.getProvince());
|
||||
vvTradeOrderEntity.setCity(vvBuyerAddress.getCity());
|
||||
vvTradeOrderEntity.setDistrict(vvBuyerAddress.getDistrict());
|
||||
vvTradeOrderEntity.setBuyerDetailAddress(vvBuyerAddress.getDetail());
|
||||
vvTradeOrderEntity.setAllPrice(allPrice);
|
||||
vvTradeOrderEntity.setStatus(OrderStatusEnums.wait_pay.getStatus());
|
||||
vvTradeOrderEntity.setBuyerId(vvOrderRequest.getBuyerId());
|
||||
vvTradeOrderEntity.setCreateTimestamp(System.currentTimeMillis());
|
||||
vvTradeOrderEntity.setModifyTimestamp(System.currentTimeMillis());
|
||||
vvTradeOrderDao.insertVvTradeOrder(vvTradeOrderEntity);
|
||||
|
||||
for (VvTradeOrderLineEntity tradeOrderLineEntity : vvTradeOrderLineEntityList) {
|
||||
|
||||
tradeOrderLineEntity.setTradeOrderId(vvTradeOrderEntity.getId());
|
||||
|
||||
vvTradeOrderLineDao.insertOrUpdateVvTradeOrderLine(tradeOrderLineEntity);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
public R add(@RequestBody VvTradeOrderDeleteDTO vvOrderRequest) {
|
||||
vvTradeOrderDao.updateByBuerIdAndIds(OrderStatusEnums.delete.getStatus(),vvOrderRequest.getBuyerId(), vvOrderRequest.getIds());
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,19 @@
|
||||
package com.heyu.api.controller.vv;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.AppShippingCartRequest;
|
||||
import com.heyu.api.data.dao.vv.VvBuyerDao;
|
||||
import com.heyu.api.data.dao.vv.VvProductDao;
|
||||
import com.heyu.api.data.dao.vv.VvShoppingCartDao;
|
||||
import com.heyu.api.data.dao.vv.VvSkuPropertyValueDao;
|
||||
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.utils.ISelect;
|
||||
import com.heyu.api.utils.PPageUtils;
|
||||
@ -16,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -31,6 +38,13 @@ public class AppShoppingCartController {
|
||||
@Autowired
|
||||
private VvBuyerDao vvBuyerDao;
|
||||
|
||||
@Autowired
|
||||
private VvProductDao vvProductDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvSkuPropertyValueDao vvSkuPropertyValueDao;
|
||||
|
||||
/***
|
||||
* 列表
|
||||
*/
|
||||
@ -59,11 +73,28 @@ public class AppShoppingCartController {
|
||||
vvShoppingCartEntity.setBuyerName(vvBuyerEntity.getBuyerName());
|
||||
vvShoppingCartEntity.setBuyerPhone(vvBuyerEntity.getBuyerPhone());
|
||||
vvShoppingCartEntity.setBuyerWeixin(vvBuyerEntity.getBuyerWeixin());
|
||||
vvShoppingCartDao.insertOrUpdateVvShoppingCart(vvShoppingCartEntity);
|
||||
return R.ok();
|
||||
|
||||
|
||||
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvShoppingCartEntity.getProductId());
|
||||
vvShoppingCartEntity.setProductName(vvProduct.getTitle());
|
||||
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvShoppingCartEntity.getSkuId());
|
||||
|
||||
List<PropertyNameValue> propertyNameValues = new ArrayList<>();
|
||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||
|
||||
PropertyNameValue propertyNameValue = new PropertyNameValue();
|
||||
propertyNameValue.setPropertyName(vvSkuPropertyValueEntity.getPropertyName());
|
||||
propertyNameValue.setPropertyValue(vvSkuPropertyValueEntity.getPropertyValue());
|
||||
propertyNameValues.add(propertyNameValue);
|
||||
}
|
||||
|
||||
vvShoppingCartEntity.setSkuInfo(JSON.toJSONString(propertyNameValues));
|
||||
|
||||
vvShoppingCartDao.insertOrUpdateVvShoppingCart(vvShoppingCartEntity);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
/***
|
||||
* 列表
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user