diff --git a/bawei-base/base-es/base-es-remote/src/main/java/com/bawei/es/remote/api/RemoteDocumentService.java b/bawei-base/base-es/base-es-remote/src/main/java/com/bawei/es/remote/api/RemoteDocumentService.java index 1f53003..2573e3b 100644 --- a/bawei-base/base-es/base-es-remote/src/main/java/com/bawei/es/remote/api/RemoteDocumentService.java +++ b/bawei-base/base-es/base-es-remote/src/main/java/com/bawei/es/remote/api/RemoteDocumentService.java @@ -18,11 +18,11 @@ import java.util.Map; public interface RemoteDocumentService { @PostMapping("/doc/{indexName}") - R queryList(@PathVariable String indexName, @RequestBody Map conditions); + R queryList(@PathVariable(value = "indexName") String indexName, @RequestBody Map conditions); @PutMapping("/doc/{indexName}") - R batchDocument(@PathVariable String indexName, @RequestBody List dataJson); + R batchDocument(@PathVariable(value = "indexName") String indexName, @RequestBody List dataJson); @DeleteMapping("/doc/{indexName}") - R batchDeleteDocument(@PathVariable String indexName, @RequestBody List dataJson); + R batchDeleteDocument(@PathVariable(value = "indexName") String indexName, @RequestBody List dataJson); } diff --git a/bawei-base/base-es/base-es-remote/src/main/java/com/bawei/es/remote/api/RemoteIndexService.java b/bawei-base/base-es/base-es-remote/src/main/java/com/bawei/es/remote/api/RemoteIndexService.java index 5493c1a..df0eb0a 100644 --- a/bawei-base/base-es/base-es-remote/src/main/java/com/bawei/es/remote/api/RemoteIndexService.java +++ b/bawei-base/base-es/base-es-remote/src/main/java/com/bawei/es/remote/api/RemoteIndexService.java @@ -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 mappings); + public R index(@PathVariable(value = "indexName") String indexName,@RequestBody Map mappings); @PutMapping("/index/{indexName}") - public R updateIndex(@PathVariable String indexName,@RequestBody Map mappings); + public R updateIndex(@PathVariable(value = "indexName") String indexName,@RequestBody Map mappings); @DeleteMapping("/index/{indexName}") - public R deleteIndex(@PathVariable String indexName); + public R deleteIndex(@PathVariable(value = "indexName") String indexName); } diff --git a/bawei-base/base-file/base-file-remote/pom.xml b/bawei-base/base-file/base-file-remote/pom.xml index 0d1823d..ba5312b 100644 --- a/bawei-base/base-file/base-file-remote/pom.xml +++ b/bawei-base/base-file/base-file-remote/pom.xml @@ -22,8 +22,7 @@ com.bawei - base-es-common - 3.6.0 + base-file-common diff --git a/bawei-base/base-file/base-file-remote/src/main/java/com/bawei/file/remote/api/RemoteFileService.java b/bawei-base/base-file/base-file-remote/src/main/java/com/bawei/file/remote/api/RemoteFileService.java index 43429a0..886a3f3 100644 --- a/bawei-base/base-file/base-file-remote/src/main/java/com/bawei/file/remote/api/RemoteFileService.java +++ b/bawei-base/base-file/base-file-remote/src/main/java/com/bawei/file/remote/api/RemoteFileService.java @@ -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 upload(@RequestPart(value = "file") MultipartFile file); } diff --git a/bawei-mall/bawei-mall-product/bawei-mall-product-server/pom.xml b/bawei-mall/bawei-mall-product/bawei-mall-product-server/pom.xml index f5291d9..302db47 100644 --- a/bawei-mall/bawei-mall-product/bawei-mall-product-server/pom.xml +++ b/bawei-mall/bawei-mall-product/bawei-mall-product-server/pom.xml @@ -100,6 +100,10 @@ com.bawei bawei-common-rabbit + + com.bawei + base-es-remote + diff --git a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/controller/MallProductInfoController.java b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/controller/MallProductInfoController.java index d2b4c3f..e04d26e 100644 --- a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/controller/MallProductInfoController.java +++ b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/controller/MallProductInfoController.java @@ -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); + } /** * 导出商品信息列表 diff --git a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/controller/TestController.java b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/controller/TestController.java index 2415ab6..bccfc77 100644 --- a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/controller/TestController.java +++ b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/controller/TestController.java @@ -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; diff --git a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/mapper/MallProductInfoMapper.java b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/mapper/MallProductInfoMapper.java index a550db7..ccaf62c 100644 --- a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/mapper/MallProductInfoMapper.java +++ b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/mapper/MallProductInfoMapper.java @@ -69,4 +69,6 @@ public interface MallProductInfoMapper * @return */ Long selectMallProductInfoCount (MallProductInfo mallProductInfo); + + List queryId(Long id); } diff --git a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/service/IMallProductInfoService.java b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/service/IMallProductInfoService.java index a89e1ed..5095c90 100644 --- a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/service/IMallProductInfoService.java +++ b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/service/IMallProductInfoService.java @@ -69,4 +69,6 @@ public interface IMallProductInfoService * @return */ Long selectMallProductInfoCount (MallProductInfo mallProductInfo); + + void unmout(Long id, String type); } diff --git a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/service/impl/MallProductInfoServiceImpl.java b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/service/impl/MallProductInfoServiceImpl.java index d3d654e..ebdb301 100644 --- a/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/service/impl/MallProductInfoServiceImpl.java +++ b/bawei-mall/bawei-mall-product/bawei-mall-product-server/src/main/java/com/bawei/mall/product/service/impl/MallProductInfoServiceImpl.java @@ -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); + } + + } + + + + + + + } } diff --git a/pom.xml b/pom.xml index 6646147..c6498ee 100644 --- a/pom.xml +++ b/pom.xml @@ -296,7 +296,11 @@ bawei-mall-search-common 3.6.0 - + + com.bawei + base-es-remote + 3.6.0 + com.bawei