Sfoglia il codice sorgente

feat:购物车相关接口

zhangwei 5 giorni fa
parent
commit
548f1b7d06
22 ha cambiato i file con 224 aggiunte e 67 eliminazioni
  1. 0 42
      edu-travel-adapter/edu-travel-adapter-currency/pom.xml
  2. 17 0
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/AddFavoriteDto.java
  3. 1 1
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/InsertProductSkuDto.java
  4. 13 0
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/UpdateShopCarDto.java
  5. 1 1
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ProductImageVo.java
  6. 2 1
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ProductSkuVo.java
  7. 5 0
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ShopCartListVo.java
  8. 9 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/constant/BaseConstant.java
  9. 0 6
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopProductImage.java
  10. 1 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/exception/GlobalExceptionHandler.java
  11. 2 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopFavoriteService.java
  12. 7 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopShoppingCartService.java
  13. 15 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopFavoriteServiceImpl.java
  14. 1 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductSkuServiceImpl.java
  15. 6 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductSpecServiceImpl.java
  16. 30 2
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopShoppingCartServiceImpl.java
  17. 17 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopFavoriteController.java
  18. 53 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopOpinionController.java
  19. 9 5
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopProductController.java
  20. 27 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopShoppingCartController.java
  21. 1 2
      edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopProductImageMapper.xml
  22. 7 2
      edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/dto/AddHappyEntryDto.java

+ 0 - 42
edu-travel-adapter/edu-travel-adapter-currency/pom.xml

@@ -1,42 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>edu.travel</groupId>
-        <artifactId>edu-travel-adapter</artifactId>
-        <version>1.0-SNAPSHOT</version>
-    </parent>
-
-
-    <artifactId>edu-travel-adapter-currency</artifactId>
-    <packaging>jar</packaging>
-
-    <name>edu-travel-adapter-currency</name>
-    <url>http://maven.apache.org</url>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-aop</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>edu.travel</groupId>
-            <artifactId>edu-travel-remote-country</artifactId>
-            <version>1.0-SNAPSHOT</version>
-        </dependency>
-        <dependency>
-            <groupId>edu.travel</groupId>
-            <artifactId>edu-travel-common-adapter</artifactId>
-            <version>1.0-SNAPSHOT</version>
-        </dependency>
-    </dependencies>
-</project>

+ 17 - 0
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/AddFavoriteDto.java

@@ -0,0 +1,17 @@
+package edu.travel.remote.dto;
+
+import lombok.Data;
+
+@Data
+public class AddFavoriteDto {
+    /**
+     * 商品id
+     */
+    private String productId;
+
+    /**
+     * 国家
+     */
+    private String countryId;
+
+}

+ 1 - 1
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/InsertProductSkuDto.java

