Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pms
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
pms
Commits
92587869
提交
92587869
authored
6月 07, 2023
作者:
xiaowang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改:商品新增
上级
5636b32c
隐藏空白字符变更
内嵌
并排
正在显示
25 个修改的文件
包含
820 行增加
和
67 行删除
+820
-67
BackstageGoodsManageController.java
...om/mmc/pms/controller/BackstageGoodsManageController.java
+28
-3
GoodsInfoDao.java
src/main/java/com/mmc/pms/dao/GoodsInfoDao.java
+14
-0
IndustrySpecDao.java
src/main/java/com/mmc/pms/dao/IndustrySpecDao.java
+2
-1
ProductDao.java
src/main/java/com/mmc/pms/dao/ProductDao.java
+18
-1
GoodsInfo.java
src/main/java/com/mmc/pms/entity/GoodsInfo.java
+2
-0
IndustrySku.java
src/main/java/com/mmc/pms/entity/IndustrySku.java
+1
-1
MallGoodsSpecInfoDO.java
src/main/java/com/mmc/pms/entity/MallGoodsSpecInfoDO.java
+23
-0
SkuSpecDO.java
src/main/java/com/mmc/pms/entity/SkuSpecDO.java
+23
-0
MallGoodsShopCarDTO.java
src/main/java/com/mmc/pms/model/dto/MallGoodsShopCarDTO.java
+58
-0
MallProductSpecPriceDTO.java
...n/java/com/mmc/pms/model/dto/MallProductSpecPriceDTO.java
+31
-0
MallSkuInfoSpecDTO.java
src/main/java/com/mmc/pms/model/dto/MallSkuInfoSpecDTO.java
+36
-0
OrderGoodsIndstDTO.java
src/main/java/com/mmc/pms/model/dto/OrderGoodsIndstDTO.java
+60
-0
OrderGoodsProdDTO.java
src/main/java/com/mmc/pms/model/dto/OrderGoodsProdDTO.java
+64
-0
ProductSkuDTO.java
src/main/java/com/mmc/pms/model/dto/ProductSkuDTO.java
+4
-0
MallOrderGoodsInfoQO.java
src/main/java/com/mmc/pms/model/qo/MallOrderGoodsInfoQO.java
+28
-0
ProductSpecPriceQO.java
src/main/java/com/mmc/pms/model/qo/ProductSpecPriceQO.java
+29
-0
GoodsProdSpecVO.java
src/main/java/com/mmc/pms/model/vo/GoodsProdSpecVO.java
+1
-1
IndustrySkuVO.java
src/main/java/com/mmc/pms/model/vo/IndustrySkuVO.java
+2
-0
GoodsInfoService.java
src/main/java/com/mmc/pms/service/GoodsInfoService.java
+12
-1
GoodsInfoServiceImpl.java
...n/java/com/mmc/pms/service/Impl/GoodsInfoServiceImpl.java
+216
-36
ProductServiceImpl.java
...ain/java/com/mmc/pms/service/Impl/ProductServiceImpl.java
+29
-6
CategoriesDao.xml
src/main/resources/mapper/CategoriesDao.xml
+1
-1
GoodsInfoDao.xml
src/main/resources/mapper/GoodsInfoDao.xml
+57
-3
IndustrySpecDao.xml
src/main/resources/mapper/IndustrySpecDao.xml
+11
-9
ProductDao.xml
src/main/resources/mapper/ProductDao.xml
+70
-4
没有找到文件。
src/main/java/com/mmc/pms/controller/BackstageGoodsManageController.java
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
controller
;
import
com.mmc.pms.common.ResultBody
;
import
com.mmc.pms.model.dto.
MallGoodsDetailDTO
;
import
com.mmc.pms.model.
dto.SkuUnitDT
O
;
import
com.mmc.pms.model.dto.
*
;
import
com.mmc.pms.model.
qo.ProductSpecPriceQ
O
;
import
com.mmc.pms.model.vo.Create
;
import
com.mmc.pms.model.vo.GoodsAddVO
;
import
com.mmc.pms.model.vo.Update
;
...
...
@@ -10,8 +10,10 @@ import com.mmc.pms.service.GoodsInfoService;
import
io.swagger.annotations.*
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @Author LW
...
...
@@ -52,6 +54,29 @@ public class BackstageGoodsManageController {
public
ResultBody
getSkuUnit
()
{
return
goodsInfoService
.
getSkuUnit
();
}
@ApiOperation
(
value
=
"根据购物车信息填充未知信息"
)
@ApiIgnore
@PostMapping
(
"fillGoodsInfo"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
MallGoodsShopCarDTO
.
class
)})
public
List
<
MallGoodsShopCarDTO
>
fillGoodsInfo
(
@RequestBody
List
<
MallGoodsShopCarDTO
>
param
)
{
return
goodsInfoService
.
fillGoodsInfo
(
param
);
}
@ApiOperation
(
value
=
"根据渠道等级和产品规格id获取对应价格"
)
@ApiIgnore
@PostMapping
(
"feignListProductSpecPrice"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
public
List
<
MallProductSpecPriceDTO
>
feignListProductSpecPrice
(
@RequestBody
ProductSpecPriceQO
productSpecPriceQO
)
{
return
goodsInfoService
.
feignListProductSpecPrice
(
productSpecPriceQO
);
}
@ApiOperation
(
value
=
"feign根据渠道等级获取单价信息"
)
@GetMapping
(
"feignGetUnitPriceByTag"
)
@ApiIgnore
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ProductSpecPriceDTO
.
class
)})
public
ProductSpecPriceDTO
feignGetUnitPriceByTag
(
@RequestParam
(
value
=
"specId"
)
Integer
specId
,
@RequestParam
(
value
=
"tagId"
)
Integer
tagId
)
{
return
goodsInfoService
.
feignGetUnitPriceByTag
(
specId
,
tagId
);
}
}
src/main/java/com/mmc/pms/dao/GoodsInfoDao.java
浏览文件 @
92587869
...
...
@@ -3,8 +3,10 @@ package com.mmc.pms.dao;
import
com.mmc.pms.entity.*
;
import
com.mmc.pms.model.vo.GoodsAddVO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Set
;
/**
* @author 23214
...
...
@@ -63,6 +65,18 @@ public interface GoodsInfoDao {
List
<
SkuUnitDO
>
getSkuUnit
();
List
<
GoodsInfo
>
listSimpleGoodsInfoByIds
(
@Param
(
"ids"
)
Set
<
Integer
>
ids
);
void
insertMallProdSkuInfo
(
MallProdInfoDO
mallProdSkuInfoDO
);
void
insertMallProdSkuInfoSpec
(
MallProdSkuInfoSpecDO
mallProdSkuInfoSpecDO
);
void
batchUpdateMallProSpec
(
@Param
(
"list"
)
List
<
Integer
>
list
,
@Param
(
"id"
)
Integer
id
);
List
<
MallProdSkuInfoSpecDO
>
listMallProdSpecInfo
(
List
<
Integer
>
mallSkuIds
);
void
batchUpdateMallProdSpec
(
List
<
Integer
>
delSpecId
);
}
...
...
src/main/java/com/mmc/pms/dao/IndustrySpecDao.java
浏览文件 @
92587869
...
...
@@ -53,7 +53,7 @@ public interface IndustrySpecDao {
void
deleteIndustryProductInventory
(
Integer
id
);
int
countListPageIndustrySpec
(
Integer
i
ndustrySkuI
d
,
String
keyword
);
int
countListPageIndustrySpec
(
Integer
id
,
String
keyword
);
List
<
IndustrySpecDO
>
listPageIndustrySpec
(
int
i
,
Integer
pageSize
,
Integer
industrySkuId
,
String
keyword
);
...
...
@@ -95,4 +95,5 @@ public interface IndustrySpecDao {
void
removeIndustrySpec
(
Integer
id
);
List
<
MallIndustrySkuInfoSpecDO
>
getIndustrySkuInfoSpec
(
Integer
goodsInfoId
);
}
src/main/java/com/mmc/pms/dao/ProductDao.java
浏览文件 @
92587869
...
...
@@ -2,6 +2,7 @@ package com.mmc.pms.dao;
import
com.mmc.pms.entity.*
;
import
com.mmc.pms.model.dto.ProductSkuVO
;
import
com.mmc.pms.model.dto.ProductSpecPriceDTO
;
import
com.mmc.pms.model.dto.ProductSpecVO
;
import
com.mmc.pms.model.qo.ProductSkuQO
;
import
com.mmc.pms.model.vo.PriceAcquisition
;
...
...
@@ -48,7 +49,7 @@ public interface ProductDao {
int
countListPageProductSpec
(
Integer
productSkuId
);
List
<
ProductSpecDO
>
listPageProductSpec
(
int
i
,
Integer
pageSize
,
Integer
productSkuId
);
List
<
ProductSpecDO
>
listPageProductSpec
(
int
pageNo
,
Integer
pageSize
,
Integer
productSkuId
);
int
batchInsertSpecPrice
(
List
<
ProductSpecPriceDO
>
list
);
...
...
@@ -87,6 +88,22 @@ public interface ProductDao {
BigDecimal
feignGetUnitPriceByTag
(
PriceAcquisition
priceAcquisition
);
List
<
MallGoodsSpecInfoDO
>
listProdSpecInfo
(
@Param
(
"prodIds"
)
Set
<
Integer
>
prodIds
);
/**
* 根据渠道等级、商品specId获取price信息
*
* @param tagInfoId
* @param prodSkuSpecIds
* @return
*/
List
<
ProductSpecPriceDO
>
listProductSpecPrice
(
Integer
tagInfoId
,
Set
<
Integer
>
prodSkuSpecIds
);
ProductSpecPriceDTO
feignGetUnitPrice
(
Integer
id
,
Integer
tagId
);
List
<
ProductSpecDO
>
getProductSpecList
(
List
<
Integer
>
productSkuIds
);
List
<
MallProdSkuInfoSpecDO
>
getProductSpecByIds
(
List
<
Integer
>
delProductSpecId
);
}
...
...
src/main/java/com/mmc/pms/entity/GoodsInfo.java
浏览文件 @
92587869
...
...
@@ -52,6 +52,8 @@ public class GoodsInfo implements Serializable {
private
String
videoUrl
;
private
String
mainImg
;
private
static
final
long
serialVersionUID
=
1L
;
public
GoodsInfo
(
GoodsAddVO
goodsAddVO
)
{
...
...
src/main/java/com/mmc/pms/entity/IndustrySku.java
浏览文件 @
92587869
...
...
@@ -46,7 +46,7 @@ public class IndustrySku implements Serializable {
public
IndustrySkuVO
buildIndustrySku
()
{
return
IndustrySkuVO
.
builder
().
id
(
this
.
id
).
description
(
this
.
description
)
.
categoryId
(
this
.
categoriesId
).
solutionName
(
this
.
solutionName
).
build
();
.
categoryId
(
this
.
categoriesId
).
categoryName
(
typeName
).
solutionName
(
this
.
solutionName
).
build
();
}
public
IndustrySkuDTO
buildIndustrySkuDTO
()
{
...
...
src/main/java/com/mmc/pms/entity/MallGoodsSpecInfoDO.java
0 → 100644
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* author:zhenjie
* Date:2022/10/15
* time:20:52
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
MallGoodsSpecInfoDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7264365143820916901L
;
private
Integer
id
;
private
Integer
sortTypeId
;
private
List
<
SkuSpecDO
>
skuSpecDOList
;
}
src/main/java/com/mmc/pms/entity/SkuSpecDO.java
0 → 100644
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* author:zhenjie
* Date:2022/10/15
* time:20:55
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
SkuSpecDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7601558723724855293L
;
private
Integer
id
;
private
Integer
specDeleted
;
private
Integer
skuSpecDeleted
;
private
String
specName
;
}
src/main/java/com/mmc/pms/model/dto/MallGoodsShopCarDTO.java
0 → 100644
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
model
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* author:zhenjie
* Date:2022/10/11
* time:14:54
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"com.mmc.csf.mall.dto.MallGoodsShopCarDTO"
,
description
=
"小程序购物车列表DTO"
)
public
class
MallGoodsShopCarDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
766856809957374985L
;
@ApiModelProperty
(
"id"
)
private
Integer
id
;
@ApiModelProperty
(
"用户id"
)
private
Integer
mallUserId
;
@ApiModelProperty
(
"商品id"
)
private
Integer
goodsInfoId
;
@ApiModelProperty
(
"购买数量"
)
private
Integer
buyNum
;
@ApiModelProperty
(
"0:待下单 1:已下单"
)
private
Integer
saleStatus
;
@ApiModelProperty
(
"推荐人id"
)
private
Integer
recMallUserId
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"是否删除"
)
private
Integer
deleted
;
@ApiModelProperty
(
"生成时间"
)
@JsonFormat
(
timezone
=
"GMT+8"
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
//区分产品或者行业
@ApiModelProperty
(
"区分产品或者行业"
)
private
Integer
directoryId
;
@ApiModelProperty
(
"商品名称"
)
private
String
goodsName
;
@ApiModelProperty
(
"商品主图"
)
private
String
mainImg
;
@ApiModelProperty
(
"状态:0:下架 1:上架"
)
private
Integer
shelfStatus
;
@ApiModelProperty
(
"商品产品规格信息"
)
private
List
<
MallSkuInfoSpecDTO
>
skuList
;
}
src/main/java/com/mmc/pms/model/dto/MallProductSpecPriceDTO.java
0 → 100644
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* author:zhenjie
* Date:2022/11/9
* time:17:17
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"com.mmc.csf.mall.dto.MallProductSpecPriceDTO"
,
description
=
"产品对应价格"
)
public
class
MallProductSpecPriceDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
4717398210156973205L
;
@ApiModelProperty
(
value
=
"产品规格id"
)
private
Integer
productSpecId
;
@ApiModelProperty
(
value
=
"合作价格"
)
private
BigDecimal
opPrice
;
@ApiModelProperty
(
value
=
"市场价格"
)
private
BigDecimal
mkPrice
;
}
src/main/java/com/mmc/pms/model/dto/MallSkuInfoSpecDTO.java
0 → 100644
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* author:zhenjie
* Date:2022/10/11
* time:15:03
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"com.mmc.csf.mall.dto.MallSkuInfoSpecDTO"
,
description
=
"商品规格DTO"
)
public
class
MallSkuInfoSpecDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
4214771967767248990L
;
@ApiModelProperty
(
"id"
)
private
Integer
id
;
@ApiModelProperty
(
"商品最小规格id"
)
private
Integer
mallSkuInfoSpecId
;
private
Integer
deleted
;
private
Boolean
valid
;
private
Date
createTime
;
@ApiModelProperty
(
"产品或者行业规格名称"
)
private
String
specName
;
}
src/main/java/com/mmc/pms/model/dto/OrderGoodsIndstDTO.java
0 → 100644
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
* author:zhenjie
* Date:2022/10/21
* time:17:40
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"com.mmc.csf.mall.dto.OrderGoodsIndstDTO"
,
description
=
"行业订单DTO"
)
public
class
OrderGoodsIndstDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1809741999941834440L
;
@ApiModelProperty
(
value
=
"id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"订单id"
)
private
Long
orderId
;
@ApiModelProperty
(
value
=
"购物车id"
)
private
Integer
mallIndstShopCarId
;
@ApiModelProperty
(
value
=
"商品id"
)
private
Integer
goodsInfoId
;
@ApiModelProperty
(
value
=
"商品所属类型id"
)
private
Integer
sortTypeId
;
@ApiModelProperty
(
value
=
"商品所有规格金额"
)
private
BigDecimal
goodsAmount
;
@ApiModelProperty
(
value
=
"商品编号"
)
private
String
goodsNo
;
@ApiModelProperty
(
value
=
"商品名称"
)
private
String
goodsName
;
@ApiModelProperty
(
value
=
"商品主图"
)
private
String
mainImg
;
@ApiModelProperty
(
value
=
"购买数量"
)
private
Integer
buyNum
;
@ApiModelProperty
(
value
=
"生成时间"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"是否有效"
)
private
Boolean
valid
;
//
// @ApiModelProperty(value = "行业订单规格")
// private List<OrderGoodsIndstDetailDTO> orderGoodsIndstDetailDTOS;
@ApiModelProperty
(
"商品服务列表"
)
private
List
<
GoodsServiceDTO
>
services
;
}
src/main/java/com/mmc/pms/model/dto/OrderGoodsProdDTO.java
0 → 100644
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
/**
* author:zhenjie
* Date:2022/10/19
* time:15:26
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"com.mmc.csf.mall.dto.OrderGoodsProdDTO"
,
description
=
"订单商品sku信息DTO"
)
public
class
OrderGoodsProdDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2066849435828937057L
;
@ApiModelProperty
(
value
=
"orderGoodsProdId"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"订单id"
)
private
Long
orderId
;
@ApiModelProperty
(
value
=
"产品购物车id"
)
private
Integer
mallProdShopCarId
;
@ApiModelProperty
(
value
=
"商品id"
)
private
Integer
goodsInfoId
;
@ApiModelProperty
(
value
=
"商品所属类型"
)
private
Integer
sortTypeId
;
@ApiModelProperty
(
value
=
"全部sku金额"
)
private
BigDecimal
goodsAmount
;
@ApiModelProperty
(
value
=
"商品编号"
)
private
String
goodsNo
;
@ApiModelProperty
(
value
=
"商品名称"
)
private
String
goodsName
;
@ApiModelProperty
(
value
=
"商品主图"
)
private
String
mainImg
;
@ApiModelProperty
(
value
=
"购买数量"
)
private
Integer
buyNum
;
@ApiModelProperty
(
value
=
"生成时间"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"是否有效"
)
private
Boolean
valid
;
@ApiModelProperty
(
value
=
"是否上架"
)
private
Integer
shelfStatus
;
@ApiModelProperty
(
value
=
"是否删除"
)
private
Integer
deleted
;
@ApiModelProperty
(
"商品服务列表"
)
private
List
<
GoodsServiceDTO
>
services
;
// @ApiModelProperty(value = "订单详情")
// private List<OrderGoodsProdDetailDTO> orderGoodsProdDetailDTOS;
}
src/main/java/com/mmc/pms/model/dto/ProductSkuDTO.java
浏览文件 @
92587869
...
...
@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Author small @Date 2023/5/16 16:29 @Version 1.0
...
...
@@ -48,4 +49,7 @@ public class ProductSkuDTO implements Serializable {
@ApiModelProperty
(
value
=
"目录名称"
)
private
String
directoryName
;
@ApiModelProperty
(
value
=
"产品规格信息对象"
)
private
List
<
ProductSpecDTO
>
productSpecList
;
}
src/main/java/com/mmc/pms/model/qo/MallOrderGoodsInfoQO.java
0 → 100644
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
model
.
qo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Set
;
/**
* author:zhenjie
* Date:2022/10/18
* time:21:45
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"com.mmc.csf.mall.qo.MallOrderGoodsInfoQO"
,
description
=
"订单查询商品信息QO"
)
public
class
MallOrderGoodsInfoQO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3807569067697485137L
;
private
Integer
mallUserId
;
private
Integer
channelClass
;
private
Set
<
Integer
>
mallProdSkuSpecIds
;
private
Set
<
Integer
>
mallIndstSkuSpecIds
;
}
src/main/java/com/mmc/pms/model/qo/ProductSpecPriceQO.java
0 → 100644
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
model
.
qo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* author:zhenjie
* Date:2022/11/10
* time:11:13
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"com.mmc.csf.model.qo.ProductSpecPriceQO"
,
description
=
"无人机城产品规格价格QO"
)
public
class
ProductSpecPriceQO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
8086345532713123505L
;
@ApiModelProperty
(
"用户id"
)
private
Integer
mallUserId
;
@ApiModelProperty
(
"渠道等级标签"
)
private
Integer
channelClass
;
@ApiModelProperty
(
"产品规格id"
)
private
List
<
Integer
>
productSpecIds
;
}
src/main/java/com/mmc/pms/model/vo/GoodsProdSpecVO.java
浏览文件 @
92587869
...
...
@@ -38,7 +38,7 @@ public class GoodsProdSpecVO implements Serializable {
private
String
productName
;
@ApiModelProperty
(
value
=
"选项来源"
)
private
List
<
Integer
>
specIds
;
private
List
<
MallProductSpecVO
>
specIds
;
@ApiModelProperty
(
value
=
"选择方式"
)
private
Integer
chooseType
;
...
...
src/main/java/com/mmc/pms/model/vo/IndustrySkuVO.java
浏览文件 @
92587869
...
...
@@ -29,6 +29,8 @@ public class IndustrySkuVO implements Serializable {
@NotNull
(
message
=
"行业分类id不能为空"
,
groups
=
{
Create
.
class
,
Update
.
class
})
@ApiModelProperty
(
value
=
"所属行业分类id"
)
private
Integer
categoryId
;
@ApiModelProperty
(
value
=
"行业名称"
)
private
String
categoryName
;
@ApiModelProperty
(
value
=
"描述"
)
private
String
description
;
}
src/main/java/com/mmc/pms/service/GoodsInfoService.java
浏览文件 @
92587869
package
com
.
mmc
.
pms
.
service
;
import
com.mmc.pms.common.ResultBody
;
import
com.mmc.pms.model.dto.MallGoodsShopCarDTO
;
import
com.mmc.pms.model.dto.MallProductSpecPriceDTO
;
import
com.mmc.pms.model.dto.ProductSpecPriceDTO
;
import
com.mmc.pms.model.qo.ProductSpecPriceQO
;
import
com.mmc.pms.model.vo.GoodsAddVO
;
import
java.util.List
;
/**
* @author 23214
* @description 针对表【goods_info(商品基本信息)】的数据库操作Service
...
...
@@ -17,5 +23,10 @@ public interface GoodsInfoService {
ResultBody
getGoodsInfoDetail
(
Integer
goodsInfoId
);
ResultBody
getSkuUnit
();
List
<
MallGoodsShopCarDTO
>
fillGoodsInfo
(
List
<
MallGoodsShopCarDTO
>
param
);
List
<
MallProductSpecPriceDTO
>
feignListProductSpecPrice
(
ProductSpecPriceQO
productSpecPriceQO
);
ProductSpecPriceDTO
feignGetUnitPriceByTag
(
Integer
specId
,
Integer
tagId
);
}
src/main/java/com/mmc/pms/service/Impl/GoodsInfoServiceImpl.java
浏览文件 @
92587869
...
...
@@ -7,6 +7,7 @@ import com.mmc.pms.dao.IndustrySpecDao;
import
com.mmc.pms.dao.ProductDao
;
import
com.mmc.pms.entity.*
;
import
com.mmc.pms.model.dto.*
;
import
com.mmc.pms.model.qo.ProductSpecPriceQO
;
import
com.mmc.pms.model.vo.*
;
import
com.mmc.pms.service.GoodsInfoService
;
import
com.mmc.pms.util.CodeUtil
;
...
...
@@ -17,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -87,10 +87,10 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
MallIndustrySkuInfoDO
mallIndustrySkuInfoDO
=
new
MallIndustrySkuInfoDO
(
goodsSpecVO
).
setGoodsInfoId
(
goodsInfo
.
getId
());
// 插入数据库商品对应的sku信息
goodsInfoDao
.
insertMallIndustrySkuInfo
(
mallIndustrySkuInfoDO
);
for
(
Integer
industrySpecId
:
goodsSpecVO
.
getSpecIds
())
{
for
(
MallProductSpecVO
mallProductSpecVO
:
goodsSpecVO
.
getSpecIds
())
{
// 构建商品对应的规格信息
MallIndustrySkuInfoSpecDO
mallIndustrySkuInfoSpecDO
=
new
MallIndustrySkuInfoSpecDO
()
.
setIndustrySpecId
(
industrySpecId
)
.
setIndustrySpecId
(
mallProductSpecVO
.
getMallSpecId
()
)
.
setMallIndustrySkuInfoId
(
mallIndustrySkuInfoDO
.
getId
())
.
setGoodsInfoId
(
goodsInfo
.
getId
());
// 插入数据库商品对应的规格信息
...
...
@@ -108,11 +108,20 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
}
// 遍历规格信息,获取其中非自定义的规格信息
List
<
GoodsProdSpecVO
>
goodsSpecList
=
productSpec
.
stream
().
filter
(
spec
->
spec
.
getFlag
().
equals
(
0
)).
collect
(
Collectors
.
toList
());
for
(
GoodsProdSpecVO
goodsSpec
:
goodsSpecList
)
{
MallProdInfoDO
mallProd
InfoDO
=
buildMallProdSkuInfo
(
goodsInfo
,
goodsSpec
,
goodsSpec
.
getSkuId
());
mallProdInfoDO
.
setProductSpecIdList
(
goodsSpec
.
getSpecIds
().
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)
));
for
(
GoodsProdSpecVO
goodsSpec
VO
:
goodsSpecList
)
{
MallProdInfoDO
mallProd
SkuInfoDO
=
new
MallProdInfoDO
(
goodsSpecVO
)
.
setProdSkuId
(
goodsSpecVO
.
getSkuId
()).
setGoodsInfoId
(
goodsInfo
.
getId
(
));
// 插入数据库商品对应的sku信息
productDao
.
insertMallProdSkuInfo
(
mallProdInfoDO
);
goodsInfoDao
.
insertMallProdSkuInfo
(
mallProdSkuInfoDO
);
for
(
MallProductSpecVO
mallProductSpecVO
:
goodsSpecVO
.
getSpecIds
())
{
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO
mallProdSkuInfoSpecDO
=
new
MallProdSkuInfoSpecDO
()
.
setProductSpecId
(
mallProductSpecVO
.
getMallSpecId
())
.
setMallProdSkuInfoId
(
mallProdSkuInfoDO
.
getId
())
.
setGoodsInfoId
(
goodsInfo
.
getId
());
// 插入数据库商品对应的规格信息
goodsInfoDao
.
insertMallProdSkuInfoSpec
(
mallProdSkuInfoSpecDO
);
}
}
}
...
...
@@ -140,8 +149,11 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
.
setDirectoryId
(
goodsInfo
.
getDirectoryId
());
// 插入产品sku信息
productDao
.
insertProductSku
(
productSkuDO
);
MallProdInfoDO
mallProdInfoDO
=
buildMallProdSkuInfo
(
goodsInfo
,
productSpec
,
productSkuDO
.
getId
());
// 插入数据库商品对应的sku信息
productDao
.
insertMallProdSkuInfo
(
mallProdInfoDO
);
// 先将自定的信息存储到数据库中
List
<
ProductSpecDO
>
customizeSpec
=
productSpec
.
getCustomizeInfo
().
stream
().
map
(
param
->
{
productSpec
.
getCustomizeInfo
().
stream
().
peek
(
param
->
{
ProductSpecDO
productSpecDO
=
new
ProductSpecDO
().
setProductSkuId
(
productSkuDO
.
getId
())
.
setVersionDesc
(
"自定义"
).
setSpecImage
(
param
.
getSpecImage
())
.
setSpecName
(
param
.
getSpecName
()).
setPartNo
(
param
.
getPartNo
());
...
...
@@ -153,13 +165,14 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
productSpecCPQVO
.
setProductSpecId
(
productSpecDO
.
getId
());
productSkuService
.
insertSpecPrice
(
productSpecCPQVO
);
}
return
productSpecDO
;
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO
mallProdSkuInfoSpecDO
=
new
MallProdSkuInfoSpecDO
()
.
setProductSpecId
(
productSpecDO
.
getId
())
.
setMallProdSkuInfoId
(
mallProdInfoDO
.
getId
())
.
setGoodsInfoId
(
goodsInfo
.
getId
());
// 插入数据库商品对应的规格信息
goodsInfoDao
.
insertMallProdSkuInfoSpec
(
mallProdSkuInfoSpecDO
);
}).
collect
(
Collectors
.
toList
());
List
<
Integer
>
ids
=
customizeSpec
.
stream
().
map
(
ProductSpecDO:
:
getId
).
collect
(
Collectors
.
toList
());
MallProdInfoDO
mallProdInfoDO
=
buildMallProdSkuInfo
(
goodsInfo
,
productSpec
,
productSkuDO
.
getId
());
mallProdInfoDO
.
setProductSpecIdList
(
ids
.
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)));
// 插入数据库商品对应的sku信息
productDao
.
insertMallProdSkuInfo
(
mallProdInfoDO
);
}
}
...
...
@@ -235,14 +248,60 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateMallIndustrySkuSpec
(
GoodsAddVO
goodsAddVO
)
{
// 先获取用户输入的商品绑定sku的id集合
Set
<
Integer
>
inputMallSkuIds
=
goodsAddVO
.
getProductSpec
().
stream
().
map
(
GoodsProdSpecVO:
:
getId
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toSet
());
// 从数据库获取该商品对应绑定的skuId的集合
List
<
MallIndustrySkuInfoDO
>
mallIndusSkuInfoList
=
goodsInfoDao
.
getMallIndustrySkuInfo
(
goodsAddVO
.
getId
());
List
<
Integer
>
skuIds
=
mallIndusSkuInfoList
.
stream
().
map
(
MallIndustrySkuInfoDO:
:
getId
).
collect
(
Collectors
.
toList
());
// 先删除所有商品绑定sku及spec信息
industrySpecDao
.
batchUpdateMallIndustrySpec
(
skuIds
,
goodsAddVO
.
getId
());
industrySpecDao
.
batchUpdateMallIndustrySku
(
skuIds
);
List
<
GoodsProdSpecVO
>
list
=
goodsAddVO
.
getProductSpec
().
stream
().
collect
(
Collectors
.
toList
());
List
<
Integer
>
dbMallSkuIds
=
mallIndusSkuInfoList
.
stream
().
map
(
MallIndustrySkuInfoDO:
:
getId
).
collect
(
Collectors
.
toList
());
// 对比数据库id如果不在就删除
List
<
Integer
>
delIds
=
dbMallSkuIds
.
stream
().
filter
(
id
->
!
inputMallSkuIds
.
contains
(
id
)).
collect
(
Collectors
.
toList
());
if
(
delIds
.
size
()
!=
0
)
{
// 先删除商品绑定sku下的spec信息
industrySpecDao
.
batchUpdateMallIndustrySpec
(
delIds
,
goodsAddVO
.
getId
());
industrySpecDao
.
batchUpdateMallIndustrySku
(
delIds
);
}
// 修改商品绑定的sku信息
List
<
GoodsProdSpecVO
>
updateGoodsSpec
=
goodsAddVO
.
getProductSpec
().
stream
().
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
List
<
MallIndustrySkuInfoDO
>
mallIndustrySkuInfoList
=
updateGoodsSpec
.
stream
().
map
(
d
->
{
MallIndustrySkuInfoDO
mallIndustrySkuInfoDO
=
new
MallIndustrySkuInfoDO
();
mallIndustrySkuInfoDO
.
setId
(
d
.
getId
()).
setIndustrySkuId
(
d
.
getSkuId
())
.
setCategoriesId
(
d
.
getCategoryId
()).
setIndustrySkuSpecName
(
d
.
getGoodsSpecName
())
.
setChooseType
(
d
.
getChooseType
()).
setSkuUnitId
(
d
.
getSkuUnitId
()).
setMust
(
d
.
getMust
());
return
mallIndustrySkuInfoDO
;
}).
collect
(
Collectors
.
toList
());
// 批量修改sku的信息
industrySpecDao
.
batchUpdateMallIndustrySkuInfo
(
mallIndustrySkuInfoList
);
// 获取新的sku信息
List
<
GoodsProdSpecVO
>
list
=
goodsAddVO
.
getProductSpec
().
stream
().
filter
(
d
->
d
.
getId
()
==
null
).
collect
(
Collectors
.
toList
());
industrySkuSpecOperation
(
new
GoodsInfo
(
goodsAddVO
.
getId
()),
list
);
// 获取商品对应的skuId
List
<
Integer
>
mallSkuIds
=
goodsAddVO
.
getProductSpec
().
stream
().
map
(
GoodsProdSpecVO:
:
getId
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
// 根据这些id查出下面对应的规格信息
List
<
MallIndustrySkuInfoSpecDO
>
mallIndustrySkuInfoSpecList
=
industrySpecDao
.
listMallIndustrySpecInfo
(
mallSkuIds
);
// 分组
Map
<
Integer
,
List
<
MallIndustrySkuInfoSpecDO
>>
dbSpecMap
=
mallIndustrySkuInfoSpecList
.
stream
().
collect
(
Collectors
.
groupingBy
(
MallIndustrySkuInfoSpecDO:
:
getMallIndustrySkuInfoId
));
List
<
GoodsProdSpecVO
>
goodsSpecList
=
goodsAddVO
.
getProductSpec
().
stream
().
filter
(
d
->
d
.
getId
()
!=
null
).
collect
(
Collectors
.
toList
());
for
(
GoodsProdSpecVO
goodsSpecVO
:
goodsSpecList
)
{
// 分组后的每一条商品绑定的规格信息
List
<
MallIndustrySkuInfoSpecDO
>
dbMallIndustrySkuSpecList
=
dbSpecMap
.
get
(
goodsSpecVO
.
getId
());
Set
<
Integer
>
inputMallSpecIds
=
goodsSpecVO
.
getSpecIds
().
stream
().
map
(
MallProductSpecVO:
:
getId
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toSet
());
List
<
Integer
>
delSpecId
=
dbMallIndustrySkuSpecList
.
stream
().
map
(
MallIndustrySkuInfoSpecDO:
:
getId
).
filter
(
id
->
!
inputMallSpecIds
.
contains
(
id
)).
collect
(
Collectors
.
toList
());
if
(
delSpecId
.
size
()
!=
0
)
{
// 删除多余的spec信息
industrySpecDao
.
batchUpdateMallIndustSpec
(
delSpecId
,
goodsAddVO
.
getId
());
}
// 新增spec的信息
for
(
MallProductSpecVO
mallProductSpecVO
:
goodsSpecVO
.
getSpecIds
())
{
if
(
mallProductSpecVO
.
getId
()
==
null
)
{
MallIndustrySkuInfoSpecDO
mallIndustrySkuInfoSpecDO
=
new
MallIndustrySkuInfoSpecDO
()
.
setIndustrySpecId
(
mallProductSpecVO
.
getMallSpecId
())
.
setMallIndustrySkuInfoId
(
goodsSpecVO
.
getId
())
.
setGoodsInfoId
(
goodsAddVO
.
getId
());
// 插入数据库商品对应的规格信息
goodsInfoDao
.
insertMallIndustrySkuInfoSpec
(
mallIndustrySkuInfoSpecDO
);
}
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -259,19 +318,16 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 对比数据库id如果不在就删除
List
<
Integer
>
delIds
=
dbMallSkuIds
.
stream
().
filter
(
id
->
!
inputMallSkuIds
.
contains
(
id
)).
collect
(
Collectors
.
toList
());
if
(
delIds
.
size
()
!=
0
)
{
// 先删除商品绑定sku下的spec信息
goodsInfoDao
.
batchUpdateMallProSpec
(
delIds
,
goodsAddVO
.
getId
());
goodsInfoDao
.
batchUpdateMallProductSku
(
delIds
);
}
// 用途:修改商品规格前选项来源保留一份快照
Map
<
Integer
,
MallProdInfoDO
>
mallProSkuInfoMap
=
mallProSkuInfoList
.
stream
().
collect
(
Collectors
.
toMap
(
MallProdInfoDO:
:
getId
,
Function
.
identity
()));
// 修改商品绑定的sku信息
List
<
MallProdInfoDO
>
mallProdSkuInfoList
=
updateGoodsSpec
.
stream
().
map
(
d
->
{
MallProdInfoDO
mallProdSkuInfoById
=
mallProSkuInfoMap
.
get
(
d
.
getId
());
MallProdInfoDO
mallProdInfoDO
=
new
MallProdInfoDO
();
mallProdInfoDO
.
setId
(
d
.
getId
()).
setProdSkuId
(
d
.
getSkuId
())
.
setCategoriesId
(
d
.
getCategoryId
()).
setProdSkuSpecName
(
d
.
getGoodsSpecName
())
.
setChooseType
(
d
.
getChooseType
()).
setSkuUnitId
(
d
.
getSkuUnitId
()).
setMust
(
d
.
getMust
())
.
setProductSpecIdList
(
d
.
getSpecIds
().
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)))
.
setBeforeUpdateSpec
(
mallProdSkuInfoById
.
getProductSpecIdList
());
.
setChooseType
(
d
.
getChooseType
()).
setSkuUnitId
(
d
.
getSkuUnitId
()).
setMust
(
d
.
getMust
());
return
mallProdInfoDO
;
}).
collect
(
Collectors
.
toList
());
// 1.3批量修改sku的信息
...
...
@@ -279,6 +335,35 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
// 1.4对新的sku进行操作
List
<
GoodsProdSpecVO
>
list
=
specInfo
.
stream
().
filter
(
d
->
d
.
getId
()
==
null
).
collect
(
Collectors
.
toList
());
productSkuSpecOperation
(
new
GoodsInfo
(
goodsAddVO
.
getId
()),
list
);
// 获取商品对应的skuId
List
<
Integer
>
mallSkuIds
=
goodsAddVO
.
getProductSpec
().
stream
().
filter
(
d
->
d
.
getId
()
!=
null
).
map
(
GoodsProdSpecVO:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
mallSkuIds
.
size
()
>
0
)
{
// 根据这些id查出下面对应的规格信息
List
<
MallProdSkuInfoSpecDO
>
mallProdSkuInfoSpecList
=
goodsInfoDao
.
listMallProdSpecInfo
(
mallSkuIds
);
// 分组
Map
<
Integer
,
List
<
MallProdSkuInfoSpecDO
>>
dbSpecMap
=
mallProdSkuInfoSpecList
.
stream
().
collect
(
Collectors
.
groupingBy
(
MallProdSkuInfoSpecDO:
:
getMallProdSkuInfoId
));
for
(
GoodsProdSpecVO
goodsSpecVO
:
updateGoodsSpec
)
{
// 分组后的每一条商品绑定的规格信息
List
<
MallProdSkuInfoSpecDO
>
dbMallProdSkuSpecList
=
dbSpecMap
.
get
(
goodsSpecVO
.
getId
());
Set
<
Integer
>
inputMallSpecIds
=
goodsSpecVO
.
getSpecIds
().
stream
().
map
(
MallProductSpecVO:
:
getId
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toSet
());
List
<
Integer
>
delSpecId
=
dbMallProdSkuSpecList
.
stream
().
map
(
MallProdSkuInfoSpecDO:
:
getId
).
filter
(
id
->
!
inputMallSpecIds
.
contains
(
id
)).
collect
(
Collectors
.
toList
());
if
(
delSpecId
.
size
()
!=
0
)
{
// 删除多余的spec信息
goodsInfoDao
.
batchUpdateMallProdSpec
(
delSpecId
);
}
// 新增spec的信息
for
(
MallProductSpecVO
mallProductSpecVO
:
goodsSpecVO
.
getSpecIds
())
{
if
(
mallProductSpecVO
.
getId
()
==
null
)
{
MallProdSkuInfoSpecDO
mallProdSkuInfoSpecDO
=
new
MallProdSkuInfoSpecDO
()
.
setProductSpecId
(
mallProductSpecVO
.
getMallSpecId
())
.
setMallProdSkuInfoId
(
goodsSpecVO
.
getId
())
.
setGoodsInfoId
(
goodsAddVO
.
getId
());
// 插入数据库商品对应的规格信息
goodsInfoDao
.
insertMallProdSkuInfoSpec
(
mallProdSkuInfoSpecDO
);
}
}
}
}
// 2、对自定义的sku进行操作
List
<
GoodsProdSpecVO
>
zdySpecInfo
=
goodsAddVO
.
getProductSpec
().
stream
().
filter
(
spec
->
spec
.
getFlag
().
equals
(
1
)).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
zdySpecInfo
))
{
...
...
@@ -289,26 +374,60 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateCustomize
(
List
<
GoodsProdSpecVO
>
zdySpecInfo
,
Integer
id
)
{
// 2.1先获取自定义的sku及规格(原来有的)
// 先获取自定义的sku及规格(原来有的)
List
<
GoodsProdSpecVO
>
zdySpec
=
zdySpecInfo
.
stream
().
filter
(
d
->
d
.
getId
()
!=
null
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNot
Empty
(
zdySpec
))
{
if
(
!
CollectionUtils
.
is
Empty
(
zdySpec
))
{
// 根据获取到的自定义sku及规格进行操作
List
<
MallProdInfoDO
>
zdySpecList
=
zdySpec
.
stream
().
map
(
d
->
{
// 构建商品对应的sku信息
ProductSkuDO
productSkuDO
=
new
ProductSkuDO
().
setCategoriesId
(
d
.
getCategoryId
())
.
setProductName
(
d
.
getProductName
()).
setCustomize
(
1
);
ProductSkuDO
productSkuDO
=
new
ProductSkuDO
().
setId
(
d
.
getSkuId
()).
setCategoriesId
(
d
.
getCategoryId
()).
setProductName
(
d
.
getProductName
());
productDao
.
updateProductSku
(
productSkuDO
);
if
(
CollectionUtils
.
isNotEmpty
(
d
.
getDelProductSpecId
()))
{
// 2.2删除这个sku下的spec
productDao
.
batchUpdateMallProdSpec
(
d
.
getDelProductSpecId
());
}
List
<
Integer
>
zdySpecIds
=
d
.
getCustomizeInfo
().
stream
().
map
(
ProductSpecVO:
:
getId
).
collect
(
Collectors
.
toList
());
return
new
MallProdInfoDO
(
d
).
setId
(
d
.
getId
()).
setProdSkuId
(
d
.
getSkuId
())
.
setProductSpecIdList
(
zdySpecIds
.
stream
().
map
(
String:
:
valueOf
).
collect
(
Collectors
.
joining
(
","
)));
return
new
MallProdInfoDO
(
d
).
setId
(
d
.
getId
()).
setProdSkuId
(
d
.
getSkuId
());
}).
collect
(
Collectors
.
toList
());
// 批量修改sku的信息
goodsInfoDao
.
batchUpdateMallProdSkuInfo
(
zdySpecList
);
}
for
(
GoodsProdSpecVO
goodsSpecVO
:
zdySpec
)
{
// 【1】获取输入的自定义规格信息// id不为空则修改
List
<
ProductSpecVO
>
customizeInfoList
=
goodsSpecVO
.
getCustomizeInfo
().
stream
().
filter
(
d
->
d
.
getId
()
!=
null
).
collect
(
Collectors
.
toList
());
for
(
ProductSpecVO
d
:
customizeInfoList
)
{
// ①修改价格配置
ProductSpecCPQVO
productSpecCPQVO
=
d
.
getProductSpecCPQVO
();
// 删除所有的随后在新增
productDao
.
removeProductSpecCPQ
(
productSpecCPQVO
);
productSkuService
.
insertSpecPrice
(
productSpecCPQVO
);
// ②在修改自定义的数据
productDao
.
updateProductSpec
(
new
ProductSpecDO
(
d
));
}
// 【2】删除多余的自定义规格
if
(!
CollectionUtils
.
isEmpty
(
goodsSpecVO
.
getDelProductSpecId
()))
{
// 批量查出spec的数据
List
<
MallProdSkuInfoSpecDO
>
prodSkuInfoSpecList
=
productDao
.
getProductSpecByIds
(
goodsSpecVO
.
getDelProductSpecId
());
for
(
MallProdSkuInfoSpecDO
mallProdSkuInfoSpecDO
:
prodSkuInfoSpecList
)
{
productDao
.
removeProductSpec
(
mallProdSkuInfoSpecDO
.
getProductSpecId
());
}
goodsInfoDao
.
batchUpdateMallProdSpec
(
goodsSpecVO
.
getDelProductSpecId
());
}
// 【3】新增最新的自定义规格
List
<
ProductSpecVO
>
collect
=
goodsSpecVO
.
getCustomizeInfo
().
stream
().
filter
(
d
->
d
.
getId
()
==
null
).
collect
(
Collectors
.
toList
());
for
(
ProductSpecVO
param
:
collect
)
{
ProductSpecDO
productSpecDO
=
new
ProductSpecDO
(
param
);
// 新增产品sku
productDao
.
insertProductSpec
(
productSpecDO
);
// 批量配置价格信息
ProductSpecCPQVO
productSpecCPQVO
=
param
.
getProductSpecCPQVO
();
productSpecCPQVO
.
setProductSpecId
(
productSpecDO
.
getId
());
productSkuService
.
insertSpecPrice
(
productSpecCPQVO
);
// 构建商品对应的规格信息
MallProdSkuInfoSpecDO
mallProdSkuInfoSpecDO
=
new
MallProdSkuInfoSpecDO
()
.
setProductSpecId
(
productSpecDO
.
getId
())
.
setMallProdSkuInfoId
(
goodsSpecVO
.
getId
())
.
setGoodsInfoId
(
id
);
// 插入数据库商品对应的规格信息
goodsInfoDao
.
insertMallProdSkuInfoSpec
(
mallProdSkuInfoSpecDO
);
}
}
// 2.2 新增新的自定义规格信息
List
<
GoodsProdSpecVO
>
newZdySpec
=
zdySpecInfo
.
stream
().
filter
(
d
->
d
.
getId
()
==
null
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
newZdySpec
))
{
...
...
@@ -469,6 +588,67 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
List
<
SkuUnitDTO
>
list
=
skuUnitList
.
stream
().
map
(
SkuUnitDO:
:
buildSkuUnitDTO
).
collect
(
Collectors
.
toList
());
return
ResultBody
.
success
(
list
);
}
@Override
public
List
<
MallGoodsShopCarDTO
>
fillGoodsInfo
(
List
<
MallGoodsShopCarDTO
>
param
)
{
Set
<
Integer
>
goodsIds
=
new
HashSet
<>();
//获取商品id
for
(
MallGoodsShopCarDTO
mallGoodsShopCarDTO
:
param
)
{
goodsIds
.
add
(
mallGoodsShopCarDTO
.
getGoodsInfoId
());
}
//查询出商品信息后进行填充
List
<
GoodsInfo
>
goodsInfoDOList
=
goodsInfoDao
.
listSimpleGoodsInfoByIds
(
goodsIds
);
for
(
MallGoodsShopCarDTO
mallGoodsShopCarDTO
:
param
)
{
for
(
GoodsInfo
goodsInfo
:
goodsInfoDOList
)
{
if
(
mallGoodsShopCarDTO
.
getGoodsInfoId
().
toString
().
equals
(
goodsInfo
.
getId
().
toString
()))
{
mallGoodsShopCarDTO
.
setDirectoryId
(
goodsInfo
.
getDirectoryId
());
mallGoodsShopCarDTO
.
setShelfStatus
(
goodsInfo
.
getShelfStatus
());
mallGoodsShopCarDTO
.
setGoodsName
(
goodsInfo
.
getGoodsName
());
mallGoodsShopCarDTO
.
setMainImg
(
goodsInfo
.
getMainImg
());
break
;
}
}
}
return
param
;
}
@Override
public
List
<
MallProductSpecPriceDTO
>
feignListProductSpecPrice
(
ProductSpecPriceQO
productSpecPriceQO
)
{
Set
<
Integer
>
ids
=
new
HashSet
<>(
productSpecPriceQO
.
getProductSpecIds
());
List
<
MallProductSpecPriceDTO
>
mallProductSpecPriceDTOS
=
productSpecPriceQO
.
getProductSpecIds
().
stream
().
map
(
d
->
{
MallProductSpecPriceDTO
mallProductSpecPriceDTO
=
new
MallProductSpecPriceDTO
();
mallProductSpecPriceDTO
.
setProductSpecId
(
d
);
return
mallProductSpecPriceDTO
;
}).
collect
(
Collectors
.
toList
());
//分别找出渠道价格和市场价格
List
<
ProductSpecPriceDO
>
productSpecPriceDOS
=
productDao
.
listProductSpecPrice
(
productSpecPriceQO
.
getChannelClass
(),
ids
);
List
<
ProductSpecPriceDO
>
productSpecPriceDOS1
=
productDao
.
listProductSpecPrice
(
0
,
ids
);
//设置合作价格
for
(
ProductSpecPriceDO
productSpecPriceDO
:
productSpecPriceDOS
)
{
for
(
MallProductSpecPriceDTO
mallProductSpecPriceDTO
:
mallProductSpecPriceDTOS
)
{
if
(
mallProductSpecPriceDTO
.
getProductSpecId
().
equals
(
productSpecPriceDO
.
getProductSpecId
()))
{
mallProductSpecPriceDTO
.
setOpPrice
(
productSpecPriceDO
.
getPrice
());
break
;
}
}
}
//设置市场价格
for
(
ProductSpecPriceDO
productSpecPriceDO
:
productSpecPriceDOS1
)
{
for
(
MallProductSpecPriceDTO
mallProductSpecPriceDTO
:
mallProductSpecPriceDTOS
)
{
if
(
mallProductSpecPriceDTO
.
getProductSpecId
().
equals
(
productSpecPriceDO
.
getProductSpecId
()))
{
mallProductSpecPriceDTO
.
setMkPrice
(
productSpecPriceDO
.
getPrice
());
break
;
}
}
}
return
mallProductSpecPriceDTOS
;
}
@Override
public
ProductSpecPriceDTO
feignGetUnitPriceByTag
(
Integer
id
,
Integer
tagId
)
{
ProductSpecPriceDTO
price
=
productDao
.
feignGetUnitPrice
(
id
,
tagId
);
return
price
;
}
}
...
...
src/main/java/com/mmc/pms/service/Impl/ProductServiceImpl.java
浏览文件 @
92587869
...
...
@@ -14,11 +14,10 @@ import com.mmc.pms.service.ProductSkuService;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -84,7 +83,20 @@ public class ProductServiceImpl implements ProductSkuService {
Integer
pageNo
=
productSkuQO
.
getPageNo
();
productSkuQO
.
buildCurrentPage
();
List
<
ProductSkuDO
>
productSkuList
=
productDao
.
listPageProductSku
(
productSkuQO
);
List
<
ProductSkuDTO
>
list
=
productSkuList
.
stream
().
map
(
ProductSkuDO:
:
buildProductSkuDTO
).
collect
(
Collectors
.
toList
());
List
<
Integer
>
productSkuIds
=
productSkuList
.
stream
().
map
(
ProductSkuDO:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
ProductSpecDO
>
productSpecList
=
productDao
.
getProductSpecList
(
productSkuIds
);
Map
<
Integer
,
List
<
ProductSpecDO
>>
productSpecMap
=
productSpecList
.
stream
().
collect
(
Collectors
.
groupingBy
(
ProductSpecDO:
:
getProductSkuId
));
List
<
ProductSkuDTO
>
list
=
productSkuList
.
stream
()
.
map
(
ProductSkuDO:
:
buildProductSkuDTO
)
.
collect
(
Collectors
.
toList
());
list
.
stream
().
peek
(
d
->
{
List
<
ProductSpecDO
>
productSpecDOS
=
productSpecMap
.
get
(
d
.
getId
());
if
(
CollectionUtils
.
isEmpty
(
productSpecDOS
))
{
d
.
setProductSpecList
(
null
);
}
else
{
d
.
setProductSpecList
(
productSpecDOS
.
stream
().
map
(
ProductSpecDO:
:
buildProductSpecDTO
).
collect
(
Collectors
.
toList
()));
}
}).
collect
(
Collectors
.
toList
());
return
ResultBody
.
success
(
PageResult
.
buildPage
(
pageNo
,
productSkuQO
.
getPageSize
(),
count
,
list
));
}
...
...
@@ -250,8 +262,19 @@ public class ProductServiceImpl implements ProductSkuService {
@Override
public
BigDecimal
feignGetUnitPriceByTag
(
PriceAcquisition
priceAcquisition
)
{
BigDecimal
price
=
productDao
.
feignGetUnitPriceByTag
(
priceAcquisition
);
return
price
==
null
?
null
:
price
;
Map
<
Integer
,
Integer
>
dayMap
=
new
HashMap
<>();
dayMap
.
put
(
0
,
7
);
dayMap
.
put
(
8
,
15
);
dayMap
.
put
(
16
,
30
);
dayMap
.
put
(
31
,
Integer
.
MAX_VALUE
);
Integer
dayRange
=
dayMap
.
entrySet
().
stream
()
.
filter
(
entry
->
priceAcquisition
.
getDay
()
<=
entry
.
getKey
())
.
findFirst
()
.
map
(
Map
.
Entry
::
getValue
)
.
orElseThrow
(()
->
new
RuntimeException
(
"租赁期限错误错误!"
));
priceAcquisition
.
setDay
(
dayRange
);
return
productDao
.
feignGetUnitPriceByTag
(
priceAcquisition
);
}
}
...
...
src/main/resources/mapper/CategoriesDao.xml
浏览文件 @
92587869
...
...
@@ -153,6 +153,6 @@
FROM categories
WHERE is_deleted = 0
AND directory_id = #{directoryId}
AND
type
= #{type}
AND
`type`
= #{type}
</select>
</mapper>
src/main/resources/mapper/GoodsInfoDao.xml
浏览文件 @
92587869
...
...
@@ -63,6 +63,17 @@
insert into mall_industry_sku_info_spec(mall_industry_sku_info_id, industry_spec_id, goods_info_id)
values (#{mallIndustrySkuInfoId}, #{industrySpecId}, #{goodsInfoId})
</insert>
<insert
id=
"insertMallProdSkuInfo"
parameterType=
"com.mmc.pms.entity.MallProdInfoDO"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into mall_prod_sku_info (goods_info_id, product_id, prod_sku_spec_name, categories_id, choose_type,
sku_unit_id, is_must, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoriesId}, #{chooseType}, #{skuUnitId}, #{must},
#{flag}) >
</insert>
<insert
id=
"insertMallProdSkuInfoSpec"
>
insert into mall_prod_info_spec (goods_info_id, mall_prod_info_id, product_spec_id)
values (#{goodsInfoId}, #{mallProdSkuInfoId}, #{productSpecId})
</insert>
<update
id=
"updateGoodsInfo"
>
update goods_info
...
...
@@ -108,15 +119,30 @@
prod_spec_name = #{d.prodSkuSpecName},
choose_type = #{d.chooseType},
sku_unit_id = #{d.skuUnitId},
is_must = #{d.must},
product_spec_id_list = #{d.productSpecIdList},
before_update_spec = #{d.beforeUpdateSpec}
is_must = #{d.must}
</set>
<where>
id = #{d.id}
</where>
</foreach>
</update>
<update
id=
"batchUpdateMallProSpec"
>
<foreach
collection=
"list"
separator=
";"
item=
"d"
>
update mall_prod_sku_info_spec
set is_deleted = 1
where mall_prod_info_id = #{d}
and goods_info_id =#{id}
and is_deleted = 0
</foreach>
</update>
<update
id=
"batchUpdateMallProdSpec"
>
<foreach
collection=
"list"
item=
"d"
separator=
";"
>
update mall_prod_info_spec
set is_deleted = 1
where id = #{d}
and is_deleted = 0
</foreach>
</update>
<delete
id=
"deleteGoodsServiceByGoodsId"
>
delete
from goods_service
...
...
@@ -229,4 +255,32 @@
FROM sku_unit
WHERE is_deleted = 0
</select>
<select
id=
"listSimpleGoodsInfoByIds"
resultType=
"com.mmc.pms.entity.GoodsInfo"
>
SELECT
gi.id,
gi.shelf_status,
img.img_url as mainImg,
gi.goods_name,
gi.directory_id
FROM
goods_info gi
LEFT JOIN goods_img img ON img.goods_info_id = gi.id
AND img.is_deleted = 0 AND img.img_type = 0
<where>
<if
test=
"ids != null"
>
<foreach
collection=
"ids"
item=
"id"
open=
"and gi.id in ("
close=
")"
index=
"index"
separator=
","
>
#{id}
</foreach>
</if>
</where>
</select>
<select
id=
"listMallProdSpecInfo"
resultType=
"com.mmc.pms.entity.MallProdSkuInfoSpecDO"
>
select id, goods_info_id goodsInfoId, mall_prod_info_id mallProdSkuInfoId, product_spec_id productSpecId
from mall_prod_info_spec
where mall_prod_info_id in
<foreach
collection=
"list"
separator=
","
item=
"d"
open=
"("
close=
")"
index=
"index"
>
#{d}
</foreach>
and is_deleted = 0
</select>
</mapper>
src/main/resources/mapper/IndustrySpecDao.xml
浏览文件 @
92587869
...
...
@@ -142,13 +142,15 @@
and is_deleted = 0
</select>
<select
id=
"getIndustrySkuById"
resultType=
"com.mmc.pms.entity.IndustrySku"
>
SELECT id,
solution_name,
categories_id,
description,
create_time
FROM industry_sku
WHERE id = #{id}
SELECT ins.id,
ins.solution_name,
ins.categories_id,
ins.description,
ins.create_time,
c.`name` typeName
FROM industry_sku ins
INNER JOIN categories c ON ins.categories_id = c.id
WHERE ins.id = #{id}
</select>
<select
id=
"countListPageIndustrySku"
resultType=
"java.lang.Integer"
>
select count(*) from industry_sku
...
...
@@ -157,7 +159,7 @@
<if
test=
"solutionName != null and solutionName != ''"
>
and solution_name like CONCAT('%',#{solutionName},'%')
</if>
<if
test=
"
goodsType
Id != null"
>
<if
test=
"
category
Id != null"
>
and categories_id like CONCAT('%',#{categoryId},'%')
</if>
</where>
...
...
@@ -169,7 +171,7 @@
ps.categories_id,
ps.description,
ps.create_time,
c.
type_
name typeName
c.name typeName
FROM
industry_sku ps
INNER JOIN categories c ON ps.categories_id = c.id
...
...
src/main/resources/mapper/ProductDao.xml
浏览文件 @
92587869
...
...
@@ -28,11 +28,12 @@
(#{item.productSpecId},#{item.cooperationTag},#{item.price},#{item.type},#{item.leaseTerm})
</foreach>
</insert>
<insert
id=
"insertMallProdSkuInfo"
>
<insert
id=
"insertMallProdSkuInfo"
parameterType=
"com.mmc.pms.entity.MallProdInfoDO"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into mall_prod_info (goods_info_id, prod_sku_id, prod_spec_name, category_id, choose_type,
sku_unit_id, is_must, product_spec_id_list, flag)
values (#{goodsInfoId}, #{prodSkuId}, #{prodSkuSpecName}, #{categoryId}, #{chooseType}, #{skuUnitId}, #{must},
#{
productSpecIdList}, #{
flag})
#{flag})
</insert>
<update
id=
"updateProductSku"
>
update product
...
...
@@ -119,7 +120,6 @@
</select>
<select
id=
"listPageProductSku"
resultType=
"com.mmc.pms.entity.ProductSkuDO"
>
SELECT
SELECT
ps.id,
ps.product_name,
ps.model,
...
...
@@ -137,7 +137,7 @@
LEFT JOIN brand_info bi ON ps.brand_info_id = bi.id
<where>
ps.is_deleted = 0
and
is_
customize
<![CDATA[<>]]>
1
and customize
<![CDATA[<>]]>
1
<if
test=
"productName != null and productName != ''"
>
and ps.product_name like CONCAT ('%',#{productName},'%')
</if>
...
...
@@ -323,5 +323,71 @@
from product_spec_price
where product_spec_id = #{specsId}
and cooperation_tag = #{channelLevelId}
and `type` = 1
and lease_term = #{day}
</select>
<select
id=
"listProdSpecInfo"
resultType=
"com.mmc.pms.entity.MallGoodsSpecInfoDO"
>
SELECT
gi.id, gi.directory_id, mpsip.id as mallSkuInfoSpecId, mpsip.is_deleted as sku_spec_deleted, ps.spec_name,
ps.is_deleted as spec_deleted
FROM
goods_info gi
INNER JOIN mall_prod_sku_info mpsi ON gi.id = mpsi.goods_info_id
INNER JOIN mall_prod_sku_info_spec mpsip ON mpsi.id = mpsip.mall_prod_sku_info_id
INNER JOIN product_spec ps ON ps.id = mpsip.product_spec_id
<where>
mpsip.id in (
<if
test=
"prodIds != null"
>
<foreach
collection=
"prodIds"
item=
"id"
index=
"index"
separator=
","
>
#{id}
</foreach>
</if>
)
</where>
</select>
<select
id=
"listProductSpecPrice"
resultType=
"com.mmc.pms.entity.ProductSpecPriceDO"
>
SELECT
psp.id,
psp.product_spec_id,
psp.cooperation_tag,
psp.price
FROM
product_spec_price psp
where psp.cooperation_tag = #{tagInfoId} and psp.product_spec_id in (
<foreach
collection=
"prodSkuSpecIds"
item=
"id"
index=
"index"
separator=
","
>
#{id}
</foreach>
)
</select>
<select
id=
"feignGetUnitPrice"
resultType=
"com.mmc.pms.model.dto.ProductSpecPriceDTO"
>
select price
from product_spec_price
where product_spec_id = #{id}
and tag_info_id = #{tagId}
</select>
<select
id=
"getProductSpecList"
resultType=
"com.mmc.pms.entity.ProductSpecDO"
>
SELECT
id,
product_id productSkuId,
spec_name specName,
spec_image specImage,
part_no partNo,
version_desc versionDesc
FROM
product_spec
WHERE
product_id in
<foreach
collection=
"list"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</select>
<select
id=
"getProductSpecByIds"
resultType=
"com.mmc.pms.entity.MallProdSkuInfoSpecDO"
>
select id, goods_info_id goodsInfoId, mall_prod_info_id mallProdSkuInfoId, product_spec_id productSpecId
from mall_prod_sku_info_spec
where id in
<foreach
collection=
"list"
separator=
","
item=
"d"
open=
"("
close=
")"
index=
"index"
>
#{d}
</foreach>
and is_deleted = 0
</select>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论