Browse Source

Merge remote-tracking branch 'origin/main' into main

zhangwei 2 weeks ago
parent
commit
48bd00da48
13 changed files with 135 additions and 15 deletions
  1. 2 1
      edu-travel-remote/edu-travel-remote-commodity/src/main/java/edu/travel/remote/commodity/ShopProductRemoteController.java
  2. 2 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopProductService.java
  3. 0 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopProductSkuService.java
  4. 4 4
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopCategoryServiceImpl.java
  5. 2 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductImageServiceImpl.java
  6. 10 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductParametersServiceImpl.java
  7. 1 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductServiceImpl.java
  8. 2 2
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductSkuServiceImpl.java
  9. 1 5
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductSpecServiceImpl.java
  10. 1 1
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopCategoryController.java
  11. 75 0
      edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopProductController.java
  12. 10 0
      edu-travel-service/edu-travel-service-debezium/pom.xml
  13. 25 1
      edu-travel-service/edu-travel-service-tenement/src/main/java/edu/travel/tenant/service/impl/SysProjectServiceImpl.java

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

@@ -1,6 +1,7 @@
 package edu.travel.remote.commodity;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import edu.travel.remote.base.RemoteBaseController;
 import edu.travel.remote.dto.GetProductByTypeDto;
 import edu.travel.remote.dto.InsertProductDto;
 import edu.travel.remote.dto.SearchProductDto;
@@ -17,7 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
 import java.io.IOException;
 
 @FeignClient(name = "commodity-dev", path = "/shopProduct")
-public interface ShopProductRemoteController {
+public interface ShopProductRemoteController extends RemoteBaseController<ShopProductVo, ShopProductVo> {
     @GetMapping("/getHotProduct")
     public RPCBaseResponse<Page<ShopProductVo>> getHotProduct(@SpringQueryMap GetProductByTypeDto param);
 

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

@@ -6,6 +6,7 @@ import edu.travel.commodity.entity.ShopProduct;
 import edu.travel.remote.dto.GetProductByTypeDto;
 import edu.travel.remote.dto.InsertProductDto;
 import edu.travel.remote.dto.SearchProductDto;
+import edu.travel.remote.dto.UpdateProductDto;
 import edu.travel.remote.vo.ShopProductVo;
 
 import java.io.IOException;
@@ -18,4 +19,5 @@ public interface ShopProductService extends IService<ShopProduct> {
     Page<ShopProductVo> searchProduct(SearchProductDto param) throws IOException;
 
     void insertProduct(InsertProductDto params);
+
 }

+ 0 - 1
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/ShopProductSkuService.java

@@ -22,5 +22,4 @@ public interface ShopProductSkuService extends IService<ShopProductSku> {
     boolean insertProductSku(List<InsertProductSpecDto> specs, List<InsertProductSkuDto> skus, ShopProduct id);
 
     void payProductSku(PayShopOrderDto payShopOrderDto);
-
 }

+ 4 - 4
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopCategoryServiceImpl.java

@@ -65,7 +65,7 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
                 .collect(Collectors.toSet());
 
         // 查询国家信息
-        Map<String, ShopCategoryVo> countryMap = fetchCountryData(countryIds);
+        Map<String, BaseCountryServeVo> countryMap = fetchCountryData(countryIds);
 
         // 遍历并设置国家信息
         for (ShopCategoryVo shopCategoryVo : categoryVos) {
@@ -88,13 +88,13 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
     }
 
     // 查询国家信息
-    private Map<String, ShopCategoryVo> fetchCountryData(Set<String> countryIds) {
-        Map<String, ShopCategoryVo> countryMap = new HashMap<>();
+    private Map<String, BaseCountryServeVo> fetchCountryData(Set<String> countryIds) {
+        Map<String, BaseCountryServeVo> countryMap = new HashMap<>();
         for (String countryId : countryIds) {
             // 假设 countryAdapter.getFormId(countryId) 返回 RPCBaseResponse<BaseCountryServeVo>
             BaseCountryServeVo countryServeVo = countryAdapter.getFormId(countryId).getData();
             if (countryServeVo != null) {
-                ShopCategoryVo countryVo = new ShopCategoryVo();  // 使用 ShopCategoryVo 来存储国家信息
+                BaseCountryServeVo countryVo = new BaseCountryServeVo();  // 使用 ShopCategoryVo 来存储国家信息
                 countryVo.setCountryId(countryId);
                 countryVo.setMap(new HashMap<>());
                 countryVo.getMap().put("countryNameZh", countryServeVo.getCountryNameZh());

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

@@ -1,5 +1,7 @@
 package edu.travel.commodity.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import edu.travel.commodity.entity.ShopProductImage;
 import edu.travel.commodity.mapper.ShopProductImageMapper;

+ 10 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/service/impl/ShopProductParametersServiceImpl.java

@@ -1,5 +1,7 @@
 package edu.travel.commodity.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import edu.travel.commodity.entity.ShopProduct;
 import edu.travel.commodity.entity.ShopProductParameters;
@@ -28,4 +30,12 @@ public class ShopProductParametersServiceImpl extends ServiceImpl<ShopProductPar
         }
         return this.saveBatch(list);
     }
+
+    @Override
+    public boolean deleteByProductId(Long productId) {
+        LambdaUpdateWrapper<ShopProductParameters> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.eq(ShopProductParameters::getProductId, productId)
+                     .set(ShopProductParameters::getDeleteFlag, 1);
+        return this.update(updateWrapper);
+    }
 }

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

@@ -17,6 +17,7 @@ import edu.travel.remote.vo.ShopProductVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.Assert;
 
 import java.io.IOException;
 import java.util.List;

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

@@ -5,6 +5,8 @@ import cn.hutool.core.lang.Snowflake;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import edu.travel.DateUtil;
 import edu.travel.adapter.service.country.CountryAdapter;
@@ -334,6 +336,4 @@ public class ShopProductSkuServiceImpl extends ServiceImpl<ShopProductSkuMapper,
         });
         return map;
     }
