提交 f2a1432b 作者: xiaowang

新增:商品列表

上级 1a012e0e
package com.mmc.pms.controller; package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.Categories;
import com.mmc.pms.model.categories.dto.AllCategoryDTO; import com.mmc.pms.model.categories.dto.AllCategoryDTO;
import com.mmc.pms.model.categories.dto.ClassifyDetailsDTO; import com.mmc.pms.model.categories.dto.ClassifyDetailsDTO;
import com.mmc.pms.model.categories.dto.ClassifyInfoDTO; import com.mmc.pms.model.categories.dto.ClassifyInfoDTO;
import com.mmc.pms.model.categories.vo.CategoriesInfoVO;
import com.mmc.pms.model.categories.vo.ClassifyInfoVO; import com.mmc.pms.model.categories.vo.ClassifyInfoVO;
import com.mmc.pms.model.categories.vo.DirectoryInfoVO; import com.mmc.pms.model.categories.vo.DirectoryInfoVO;
import com.mmc.pms.model.categories.vo.RelevantBusinessVO; import com.mmc.pms.model.categories.vo.RelevantBusinessVO;
...@@ -17,10 +15,8 @@ import io.swagger.annotations.*; ...@@ -17,10 +15,8 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import java.util.List;
/** /**
* @Author lw @Date 2023/5/15 13:24 @Version 1.0 * @Author lw @Date 2023/5/15 13:24 @Version 1.0
...@@ -29,96 +25,107 @@ import java.util.List; ...@@ -29,96 +25,107 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/classify") @RequestMapping("/classify")
public class BackstageCategoriesController { public class BackstageCategoriesController {
@Autowired @Autowired private CategoriesService categoriesService;
private CategoriesService categoriesService;
@ApiOperation(value = "新增or修改目录")
@ApiOperation(value = "新增or修改目录") @PostMapping("addOrEditDirectory")
@PostMapping("addOrEditDirectory") @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) public ResultBody addOrEditDirectory(@RequestBody DirectoryInfoVO param) {
public ResultBody addOrEditDirectory(@RequestBody DirectoryInfoVO param) { return categoriesService.addOrEditDirectory(param);
return categoriesService.addOrEditDirectory(param); }
}
@ApiOperation(value = "目录列表")
@ApiOperation(value = "目录列表") @GetMapping("directoryList")
@GetMapping("directoryList") @ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)}) public ResultBody directoryList(
public ResultBody directoryList(@RequestParam Integer pageNo, @RequestParam Integer pageSize, @RequestParam(required = false) Integer type) { @RequestParam Integer pageNo,
return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type)); @RequestParam Integer pageSize,
} @RequestParam(required = false) Integer type) {
return ResultBody.success(categoriesService.directoryList(pageNo, pageSize, type));
@ApiOperation(value = "删除目录") }
@GetMapping("removeDirectory")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiOperation(value = "删除目录")
public ResultBody removeDirectory(@ApiParam(value = "id") @RequestParam(value = "id") Integer id) { @GetMapping("removeDirectory")
return categoriesService.removeDirectory(id); @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
} public ResultBody removeDirectory(
@ApiParam(value = "id") @RequestParam(value = "id") Integer id) {
@ApiOperation(value = "分类新增") return categoriesService.removeDirectory(id);
@PostMapping("addClassification") }
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addClassification(@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) { @ApiOperation(value = "分类新增")
return categoriesService.addClassification(classifyInfoVO); @PostMapping("addClassification")
} @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addClassification(
@Validated(Create.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
@ApiOperation(value = "分类修改") return categoriesService.addClassification(classifyInfoVO);
@PostMapping("updateClassification") }
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateClassification(@Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) { @ApiOperation(value = "分类修改")
return categoriesService.updateClassification(classifyInfoVO); @PostMapping("updateClassification")
} @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody updateClassification(
@ApiOperation(value = "分类信息-排序") @Validated(Update.class) @RequestBody ClassifyInfoVO classifyInfoVO) {
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) return categoriesService.updateClassification(classifyInfoVO);
@GetMapping("exchangeSortType") }
public ResultBody exchangeSortType(@ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId") Integer firstId,
@ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId") Integer secondId) { @ApiOperation(value = "分类信息-排序")
return categoriesService.exchangeSortType(firstId, secondId); @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
} @GetMapping("exchangeSortType")
public ResultBody exchangeSortType(
@ApiParam(value = "第一个分类id", required = true) @RequestParam(value = "firstId")
@ApiOperation(value = "分类信息-列表") Integer firstId,
@PostMapping("getClassificationList") @ApiParam(value = "第二个分类id", required = true) @RequestParam(value = "secondId")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)}) Integer secondId) {
public ResultBody getClassificationList(@RequestBody QueryClassifyVO queryClassifyVO) { return categoriesService.exchangeSortType(firstId, secondId);
return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO)); }
}
@ApiOperation(value = "分类信息-列表")
@PostMapping("getClassificationList")
@ApiOperation(value = "分类详情") @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyInfoDTO.class)})
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)}) public ResultBody getClassificationList(@RequestBody QueryClassifyVO queryClassifyVO) {
@GetMapping("getClassifyDetails") return ResultBody.success(categoriesService.getClassificationList(queryClassifyVO));
public ResultBody getClassifyDetails(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) { }
return categoriesService.getClassifyDetails(id);
} @ApiOperation(value = "分类详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ClassifyDetailsDTO.class)})
@ApiOperation(value = "分类详情") @GetMapping("getClassifyDetails")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)}) public ResultBody getClassifyDetails(
@GetMapping("queryRelevantBusiness") @ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id) {
public ResultBody queryRelevantBusiness(@ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id, return categoriesService.getClassifyDetails(id);
@ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type") Integer type) { }
return categoriesService.queryRelevantBusiness(id, type);
} @ApiOperation(value = "分类详情下关联业务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
@ApiOperation(value = "分类删除") @GetMapping("queryRelevantBusiness")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)}) public ResultBody queryRelevantBusiness(
@GetMapping("deleteRelevantBusiness") @ApiParam(value = "分类id", required = true) @RequestParam(value = "id") Integer id,
public ResultBody deleteRelevantBusiness(@ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id") Integer id) { @ApiParam(value = "业务类型", required = true) @Min(value = 0) @RequestParam(value = "type")
return categoriesService.deleteRelevantBusiness(id); Integer type) {
} return categoriesService.queryRelevantBusiness(id, type);
}
@ApiOperation(value = "目录列表不含分页")
@GetMapping("getDirectoryList") @ApiOperation(value = "分类删除")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = RelevantBusinessVO.class)})
public ResultBody getDirectoryList(Integer type) { @GetMapping("deleteRelevantBusiness")
return categoriesService.getDirectoryList(type); public ResultBody deleteRelevantBusiness(
} @ApiParam(value = "分类id", required = true) @Min(value = 1) @RequestParam(value = "id")
Integer id) {
@ApiOperation(value = "根据类型获取各个目录及分类信息") return categoriesService.deleteRelevantBusiness(id);
@GetMapping("queryCategoryInfoByType") }
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AllCategoryDTO.class)})
public ResultBody queryCategoryInfoByType(@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城", required = true) @RequestParam(value = "type") Integer type) { @ApiOperation(value = "目录列表不含分页")
return categoriesService.queryCategoryInfoByType(type); @GetMapping("getDirectoryList")
} @ApiResponses({@ApiResponse(code = 200, message = "OK", response = DirectoryInfoVO.class)})
public ResultBody getDirectoryList(Integer type) {
return categoriesService.getDirectoryList(type);
}
@ApiOperation(value = "根据类型获取各个目录及分类信息")
@GetMapping("queryCategoryInfoByType")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = AllCategoryDTO.class)})
public ResultBody queryCategoryInfoByType(
@ApiParam(value = "类型:1:作业服务 2:设备 3:培训 4:产品商城", required = true) @RequestParam(value = "type")
Integer type) {
return categoriesService.queryCategoryInfoByType(type);
}
} }
...@@ -8,6 +8,7 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO; ...@@ -8,6 +8,7 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO; import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO; import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.*; import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO; import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.service.GoodsInfoService; import com.mmc.pms.service.GoodsInfoService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
...@@ -51,6 +52,13 @@ public class BackstageGoodsManageController { ...@@ -51,6 +52,13 @@ public class BackstageGoodsManageController {
return goodsInfoService.getGoodsInfoDetail(goodsInfoId); return goodsInfoService.getGoodsInfoDetail(goodsInfoId);
} }
@ApiOperation(value = "商品列表-分页")
@PostMapping("listPageGoodsInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = GoodsInfoListDTO.class)})
public ResultBody listPageGoodsInfo(@ApiParam("商品查询条件QO") @RequestBody MallGoodsQO param) {
return ResultBody.success(goodsInfoService.listPageGoodsInfo(param));
}
@ApiOperation(value = "单位信息") @ApiOperation(value = "单位信息")
@GetMapping("getSkuUnit") @GetMapping("getSkuUnit")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = SkuUnitDTO.class)})
......
package com.mmc.pms.controller; package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.model.lease.dto.BrandDTO;
import com.mmc.pms.model.lease.dto.DeviceCategoryDTO;
import com.mmc.pms.model.lease.dto.WareInfoDTO;
import com.mmc.pms.model.lease.vo.LeaseVo;
import com.mmc.pms.model.other.dto.AdDTO; import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.other.dto.DistrictInfoDTO; import com.mmc.pms.model.other.dto.DistrictInfoDTO;
import com.mmc.pms.model.other.dto.ModelDTO;
import com.mmc.pms.service.WebDeviceService; import com.mmc.pms.service.WebDeviceService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @Author small @Date 2023/5/15 13:25 @Version 1.0 * @Author small @Date 2023/5/15 13:25 @Version 1.0
...@@ -25,75 +21,18 @@ import org.springframework.web.bind.annotation.*; ...@@ -25,75 +21,18 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/webDevice") @RequestMapping("/webDevice")
public class WebDeviceController { public class WebDeviceController {
@Autowired @Autowired private WebDeviceService webDeviceService;
private WebDeviceService webDeviceService;
@ApiOperation(value = "地域") @ApiOperation(value = "地域")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/getSecondDistrictInfo") @GetMapping("/getSecondDistrictInfo")
public ResultBody<DistrictInfoDTO> getSecondDistrictInfo() { public ResultBody<DistrictInfoDTO> getSecondDistrictInfo() {
return webDeviceService.listSecondDistrict(); return webDeviceService.listSecondDistrict();
} }
@ApiOperation("设备类目")
@GetMapping("/category")
public ResultBody<DeviceCategoryDTO> category() {
return webDeviceService.category();
}
@ApiOperation("品牌")
@GetMapping("/brand")
public ResultBody<BrandDTO> brand() {
return webDeviceService.brand();
}
@ApiOperation("型号")
@GetMapping("/model")
public ResultBody<ModelDTO> model() {
return webDeviceService.model();
}
@ApiOperation("设备品牌")
@GetMapping("/deviceBrand")
public ResultBody<BrandDTO> deviceBrand() {
return webDeviceService.deviceBrand();
}
@ApiOperation("设备型号")
@GetMapping("/deviceModel")
public ResultBody<ModelDTO> deviceModel() {
return webDeviceService.deviceModel();
}
@ApiOperation(value = "设备详情")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/detail")
public ResultBody<WareInfoDTO> detail(@RequestParam(value = "id", required = true) Integer id) {
WareInfoDTO wareInfoDTO = webDeviceService.getWareInfoById(id);
return wareInfoDTO == null
? ResultBody.error(ResultEnum.NOT_FOUND)
: ResultBody.success(wareInfoDTO);
}
@ApiOperation(value = "立即租赁")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("/update")
public ResultBody update(@RequestBody LeaseVo param) {
return webDeviceService.update(param);
}
@ApiOperation("设备广告位")
@GetMapping("/ad")
public ResultBody<AdDTO> ad() {
return webDeviceService.ad();
}
//
// @ApiOperation(value = "设备列表筛选")
// @ApiResponses({@ApiResponse(code = 200, message = "OK", response = WareInfoItemDTO.class)})
// @PostMapping("/deviceList")
// public ResultBody<WareInfoItemDTO> listWareInfoPage(
// @RequestBody @Validated(Page.class) WareInfoQO param) {
// return webDeviceService.listWareInfoPage(param, request);
// }
@ApiOperation("设备广告位")
@GetMapping("/ad")
public ResultBody<AdDTO> ad() {
return webDeviceService.ad();
}
} }
package com.mmc.pms.dao; package com.mmc.pms.dao;
import com.mmc.pms.entity.*; import com.mmc.pms.entity.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO; import com.mmc.pms.model.sale.vo.GoodsAddVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -96,4 +97,8 @@ public interface GoodsInfoDao { ...@@ -96,4 +97,8 @@ public interface GoodsInfoDao {
List<MallProdSkuInfoSpecDO> listMallprodSpecById(List<Integer> goodsIds); List<MallProdSkuInfoSpecDO> listMallprodSpecById(List<Integer> goodsIds);
List<SaleServiceDO> listSaleServiceInfo(); List<SaleServiceDO> listSaleServiceInfo();
int countListGoodsInfo(MallGoodsQO param);
List<GoodsInfo> listGoodsInfo(MallGoodsQO param);
} }
...@@ -82,8 +82,6 @@ public interface ProductDao { ...@@ -82,8 +82,6 @@ public interface ProductDao {
void removeProductSku(Integer id); void removeProductSku(Integer id);
List<MallProdInfoDO> listMallProdInfo(String id);
void removeProductSpec(Integer id); void removeProductSpec(Integer id);
List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds); List<IndustrySpecDO> listIndustrySpec(@Param("industrySpecIds") Set<Integer> industrySpecIds);
......
...@@ -2,6 +2,7 @@ package com.mmc.pms.entity; ...@@ -2,6 +2,7 @@ package com.mmc.pms.entity;
import com.mmc.pms.model.categories.vo.RelevanceGoodsInfoVO; import com.mmc.pms.model.categories.vo.RelevanceGoodsInfoVO;
import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO; import com.mmc.pms.model.lease.dto.LeaseGoodsInfoDTO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.sale.vo.GoodsAddVO; import com.mmc.pms.model.sale.vo.GoodsAddVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -11,73 +12,94 @@ import java.io.Serializable; ...@@ -11,73 +12,94 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* @author 23214 * @author 23214 @TableName goods_info
* @TableName goods_info
*/ */
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class GoodsInfo implements Serializable { public class GoodsInfo implements Serializable {
private Integer id; private Integer id;
private Integer pid; private Integer pid;
private String goodsNo; private String goodsNo;
private String goodsName; private String goodsName;
private Integer directoryId; private Integer directoryId;
private Integer addGoodsUserId; private Integer addGoodsUserId;
private Integer categoryByOne; private Integer categoryByOne;
private Integer categoryByTwo; private Integer categoryByTwo;
private String ecoLabel; private String ecoLabel;
private Integer shelfStatus; private Integer shelfStatus;
private Integer showCode; private Integer showCode;
private Integer sort; private Integer sort;
private Date createTime; private Date createTime;
private Integer goodsType; private Integer goodsType;
private Date updateTime; private Date updateTime;
private Integer deleted; private Integer deleted;
private Integer goodsVideoId; private Integer goodsVideoId;
private String videoUrl; private String videoUrl;
private String mainImg; private String mainImg;
private static final long serialVersionUID = 1L; private Integer isCoupons;
public GoodsInfo(GoodsAddVO goodsAddVO) { private String directoryName;
this.id = goodsAddVO.getId();
this.goodsName = goodsAddVO.getGoodsName();
this.shelfStatus = goodsAddVO.getShelfStatus();
this.categoryByOne = goodsAddVO.getCategoryByOne();
this.categoryByTwo = goodsAddVO.getCategoryByTwo();
this.directoryId = goodsAddVO.getDirectoryId();
this.ecoLabel = goodsAddVO.getTag();
this.goodsType = goodsAddVO.getGoodsType();
}
public GoodsInfo(Integer id) { private static final long serialVersionUID = 1L;
this.id = id;
}
public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() { public GoodsInfo(GoodsAddVO goodsAddVO) {
return RelevanceGoodsInfoVO.builder().id(id).goodsName(goodsName).shelf(shelfStatus).mainImage(mainImg).build(); this.id = goodsAddVO.getId();
} this.goodsName = goodsAddVO.getGoodsName();
this.shelfStatus = goodsAddVO.getShelfStatus();
this.categoryByOne = goodsAddVO.getCategoryByOne();
this.categoryByTwo = goodsAddVO.getCategoryByTwo();
this.directoryId = goodsAddVO.getDirectoryId();
this.ecoLabel = goodsAddVO.getTag();
this.goodsType = goodsAddVO.getGoodsType();
}
public LeaseGoodsInfoDTO buildLeaseGoodsInfoDTO() { public GoodsInfo(Integer id) {
return LeaseGoodsInfoDTO.builder().id(id).goodsName(goodsName).images(mainImg).build(); this.id = id;
} }
}
\ No newline at end of file public RelevanceGoodsInfoVO buildRelevanceGoodsInfoVO() {
return RelevanceGoodsInfoVO.builder()
.id(id)
.goodsName(goodsName)
.shelf(shelfStatus)
.mainImage(mainImg)
.build();
}
public LeaseGoodsInfoDTO buildLeaseGoodsInfoDTO() {
return LeaseGoodsInfoDTO.builder().id(id).goodsName(goodsName).images(mainImg).build();
}
public GoodsInfoListDTO buildGoodsInfoListDTO() {
return GoodsInfoListDTO.builder()
.id(id)
.goodsName(goodsName)
.directoryName(directoryName)
.directoryId(directoryId)
.createTime(createTime)
.imgUrl(mainImg)
.status(shelfStatus)
.isCoupons(this.isCoupons)
.build();
}
}
package com.mmc.pms.model.sale.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @Author LW
*
* @date 2022/3/22 9:44 概要:商品列表查询QO
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MallGoodsQO {
@ApiModelProperty(value = "商品名称", example = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品类型 0:销售 1:租赁", example = "0")
private Integer goodsType;
@ApiModelProperty(value = "开始时间", example = "2023-06-09 00:00:00")
private String startTime;
@ApiModelProperty(value = "结束时间", example = "2023-06-11 23:59:59")
private String endTime;
@ApiModelProperty(value = "状态 0:下架(仓库中)1:上架", example = "1")
private Integer status;
@ApiModelProperty(value = "目录id", example = "1")
private Integer directoryId;
@ApiModelProperty(value = "页码", required = true, example = "1")
@NotNull(
message = "页码不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true, example = "10")
@NotNull(
message = "每页显示数不能为空",
groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
...@@ -8,7 +8,9 @@ import com.mmc.pms.model.qo.ProductSpecPriceQO; ...@@ -8,7 +8,9 @@ import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.MallGoodsShopCarDTO; import com.mmc.pms.model.sale.dto.MallGoodsShopCarDTO;
import com.mmc.pms.model.sale.dto.MallProductSpecPriceDTO; import com.mmc.pms.model.sale.dto.MallProductSpecPriceDTO;
import com.mmc.pms.model.sale.dto.ProductSpecPriceDTO; import com.mmc.pms.model.sale.dto.ProductSpecPriceDTO;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.GoodsAddVO; import com.mmc.pms.model.sale.vo.GoodsAddVO;
import com.mmc.pms.page.PageResult;
import java.util.List; import java.util.List;
...@@ -38,4 +40,6 @@ public interface GoodsInfoService { ...@@ -38,4 +40,6 @@ public interface GoodsInfoService {
List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); List<OrderGoodsProdDTO> feignListProdGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO); List<OrderGoodsIndstDTO> feignListIndstGoodsSkuInfo(MallOrderGoodsInfoQO mallOrderGoodsInfoQO);
PageResult listPageGoodsInfo(MallGoodsQO param);
} }
...@@ -12,7 +12,9 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDetailDTO; ...@@ -12,7 +12,9 @@ import com.mmc.pms.model.order.dto.OrderGoodsProdDetailDTO;
import com.mmc.pms.model.qo.MallOrderGoodsInfoQO; import com.mmc.pms.model.qo.MallOrderGoodsInfoQO;
import com.mmc.pms.model.qo.ProductSpecPriceQO; import com.mmc.pms.model.qo.ProductSpecPriceQO;
import com.mmc.pms.model.sale.dto.*; import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.qo.MallGoodsQO;
import com.mmc.pms.model.sale.vo.*; import com.mmc.pms.model.sale.vo.*;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.GoodsInfoService; import com.mmc.pms.service.GoodsInfoService;
import com.mmc.pms.util.CodeUtil; import com.mmc.pms.util.CodeUtil;
import com.mmc.pms.util.TDateUtil; import com.mmc.pms.util.TDateUtil;
...@@ -1102,4 +1104,18 @@ public class GoodsInfoServiceImpl implements GoodsInfoService { ...@@ -1102,4 +1104,18 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
} }
return mallGoodsInfoSimpleDOS; return mallGoodsInfoSimpleDOS;
} }
@Override
public PageResult listPageGoodsInfo(MallGoodsQO param) {
int count = goodsInfoDao.countListGoodsInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfo> goodsInfo = goodsInfoDao.listGoodsInfo(param);
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfo::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
} }
...@@ -3,12 +3,9 @@ package com.mmc.pms.service.Impl; ...@@ -3,12 +3,9 @@ package com.mmc.pms.service.Impl;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum; import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.MiniProgramProductMallDao; import com.mmc.pms.dao.MiniProgramProductMallDao;
import com.mmc.pms.dao.WebDeviceDao;
import com.mmc.pms.entity.*; import com.mmc.pms.entity.*;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.*; import com.mmc.pms.model.sale.dto.*;
import com.mmc.pms.model.sale.vo.GoodsProductSkuVO; import com.mmc.pms.model.sale.vo.GoodsProductSkuVO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.MiniProgramProductMallService; import com.mmc.pms.service.MiniProgramProductMallService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -26,210 +23,184 @@ import java.util.stream.Collectors; ...@@ -26,210 +23,184 @@ import java.util.stream.Collectors;
@Service @Service
public class MiniProgramProductMallServiceImpl implements MiniProgramProductMallService { public class MiniProgramProductMallServiceImpl implements MiniProgramProductMallService {
@Autowired @Autowired private MiniProgramProductMallDao goodsInfoDao;
private MiniProgramProductMallDao goodsInfoDao;
@Autowired
private WebDeviceDao webDeviceDao;
@Override @Override
public ResultBody getAppGoodsInfoDetail(Integer goodsId) { public ResultBody getAppGoodsInfoDetail(Integer goodsId) {
// 查询此商品是否下架或删除 // 查询此商品是否下架或删除
GoodsInfoDO goodsInfoDO = goodsInfoDao.getGoodsInfoByGoodsId(goodsId); GoodsInfoDO goodsInfoDO = goodsInfoDao.getGoodsInfoByGoodsId(goodsId);
if (goodsInfoDO == null || goodsInfoDO.getShelfStatus().equals(0)) { if (goodsInfoDO == null || goodsInfoDO.getShelfStatus().equals(0)) {
return ResultBody.error(ResultEnum.SHOP_GOODS_NOT_ERROR); return ResultBody.error(ResultEnum.SHOP_GOODS_NOT_ERROR);
} }
AppGoodsInfoDetailDTO appGoodsInfoDetailDTO = new AppGoodsInfoDetailDTO(); AppGoodsInfoDetailDTO appGoodsInfoDetailDTO = new AppGoodsInfoDetailDTO();
appGoodsInfoDetailDTO appGoodsInfoDetailDTO
.setId(goodsInfoDO.getId()) .setId(goodsInfoDO.getId())
.setGoodsName(goodsInfoDO.getGoodsName()) .setGoodsName(goodsInfoDO.getGoodsName())
.setGoodsVideoId(goodsInfoDO.getGoodsVideoId()) .setGoodsVideoId(goodsInfoDO.getGoodsVideoId())
.setMasterTypeId(goodsInfoDO.getMasterTypeId()) .setMasterTypeId(goodsInfoDO.getMasterTypeId())
.setRepoId(goodsInfoDO.getRepoId()) .setRepoId(goodsInfoDO.getRepoId())
.setSortTypeId(goodsInfoDO.getSortTypeId()) .setSortTypeId(goodsInfoDO.getSortTypeId())
.setShelfStatus(goodsInfoDO.getShelfStatus()) .setShelfStatus(goodsInfoDO.getShelfStatus())
.setSlaveTypeId(goodsInfoDO.getSlaveTypeId()) .setSlaveTypeId(goodsInfoDO.getSlaveTypeId())
.setShareFlyServiceId(goodsInfoDO.getShareFlyServiceId()) .setShareFlyServiceId(goodsInfoDO.getShareFlyServiceId())
.setGoodsVideo(goodsInfoDO.getVideoUrl()) .setGoodsVideo(goodsInfoDO.getVideoUrl())
.setTag(goodsInfoDO.getTag()) .setTag(goodsInfoDO.getTag())
.setPid(goodsInfoDO.getPid()); .setPid(goodsInfoDO.getPid());
// 获取商品图片信息 // 获取商品图片信息
List<GoodsImgDO> goodsImgDO = goodsInfoDao.listGoodsInfoByGoodsId(goodsId); List<GoodsImgDO> goodsImgDO = goodsInfoDao.listGoodsInfoByGoodsId(goodsId);
appGoodsInfoDetailDTO.setImages( appGoodsInfoDetailDTO.setImages(
goodsImgDO.stream().map(GoodsImgDO::buildGoodsImgDTO).collect(Collectors.toList())); goodsImgDO.stream().map(GoodsImgDO::buildGoodsImgDTO).collect(Collectors.toList()));
// 获取商品详情信息 // 获取商品详情信息
GoodsDetailDO goodsDetailDO = goodsInfoDao.getGoodsDetailByGoodsId(goodsId); GoodsDetailDO goodsDetailDO = goodsInfoDao.getGoodsDetailByGoodsId(goodsId);
appGoodsInfoDetailDTO.setGoodsDetail(goodsDetailDO.buildGoodsDetailInfoDTO()); appGoodsInfoDetailDTO.setGoodsDetail(goodsDetailDO.buildGoodsDetailInfoDTO());
// 获取其他服务信息 // 获取其他服务信息
List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsId); List<GoodsServiceDO> goodsServiceDO = goodsInfoDao.listGoodsServiceByGoodsId(goodsId);
appGoodsInfoDetailDTO.setOtherService( appGoodsInfoDetailDTO.setOtherService(
goodsServiceDO.stream() goodsServiceDO.stream()
.map(GoodsServiceDO::buildGoodsOtherServiceDTO) .map(GoodsServiceDO::buildGoodsOtherServiceDTO)
.collect(Collectors.toList())); .collect(Collectors.toList()));
// 判断商品是什么类型 // 判断商品是什么类型
if (!goodsInfoDO.getSortTypeId().equals(2)) { if (!goodsInfoDO.getSortTypeId().equals(2)) {
// 获取该商品绑定的sku信息 // 获取该商品绑定的sku信息
List<MallProdInfoDO> mallProdSkuInfo = goodsInfoDao.getMallProdInfoByGoodsId(goodsId); List<MallProdInfoDO> mallProdSkuInfo = goodsInfoDao.getMallProdInfoByGoodsId(goodsId);
// 获取该商品绑定的规格信息 // 获取该商品绑定的规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList = List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecList =
goodsInfoDao.listMallProdSkuInfoSpec(goodsId); goodsInfoDao.listMallProdSkuInfoSpec(goodsId);
Map<Integer, List<MallProdSkuInfoSpecDO>> specMap = Map<Integer, List<MallProdSkuInfoSpecDO>> specMap =
mallProdSkuInfoSpecList.stream() mallProdSkuInfoSpecList.stream()
.collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId)); .collect(Collectors.groupingBy(MallProdSkuInfoSpecDO::getMallProdSkuInfoId));
List<GoodsSpecDTO> list = List<GoodsSpecDTO> list =
mallProdSkuInfo.stream() mallProdSkuInfo.stream()
.map( .map(
d -> { d -> {
// 获取sku下规格信息 // 获取sku下规格信息
List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecDOList = specMap.get(d.getId()); List<MallProdSkuInfoSpecDO> mallProdSkuInfoSpecDOList = specMap.get(d.getId());
List<ProductSpecDO> productSpecList = List<ProductSpecDO> productSpecList =
goodsInfoDao.listProductSpecInfo( goodsInfoDao.listProductSpecInfo(
mallProdSkuInfoSpecDOList.stream() mallProdSkuInfoSpecDOList.stream()
.map(MallProdSkuInfoSpecDO::getProductSpecId) .map(MallProdSkuInfoSpecDO::getProductSpecId)
.collect(Collectors.toList())); .collect(Collectors.toList()));
List<MallProductSpecDTO> collect = List<MallProductSpecDTO> collect =
productSpecList.stream() productSpecList.stream()
.map(ProductSpecDO::buildMallProductSpecDTO) .map(ProductSpecDO::buildMallProductSpecDTO)
.collect(Collectors.toList());
collect.stream()
.peek(
m -> {
for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO :
mallProdSkuInfoSpecDOList) {
if (m.getProductSpec()
.equals(mallProdSkuInfoSpecDO.getProductSpecId())) {
m.setId(mallProdSkuInfoSpecDO.getId());
break;
}
}
})
.collect(Collectors.toList());
GoodsSpecDTO goodsSpecDTO = new GoodsSpecDTO();
goodsSpecDTO
.setId(d.getId())
.setSkuId(d.getProdSkuId())
.setGoodsSpecName(d.getProdSkuSpecName())
.setSkuName(d.getProductSkuName())
.setBrandInfoId(d.getBrandInfoId())
.setCategoryId(d.getCategoriesId())
.setTypeName(d.getTypeName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setUnitName(d.getUnitName())
.setMust(d.getMust())
.setProductSpecList(collect);
return goodsSpecDTO;
})
.collect(Collectors.toList()); .collect(Collectors.toList());
appGoodsInfoDetailDTO.setGoodsSpec(list); collect.stream()
} else { .peek(
appGoodsInfoDetailDTO.setGoodsSpec(getIndustrySpecInfo(goodsId)); m -> {
} for (MallProdSkuInfoSpecDO mallProdSkuInfoSpecDO :
return ResultBody.success(appGoodsInfoDetailDTO); mallProdSkuInfoSpecDOList) {
if (m.getProductSpec()
.equals(mallProdSkuInfoSpecDO.getProductSpecId())) {
m.setId(mallProdSkuInfoSpecDO.getId());
break;
}
}
})
.collect(Collectors.toList());
GoodsSpecDTO goodsSpecDTO = new GoodsSpecDTO();
goodsSpecDTO
.setId(d.getId())
.setSkuId(d.getProdSkuId())
.setGoodsSpecName(d.getProdSkuSpecName())
.setSkuName(d.getProductSkuName())
.setBrandInfoId(d.getBrandInfoId())
.setCategoryId(d.getCategoriesId())
.setTypeName(d.getTypeName())
.setChooseType(d.getChooseType())
.setSkuUnitId(d.getSkuUnitId())
.setUnitName(d.getUnitName())
.setMust(d.getMust())
.setProductSpecList(collect);
return goodsSpecDTO;
})
.collect(Collectors.toList());
appGoodsInfoDetailDTO.setGoodsSpec(list);
} else {
appGoodsInfoDetailDTO.setGoodsSpec(getIndustrySpecInfo(goodsId));
} }
return ResultBody.success(appGoodsInfoDetailDTO);
}
@Override private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) {
public ResultBody listGoodsByQO(GoodsInfoQO param) { // 获取商品对应绑定的行业sku信息
int count = goodsInfoDao.countListGoodsByQO(param); List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList =
if (count == 0) { goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId);
return ResultBody.success( List<GoodsSpecDTO> list =
PageResult.buildPage(param.getPageNo(), param.getPageSize(), count)); mallIndustrySkuInfoList.stream()
} .map(MallIndustrySkuInfoDO::buildGoodsSpecDTO)
int pageNo = param.getPageNo(); .collect(Collectors.toList());
param.buildCurrentPage(); // 根据商品id查出该商品下绑定的规格信息
List<GoodsInfoDO> list = goodsInfoDao.listGoodsByQO(param); List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec =
// 找出行业对应的序号 goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId);
List<GoodsTypeDO> ids = goodsInfoDao.listIndustryIdBySort(); list =
int order = 0; list.stream()
/*if (param.getMasterTypeId() != null) { .peek(
for (int i = 0; i < ids.size(); i++) { d -> {
if (param.getMasterTypeId().toString().equals(ids.get(i).getId().toString())) { List<MallIndustrySpecDTO> industrySpec = new ArrayList<>();
order = i + 1; for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) {
break; if (d.getId().equals(e.getMallIndustrySkuInfoId())) {
} IndustrySpecDO industrySpecDO = e.getIndustrySpecDO();
} // 获取商品清单信息
}*/ List<IndustryProductInventoryDO> industryProdInventory =
List<AppGoodsInfoDTO> pageList = new ArrayList<>(); goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId());
for (GoodsInfoDO d : list) { List<ProductInventoryVO> productInventoryList = new ArrayList<>();
AppGoodsInfoDTO appGoodsInfoDTO = d.buildAppGoodsInfoDTO(); // 获取行业规格绑定的产品规格信息
// 直接看该服务在当前行业对应所有服务中在第几个 List<InventorySpecDO> inventorySpecDOList =
for (int j = 0; j < list.size(); j++) { goodsInfoDao.listInventorySpec(
if (appGoodsInfoDTO.getId().toString().equals(list.get(j).getId().toString())) { industryProdInventory.stream()
if (j < 9) { .map(IndustryProductInventoryDO::getId)
appGoodsInfoDTO.setCode(order + "0" + (j + 1)); .collect(Collectors.toList()));
} else { Map<Integer, List<InventorySpecDO>> inventoryMap =
appGoodsInfoDTO.setCode(order + "" + (j + 1)); inventorySpecDOList.stream()
.collect(
Collectors.groupingBy(
InventorySpecDO::getIndustryProductInventoryId));
getIndustrySpecOnProdSpecInfo(
industryProdInventory, productInventoryList, inventoryMap);
MallIndustrySpecDTO industrySpecDTO =
industrySpecDO.buildMallIndustrySpecDTO();
industrySpecDTO.setId(e.getId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId());
industrySpecDTO.setIndustrySkuId(d.getSkuId());
industrySpecDTO.setProductInventoryList(productInventoryList);
industrySpec.add(industrySpecDTO);
} }
break; }
} d.setIndustrySpecList(industrySpec);
} })
if (appGoodsInfoDTO.getShelfStatus() == 1) { .collect(Collectors.toList());
pageList.add(appGoodsInfoDTO); return list;
} }
}
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
private List<GoodsSpecDTO> getIndustrySpecInfo(Integer goodsInfoId) { private void getIndustrySpecOnProdSpecInfo(
// 获取商品对应绑定的行业sku信息 List<IndustryProductInventoryDO> industryProdInventory,
List<MallIndustrySkuInfoDO> mallIndustrySkuInfoList = goodsInfoDao.getMallIndustrySkuInfo(goodsInfoId); List<ProductInventoryVO> productInventoryList,
List<GoodsSpecDTO> list = mallIndustrySkuInfoList.stream().map(MallIndustrySkuInfoDO::buildGoodsSpecDTO).collect(Collectors.toList()); Map<Integer, List<InventorySpecDO>> inventoryMap) {
// 根据商品id查出该商品下绑定的规格信息 for (IndustryProductInventoryDO industryProductInventoryDO : industryProdInventory) {
List<MallIndustrySkuInfoSpecDO> mallIndustrySkuInfoSpec = goodsInfoDao.getIndustrySkuInfoSpec(goodsInfoId); List<InventorySpecDO> inventorySpec = inventoryMap.get(industryProductInventoryDO.getId());
list = list.stream().peek(d -> { if (!CollectionUtils.isEmpty(inventorySpec)) {
List<MallIndustrySpecDTO> industrySpec = new ArrayList<>(); List<ProductSpecVO> productSpecList =
for (MallIndustrySkuInfoSpecDO e : mallIndustrySkuInfoSpec) { inventorySpec.stream()
if (d.getId().equals(e.getMallIndustrySkuInfoId())) { .map(
IndustrySpecDO industrySpecDO = e.getIndustrySpecDO(); in -> {
// 获取商品清单信息 ProductSpecDO productSpecDetail =
List<IndustryProductInventoryDO> industryProdInventory = goodsInfoDao.getIndustryProductInventory(e.getIndustrySpecId()); goodsInfoDao.getProductSpecDetail(in.getProductSpecId());
List<ProductInventoryVO> productInventoryList = new ArrayList<>(); ProductSpecVO productSpecVO = new ProductSpecVO();
// 获取行业规格绑定的产品规格信息 BeanUtils.copyProperties(productSpecDetail, productSpecVO);
List<InventorySpecDO> inventorySpecDOList = goodsInfoDao.listInventorySpec(industryProdInventory.stream().map(IndustryProductInventoryDO::getId).collect(Collectors.toList())); return productSpecVO;
Map<Integer, List<InventorySpecDO>> inventoryMap = inventorySpecDOList.stream().collect(Collectors.groupingBy(InventorySpecDO::getIndustryProductInventoryId)); })
getIndustrySpecOnProdSpecInfo(industryProdInventory, productInventoryList, inventoryMap); .collect(Collectors.toList());
MallIndustrySpecDTO industrySpecDTO = industrySpecDO.buildMallIndustrySpecDTO(); ProductSkuDO productSkuDetail =
industrySpecDTO.setId(e.getId()); goodsInfoDao.getProductSkuDetail(industryProductInventoryDO.getProductSkuId());
industrySpecDTO.setIndustrySpecId(e.getIndustrySpecId()); GoodsProductSkuVO goodsProductSkuVO = new GoodsProductSkuVO();
industrySpecDTO.setIndustrySkuId(d.getSkuId()); BeanUtils.copyProperties(productSkuDetail, goodsProductSkuVO);
industrySpecDTO.setProductInventoryList(productInventoryList); // 添加数据
industrySpec.add(industrySpecDTO); ProductInventoryVO productInventoryVO = new ProductInventoryVO();
} productInventoryVO.setSelect(industryProductInventoryDO.getSelected());
} productInventoryVO.setProductSku(goodsProductSkuVO);
d.setIndustrySpecList(industrySpec); productInventoryVO.setProductSpecList(productSpecList);
}).collect(Collectors.toList()); productInventoryList.add(productInventoryVO);
return list; }
}
private void getIndustrySpecOnProdSpecInfo(
List<IndustryProductInventoryDO> industryProdInventory,
List<ProductInventoryVO> productInventoryList,
Map<Integer, List<InventorySpecDO>> inventoryMap) {
for (IndustryProductInventoryDO industryProductInventoryDO : industryProdInventory) {
List<InventorySpecDO> inventorySpec = inventoryMap.get(industryProductInventoryDO.getId());
if (!CollectionUtils.isEmpty(inventorySpec)) {
List<ProductSpecVO> productSpecList =
inventorySpec.stream()
.map(
in -> {
ProductSpecDO productSpecDetail =
goodsInfoDao.getProductSpecDetail(in.getProductSpecId());
ProductSpecVO productSpecVO = new ProductSpecVO();
BeanUtils.copyProperties(productSpecDetail, productSpecVO);
return productSpecVO;
})
.collect(Collectors.toList());
ProductSkuDO productSkuDetail =
goodsInfoDao.getProductSkuDetail(industryProductInventoryDO.getProductSkuId());
GoodsProductSkuVO goodsProductSkuVO = new GoodsProductSkuVO();
BeanUtils.copyProperties(productSkuDetail, goodsProductSkuVO);
// 添加数据
ProductInventoryVO productInventoryVO = new ProductInventoryVO();
productInventoryVO.setSelect(industryProductInventoryDO.getSelected());
productInventoryVO.setProductSku(goodsProductSkuVO);
productInventoryVO.setProductSpecList(productSpecList);
productInventoryList.add(productInventoryVO);
}
}
} }
}
} }
...@@ -3,9 +3,13 @@ package com.mmc.pms.service.Impl; ...@@ -3,9 +3,13 @@ package com.mmc.pms.service.Impl;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.dao.WebProductMallDao; import com.mmc.pms.dao.WebProductMallDao;
import com.mmc.pms.entity.AdDO; import com.mmc.pms.entity.AdDO;
import com.mmc.pms.entity.GoodsInfoDO;
import com.mmc.pms.entity.ProductCategory; import com.mmc.pms.entity.ProductCategory;
import com.mmc.pms.model.other.dto.AdDTO; import com.mmc.pms.model.other.dto.AdDTO;
import com.mmc.pms.model.qo.GoodsInfoQO;
import com.mmc.pms.model.sale.dto.GoodsInfoListDTO;
import com.mmc.pms.model.sale.dto.ProductCategoryDTO; import com.mmc.pms.model.sale.dto.ProductCategoryDTO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.WebProductMallService; import com.mmc.pms.service.WebProductMallService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -72,4 +76,24 @@ public class WebProductMallServiceImpl implements WebProductMallService { ...@@ -72,4 +76,24 @@ public class WebProductMallServiceImpl implements WebProductMallService {
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResultBody.success(collect); return ResultBody.success(collect);
} }
@Override
public PageResult listPageGoodsInfo(GoodsInfoQO param) {
int count = webProductMallDao.countListGoodsInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<GoodsInfoDO> goodsInfo = webProductMallDao.listGoodsInfo(param);
goodsInfo.stream()
.forEach(
t -> {
Integer product = webProductMallDao.findProduct(t.getId());
t.setIsCoupons(product);
});
List<GoodsInfoListDTO> pageList =
goodsInfo.stream().map(GoodsInfoDO::buildGoodsInfoListDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
}
} }
package com.mmc.pms.service; package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.GoodsInfoQO;
/** /**
* @Author small @Date 2023/5/16 15:08 @Version 1.0 * @Author small @Date 2023/5/16 15:08 @Version 1.0
*/ */
public interface MiniProgramProductMallService { public interface MiniProgramProductMallService {
ResultBody getAppGoodsInfoDetail(Integer id); ResultBody getAppGoodsInfoDetail(Integer id);
ResultBody listGoodsByQO(GoodsInfoQO param);
} }
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
<foreach collection="list" item="d" separator=";"> <foreach collection="list" item="d" separator=";">
update mall_prod_info update mall_prod_info
<set> <set>
prod_sku_id = #{d.prodSkuId}, product_id = #{d.prodSkuId},
categories_id = #{d.categoriesId}, categories_id = #{d.categoriesId},
prod_spec_name = #{d.prodSkuSpecName}, prod_spec_name = #{d.prodSkuSpecName},
choose_type = #{d.chooseType}, choose_type = #{d.chooseType},
...@@ -487,4 +487,65 @@ ...@@ -487,4 +487,65 @@
FROM sale_service FROM sale_service
WHERE is_deleted = 0 WHERE is_deleted = 0
</select> </select>
<select id="countListGoodsInfo" resultType="java.lang.Integer">
SELECT
count(*)
FROM
goods_info gi
<where>
gi.is_deleted = 0 and gi.goods_type = #{goodsType}
<if test="goodsName != null and goodsName !=''">
AND (gi.goods_name LIKE CONCAT('%',#{goodsName},'%'))
</if>
<if test="status != null">
AND (gi.shelf_status = #{status})
</if>
<if test="startTime != null and startTime != '' ">
and gi.create_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and gi.create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="directoryId != null">
and (gi.directory_id = #{directoryId})
</if>
</where>
</select>
<select id="listGoodsInfo" resultType="com.mmc.pms.entity.GoodsInfo">
SELECT
gi.id,
gi.goods_name,
gi.shelf_status,
gi.create_time,
gi.directory_id,
img.img_url mainImg,
d.directory_name
FROM
goods_info gi
LEFT JOIN goods_img img ON gi.id = img.goods_info_id
AND img.img_type = 0
AND img.is_deleted = 0
INNER JOIN `directory` d ON gi.directory_id = d.id
<where>
gi.is_deleted = 0 and gi.goods_type = #{goodsType}
<if test="goodsName != null and goodsName !=''">
AND (gi.goods_name LIKE CONCAT('%',#{goodsName},'%'))
</if>
<if test="status != null">
AND (gi.shelf_status = #{status})
</if>
<if test="startTime != null and startTime != '' ">
and gi.create_time &gt;= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="endTime != null and endTime != '' ">
and gi.create_time &lt;= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if test="directoryId != null">
and (gi.directory_id = #{directoryId})
</if>
</where>
ORDER BY
gi.shelf_status DESC , gi.create_time DESC
limit #{pageNo},#{pageSize}
</select>
</mapper> </mapper>
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<select id="getMallProdInfoByGoodsId" resultType="com.mmc.pms.entity.MallProdInfoDO"> <select id="getMallProdInfoByGoodsId" resultType="com.mmc.pms.entity.MallProdInfoDO">
SELECT mp.id, SELECT mp.id,
mp.prod_sku_id prodSkuId, mp.product_id prodSkuId,
mp.prod_spec_name prodSkuSpecName, mp.prod_spec_name prodSkuSpecName,
mp.goods_type_id goodsTypeId, mp.goods_type_id goodsTypeId,
mp.choose_type chooseType, mp.choose_type chooseType,
...@@ -133,9 +133,9 @@ ...@@ -133,9 +133,9 @@
ps.product_name productSkuName, ps.product_name productSkuName,
ps.brand_info_id brandInfoId, ps.brand_info_id brandInfoId,
gt.type_name typeName gt.type_name typeName
FROM mall_prod_sku_info mp FROM mall_prod_info mp
INNER JOIN sku_unit su ON su.id = mp.sku_unit_id INNER JOIN sku_unit su ON su.id = mp.sku_unit_id
INNER JOIN product ps ON ps.id = mp.prod_sku_id INNER JOIN product ps ON ps.id = mp.product_id
LEFT JOIN goods_type gt ON mp.goods_type_id = gt.id LEFT JOIN goods_type gt ON mp.goods_type_id = gt.id
WHERE mp.goods_info_id = #{goodsId} WHERE mp.goods_info_id = #{goodsId}
AND mp.is_deleted = 0 AND mp.is_deleted = 0
...@@ -143,9 +143,9 @@ ...@@ -143,9 +143,9 @@
<select id="listMallProdSkuInfoSpec" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO"> <select id="listMallProdSkuInfoSpec" resultType="com.mmc.pms.entity.MallProdSkuInfoSpecDO">
SELECT id, SELECT id,
mall_prod_sku_info_id mallProdSkuInfoId, mall_prod_info_id mallProdSkuInfoId,
product_spec_id productSpecId product_spec_id productSpecId
FROM mall_prod_sku_info_spec FROM mall_prod_info_spec
WHERE goods_info_id = #{goodsId} WHERE goods_info_id = #{goodsId}
AND is_deleted = 0 AND is_deleted = 0
</select> </select>
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
</insert> </insert>
<insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO" <insert id="insertMallProdSkuInfo" parameterType="com.mmc.pms.entity.MallProdInfoDO"
keyProperty="id" useGeneratedKeys="true"> keyProperty="id" useGeneratedKeys="true">
insert into mall_prod_info (goods_info_id, prod_sku_id, prod_spec_name, category_id, choose_type, insert into mall_prod_info (goods_info_id, product_id, prod_spec_name, categories_id, choose_type,
sku_unit_id, is_must, product_spec_id_list, flag) sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoryId}, #{chooseType}, #{skuUnitId}, #{must}, values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
#{flag}) #{flag})
</insert> </insert>
<update id="updateProductSku"> <update id="updateProductSku">
......
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
SELECT count(1) SELECT count(1)
FROM goods_info gi FROM goods_info gi
INNER JOIN mall_prod_sku_info mpsi ON mpsi.goods_info_id = gi.id INNER JOIN mall_prod_sku_info mpsi ON mpsi.goods_info_id = gi.id
INNER JOIN product ps ON mpsi.prod_sku_id = ps.id INNER JOIN product ps ON mpsi.product_id = ps.id
AND ps.is_deleted = 0 AND ps.is_deleted = 0
INNER JOIN brand_info bi ON ps.brand_info_id = bi.id INNER JOIN brand_info bi ON ps.brand_info_id = bi.id
AND bi.is_delete = 0 AND bi.is_delete = 0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论