添加商品上下架接口

customer
gyc 2024-04-26 17:17:47 +08:00
parent 03cb49cc0d
commit 6d7e98a31e
11 changed files with 67 additions and 15 deletions

View File

@ -18,11 +18,11 @@ import java.util.Map;
public interface RemoteDocumentService
{
@PostMapping("/doc/{indexName}")
R queryList(@PathVariable String indexName, @RequestBody Map<String,Object> conditions);
R queryList(@PathVariable(value = "indexName") String indexName, @RequestBody Map<String,Object> conditions);
@PutMapping("/doc/{indexName}")
R batchDocument(@PathVariable String indexName, @RequestBody List<String> dataJson);
R batchDocument(@PathVariable(value = "indexName") String indexName, @RequestBody List<String> dataJson);
@DeleteMapping("/doc/{indexName}")
R batchDeleteDocument(@PathVariable String indexName, @RequestBody List<String> dataJson);
R batchDeleteDocument(@PathVariable(value = "indexName") String indexName, @RequestBody List<String> dataJson);
}

View File

@ -17,17 +17,17 @@ import java.util.Map;
public interface RemoteIndexService
{
@GetMapping("/index/{indexName}")
public R exist(@PathVariable String indexName);
public R exist(@PathVariable(value = "indexName") String indexName);
@GetMapping("/index/getMapping/{indexName}")
public R getMapping(@PathVariable String indexName);
public R getMapping(@PathVariable(value = "indexName") String indexName);
@PostMapping("/index/{indexName}")
public R index(@PathVariable String indexName,@RequestBody Map<String,Object> mappings);
public R index(@PathVariable(value = "indexName") String indexName,@RequestBody Map<String,Object> mappings);
@PutMapping("/index/{indexName}")
public R updateIndex(@PathVariable String indexName,@RequestBody Map<String,Object> mappings);
public R updateIndex(@PathVariable(value = "indexName") String indexName,@RequestBody Map<String,Object> mappings);
@DeleteMapping("/index/{indexName}")
public R deleteIndex(@PathVariable String indexName);
public R deleteIndex(@PathVariable(value = "indexName") String indexName);
}

View File

@ -22,8 +22,7 @@
<!-- 文件服务公共依赖 -->
<dependency>
<groupId>com.bawei</groupId>
<artifactId>base-es-common</artifactId>
<version>3.6.0</version>
<artifactId>base-file-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,4 +1,5 @@
package com.bawei.file.remote.api;
import com.bawei.file.domain.SysFile;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
@ -22,6 +23,6 @@ public interface RemoteFileService
* @param file
* @return
*/
@PostMapping(value = "/upload")
public R upload();
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
}

View File

@ -100,6 +100,10 @@
<groupId>com.bawei</groupId>
<artifactId>bawei-common-rabbit</artifactId>
</dependency>
<dependency>
<groupId>com.bawei</groupId>
<artifactId>base-es-remote</artifactId>
</dependency>
</dependencies>

View File

@ -67,7 +67,10 @@ public class MallProductInfoController extends BaseController
return R.ok(mallProductInfoService.selectMallProductInfoCount(mallProductInfo));
}
@PostMapping("/unmount")
public void unmount(@RequestParam Long id,@RequestParam String status){
mallProductInfoService.unmout(id,status);
}
/**
*

View File

@ -3,6 +3,7 @@ package com.bawei.mall.product.controller;
import com.bawei.common.core.domain.R;
import com.bawei.common.rabbit.domain.Message;
import com.bawei.common.rabbit.enums.QueueEnum;
import com.bawei.es.remote.api.RemoteIndexService;
import com.bawei.mall.product.cache.ProductInfoCache;
import com.bawei.mall.product.domain.reponse.ProductDetailsResponse;
import com.bawei.mall.product.domain.reponse.ProductInfoResponse;
@ -25,7 +26,6 @@ public class TestController {
@Autowired
private RabbitTemplate rabbitTemplate;
@Autowired
private IMallProductInfoService productInfoService;

View File

@ -69,4 +69,6 @@ public interface MallProductInfoMapper
* @return
*/
Long selectMallProductInfoCount (MallProductInfo mallProductInfo);
List<MallProductInfo> queryId(Long id);
}

View File

@ -69,4 +69,6 @@ public interface IMallProductInfoService
* @return
*/
Long selectMallProductInfoCount (MallProductInfo mallProductInfo);
void unmout(Long id, String type);
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.bawei.common.core.exception.ServiceException;
import com.bawei.common.core.utils.DateUtils;
import com.bawei.common.core.utils.StringUtils;
import com.bawei.common.core.utils.bean.BeanUtils;
import com.bawei.common.core.utils.thread.ThreadPool;
import com.bawei.common.rabbit.domain.Message;
@ -26,6 +27,7 @@ import com.bawei.mall.product.mapper.MallProductInfoMapper;
import com.bawei.mall.product.domain.MallProductInfo;
import com.bawei.mall.product.service.IMallProductInfoService;
import org.springframework.transaction.annotation.Transactional;
import org.w3c.dom.ranges.RangeException;
/**
* Service
@ -196,5 +198,40 @@ public class MallProductInfoServiceImpl implements IMallProductInfoService
@Override
public Long selectMallProductInfoCount (MallProductInfo mallProductInfo) {
return mallProductInfoMapper.selectMallProductInfoCount(mallProductInfo);
}
@Override
public void unmout(Long id, String status) {
if(id==null && id==0){
throw new RuntimeException("id不能为空");
}
if (status==null || status.equals("")){
throw new RuntimeException("商品状态不能为空");
}
MallProductInfo mallProductInfo = mallProductInfoMapper.selectMallProductInfoById(id);
if (mallProductInfo.getStatus().equals("0")){
if (status.equals("1")){
mallProductInfo.setStatus(status);
mallProductInfoMapper.updateMallProductInfo(mallProductInfo);
}else {
throw new RuntimeException("商品已上架");
}
}else {
if (status.equals("1")){
throw new RuntimeException("商品已下架");
}else {
mallProductInfo.setStatus(status);
mallProductInfoMapper.updateMallProductInfo(mallProductInfo);
}
}
}
}

View File

@ -296,7 +296,11 @@
<artifactId>bawei-mall-search-common</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>com.bawei</groupId>
<artifactId>base-es-remote</artifactId>
<version>3.6.0</version>
</dependency>
<!-- 商品搜索远程调用依赖 -->
<dependency>
<groupId>com.bawei</groupId>