-
-
 }

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

@@ -5,6 +5,7 @@ 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.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import edu.travel.commodity.constant.BaseConstant;
@@ -212,9 +213,4 @@ public class ShopProductSpecServiceImpl extends SysServiceImpl<ShopProductSpecMa
         return new RPCBaseResponse<>(200, "SUCCESS", specVo);
     }
 
-
-
-
-
-
 }

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

@@ -93,7 +93,7 @@ public class ShopCategoryController extends BaseController<ShopCategory> impleme
      */
     @Override
     @PostMapping("/updateTargetFormId")
-    public RPCBaseResponse<ShopCategoryVo> updateTargetFormId(ShopCategoryDto entity) {
+    public RPCBaseResponse<ShopCategoryVo> updateTargetFormId(@RequestBody ShopCategoryDto entity) {
         ShopCategory shopCurrency = new ShopCategory();
         BeanUtils.copyProperties(entity, shopCurrency);
         //调用接口获取地址,填入ImageUrl

+ 75 - 0
edu-travel-service/edu-travel-service-commodity/src/main/java/edu/travel/commodity/web/ShopProductController.java

@@ -16,6 +16,7 @@ import edu.travel.remote.commodity.ShopProductRemoteController;
 import edu.travel.remote.dto.GetProductByTypeDto;
 import edu.travel.remote.dto.InsertProductDto;
 import edu.travel.remote.dto.SearchProductDto;
+import edu.travel.remote.dto.UpdateProductDto;
 import edu.travel.remote.upload.dto.EduFileDTO;
 import edu.travel.remote.upload.vo.FileVo;
 import edu.travel.remote.vo.FileWebVo;
@@ -23,6 +24,7 @@ import edu.travel.remote.vo.ShopProductVo;
 import edu.travel.resp.BaseResponse;
 import edu.travel.rpc.RPCBaseResponse;
 import edu.travel.web.BaseController;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -143,4 +145,77 @@ public class ShopProductController extends BaseController<ShopProduct> implement
         long id = IdUtils.getSnowflakeId();
         return success(id + "");
     }
+
+    /**
+     * 获取商品
+     * @param id
+     * @return
+     */
+    @Override
+    @GetMapping("/getFormId")
+    public RPCBaseResponse<ShopProductVo> getFormId(String id) {
+        RPCBaseResponse<ShopProduct> shopCurrencyRPCBaseResponse = super.getId(id);
+        RPCBaseResponse<ShopProductVo> shopCurrencyVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopCurrencyRPCBaseResponse, shopCurrencyVoRPCBaseResponse);
+        return shopCurrencyVoRPCBaseResponse;
+    }
+
+    /**
+     * 更新商品
+     * @param entity
+     * @return
+     */
+    @Override
+    @PostMapping("/updateById")
+    public RPCBaseResponse<ShopProductVo> updateTargetFormId(@RequestBody ShopProductVo entity) {
+        ShopProduct shopProduct = new ShopProduct();
+        BeanUtils.copyProperties(entity, shopProduct);
+        RPCBaseResponse<ShopProduct> shopCurrencyRPCBaseResponse = super.updateTargetById(shopProduct);
+        RPCBaseResponse<ShopProductVo> shopCurrencyVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopCurrencyRPCBaseResponse, shopCurrencyVoRPCBaseResponse);
+        return shopCurrencyVoRPCBaseResponse;
+    }
+
+    /**
+     * 新增商品
+     * @param entity
+     * @return
+     */
+    @Override
+    @PostMapping("/saveForm")
+    public RPCBaseResponse<ShopProductVo> saveFormTarget(@RequestBody ShopProductVo entity) {
+        ShopProduct shopProduct = new ShopProduct();
+        BeanUtils.copyProperties(entity, shopProduct);
+        RPCBaseResponse<ShopProduct> shopCurrencyRPCBaseResponse = super.saveTarget(shopProduct);
+        RPCBaseResponse<ShopProductVo> shopCurrencyVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopCurrencyRPCBaseResponse, shopCurrencyVoRPCBaseResponse);
+        return shopCurrencyVoRPCBaseResponse;
+    }
+
+    /**
+     * 删除商品
+     * @param ids
+     * @return
+     */
+    @Override
+    @PostMapping("/deleteById")
+    public RPCBaseResponse<ShopProductVo> deleteTargetFormId(List<String> ids) {
+        RPCBaseResponse<ShopProduct> shopCurrencyRPCBaseResponse = super.deleteTargetById(ids);
+        RPCBaseResponse<ShopProductVo> shopCurrencyVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopCurrencyRPCBaseResponse, shopCurrencyVoRPCBaseResponse);
+        return shopCurrencyVoRPCBaseResponse;
+    }
+
+    /**
+     * 获取所有商品
+     * @return
+     */
+    @Override
+    @GetMapping("/getAllForm")
+    public RPCBaseResponse<List<ShopProductVo>> getAllForm() {
+        RPCBaseResponse<List<ShopProduct>> shopCurrencyRPCBaseResponse = super.listAll();
+        RPCBaseResponse<List<ShopProductVo>> shopCurrencyVoRPCBaseResponse = new RPCBaseResponse<>();
+        BeanUtils.copyProperties(shopCurrencyRPCBaseResponse, shopCurrencyVoRPCBaseResponse);
+        return shopCurrencyVoRPCBaseResponse;
+    }
 }