@@ -42,7 +42,7 @@ public class InsertProductSkuDto {
     /**
      * 商品SKU图片
      */
-    private List<String> imageUrl;
+    private List<FIleDto> imageUrl;
     /**
      * 销量
      */

+ 13 - 0
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/dto/UpdateShopCarDto.java

@@ -0,0 +1,13 @@
+package edu.travel.remote.dto;
+
+import lombok.Data;
+
+@Data
+public class UpdateShopCarDto {
+    //商品ID
+    private String id;
+    //商品SKU
+    private String skuId;
+    //商品数量
+    private Integer query;
+}

+ 1 - 1
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ProductImageVo.java

@@ -22,7 +22,7 @@ public class ProductImageVo {
     /**
      * 判断图片/视频,默认0,0图片,1视频
      */
-    private Integer urlType;
+    private String urlType;
 
     /**是否默认列表图片*/
     private Integer isDefault;

+ 2 - 1
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ProductSkuVo.java

@@ -1,5 +1,6 @@
 package edu.travel.remote.vo;
 
+import edu.travel.remote.dto.FIleDto;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -53,7 +54,7 @@ public class ProductSkuVo {
     /**
      * 商品SKU图片
      */
-    private List<ProductImageVo> imageUrl;
+    private List<FIleDto> imageUrls;
     /**
      * 销量
      */

+ 5 - 0
edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/vo/ShopCartListVo.java

@@ -64,4 +64,9 @@ public class ShopCartListVo {
      */
     private List<SpecValueVo> specValue;
 
+    /**
+     * state  0 上架 1 下架
+     */
+    private String state;
+
 }

+ 9 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/constant/BaseConstant.java

@@ -30,8 +30,16 @@ public class BaseConstant {
     private static final Set<String> PRODUCT_IMAGE_TYPES = new HashSet<>(
             Arrays.asList("jpg", "jpeg", "png")
     );
-
+    /**
+     * 意见文件类型
+     */
+    private static final Set<String> OPINION_FILE_TYPES = new HashSet<>(
+            Arrays.asList("jpg", "jpeg", "png","mp4")
+    );
     public static Set<String> getProductImageTypes() {
         return PRODUCT_IMAGE_TYPES;
     }
+    public static Set<String> getOpinionFileTypes() {
+        return OPINION_FILE_TYPES;
+    }
 }

+ 0 - 6
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/entity/ShopProductImage.java

@@ -26,12 +26,6 @@ public class ShopProductImage extends BaseEntity {
     private Long id;
 
     /**
-     * sku
-     */
-    @TableField(value = "sku_id")
-    private Long skuId;
-
-    /**
      * 商品ID
      */
     @TableField(value = "product_id")

+ 1 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/exception/GlobalExceptionHandler.java

@@ -24,7 +24,7 @@ public class GlobalExceptionHandler {
     @ExceptionHandler(BaseException.class)
     public BaseResponse<Object> handleUserInfoException(BaseException e){
         e.printStackTrace();
-        return  PageResponse.out(e.getCode(),e.getMessage(),null);
+        return new BaseResponse<>(e.getCode(),e.getMessage(),null);
     }
 
     @ExceptionHandler(IllegalArgumentException.class)

+ 2 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopFavoriteService.java

@@ -3,6 +3,7 @@ package edu.travel.commodity.service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import edu.travel.commodity.entity.ShopFavorite;
 import com.baomidou.mybatisplus.extension.service.IService;
+import edu.travel.remote.dto.AddFavoriteDto;
 import edu.travel.remote.dto.BaseDto;
 import edu.travel.remote.vo.ShopFavoriteVo;
 
@@ -11,4 +12,5 @@ public interface ShopFavoriteService extends IService<ShopFavorite>{
 
     Page<ShopFavoriteVo> getFavorite(BaseDto baseDto);
 
+    void addFavorite(AddFavoriteDto params);
 }

+ 7 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopShoppingCartService.java

@@ -5,12 +5,19 @@ import edu.travel.commodity.entity.ShopShoppingCart;
 import com.baomidou.mybatisplus.extension.service.IService;
 import edu.travel.remote.dto.AddShopCartDto;
 import edu.travel.remote.dto.BaseDto;
+import edu.travel.remote.dto.UpdateShopCarDto;
 import edu.travel.remote.vo.ShopCartListVo;
 
+import java.util.Set;
+
 public interface ShopShoppingCartService extends IService<ShopShoppingCart>{
 
 
     Boolean addShopCart(AddShopCartDto params);
 
     Page<ShopCartListVo> getShopCartList(BaseDto params);
+
+    Boolean updateCart(UpdateShopCarDto params);
+
+    Integer delCart(Set<String> ids);
 }

+ 15 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopFavoriteServiceImpl.java

@@ -11,6 +11,8 @@ import edu.travel.commodity.service.ShopFavoriteService;
 import edu.travel.commodity.service.ShopProductService;
 import edu.travel.commodity.utils.PageUtil;
 import edu.travel.commodity.utils.TokenData;
+import edu.travel.exception.BaseException;
+import edu.travel.remote.dto.AddFavoriteDto;
 import edu.travel.remote.dto.BaseDto;
 import edu.travel.service.SysServiceImpl;
 import edu.travel.remote.vo.ShopFavoriteVo;
@@ -54,7 +56,7 @@ public class ShopFavoriteServiceImpl extends SysServiceImpl<ShopFavoriteMapper,
             if(!ObjectUtil.isEmpty(shopProduct)){
                 shopProductVo.setProductName(shopProduct.getProductName());
                 shopProductVo.setDescription(shopProduct.getDescription());
-                shopProductVo.setMainImageUrl(shopProduct.getDescription());
+                shopProductVo.setMainImageUrl(shopProduct.getMainImageUrl());
                 shopProductVo.setHeatValue(shopProduct.getHeatValue());
                 shopProductVo.setSalesVolume(shopProduct.getSalesVolume());
                 shopProductVo.setDefaultPrice(shopProduct.getDefaultPrice());
@@ -64,4 +66,16 @@ public class ShopFavoriteServiceImpl extends SysServiceImpl<ShopFavoriteMapper,
         }
         return pageEntity;
     }
+
+    @Override
+    public void addFavorite(AddFavoriteDto params) {
+        ShopProduct product = shopProductService.getById(params.getProductId());
+        if(ObjectUtil.isEmpty(product) ||!product.getCountryId().toString().equals(params.getCountryId())){
+            throw new BaseException("商品不存在");
+        }
+        ShopFavorite shopFavorite = new ShopFavorite();
+        shopFavorite.setProductId(product.getId());
+        shopFavorite.setUserId(Long.valueOf(TokenData.getUserId()));
+        save(shopFavorite);
+    }
 }

+ 1 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductSkuServiceImpl.java

@@ -239,7 +239,7 @@ public class ShopProductSkuServiceImpl extends ServiceImpl<ShopProductSkuMapper,
             for (InsertProductSkuDto insertProductSkuDto : skus) {
                 ShopProductSku bean = BeanUtil.toBean(insertProductSkuDto, ShopProductSku.class);
                 bean.setProductId(product.getId());
-                bean.setImageUrl(StringUtil.toListString(insertProductSkuDto.getImageUrl()));
+                bean.setImageUrl(JSONUtil.toJsonStr(insertProductSkuDto.getImageUrl()));
                 shopProductSkus.add(bean);
                 for (SkuValueDto skuValues : insertProductSkuDto.getSkuValues()) {
                     ShopSkuSpecValue skuValue = new ShopSkuSpecValue();

+ 6 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductSpecServiceImpl.java

@@ -2,6 +2,8 @@ package edu.travel.commodity.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -10,6 +12,8 @@ import edu.travel.commodity.entity.*;
 import edu.travel.commodity.mapper.ShopProductSpecMapper;
 import edu.travel.commodity.service.*;
 import edu.travel.commodity.utils.IdUtils;
+import edu.travel.commodity.utils.StringUtil;
+import edu.travel.remote.dto.FIleDto;
 import edu.travel.remote.dto.InsertProductSpecDto;
 import edu.travel.remote.dto.ProductSpecDto;
 import edu.travel.remote.dto.SpecValueDto;
@@ -85,6 +89,8 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProductSpecMappe
             bean.setImages(imageMap.get(info.getSkuId().toString()));
             List<ShopSkuSpecValueVo> shopSkuSpecValueVos = map.get(info.getSkuId().toString());
             infoVo.setSpecValue(shopSkuSpecValueVos);
+            JSONArray objects = JSONUtil.parseArray(info.getImageUrl());
+            infoVo.setImageUrls(JSONUtil.toList(objects, FIleDto.class));
             productSkuVos.add(infoVo);
         }
         List<SpecSortVo> specSortVoList= getSpecSortVoList(param.getProductId());

+ 30 - 2
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopShoppingCartServiceImpl.java

@@ -20,6 +20,7 @@ import edu.travel.commodity.utils.TokenData;
 import edu.travel.remote.dto.AddShopCartDto;
 import edu.travel.remote.dto.BaseDto;
 import edu.travel.exception.BaseException;
+import edu.travel.remote.dto.UpdateShopCarDto;
 import edu.travel.remote.vo.ShopCartListVo;
 import edu.travel.remote.vo.ShopSkuSpecValueVo;
 import edu.travel.remote.vo.SpecValueVo;
@@ -42,6 +43,9 @@ public class ShopShoppingCartServiceImpl extends ServiceImpl<ShopShoppingCartMap
     private ShopProductSpecMapper shopProductSpecMapper;
     @Override
     public Boolean addShopCart(AddShopCartDto params) {
+        if(params.getQuantity()<=0){
+            throw new BaseException("数量有误,请重新选择");
+        }
         // 获取用户id
         String userId = TokenData.getUserId();
         ShopProduct byId = shopProductService.getById(params.getProductId());
@@ -51,11 +55,11 @@ public class ShopShoppingCartServiceImpl extends ServiceImpl<ShopShoppingCartMap
         if(byId==null||byId.getStatus().equals(BaseConstant.BASIC_STATUS_YES_NUM)||one==null){
             throw new BaseException("商品已经下架");
         }
-
         ShopShoppingCart shopShoppingCart = new ShopShoppingCart();
         shopShoppingCart.setProductSkuId(one.getId());
         shopShoppingCart.setUserId(Long.valueOf(userId));
         shopShoppingCart.setQuantity(params.getQuantity());
+        shopShoppingCart.setProductId(one.getProductId());
         return save(shopShoppingCart);
     }
 
@@ -91,7 +95,9 @@ public class ShopShoppingCartServiceImpl extends ServiceImpl<ShopShoppingCartMap
         String project = request.getHeader("project");
         List<ShopSkuSpecValueVo> skuValue = shopProductSpecMapper.getSkuValue(skus, project);
         Map<String, List<ShopSkuSpecValueVo>> sku = skuValue.stream().collect(Collectors.groupingBy(ShopSkuSpecValueVo::getSkuId));
-
+        if(ObjectUtil.isEmpty(collect)){
+            return pageEntity;
+        }
 
         List<ShopProduct> shopProducts = shopProductService.listByIds(collect);
         HashMap<String, ShopProduct> map = new HashMap<>();
@@ -111,6 +117,8 @@ public class ShopShoppingCartServiceImpl extends ServiceImpl<ShopShoppingCartMap
                     record.setPrice(shopProductSku.getPrice());
                     record.setInventory(shopProductSku.getInventory());
                     record.setSkuId(shopProductSku.getSkuId().toString());
+                    //0 上架 1 下架
+                    record.setState(shopProductSku.getStatus().toString());
                 }
                 String skuId = record.getSkuId();
                 if(ObjectUtil.isEmpty(skuId))continue;
@@ -124,5 +132,25 @@ public class ShopShoppingCartServiceImpl extends ServiceImpl<ShopShoppingCartMap
         return pageEntity;
     }
 
+    @Override
+    public Boolean updateCart(UpdateShopCarDto params) {
+        ShopShoppingCart cart = getById(params.getId());
+        if(cart==null){
+            return false;
+        }
+        if(!ObjectUtil.isEmpty(params.getQuery())&&params.getQuery()>0){
+            cart.setQuantity(params.getQuery());
+        }
+        if(!ObjectUtil.isEmpty(params.getSkuId())){
+            cart.setProductSkuId(Long.valueOf(params.getSkuId()));
+        }
+        return updateById(cart);
+    }
+
+    @Override
+    public Integer delCart(Set<String> ids) {
+        return baseMapper.deleteBatchIds(ids);
+    }
+
 
 }

+ 17 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopFavoriteController.java

@@ -2,6 +2,7 @@ package edu.travel.commodity.web;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import edu.travel.commodity.service.ShopFavoriteService;
+import edu.travel.remote.dto.AddFavoriteDto;
 import edu.travel.remote.dto.BaseDto;
 import edu.travel.rpc.RPCBaseResponse;
 import edu.travel.remote.vo.ShopFavoriteVo;
@@ -9,6 +10,8 @@ import org.springframework.web.bind.annotation.*;
 
 import org.springframework.beans.factory.annotation.Autowired;
 
+import static edu.travel.rpc.RPCBaseResponse.success;
+
 /**
 * 收藏表(shop_favorite)表控制层
 *
@@ -29,6 +32,19 @@ public class ShopFavoriteController {
      */
     @GetMapping("/getFavorite")
     public RPCBaseResponse<Page<ShopFavoriteVo>> getFavorite(BaseDto baseDto){
-        return RPCBaseResponse.success(shopFavoriteService.getFavorite(baseDto));
+        return success(shopFavoriteService.getFavorite(baseDto));
+    }
+
+
+    /**
+     *  添加收藏
+     * @param params
+     * @return {@link RPCBaseResponse }<{@link Void }>
+     */
+
+    @GetMapping("/addFavorite")
+    public RPCBaseResponse<Void> addFavorite(@RequestBody AddFavoriteDto params){
+        shopFavoriteService.addFavorite(params);
+        return success();
     }
 }

