提交修改
This commit is contained in:
parent
eb0beacfc5
commit
d2c061ef2d
@ -14,6 +14,7 @@ import com.heyu.api.data.entity.vv.VvBuyerAddressEntity;
|
|||||||
import com.lz.mybatis.plugin.annotations.By;
|
import com.lz.mybatis.plugin.annotations.By;
|
||||||
import com.lz.mybatis.plugin.annotations.Column;
|
import com.lz.mybatis.plugin.annotations.Column;
|
||||||
import com.lz.mybatis.plugin.annotations.IF;
|
import com.lz.mybatis.plugin.annotations.IF;
|
||||||
|
import com.lz.mybatis.plugin.annotations.OrderByIdDesc;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ public interface VvBuyerAddressDao extends BaseMapper<VvBuyerAddressEntity> {
|
|||||||
int deleteVvBuyerAddressById(@Param("id") Long id);
|
int deleteVvBuyerAddressById(@Param("id") Long id);
|
||||||
|
|
||||||
|
|
||||||
|
@OrderByIdDesc
|
||||||
List<VvBuyerAddressEntity> selectAppByCondition(IPage page, Long buyerId);
|
List<VvBuyerAddressEntity> selectAppByCondition(IPage page, Long buyerId);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
package com.heyu.api.data.entity.vv;
|
package com.heyu.api.data.entity.vv;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import com.lz.mybatis.plugin.annotations.AS;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;import java.util.Date;
|
||||||
/**
|
/**
|
||||||
*购物车
|
*购物车
|
||||||
* @author quyixiao
|
* @author quyixiao
|
||||||
* @since 2025-11-21
|
* @since 2025-12-03
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -39,6 +39,7 @@ private static final long serialVersionUID = 1L;
|
|||||||
public final static String single_discount_amount = CLASS_NAME + "single_discount_amount"; // 单比折扣价
|
public final static String single_discount_amount = CLASS_NAME + "single_discount_amount"; // 单比折扣价
|
||||||
public final static String all_discount_amount = CLASS_NAME + "all_discount_amount"; // 总折扣价
|
public final static String all_discount_amount = CLASS_NAME + "all_discount_amount"; // 总折扣价
|
||||||
public final static String activity_info = CLASS_NAME + "activity_info"; // 活动信息
|
public final static String activity_info = CLASS_NAME + "activity_info"; // 活动信息
|
||||||
|
public final static String image_url = CLASS_NAME + "image_url"; // 图片
|
||||||
//
|
//
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
@ -76,6 +77,8 @@ private static final long serialVersionUID = 1L;
|
|||||||
private BigDecimal allDiscountAmount;
|
private BigDecimal allDiscountAmount;
|
||||||
//活动信息
|
//活动信息
|
||||||
private String activityInfo;
|
private String activityInfo;
|
||||||
|
//图片
|
||||||
|
private String imageUrl;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -346,6 +349,21 @@ private static final long serialVersionUID = 1L;
|
|||||||
this.activityInfo = activityInfo;
|
this.activityInfo = activityInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getImageUrl() {
|
||||||
|
return imageUrl;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
* @param imageUrl
|
||||||
|
*/
|
||||||
|
public void setImageUrl(String imageUrl) {
|
||||||
|
this.imageUrl = imageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VvShoppingCartEntity{" +
|
return "VvShoppingCartEntity{" +
|
||||||
@ -367,6 +385,7 @@ private static final long serialVersionUID = 1L;
|
|||||||
",singleDiscountAmount=" + singleDiscountAmount +
|
",singleDiscountAmount=" + singleDiscountAmount +
|
||||||
",allDiscountAmount=" + allDiscountAmount +
|
",allDiscountAmount=" + allDiscountAmount +
|
||||||
",activityInfo=" + activityInfo +
|
",activityInfo=" + activityInfo +
|
||||||
|
",imageUrl=" + imageUrl +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -84,6 +84,9 @@ public enum ActionEnums {
|
|||||||
|
|
||||||
App_Track_Logistics("Admin_Track_Logistics", "app查看物流", "/app/logistics/query", null),
|
App_Track_Logistics("Admin_Track_Logistics", "app查看物流", "/app/logistics/query", null),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 取消按钮
|
* 取消按钮
|
||||||
*/
|
*/
|
||||||
@ -107,7 +110,6 @@ public enum ActionEnums {
|
|||||||
*/
|
*/
|
||||||
private String targetStatus ;
|
private String targetStatus ;
|
||||||
|
|
||||||
|
|
||||||
ActionEnums(String buttonName, String desc, String interfaceUri, String targetStatus) {
|
ActionEnums(String buttonName, String desc, String interfaceUri, String targetStatus) {
|
||||||
this.buttonName = buttonName;
|
this.buttonName = buttonName;
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
@ -115,7 +117,6 @@ public enum ActionEnums {
|
|||||||
this.targetStatus = targetStatus;
|
this.targetStatus = targetStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getButtonName() {
|
public String getButtonName() {
|
||||||
return buttonName;
|
return buttonName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public class MysqlMain_update {
|
|||||||
}
|
}
|
||||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||||
|
|
||||||
list.add(new TablesBean("vv_my_settlement"));
|
list.add(new TablesBean("vv_shopping_cart"));
|
||||||
|
|
||||||
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
|||||||
@ -2,15 +2,15 @@ package com.heyu.api.controller.vv;
|
|||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.heyu.api.common.annotation.AppLogin;
|
|
||||||
import com.heyu.api.data.enums.BuyerAddressEnums;
|
|
||||||
import com.heyu.api.alibaba.request.vv.AppBuyerAddressRequest;
|
import com.heyu.api.alibaba.request.vv.AppBuyerAddressRequest;
|
||||||
|
import com.heyu.api.common.annotation.AppLogin;
|
||||||
import com.heyu.api.common.annotation.Describe;
|
import com.heyu.api.common.annotation.Describe;
|
||||||
import com.heyu.api.data.dao.vv.VvBuyerAddressDao;
|
import com.heyu.api.data.dao.vv.VvBuyerAddressDao;
|
||||||
import com.heyu.api.data.dao.vv.VvBuyerDao;
|
import com.heyu.api.data.dao.vv.VvBuyerDao;
|
||||||
import com.heyu.api.data.entity.vv.VvBuyerAddressEntity;
|
import com.heyu.api.data.entity.vv.VvBuyerAddressEntity;
|
||||||
import com.heyu.api.data.entity.vv.VvBuyerEntity;
|
import com.heyu.api.data.enums.BuyerAddressEnums;
|
||||||
import com.heyu.api.data.utils.R;
|
import com.heyu.api.data.utils.R;
|
||||||
|
import com.heyu.api.data.utils.StringUtils;
|
||||||
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;
|
||||||
@ -60,13 +60,17 @@ public class AppBuyerAddressManagerController {
|
|||||||
@Describe("买家地址插入或修改")
|
@Describe("买家地址插入或修改")
|
||||||
@RequestMapping("/insertOrUpdate")
|
@RequestMapping("/insertOrUpdate")
|
||||||
public R inserOrUpdate(@RequestBody VvBuyerAddressEntity vvBuyerAddressEntity) {
|
public R inserOrUpdate(@RequestBody VvBuyerAddressEntity vvBuyerAddressEntity) {
|
||||||
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(vvBuyerAddressEntity.getBuyerId());
|
|
||||||
// 如果当前状态是默认地址,
|
// 如果当前状态是默认地址,
|
||||||
if (BuyerAddressEnums.default_address.getStatus().equals(vvBuyerAddressEntity.getStatus())) {
|
if (BuyerAddressEnums.default_address.getStatus().equals(vvBuyerAddressEntity.getStatus())) {
|
||||||
vvBuyerAddressDao.updateVvBuyerAddressStatusById(BuyerAddressEnums.common.getStatus(),
|
vvBuyerAddressDao.updateVvBuyerAddressStatusById(BuyerAddressEnums.common.getStatus(),
|
||||||
BuyerAddressEnums.default_address.getStatus(),
|
BuyerAddressEnums.default_address.getStatus(),
|
||||||
vvBuyerAddressEntity.getBuyerId());
|
vvBuyerAddressEntity.getBuyerId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isEmpty(vvBuyerAddressEntity.getStatus())){
|
||||||
|
vvBuyerAddressEntity.setStatus(BuyerAddressEnums.common.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
vvBuyerAddressDao.insertOrUpdateVvBuyerAddress(vvBuyerAddressEntity);
|
vvBuyerAddressDao.insertOrUpdateVvBuyerAddress(vvBuyerAddressEntity);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,13 +86,11 @@ public class AppShoppingCartController {
|
|||||||
if (NumberUtil.equals(vvShoppingCartEntity.getSkuId(), vvSkuEntity.getId())) {
|
if (NumberUtil.equals(vvShoppingCartEntity.getSkuId(), vvSkuEntity.getId())) {
|
||||||
vvShoppingCartDTO.setVvSkuEntity(vvSkuEntity);
|
vvShoppingCartDTO.setVvSkuEntity(vvSkuEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
vvShoppingCartDTOS.add(vvShoppingCartDTO);
|
vvShoppingCartDTOS.add(vvShoppingCartDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
pageUtils.setRows(vvShoppingCartDTOS);
|
pageUtils.setRows(vvShoppingCartDTOS);
|
||||||
|
|
||||||
return R.ok().setData(pageUtils);
|
return R.ok().setData(pageUtils);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,39 +100,46 @@ public class AppShoppingCartController {
|
|||||||
*/
|
*/
|
||||||
@Describe("加购物车")
|
@Describe("加购物车")
|
||||||
@RequestMapping("/addOrUpdate")
|
@RequestMapping("/addOrUpdate")
|
||||||
public R add(@RequestBody AppShoppingCartAddRequest VvShoppingCartAddRequest) {
|
public R add(@RequestBody AppShoppingCartAddRequest vvShoppingCartAddRequest) {
|
||||||
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(VvShoppingCartAddRequest.getBuyerId());
|
VvBuyerEntity vvBuyerEntity = vvBuyerDao.selectVvBuyerById(vvShoppingCartAddRequest.getBuyerId());
|
||||||
String activityTokenInfo = redisUtils.get(ApiConstants.token_activity + VvShoppingCartAddRequest.getToken());
|
String activityTokenInfo = redisUtils.get(ApiConstants.token_activity + vvShoppingCartAddRequest.getToken());
|
||||||
|
|
||||||
VvActivityDTO vvActivityDTO = null;
|
VvActivityDTO vvActivityDTO = null;
|
||||||
if(StringUtils.isNotEmpty(activityTokenInfo)){
|
if(StringUtils.isNotEmpty(activityTokenInfo)){
|
||||||
vvActivityDTO = JSON.parseObject(activityTokenInfo, VvActivityDTO.class);
|
vvActivityDTO = JSON.parseObject(activityTokenInfo, VvActivityDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
VvShoppingCartEntity vvShoppingCartEntity = new VvShoppingCartEntity();
|
VvShoppingCartEntity vvShoppingCartEntity = new VvShoppingCartEntity();
|
||||||
vvShoppingCartEntity.setNum(VvShoppingCartAddRequest.getNum());
|
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.setSkuId(vvShoppingCartAddRequest.getSkuId());
|
||||||
vvShoppingCartEntity.setBuyerId(VvShoppingCartAddRequest.getBuyerId());
|
vvShoppingCartEntity.setBuyerId(vvShoppingCartAddRequest.getBuyerId());
|
||||||
|
|
||||||
VvSkuEntity vvSkuEntity = vvSkuDao.selectVvSkuById(VvShoppingCartAddRequest.getSkuId());
|
VvSkuEntity vvSkuEntity = vvSkuDao.selectVvSkuById(vvShoppingCartAddRequest.getSkuId());
|
||||||
vvShoppingCartEntity.setProductId(vvSkuEntity.getProductId());
|
vvShoppingCartEntity.setProductId(vvSkuEntity.getProductId());
|
||||||
vvShoppingCartEntity.setSinglePrice(vvSkuEntity.getPromotionPrice());
|
vvShoppingCartEntity.setSinglePrice(vvSkuEntity.getPromotionPrice());
|
||||||
vvShoppingCartEntity.setAllPrice(BigDecimalUtil.multiply(vvSkuEntity.getPromotionPrice(), new BigDecimal(VvShoppingCartAddRequest.getNum())));
|
vvShoppingCartEntity.setAllPrice(BigDecimalUtil.multiply(vvSkuEntity.getPromotionPrice(), new BigDecimal(vvShoppingCartAddRequest.getNum())));
|
||||||
|
|
||||||
if(vvActivityDTO !=null){
|
if(vvActivityDTO !=null){
|
||||||
vvShoppingCartEntity.setActivityInfo(JSON.toJSONString(vvActivityDTO));
|
vvShoppingCartEntity.setActivityInfo(JSON.toJSONString(vvActivityDTO));
|
||||||
vvShoppingCartEntity.setAllDiscountAmount(BigDecimalUtil.multiply(vvActivityDTO.getDiscountAmount(), new BigDecimal(VvShoppingCartAddRequest.getNum())));
|
vvShoppingCartEntity.setAllDiscountAmount(BigDecimalUtil.multiply(vvActivityDTO.getDiscountAmount(), new BigDecimal(vvShoppingCartAddRequest.getNum())));
|
||||||
vvShoppingCartEntity.setSingleDiscountAmount(vvActivityDTO.getDiscountAmount());
|
vvShoppingCartEntity.setSingleDiscountAmount(vvActivityDTO.getDiscountAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvShoppingCartEntity.getSkuId());
|
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvShoppingCartEntity.getSkuId());
|
||||||
|
|
||||||
VvSkuPropertyValueEntity vvSkuPropertyValue = vvSkuPropertyValueEntities.get(0);
|
VvSkuPropertyValueEntity vvSkuPropertyValue = vvSkuPropertyValueEntities.get(0);
|
||||||
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvSkuPropertyValue.getProductId());
|
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvSkuPropertyValue.getProductId());
|
||||||
|
|
||||||
vvShoppingCartEntity.setProductName(vvProduct.getTitle());
|
vvShoppingCartEntity.setProductName(vvProduct.getTitle());
|
||||||
|
|
||||||
|
String imageUrl =vvSkuEntity.getImageUrl();
|
||||||
|
if(StringUtils.isBlank(imageUrl)){
|
||||||
|
imageUrl = vvProduct.getMainImageUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
vvShoppingCartEntity.setImageUrl(imageUrl);
|
||||||
|
|
||||||
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();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user