+ 10 - 0
edu-travel-service/edu-travel-service-debezium/pom.xml

@@ -68,6 +68,16 @@
             <artifactId>edu-travel-common-debezium</artifactId>
             <version>1.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>io.debezium</groupId>
+            <artifactId>debezium-embedded</artifactId>
+            <version>1.9.4.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>io.debezium</groupId>
+            <artifactId>debezium-connector-postgres</artifactId>
+            <version>1.9.4.Final</version>
+        </dependency>
     </dependencies>
     <profiles>
         <profile>

+ 25 - 1
edu-travel-service/edu-travel-service-tenement/src/main/java/edu/travel/tenant/service/impl/SysProjectServiceImpl.java

@@ -39,8 +39,32 @@ public class SysProjectServiceImpl extends ServiceImpl<SysProjectMapper, SysProj
 
     @Override
     public IPage<SysProject> getProjectPageList(SysProjectDto sysProjectDto) {
-        IPage<SysProject> sysProjectPage = new Page<>(sysProjectDto.getCurrentPage() == null ? 1 : sysProjectDto.getCurrentPage(), sysProjectDto.getPageSize() == null ? 10 : sysProjectDto.getPageSize());
+        IPage<SysProject> sysProjectPage = new Page<SysProject>(sysProjectDto.getCurrentPage() == null ? 1 : sysProjectDto.getCurrentPage(), sysProjectDto.getPageSize() == null ? 10 : sysProjectDto.getPageSize());
         IPage<SysProject> sysProjectIPage = this.baseMapper.selectPage(sysProjectPage, null);
         return sysProjectIPage;
     }
+
+    @Transactional
+    public SysProjectVo updateProject(SysProjectDto sysProjectDto) {
+        // 验证必要参数
+        Assert.isTrue(ObjectUtil.isNotEmpty(sysProjectDto.getId()), "项目ID不能为空");
+        Assert.isTrue(ObjectUtil.isNotEmpty(sysProjectDto.getProjectNameCn()), "项目中文名不能为空");
+        Assert.isTrue(ObjectUtil.isNotEmpty(sysProjectDto.getProjectNameEn()), "项目英文名不能为空");
+        
+        // 检查项目是否存在
+        SysProject existingProject = this.getById(sysProjectDto.getId());
+        Assert.notNull(existingProject, "项目不存在");
+        
+        // 复制更新的属性
+        SysProject sysProject = BeanUtil.copyProperties(sysProjectDto, SysProject.class);
+        // 保留原有的项目标识和密钥对
+        sysProject.setProject(existingProject.getProject());
+        sysProject.setPublicKey(existingProject.getPublicKey());
+        sysProject.setPrivateKey(existingProject.getPrivateKey());
+        
+        // 更新项目
+        this.updateById(sysProject);
+        
+        return BeanUtil.copyProperties(sysProject, SysProjectVo.class);
+    }
 }