+ 53 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopOpinionController.java

@@ -1,10 +1,18 @@
 package edu.travel.commodity.web;
 
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.io.FileTypeUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import edu.travel.adapter.service.upload.UploadAdapter;
+import edu.travel.commodity.constant.BaseConstant;
 import edu.travel.commodity.entity.ShopOpinion;
 import edu.travel.commodity.service.ShopOpinionService;
+import edu.travel.commodity.utils.FIleUtil;
 import edu.travel.remote.dto.ShopOpinionDto;
 import edu.travel.remote.opinion.ShopOpinionRemoteController;
+import edu.travel.remote.upload.dto.EduFileDTO;
 import edu.travel.remote.vo.ShopOpinionVo;
 import edu.travel.rpc.RPCBaseResponse;
 import edu.travel.web.BaseController;
@@ -12,9 +20,14 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.util.Date;
 import java.util.List;
 
+import static edu.travel.rpc.RPCBaseResponse.error;
+import static edu.travel.rpc.RPCBaseResponse.success;
+
 /**
 * 意见表(shop_opinion)表控制层
 *
@@ -28,6 +41,8 @@ public class ShopOpinionController extends BaseController<ShopOpinion> implement
 */
     @Autowired
     private ShopOpinionService shopOpinionService;
+    @Autowired
+    private UploadAdapter uploadAdapter;
     /**
      * 分页查询(连表)
      */
@@ -99,4 +114,42 @@ public class ShopOpinionController extends BaseController<ShopOpinion> implement
         return baseCountryVoRPCBaseResponse;
     }
 
+    /**
+     * 意见图片上传
+     */
+    @GetMapping("/uploadOpinionImage")
+    public RPCBaseResponse<String> uploadOpinionImage(MultipartFile file) {
+        if (file == null || file.isEmpty()) {
+            return error();
+        }
+        try {
+            // 通过文件的字节流获取真实类型(Hutool自动解析魔数)
+            String fileType = FileTypeUtil.getType(file.getInputStream());
+            // 判断类型是否在支持的图片类型集合中
+            if (fileType != null && BaseConstant.getOpinionFileTypes().contains(fileType.toLowerCase())) {
+                String filename = file.getOriginalFilename();
+                if(ObjectUtil.isEmpty(filename)){
+                    return error();
+                }
+                RPCBaseResponse<String> stringRPCBaseResponse = uploadAdapter.initializeUpload();
+
+                EduFileDTO eduFileDTO = new EduFileDTO();
+                eduFileDTO.setUploadId(stringRPCBaseResponse.getData());
+                eduFileDTO.setFileType(fileType);
+                eduFileDTO.setFileName(filename);
+                eduFileDTO.setFileSysName(IdUtil.fastSimpleUUID()+ DateUtil.format(new Date(),"yyyyMMddHHmmss") +"."+fileType);
+                eduFileDTO.setFileMd5(FIleUtil.calculateFileMd5(file.getBytes()));
+                RPCBaseResponse rpcBaseResponse = uploadAdapter.uploadFile(eduFileDTO, file);
+                return success(rpcBaseResponse.getData().toString());
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            // 处理流读取异常或类型解析失败
+            return error("文件上传失败");
+        }
+        return error();
+    }
+
+
+
 }

