瀏覽代碼

Merge branch 'zx_saas_goods' of http://git.dayaedu.com/yonge/mec into zx_saas_goods

刘俊驰 1 年之前
父節點
當前提交
9b5929a42a

+ 1 - 1
mec-application/src/main/java/com/ym/mec/web/controller/GoodsController.java

@@ -125,7 +125,7 @@ public class GoodsController extends BaseController {
 
     @ApiOperation(value = "查询商城商品列表分页")
     @GetMapping("/queryGoodsSubByPage")
-    @PreAuthorize("@pcs.hasPermissions('goods/queryGoodsSubByPage')")
+//    @PreAuthorize("@pcs.hasPermissions('goods/queryGoodsSubByPage')")
     public Object queryGoodsSubByPage(GoodsWrapper.GoodsSubQuery query) {
         return succeed(goodsService.queryGoodsSubByPage(query));
 

+ 7 - 0
mec-application/src/main/java/com/ym/mec/web/controller/ImportController.java

@@ -67,6 +67,13 @@ public class ImportController extends BaseController {
         return succeed(goodsService.importGoods(file, sysUserService.getUserId()));
     }
 
+    @ApiOperation(value = "导入商品")
+    @PostMapping(value = "goodsV2")
+    @PreAuthorize("@pcs.hasPermissions('import/goodsV2')")
+    public HttpResponseResult<List<Goods>> importGoodsV2(@RequestParam("file") MultipartFile file) throws Exception {
+        return succeed(goodsService.importGoodsV2(file, sysUserService.getUserId()));
+    }
+
     @ApiOperation(value = "导入财务支出")
     @PostMapping(value = "financialExpenditure")
     @PreAuthorize("@pcs.hasPermissions('import/financialExpenditure')")

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/GoodsService.java

@@ -78,6 +78,15 @@ public interface GoodsService extends BaseService<Integer, Goods> {
     List<Goods> importGoods(MultipartFile file, Integer operatorId) throws Exception;
 
     /**
+     * 导入组合商品
+     * @param file 文件
+     * @param userId 导入人信息
+     * @return 商品列表
+     */
+    List<Goods> importGoodsV2(MultipartFile file, Integer userId);
+
+
+    /**
      * @describe 库存预警
      * @apiNote 时光荏苒,认真工作的时间总是过得很快,而我、享受这一刻!
      * @author zouxuan

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -193,6 +193,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		paramDto.setPublishStatus(1);
 		paramDto.setPageSize(1000);
 		paramDto.setPageNum(1);
+		paramDto.setJson(JSON.toJSONString(paramDto));
 		List<PmsProductDto> productList = mallFeignService.getProductList(paramDto).getRows();
 		if(CollectionUtils.isEmpty(productList)){
 			throw new BizException("子商品不存在");
@@ -305,6 +306,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 					.productIds(String.join(",", goodIdList))
 					.pageSize(9999)
 					.pageNum(1).build();
+			build.setJson(JSON.toJSONString(build));
 			Map<String, PmsProductDto> map = mallFeignService.getProductList(build)
 					.getRows().stream().collect(Collectors.toMap(next -> next.getGoodsId() + "_" + next.getSkuStockId(), Function.identity()));
 			goodsSubList.forEach(next -> {
@@ -535,6 +537,12 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 		return goodsList;
 	}
 
+
+	@Override
+	public List<Goods> importGoodsV2(MultipartFile file, Integer userId) {
+		return null;
+	}
+
 	@Override
 	public void repertoryWarn(Integer tenantId) {
 		//预警手机号
@@ -864,6 +872,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 				.pageNum(query.getPage())
 				.pageSize(query.getRows())
 				.build();
+		dto.setJson(JSON.toJSONString(dto));
 		return mallFeignService.getProductList(dto);
 	}
 

+ 5 - 1
mec-client-api/src/main/java/com/ym/mec/mall/MallFeignService.java

@@ -7,7 +7,10 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.mall.fallback.MallFeignServiceFallback;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
 
 @FeignClient(name = "${app-config.open-feign.mall-server.name:mall-server}",
 		contextId = "MallFeignService",
@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 public interface MallFeignService {
 
 	@PostMapping(value = "open/product/list")
-	PageInfo<PmsProductDto> getProductList(PmsProductQueryParamDto productQueryParam);
+	@ResponseBody
+	PageInfo<PmsProductDto> getProductList(@RequestBody PmsProductQueryParamDto productQueryParam);
 
 }

+ 2 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/dto/PmsProductQueryParamDto.java

@@ -35,4 +35,6 @@ public class PmsProductQueryParamDto {
     private Integer pageSize;
 //    @NotNull(message = "页码不能为空")
     private Integer pageNum;
+
+    private String json;
 }

+ 1 - 1
mec-common/common-core/src/main/java/com/ym/mec/common/page/PageInfo.java

@@ -138,6 +138,7 @@ public class PageInfo<T> implements Serializable {
 	}
 
 	public int getTotalPage() {
+		this.totalPage = new BigDecimal(total).divide(new BigDecimal(limit), 0, BigDecimal.ROUND_CEILING).intValue();
 		return totalPage;
 	}
 
@@ -147,7 +148,6 @@ public class PageInfo<T> implements Serializable {
 
 	public void setTotal(int total) {
 		this.total = total;
-		this.totalPage=new BigDecimal(total).divide(new BigDecimal(limit),0,BigDecimal.ROUND_CEILING).intValue();
 	}
 
 	public List<T> getRows() {

+ 3 - 1
mec-mall/mall-admin/src/main/java/com/yonge/cooleshow/admin/controller/open/OpenController.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.admin.controller.open;
 
+import com.alibaba.fastjson.JSON;
 import com.ym.mec.common.dto.PmsProductDto;
 import com.ym.mec.common.dto.PmsProductQueryParamDto;
 import com.ym.mec.common.page.PageInfo;
@@ -76,7 +77,8 @@ public class OpenController {
     @PostMapping(value = "/product/list")
     @ResponseBody
     public PageInfo<PmsProductDto> getProductList(@RequestBody @Validated PmsProductQueryParamDto productQueryParam){
-
+        String json = productQueryParam.getJson();
+        productQueryParam = JSON.parseObject(json,PmsProductQueryParamDto.class);
         List<PmsProductDto> feignProductList = productService.getFeignProductList(productQueryParam);
         CommonPage<PmsProductDto> dtoCommonPage = CommonPage.restPage(feignProductList);
         PageInfo<PmsProductDto> pageInfo = new PageInfo<>(productQueryParam.getPageNum(),productQueryParam.getPageSize());