feat:在线商城部分远程接口

This commit is contained in:
zjf committed 2025-08-01 11:19:39 +08:00
1 parent d2371cc892
commit 16705ff635
5 files changed
+112 -29

No files matched your search

@@ -0,0 +1,78 @@
/*
*
* Copyright (c) 2018-2025, pjcloud All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the pig4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: pjcloud
*
*/
package com.bsd.pjcloud.supermarket.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuQueryDTO;
import com.bsd.pjcloud.supermarket.entity.ShopSkuEntity;
import com.bsd.pjcloud.supermarket.vo.app.ShopSpuDetailAppVo;
import com.bsd.pjcloud.supermarket.vo.app.ShopSpuListAppVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* @author zjf
* @date 2018/6/22
*/
@FeignClient(contextId = "remoteShopSkuService", value = ServiceNameConstants.SUPERMARKET_SERVICE)
public interface RemoteShopSkuService {
/**
* 更新库存
* @return
*/
/**
* 根据skuId和数量扣减库存
* @param skuId
* @param num * 正数:增加库存,负数:扣减库存
* @return
*/
@PostMapping("/app/shopSpu/deductStock")
R<Boolean> deductStock(@RequestParam Long skuId, @RequestParam Integer num);
/**
* 查询所有sku列表信息,根据条件skuIds
* @return R
*/
@PostMapping("/shopSku/selectListAll")
R<List<ShopSkuEntity>> getSelectListAll(@RequestParam List<Long> ids);
/**
* 购物车效验库存
* @param skuId
* @param incrCount 扣减数量,正数负数都行
* @return
*/
@GetMapping("/app/shopSpu/checkSpuStock")
R<Boolean> checkSpuStock(@RequestParam(value ="skuId")Long skuId,@RequestParam("incrCount")Integer incrCount);
}
@@ -27,6 +27,7 @@ import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuQueryDTO;
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockByCodeReqDTO;
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
import com.bsd.pjcloud.supermarket.entity.ShopSpuEntity;
import com.bsd.pjcloud.supermarket.vo.ad.SmErpSpuDetailsVo;
import com.bsd.pjcloud.supermarket.vo.ad.SpuVo;
import com.bsd.pjcloud.supermarket.vo.app.ShopSpuDetailAppVo;
@@ -59,9 +60,8 @@ public interface RemoteShopSpuService {
@RequestParam(required = false) String merchantId);
/**
* 根据spu id 查询spu详情,详情包括辅助条码和包装单位基本信息
* 根据spu id 查询spu以及对应的sku详情
* @param ids
* @return
*/
@@ -69,35 +69,13 @@ public interface RemoteShopSpuService {
R<List<ShopSpuDetailAppVo>> getShopSpuDetailByIds(@RequestParam List<Long> ids);
/**
* 更新库存
* 根据spu ids 查询spu信息
* @param
* @return
*/
/**
* 根据skuId和数量扣减库存
* @param skuId
* @param num * 正数:增加库存,负数:扣减库存
* @return
*/
@PostMapping("/app/shopSpu/deductStock")
R<Boolean> deductStock(@RequestParam Long skuId, @RequestParam Integer num);
/**
* 查询所有的超市spu列表信息,根据条件
* @return R
*/
// @PostMapping("/supermarketSpu/app/selectListAll")
// R getSupermarketSpu(@RequestBody SupermarketSpuQueryDTO supermarketSpuQueryDTO);
/**
* 购物车效验库存
* @param skuId
* @param incrCount 扣减数量,正数负数都行
* @return
*/
@GetMapping("/app/shopSpu/checkSpuStock")
R<Boolean> checkSpuStock(@RequestParam(value ="skuId")Long skuId,@RequestParam("incrCount")Integer incrCount);
@GetMapping("/shopSpu/selectListAll")
R<List<ShopSpuEntity>> getSelectListAll(@RequestParam List<Long> ids);
}
@@ -3,3 +3,4 @@ com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketSpuService
com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketUnitSkuService
com.bsd.pjcloud.supermarket.api.feign.RemoteShopCategoryService
com.bsd.pjcloud.supermarket.api.feign.RemoteShopSpuService
com.bsd.pjcloud.supermarket.api.feign.RemoteShopSKuService
@@ -9,6 +9,7 @@ import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.supermarket.entity.ShopSkuEntity;
import com.bsd.pjcloud.supermarket.service.ShopSkuService;
import com.bsd.pjcloud.supermarket.vo.ad.SmErpSpuDetailsVo;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -116,4 +117,17 @@ public class ShopSkuController {
public List<ShopSkuEntity> export(ShopSkuEntity shopSku,Long[] ids) {
return shopSkuService.list(Wrappers.lambdaQuery(shopSku).in(ArrayUtil.isNotEmpty(ids), ShopSkuEntity::getId, ids));
}
/**
* 根据skuids 查询多个sku的详情信息
* @param ids
* @return
*/
@Operation(summary = "sku详情" , description = "根据多个skuid,查询多个sku详情" )
@GetMapping("/selectListAll" )
public R<List<ShopSkuEntity>> getSelectListAll(@RequestParam List<Long> ids) {
List<ShopSkuEntity> shopSkuEntities = shopSkuService.listByIds(ids);
return R.ok(shopSkuEntities);
}
}
@@ -137,4 +137,16 @@ public class ShopSpuController {
public List<ShopSpuEntity> export(ShopSpuEntity shopSpu,Long[] ids) {
return shopSpuService.list(Wrappers.lambdaQuery(shopSpu).in(ArrayUtil.isNotEmpty(ids), ShopSpuEntity::getId, ids));
}
/**
* 根据spuids 查询多个spu的详情信息
* @param ids
* @return
*/
@Operation(summary = "spu信息" , description = "根据多个spuid,查询多个spu信息" )
@GetMapping("/selectListAll" )
public R<List<ShopSpuEntity>> getSelectListAll(@RequestParam List<Long> ids) {
List<ShopSpuEntity> shopSpuEntities = shopSpuService.listByIds(ids);
return R.ok(shopSpuEntities);
}
}