Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
fee6786d
Commit
fee6786d
authored
Aug 10, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 小程序收藏册接口
parent
50618e8e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
36 deletions
+183
-36
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/FavoritesResponseVo.java
...in/java/com/wwdz/ch/wx/entity/vo/FavoritesResponseVo.java
+19
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/ItemResponseVo.java
...rc/main/java/com/wwdz/ch/wx/entity/vo/ItemResponseVo.java
+2
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+18
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+1
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
...c/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
+105
-32
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
+38
-2
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/FavoritesResponseVo.java
0 → 100644
View file @
fee6786d
package
com.wwdz.ch.wx.entity.vo
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
FavoritesResponseVo
implements
Entity
{
private
Long
id
;
private
String
title
;
private
String
description
;
private
Integer
sort
;
private
Date
addTime
;
private
Date
updateTime
;
private
Boolean
deleted
;
private
String
images
;
private
long
count
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/ItemResponseVo.java
View file @
fee6786d
package
com.wwdz.ch.wx.entity.vo
;
package
com.wwdz.ch.wx.entity.vo
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
lombok.Data
;
@Data
@Data
public
class
ItemResponseVo
{
public
class
ItemResponseVo
implements
Entity
{
private
Long
id
;
private
Long
id
;
private
Long
itemId
;
private
Long
itemId
;
private
Integer
cid
;
private
Integer
cid
;
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
fee6786d
...
@@ -14,6 +14,7 @@ import com.wwdz.ch.db.dto.request.CoinRequestDto;
...
@@ -14,6 +14,7 @@ import com.wwdz.ch.db.dto.request.CoinRequestDto;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo
;
import
com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo
;
import
com.wwdz.ch.wx.entity.vo.FavoritesResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
...
@@ -72,6 +73,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -72,6 +73,7 @@ public class FavoritesServiceImpl implements FavoritesService {
page
.
setTotal
(
0
);
page
.
setTotal
(
0
);
page
.
setList
(
new
ArrayList
<>());
page
.
setList
(
new
ArrayList
<>());
PageInfo
<
Favorites
>
favoritesPage
=
favoritesDao
.
pageByUserId
(
dto
.
getUserId
(),
dto
.
getPage
(),
dto
.
getSize
());
PageInfo
<
Favorites
>
favoritesPage
=
favoritesDao
.
pageByUserId
(
dto
.
getUserId
(),
dto
.
getPage
(),
dto
.
getSize
());
page
.
setHasNextPage
(
favoritesPage
.
isHasNextPage
());
if
(
favoritesPage
.
getList
().
isEmpty
())
{
if
(
favoritesPage
.
getList
().
isEmpty
())
{
return
Result
.
success
(
page
);
return
Result
.
success
(
page
);
}
}
...
@@ -95,7 +97,21 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -95,7 +97,21 @@ public class FavoritesServiceImpl implements FavoritesService {
@Override
@Override
public
Result
list
(
FavoritesRequestDto
dto
)
{
public
Result
list
(
FavoritesRequestDto
dto
)
{
try
{
try
{
return
Result
.
success
(
favoritesDao
.
listByUserId
(
dto
.
getUserId
()));
List
<
Favorites
>
list
=
favoritesDao
.
listByUserId
(
dto
.
getUserId
());
List
<
FavoritesResponseVo
>
result
=
new
ArrayList
<>();
for
(
Favorites
favorites
:
list
)
{
FavoritesResponseVo
vo
=
new
FavoritesResponseVo
();
vo
.
setId
(
favorites
.
getId
());
vo
.
setTitle
(
favorites
.
getTitle
());
vo
.
setDescription
(
favorites
.
getDescription
());
vo
.
setSort
(
favorites
.
getSort
());
vo
.
setDeleted
(
favorites
.
getDeleted
());
vo
.
setAddTime
(
favorites
.
getAddTime
());
vo
.
setImages
(
favorites
.
getImages
());
vo
.
setUpdateTime
(
favorites
.
getUpdateTime
());
vo
.
setCount
(
favoritesItemsRelationDao
.
countByFavoritesId
(
favorites
.
getId
()));
}
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取收藏册列表失败,原因:"
+
e
.
getMessage
(),
e
);
logger
.
error
(
"获取收藏册列表失败,原因:"
+
e
.
getMessage
(),
e
);
return
Result
.
failed
(-
1
,
"获取收藏册列表失败"
);
return
Result
.
failed
(-
1
,
"获取收藏册列表失败"
);
...
@@ -179,6 +195,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -179,6 +195,7 @@ public class FavoritesServiceImpl implements FavoritesService {
page
.
setTotal
(
0L
);
page
.
setTotal
(
0L
);
page
.
setList
(
new
ArrayList
<>());
page
.
setList
(
new
ArrayList
<>());
PageInfo
<
FavoritesItemsRelation
>
relationPage
=
favoritesItemsRelationDao
.
pageByFavoritesId
(
dto
.
getId
(),
dto
.
getPage
(),
dto
.
getSize
());
PageInfo
<
FavoritesItemsRelation
>
relationPage
=
favoritesItemsRelationDao
.
pageByFavoritesId
(
dto
.
getId
(),
dto
.
getPage
(),
dto
.
getSize
());
page
.
setHasNextPage
(
relationPage
.
isHasNextPage
());
if
(
relationPage
.
getList
().
isEmpty
())
{
if
(
relationPage
.
getList
().
isEmpty
())
{
return
Result
.
success
(
page
);
return
Result
.
success
(
page
);
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
fee6786d
...
@@ -51,6 +51,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -51,6 +51,7 @@ public class ItemServiceImpl implements ItemService {
result
.
setPageSize
(
page
.
getPageSize
());
result
.
setPageSize
(
page
.
getPageSize
());
result
.
setTotal
(
page
.
getTotal
());
result
.
setTotal
(
page
.
getTotal
());
result
.
setList
(
new
ArrayList
<>());
result
.
setList
(
new
ArrayList
<>());
result
.
setHasNextPage
(
result
.
isHasNextPage
());
if
(
CollectionUtils
.
isEmpty
(
page
.
getList
()))
{
if
(
CollectionUtils
.
isEmpty
(
page
.
getList
()))
{
return
Result
.
success
(
result
);
return
Result
.
success
(
result
);
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
View file @
fee6786d
...
@@ -5,22 +5,20 @@ import com.wwdz.ch.wx.entity.request.FavoritesRequestDto;
...
@@ -5,22 +5,20 @@ import com.wwdz.ch.wx.entity.request.FavoritesRequestDto;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.KlDataRequestDto
;
import
com.wwdz.ch.wx.entity.request.KlDataRequestDto
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
com.xxdxxs.support.Delete
;
import
com.xxdxxs.support.Select
;
import
com.xxdxxs.utils.JsonUtils
;
import
com.xxdxxs.utils.JsonUtils
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Objects
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@RestController
@RestController
@RequestMapping
(
"/wx/favorites"
)
@RequestMapping
(
"/wx/favorites"
)
...
@@ -72,46 +70,83 @@ public class WxFavoritesController {
...
@@ -72,46 +70,83 @@ public class WxFavoritesController {
@ApiOperation
(
value
=
"新增"
)
@ApiOperation
(
value
=
"新增"
)
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
public
Result
add
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
add
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
if
(
Objects
.
isNull
(
dto
.
getUserId
()))
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】收藏册新增,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
title
=
JsonUtils
.
getValueByPath
(
json
,
"title"
);
String
description
=
JsonUtils
.
getValueByPath
(
json
,
"description"
);
String
images
=
JsonUtils
.
getValueByPath
(
json
,
"images"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
dto
.
getTitle
()
))
{
if
(
StringUtils
.
isBlank
(
title
))
{
return
Result
.
failed
(
"标题不能为空"
);
return
Result
.
failed
(
"标题不能为空"
);
}
}
if
(
dto
.
getTitle
()
.
length
()
>
20
)
{
if
(
title
.
length
()
>
20
)
{
return
Result
.
failed
(
"标题的字数不能大于20字"
);
return
Result
.
failed
(
"标题的字数不能大于20字"
);
}
}
if
(
StringUtils
.
isNotBlank
(
d
to
.
getDescription
())
&&
dto
.
getDescription
()
.
length
()
>
200
)
{
if
(
StringUtils
.
isNotBlank
(
d
escription
)
&&
description
.
length
()
>
200
)
{
return
Result
.
failed
(
"描述的字数不能大于200字"
);
return
Result
.
failed
(
"描述的字数不能大于200字"
);
}
}
FavoritesRequestDto
dto
=
new
FavoritesRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setTitle
(
title
);
dto
.
setDescription
(
description
);
dto
.
setImages
(
images
);
return
favoritesService
.
add
(
dto
);
return
favoritesService
.
add
(
dto
);
}
}
@ApiOperation
(
value
=
"修改"
)
@ApiOperation
(
value
=
"修改"
)
@PostMapping
(
"/update"
)
@PostMapping
(
"/update"
)
public
Result
update
(
@RequestBody
FavoritesRequestDto
dto
)
{
public
Result
update
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】收藏册修改,请求参数,kl_data:{}"
,
json
);
String
id
=
JsonUtils
.
getValueByPath
(
json
,
"id"
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
title
=
JsonUtils
.
getValueByPath
(
json
,
"title"
);
String
description
=
JsonUtils
.
getValueByPath
(
json
,
"description"
);
String
images
=
JsonUtils
.
getValueByPath
(
json
,
"images"
);
if
(
StringUtils
.
isBlank
(
id
))
{
return
Result
.
failed
(
"id不能为空"
);
return
Result
.
failed
(
"id不能为空"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getUserId
()
))
{
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
dto
.
getTitle
()
))
{
if
(
StringUtils
.
isBlank
(
title
))
{
return
Result
.
failed
(
"标题不能为空"
);
return
Result
.
failed
(
"标题不能为空"
);
}
}
if
(
dto
.
getTitle
()
.
length
()
>
20
)
{
if
(
title
.
length
()
>
20
)
{
return
Result
.
failed
(
"标题的字数不能大于20字"
);
return
Result
.
failed
(
"标题的字数不能大于20字"
);
}
}
if
(
StringUtils
.
isNotBlank
(
d
to
.
getDescription
())
&&
dto
.
getDescription
()
.
length
()
>
200
)
{
if
(
StringUtils
.
isNotBlank
(
d
escription
)
&&
description
.
length
()
>
200
)
{
return
Result
.
failed
(
"描述的字数不能大于200字"
);
return
Result
.
failed
(
"描述的字数不能大于200字"
);
}
}
FavoritesRequestDto
dto
=
new
FavoritesRequestDto
();
dto
.
setId
(
Long
.
parseLong
(
id
));
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setTitle
(
title
);
dto
.
setDescription
(
description
);
dto
.
setImages
(
images
);
return
favoritesService
.
update
(
dto
);
return
favoritesService
.
update
(
dto
);
}
}
@ApiOperation
(
value
=
"详情"
)
@ApiOperation
(
value
=
"详情"
)
@PostMapping
(
"/info"
)
@PostMapping
(
"/info"
)
public
Result
info
(
@RequestBody
@Validated
(
Select
.
class
)
FavoritesRequestDto
dto
)
{
public
Result
info
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】收藏册详情查询,请求参数,kl_data:{}"
,
json
);
String
id
=
JsonUtils
.
getValueByPath
(
json
,
"id"
);
if
(
StringUtils
.
isBlank
(
id
))
{
return
Result
.
failed
(
"收藏册id不能为空"
);
}
FavoritesRequestDto
dto
=
new
FavoritesRequestDto
();
dto
.
setId
(
Long
.
parseLong
(
id
));
return
favoritesService
.
info
(
dto
);
return
favoritesService
.
info
(
dto
);
}
}
...
@@ -142,49 +177,87 @@ public class WxFavoritesController {
...
@@ -142,49 +177,87 @@ public class WxFavoritesController {
@ApiOperation
(
value
=
"单个删除"
)
@ApiOperation
(
value
=
"单个删除"
)
@PostMapping
(
"/delete"
)
@PostMapping
(
"/delete"
)
public
Result
delete
(
@RequestBody
@Validated
(
Delete
.
class
)
FavoritesRequestDto
dto
)
{
public
Result
delete
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
String
json
=
klDataRequestDto
.
getKl_data
();
return
Result
.
failed
(
"id不能为空"
);
logger
.
info
(
"【请求开始】收藏册单个删除,请求参数,kl_data:{}"
,
json
);
String
id
=
JsonUtils
.
getValueByPath
(
json
,
"id"
);
if
(
StringUtils
.
isBlank
(
id
))
{
return
Result
.
failed
(
"收藏册id不能为空"
);
}
}
FavoritesRequestDto
dto
=
new
FavoritesRequestDto
();
dto
.
setId
(
Long
.
parseLong
(
id
));
return
favoritesService
.
delete
(
dto
);
return
favoritesService
.
delete
(
dto
);
}
}
@ApiOperation
(
value
=
"批量删除"
)
@ApiOperation
(
value
=
"批量删除"
)
@PostMapping
(
"/batchDelete"
)
@PostMapping
(
"/batchDelete"
)
public
Result
batchDelete
(
@RequestBody
@Validated
(
Delete
.
class
)
FavoritesRequestDto
dto
)
{
public
Result
batchDelete
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
if
(
CollectionUtils
.
isEmpty
(
dto
.
getIds
()))
{
String
json
=
klDataRequestDto
.
getKl_data
();
return
Result
.
failed
(
"请选择收藏册"
);
logger
.
info
(
"【请求开始】收藏册批量删除,请求参数,kl_data:{}"
,
json
);
String
ids
=
JsonUtils
.
getValueByPath
(
json
,
"ids"
);
if
(
StringUtils
.
isBlank
(
ids
))
{
return
Result
.
failed
(
"收藏册id不能为空"
);
}
}
List
<
Long
>
idss
=
Arrays
.
stream
(
ids
.
substring
(
1
,
ids
.
length
()
-
1
).
split
(
","
))
.
map
(
Long:
:
valueOf
).
collect
(
Collectors
.
toList
());
FavoritesRequestDto
dto
=
new
FavoritesRequestDto
();
dto
.
setIds
(
idss
);
return
favoritesService
.
batchDelete
(
dto
);
return
favoritesService
.
batchDelete
(
dto
);
}
}
@ApiOperation
(
value
=
"取消收藏"
)
@ApiOperation
(
value
=
"取消收藏"
)
@PostMapping
(
"/removeItem"
)
@PostMapping
(
"/removeItem"
)
public
Result
removeItem
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
removeItem
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
if
(
Objects
.
isNull
(
dto
.
getUserId
()))
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】收藏册取消收藏,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
favoritesId
=
JsonUtils
.
getValueByPath
(
json
,
"favoritesId"
);
String
itemIds
=
JsonUtils
.
getValueByPath
(
json
,
"itemIds"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getFavoritesId
()
))
{
if
(
StringUtils
.
isBlank
(
favoritesId
))
{
return
Result
.
failed
(
"收藏册不能为空"
);
return
Result
.
failed
(
"收藏册
id
不能为空"
);
}
}
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()
))
{
if
(
StringUtils
.
isBlank
(
itemIds
))
{
return
Result
.
failed
(
"请选择藏品"
);
return
Result
.
failed
(
"请选择藏品"
);
}
}
List
<
Long
>
itemIdss
=
Arrays
.
stream
(
itemIds
.
substring
(
1
,
itemIds
.
length
()
-
1
).
split
(
","
))
.
map
(
Long:
:
valueOf
).
collect
(
Collectors
.
toList
());
ItemRequestDto
dto
=
new
ItemRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setFavoritesId
(
Long
.
parseLong
(
favoritesId
));
dto
.
setItemIds
(
itemIdss
);
return
favoritesService
.
removeItem
(
dto
);
return
favoritesService
.
removeItem
(
dto
);
}
}
@ApiOperation
(
value
=
"移动藏品"
)
@ApiOperation
(
value
=
"移动藏品"
)
@PostMapping
(
"/moveItem"
)
@PostMapping
(
"/moveItem"
)
public
Result
moveItem
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
moveItem
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
if
(
Objects
.
isNull
(
dto
.
getBeforeFavoritesId
()))
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】收藏册移动藏品,请求参数,kl_data:{}"
,
json
);
String
beforeFavoritesId
=
JsonUtils
.
getValueByPath
(
json
,
"beforeFavoritesId"
);
String
afterFavoritesId
=
JsonUtils
.
getValueByPath
(
json
,
"afterFavoritesId"
);
String
itemIds
=
JsonUtils
.
getValueByPath
(
json
,
"itemIds"
);
if
(
StringUtils
.
isBlank
(
beforeFavoritesId
))
{
return
Result
.
failed
(
"原收藏册不能为空"
);
return
Result
.
failed
(
"原收藏册不能为空"
);
}
}
if
(
Objects
.
isNull
(
dto
.
getAfterFavoritesId
()
))
{
if
(
StringUtils
.
isBlank
(
afterFavoritesId
))
{
return
Result
.
failed
(
"现收藏册不能为空"
);
return
Result
.
failed
(
"现收藏册不能为空"
);
}
}
if
(
CollectionUtils
.
isEmpty
(
dto
.
getItemIds
()
))
{
if
(
StringUtils
.
isBlank
(
itemIds
))
{
return
Result
.
failed
(
"请选择藏品"
);
return
Result
.
failed
(
"请选择藏品"
);
}
}
List
<
Long
>
itemIdss
=
Arrays
.
stream
(
itemIds
.
substring
(
1
,
itemIds
.
length
()
-
1
).
split
(
","
))
.
map
(
Long:
:
valueOf
).
collect
(
Collectors
.
toList
());
ItemRequestDto
dto
=
new
ItemRequestDto
();
dto
.
setBeforeFavoritesId
(
Long
.
parseLong
(
beforeFavoritesId
));
dto
.
setAfterFavoritesId
(
Long
.
parseLong
(
afterFavoritesId
));
dto
.
setItemIds
(
itemIdss
);
return
favoritesService
.
moveItem
(
dto
);
return
favoritesService
.
moveItem
(
dto
);
}
}
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
View file @
fee6786d
...
@@ -27,7 +27,7 @@ public class WxItemController {
...
@@ -27,7 +27,7 @@ public class WxItemController {
@PostMapping
(
"/page"
)
@PostMapping
(
"/page"
)
public
Result
page
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
page
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】藏品列表
分页查询
,请求参数,kl_data:{}"
,
json
);
logger
.
info
(
"【请求开始】藏品列表
首页
,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
page
=
JsonUtils
.
getValueByPath
(
json
,
"page"
);
String
page
=
JsonUtils
.
getValueByPath
(
json
,
"page"
);
String
size
=
JsonUtils
.
getValueByPath
(
json
,
"size"
);
String
size
=
JsonUtils
.
getValueByPath
(
json
,
"size"
);
...
@@ -56,7 +56,43 @@ public class WxItemController {
...
@@ -56,7 +56,43 @@ public class WxItemController {
@ApiOperation
(
value
=
"新增"
)
@ApiOperation
(
value
=
"新增"
)
@PostMapping
(
"/add"
)
@PostMapping
(
"/add"
)
public
Result
add
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
add
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】藏品发布,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
cid
=
JsonUtils
.
getValueByPath
(
json
,
"cid"
);
String
name
=
JsonUtils
.
getValueByPath
(
json
,
"name"
);
String
detail
=
JsonUtils
.
getValueByPath
(
json
,
"detail"
);
String
images
=
JsonUtils
.
getValueByPath
(
json
,
"images"
);
String
favoritesId
=
JsonUtils
.
getValueByPath
(
json
,
"favoritesId"
);
String
price
=
JsonUtils
.
getValueByPath
(
json
,
"price"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
cid
))
{
return
Result
.
failed
(
"分类id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
name
))
{
return
Result
.
failed
(
"标题不能为空"
);
}
if
(
StringUtils
.
isBlank
(
price
))
{
return
Result
.
failed
(
"价格不能为空"
);
}
if
(
StringUtils
.
isBlank
(
images
))
{
return
Result
.
failed
(
"图片或视频不能为空"
);
}
if
(
StringUtils
.
isBlank
(
favoritesId
))
{
return
Result
.
failed
(
"收藏册id不能为空"
);
}
ItemRequestDto
dto
=
new
ItemRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setName
(
name
);
dto
.
setCid
(
Integer
.
parseInt
(
cid
));
dto
.
setDetail
(
detail
);
dto
.
setFavoritesId
(
Long
.
parseLong
(
favoritesId
));
dto
.
setImages
(
images
);
dto
.
setPrice
(
price
);
return
itemService
.
add
(
dto
);
return
itemService
.
add
(
dto
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment