Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pms
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
pms
Commits
ec92b8f9
提交
ec92b8f9
authored
8月 14, 2023
作者:
xiaowang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:租赁商品详情
上级
067bb945
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
171 行增加
和
13 行删除
+171
-13
LeaseGoodsController.java
...va/com/mmc/pms/controller/lease/LeaseGoodsController.java
+9
-5
LeaseGoodsDao.java
src/main/java/com/mmc/pms/dao/lease/LeaseGoodsDao.java
+11
-4
LeaseGoodsDO.java
src/main/java/com/mmc/pms/entity/lease/LeaseGoodsDO.java
+10
-0
LeaseGoodsResourcesDO.java
.../java/com/mmc/pms/entity/lease/LeaseGoodsResourcesDO.java
+5
-1
LeasePartsListDO.java
src/main/java/com/mmc/pms/entity/lease/LeasePartsListDO.java
+4
-0
LeasePriceStockDO.java
...main/java/com/mmc/pms/entity/lease/LeasePriceStockDO.java
+8
-0
LeaseSpecAttrDO.java
src/main/java/com/mmc/pms/entity/lease/LeaseSpecAttrDO.java
+12
-0
LeaseSpecAttrValueDO.java
...n/java/com/mmc/pms/entity/lease/LeaseSpecAttrValueDO.java
+5
-0
LeaseGoodsService.java
...ain/java/com/mmc/pms/service/lease/LeaseGoodsService.java
+2
-1
LeaseGoodsServiceImpl.java
...com/mmc/pms/service/lease/impl/LeaseGoodsServiceImpl.java
+25
-2
LeaseGoodsDao.xml
src/main/resources/mapper/lease/LeaseGoodsDao.xml
+80
-0
没有找到文件。
src/main/java/com/mmc/pms/controller/lease/LeaseGoodsController.java
浏览文件 @
ec92b8f9
...
...
@@ -14,10 +14,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -33,7 +30,7 @@ public class LeaseGoodsController extends BaseController {
@Resource
LeaseGoodsService
leaseGoodsService
;
@ApiOperation
(
value
=
"新增
商城
商品"
)
@ApiOperation
(
value
=
"新增
租赁
商品"
)
@PostMapping
(
"addLeaseGoods"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
public
ResultBody
addLeaseGoods
(
@RequestBody
LeaseGoodsVO
leaseGoodsVO
,
HttpServletRequest
request
)
{
...
...
@@ -47,4 +44,11 @@ public class LeaseGoodsController extends BaseController {
public
ResultBody
getLeaseTermInfo
()
{
return
leaseGoodsService
.
getLeaseTermInfo
();
}
@ApiOperation
(
value
=
"租赁商品详情"
)
@PostMapping
(
"leaseGoodsDetails"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
public
ResultBody
leaseGoodsDetails
(
@RequestParam
Integer
id
)
{
return
leaseGoodsService
.
leaseGoodsDetails
(
id
);
}
}
src/main/java/com/mmc/pms/dao/lease/LeaseGoodsDao.java
浏览文件 @
ec92b8f9
package
com
.
mmc
.
pms
.
dao
.
lease
;
import
com.mmc.pms.entity.lease.LeaseGoodsDO
;
import
com.mmc.pms.entity.lease.LeasePartsListDO
;
import
com.mmc.pms.entity.lease.LeasePriceStockDO
;
import
com.mmc.pms.entity.lease.LeaseTermInfoDO
;
import
com.mmc.pms.entity.lease.*
;
import
com.mmc.pms.entity.mall.MallGoodsResourcesDO
;
import
com.mmc.pms.entity.mall.SpecAttrDO
;
import
com.mmc.pms.entity.mall.SpecAttrValueDO
;
...
...
@@ -37,4 +34,14 @@ public interface LeaseGoodsDao {
void
batchInsertLeaseParts
(
List
<
LeasePartsListDO
>
list
);
List
<
LeaseTermInfoDO
>
getLeaseTermInfo
();
LeaseGoodsDO
getLeaseGoodsBaseInfo
(
Integer
id
);
List
<
LeaseGoodsResourcesDO
>
getLeaseGoodsResources
(
Integer
id
);
List
<
LeaseSpecAttrDO
>
listSpecAttr
(
Integer
id
);
List
<
LeasePriceStockDO
>
listPriceStock
(
Integer
id
);
List
<
LeasePartsListDO
>
listLeasePartsListDO
(
Integer
id
);
}
src/main/java/com/mmc/pms/entity/lease/LeaseGoodsDO.java
浏览文件 @
ec92b8f9
...
...
@@ -110,5 +110,15 @@ public class LeaseGoodsDO implements Serializable {
this
.
logisticsCompany
=
leaseGoodsVO
.
getLogisticsCompany
();
this
.
modeOfDelivery
=
leaseGoodsVO
.
getModeOfDelivery
();
}
public
LeaseGoodsVO
buildLeaseGoodsVO
()
{
return
LeaseGoodsVO
.
builder
().
id
(
id
).
tradeName
(
tradeName
)
.
sellingPoint
(
sellingPoint
).
level
(
level
).
shelfStatus
(
shelfStatus
)
.
productTypeId
(
productTypeId
).
brandInfoId
(
brandInfoId
).
deviceModeId
(
deviceModeId
)
.
productParam
(
productParam
).
productDetails
(
productDetails
).
minLeaseTerm
(
minLeaseTerm
)
.
maxLeaseTerm
(
maxLeaseTerm
).
shipAddress
(
shipAddress
).
returnAddress
(
returnAddress
)
.
logisticsCompany
(
logisticsCompany
).
modeOfDelivery
(
modeOfDelivery
).
createTime
(
createTime
)
.
userAccountId
(
userAccountId
).
build
();
}
}
src/main/java/com/mmc/pms/entity/lease/LeaseGoodsResourcesDO.java
浏览文件 @
ec92b8f9
package
com
.
mmc
.
pms
.
entity
.
lease
;
import
com.mmc.pms.model.mall.GoodsResourcesVO
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -34,6 +35,9 @@ public class LeaseGoodsResourcesDO implements Serializable {
private
Date
createTime
;
private
Date
updateTime
;
public
GoodsResourcesVO
buildGoodsResourcesVO
()
{
return
GoodsResourcesVO
.
builder
().
id
(
id
).
url
(
url
).
type
(
type
).
build
();
}
}
src/main/java/com/mmc/pms/entity/lease/LeasePartsListDO.java
浏览文件 @
ec92b8f9
...
...
@@ -36,5 +36,9 @@ public class LeasePartsListDO implements Serializable {
this
.
name
=
param
.
getName
();
this
.
price
=
param
.
getPrice
();
}
public
LeasePartsListVO
buildLeasePartsListVO
()
{
return
LeasePartsListVO
.
builder
().
id
(
id
).
name
(
name
).
number
(
number
).
price
(
price
).
build
();
}
}
src/main/java/com/mmc/pms/entity/lease/LeasePriceStockDO.java
浏览文件 @
ec92b8f9
...
...
@@ -90,5 +90,13 @@ public class LeasePriceStockDO implements Serializable {
this
.
showPrice
=
param
.
getShowPrice
();
this
.
stockOut
=
param
.
getStockOut
();
}
public
LeasePriceStockVO
buildPriceStockVO
()
{
return
LeasePriceStockVO
.
builder
().
id
(
id
).
productSpec
(
productSpec
)
.
cashPledge
(
cashPledge
).
threeDaysRental
(
threeDaysRental
)
.
sevenDaysRental
(
sevenDaysRental
).
thirtyDaysRental
(
thirtyDaysRental
)
.
ninetyDaysRental
(
ninetyDaysRental
).
maxDaysRental
(
maxDaysRental
)
.
showPrice
(
showPrice
).
skuImage
(
skuImage
).
stock
(
stock
).
stockOut
(
stockOut
).
build
();
}
}
src/main/java/com/mmc/pms/entity/lease/LeaseSpecAttrDO.java
浏览文件 @
ec92b8f9
package
com
.
mmc
.
pms
.
entity
.
lease
;
import
com.mmc.pms.model.mall.SpecAttrVO
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.apache.commons.collections4.CollectionUtils
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 规格属性表(LeaseSpecAttrDO)实体类
...
...
@@ -32,5 +36,13 @@ public class LeaseSpecAttrDO implements Serializable {
private
Date
createTime
;
private
Date
updateTime
;
private
List
<
LeaseSpecAttrValueDO
>
leaseSpecAttrValues
;
public
SpecAttrVO
buildSpecAttrVO
()
{
return
SpecAttrVO
.
builder
().
id
(
id
).
specName
(
specName
)
.
specValuesList
(
CollectionUtils
.
isEmpty
(
leaseSpecAttrValues
)
?
null
:
this
.
leaseSpecAttrValues
.
stream
().
map
(
LeaseSpecAttrValueDO:
:
buildSpecAttr
).
collect
(
Collectors
.
toList
())).
build
();
}
}
src/main/java/com/mmc/pms/entity/lease/LeaseSpecAttrValueDO.java
浏览文件 @
ec92b8f9
package
com
.
mmc
.
pms
.
entity
.
lease
;
import
com.mmc.pms.model.mall.SpecAttrVO
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -28,5 +29,9 @@ public class LeaseSpecAttrValueDO implements Serializable {
private
String
specValueName
;
private
Date
createTime
;
public
SpecAttrVO
buildSpecAttr
()
{
return
SpecAttrVO
.
builder
().
id
(
id
).
specName
(
specValueName
).
build
();
}
}
src/main/java/com/mmc/pms/service/lease/LeaseGoodsService.java
浏览文件 @
ec92b8f9
...
...
@@ -12,5 +12,6 @@ public interface LeaseGoodsService {
ResultBody
addLeaseGoods
(
LeaseGoodsVO
leaseGoodsVO
,
Integer
userAccountId
);
ResultBody
getLeaseTermInfo
();
ResultBody
leaseGoodsDetails
(
Integer
id
);
}
src/main/java/com/mmc/pms/service/lease/impl/LeaseGoodsServiceImpl.java
浏览文件 @
ec92b8f9
...
...
@@ -2,8 +2,7 @@ package com.mmc.pms.service.lease.impl;
import
com.mmc.pms.common.ResultBody
;
import
com.mmc.pms.dao.lease.LeaseGoodsDao
;
import
com.mmc.pms.entity.lease.LeaseGoodsDO
;
import
com.mmc.pms.entity.lease.LeasePartsListDO
;
import
com.mmc.pms.entity.lease.*
;
import
com.mmc.pms.model.lease.vo.LeaseGoodsVO
;
import
com.mmc.pms.model.lease.vo.LeasePartsListVO
;
import
com.mmc.pms.service.lease.LeaseGoodsService
;
...
...
@@ -63,4 +62,28 @@ public class LeaseGoodsServiceImpl implements LeaseGoodsService {
public
ResultBody
getLeaseTermInfo
()
{
return
ResultBody
.
success
(
leaseGoodsDao
.
getLeaseTermInfo
());
}
@Override
public
ResultBody
leaseGoodsDetails
(
Integer
id
)
{
LeaseGoodsDO
leaseGoodsDO
=
leaseGoodsDao
.
getLeaseGoodsBaseInfo
(
id
);
if
(
leaseGoodsDO
==
null
)
{
return
ResultBody
.
error
(
"商品不存在或已删除!"
);
}
LeaseGoodsVO
leaseGoodsVO
=
leaseGoodsDO
.
buildLeaseGoodsVO
();
// 获取图片及其他资源信息
List
<
LeaseGoodsResourcesDO
>
leaseGoodsResourcesList
=
leaseGoodsDao
.
getLeaseGoodsResources
(
id
);
leaseGoodsVO
.
setResourcesList
(
leaseGoodsResourcesList
.
stream
()
.
map
(
LeaseGoodsResourcesDO:
:
buildGoodsResourcesVO
).
collect
(
Collectors
.
toList
()));
// 获取规格及规格值
List
<
LeaseSpecAttrDO
>
specAttrDOList
=
leaseGoodsDao
.
listSpecAttr
(
id
);
leaseGoodsVO
.
setSpecAttrList
(
specAttrDOList
.
stream
().
map
(
LeaseSpecAttrDO:
:
buildSpecAttrVO
).
collect
(
Collectors
.
toList
()));
// 获取价格库存排列组合
List
<
LeasePriceStockDO
>
priceStockDOList
=
leaseGoodsDao
.
listPriceStock
(
id
);
leaseGoodsVO
.
setPriceStock
(
priceStockDOList
.
stream
().
map
(
LeasePriceStockDO:
:
buildPriceStockVO
).
collect
(
Collectors
.
toList
()));
// 获取商品清单信息
List
<
LeasePartsListDO
>
leasePartsDOList
=
leaseGoodsDao
.
listLeasePartsListDO
(
id
);
leaseGoodsVO
.
setLeasePartsList
(
CollectionUtils
.
isEmpty
(
leasePartsDOList
)
?
null
:
leasePartsDOList
.
stream
().
map
(
LeasePartsListDO:
:
buildLeasePartsListVO
).
collect
(
Collectors
.
toList
()));
return
ResultBody
.
success
(
leaseGoodsVO
);
}
}
src/main/resources/mapper/lease/LeaseGoodsDao.xml
浏览文件 @
ec92b8f9
...
...
@@ -3,6 +3,17 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.mmc.pms.dao.lease.LeaseGoodsDao"
>
<resultMap
id=
"leaseSpecAttr"
type=
"com.mmc.pms.entity.lease.LeaseSpecAttrDO"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"lease_goods_id"
property=
"mallGoodsId"
/>
<result
column=
"spec_name"
property=
"specName"
/>
<collection
property=
"leaseSpecAttrValues"
javaType=
"java.util.List"
ofType=
"com.mmc.pms.entity.lease.LeaseSpecAttrValueDO"
>
<id
property=
"id"
column=
"valueId"
/>
<result
property=
"specValueName"
column=
"spec_value_name"
/>
</collection>
</resultMap>
<insert
id=
"insertLeaseGoodsBaseInfo"
parameterType=
"com.mmc.pms.entity.lease.LeaseGoodsDO"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into lease_goods (trade_name,
...
...
@@ -102,4 +113,72 @@
select id, lease_date
from lease_term_info
</select>
<select
id=
"getLeaseGoodsBaseInfo"
resultType=
"com.mmc.pms.entity.lease.LeaseGoodsDO"
>
select id,
trade_name,
selling_point,
`level`,
shelf_status,
product_type_id,
brand_info_id,
device_mode_id,
product_param,
product_details,
min_lease_term,
max_lease_term,
ship_address,
return_address,
logistics_company,
mode_of_delivery,
user_account_id,
create_time,
sort
from lease_goods
where id = #{id}
</select>
<select
id=
"getLeaseGoodsResources"
resultType=
"com.mmc.pms.entity.lease.LeaseGoodsResourcesDO"
>
SELECT id,
lease_goods_id,
url,
`type`
from lease_goods_resources
where lease_goods_id = #{id}
</select>
<select
id=
"listSpecAttr"
resultMap=
"leaseSpecAttr"
>
SELECT lsa.id,
lsa.lease_goods_id,
lsa.spec_name,
lsav.id as valueId,
lsav.spec_value_name
FROM lease_spec_attr lsa
LEFT JOIN lease_spec_attr_value lsav ON lsa.id = lsav.spec_attr_id
WHERE lsa.lease_goods_id = #{id}
</select>
<select
id=
"listPriceStock"
resultType=
"com.mmc.pms.entity.lease.LeasePriceStockDO"
>
select id,
lease_goods_id,
product_spec,
sku_image,
cash_pledge,
three_days_rental,
seven_days_rental,
thirty_days_rental,
ninety_days_rental,
max_days_rental,
show_price,
stock,
stock_out,
create_time
from lease_price_stock
where lease_goods_id = #{id}
</select>
<select
id=
"listLeasePartsListDO"
resultType=
"com.mmc.pms.entity.lease.LeasePartsListDO"
>
select id,
lease_goods_id,
`name`,
`number`,
price
from lease_parts_list
where lease_goods_id = #{id}
</select>
</mapper>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论