+ 9 - 5
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopProductController.java

@@ -11,6 +11,7 @@ import edu.travel.commodity.constant.BaseConstant;
 import edu.travel.commodity.entity.ShopProduct;
 import edu.travel.commodity.service.ShopProductService;
 import edu.travel.commodity.utils.FIleUtil;
+import edu.travel.commodity.utils.IdUtils;
 import edu.travel.remote.dto.GetProductByTypeDto;
 import edu.travel.remote.dto.InsertProductDto;
 import edu.travel.remote.dto.SearchProductDto;
@@ -68,6 +69,11 @@ public class ShopProductController extends BaseController<ShopProduct> {
     }
 
 
+    /**
+     *  上传商品图片
+     * @param file
+     * @return {@link RPCBaseResponse }<{@link String }>
+     */
 
     @PostMapping("/uploadProductImage")
     public RPCBaseResponse<String> searchProduct(MultipartFile file) throws IOException {
@@ -117,14 +123,12 @@ public class ShopProductController extends BaseController<ShopProduct> {
 
     /**
      *  获取SkuId
-     * @param params
      * @return {@link RPCBaseResponse }<{@link String }>
      */
 
     @GetMapping("/getSkuId")
-    public RPCBaseResponse<String> getSkuId(@RequestBody InsertProductDto params){
-        Snowflake snowflake = IdUtil.createSnowflake(1, 1);
-        long orderNum = snowflake.nextId();
-        return success(orderNum+"");
+    public RPCBaseResponse<String> getSkuId(){
+        long id = IdUtils.getSnowflakeId();
+        return success(id+"");
     }
 }

+ 27 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopShoppingCartController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import edu.travel.commodity.service.ShopShoppingCartService;
 import edu.travel.remote.dto.AddShopCartDto;
 import edu.travel.remote.dto.BaseDto;
+import edu.travel.remote.dto.UpdateShopCarDto;
 import edu.travel.resp.BaseResponse;
 import edu.travel.rpc.RPCBaseResponse;
 import edu.travel.remote.vo.ShopCartListVo;
@@ -11,6 +12,8 @@ import org.springframework.web.bind.annotation.*;
 
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.Set;
+
 import static edu.travel.rpc.RPCBaseResponse.success;
 
 /**
@@ -49,5 +52,29 @@ public class ShopShoppingCartController {
         return success(shopShoppingCartService.getShopCartList(params));
     }
 
+    /**
+     * 修改购物车信息
+     * @param params
+     * @return {@link BaseResponse }<{@link Page }<{@link ShopCartListVo }>>
+     */
+
+    @PostMapping("/updateCart")
+    public RPCBaseResponse<Boolean> updateCart(@RequestBody UpdateShopCarDto params) {
+        return success(shopShoppingCartService.updateCart(params));
+    }
+    /**
+     * 删除购物车
+     * @param ids
+     * @return {@link BaseResponse }<{@link Page }<{@link ShopCartListVo }>>
+     */
+
+    @PostMapping("/delCart")
+    public RPCBaseResponse<Integer> delCart(@RequestBody Set<String> ids) {
+        return success(shopShoppingCartService.delCart(ids));
+    }
+
+
+
+
 
 }

+ 1 - 2
edu-travel-service/edu-travel-service-commodity/src/main/resources/mapper/ShopProductImageMapper.xml

@@ -5,7 +5,6 @@
     <!--@mbg.generated-->
     <!--@Table shop_product_image-->
     <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="sku_id" jdbcType="BIGINT" property="skuId" />
     <result column="product_id" jdbcType="BIGINT" property="productId" />
     <result column="url" jdbcType="VARCHAR" property="url" />
     <result column="url_type" jdbcType="VARCHAR" property="urlType" />
@@ -20,7 +19,7 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, sku_id, product_id, url, url_type, sort_order, project, create_time, create_user_id, 
+    id, product_id, url, url_type, sort_order, project, create_time, create_user_id,
     update_time, update_user_id, delete_flag,is_default
   </sql>
 </mapper>

+ 7 - 2
edu-travel-service/edu-travel-service-education/src/main/java/edu/travel/education/dto/AddHappyEntryDto.java

@@ -49,9 +49,14 @@ public class AddHappyEntryDto{
     private Integer courseType;
 
     /**
-     * 年龄
+     * 最小年龄
      */
-    private String age;
+    private Integer minAge;
+
+    /**
+     * 最大年龄
+     */
+    private Integer maxAge;
 
     /**
      * 邮箱