添加商品上下架接口
parent
03cb49cc0d
commit
6d7e98a31e
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品信息列表
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -69,4 +69,6 @@ public interface MallProductInfoMapper
|
|||
* @return
|
||||
*/
|
||||
Long selectMallProductInfoCount (MallProductInfo mallProductInfo);
|
||||
|
||||
List<MallProductInfo> queryId(Long id);
|
||||
}
|
||||
|
|
|
@ -69,4 +69,6 @@ public interface IMallProductInfoService
|
|||
* @return
|
||||
*/
|
||||
Long selectMallProductInfoCount (MallProductInfo mallProductInfo);
|
||||
|
||||
void unmout(Long id, String type);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue