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
460f8e34
Commit
460f8e34
authored
Aug 09, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 小程序接口
parent
06c96fa9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
287 additions
and
98 deletions
+287
-98
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/KlDataRequestDto.java
.../java/com/wwdz/ch/wx/entity/request/KlDataRequestDto.java
+9
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/AgentTranceResponseVo.java
.../java/com/wwdz/ch/wx/entity/vo/AgentTranceResponseVo.java
+11
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
...rc/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
+2
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+11
-7
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+12
-7
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+29
-24
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserService.java
...api/src/main/java/com/wwdz/ch/wx/service/UserService.java
+0
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
...rc/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
+33
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
...c/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
+58
-4
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
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
+84
-50
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/request/KlDataRequestDto.java
0 → 100644
View file @
460f8e34
package
com.wwdz.ch.wx.entity.request
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
@Data
public
class
KlDataRequestDto
implements
Entity
{
private
String
kl_data
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/AgentTranceResponseVo.java
0 → 100644
View file @
460f8e34
package
com.wwdz.ch.wx.entity.vo
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
@Data
public
class
AgentTranceResponseVo
implements
Entity
{
private
String
agentTraceInfo_
;
private
Integer
viewType
;
private
Object
detail
;
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
View file @
460f8e34
...
...
@@ -18,6 +18,7 @@ public class CategoryServiceImpl implements CategoryService {
@Override
public
Result
top
(
CategoryRequestDto
dto
)
{
try
{
logger
.
info
(
"【请求结束】查询分类类目成功"
);
return
Result
.
success
(
categoryManager
.
queryByLevel
(
dto
.
getLevel
(),
dto
.
getPage
(),
dto
.
getSize
()));
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询分类类目失败"
,
e
);
...
...
@@ -28,6 +29,7 @@ public class CategoryServiceImpl implements CategoryService {
@Override
public
Result
child
(
CategoryRequestDto
dto
)
{
try
{
logger
.
info
(
"【请求结束】查询子类目成功"
);
return
Result
.
success
(
categoryManager
.
queryByPid
(
dto
.
getId
()));
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询子类目失败"
,
e
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
460f8e34
...
...
@@ -13,6 +13,7 @@ import com.wwdz.ch.db.domain.UserItemsRelation;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -23,10 +24,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -68,6 +66,7 @@ public class FavoritesServiceImpl implements FavoritesService {
@Override
public
Result
page
(
FavoritesRequestDto
dto
)
{
try
{
return
Result
.
success
(
favoritesDao
.
pageByUserId
(
dto
.
getUserId
(),
dto
.
getPage
(),
dto
.
getSize
()));
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询收藏册列表失败,原因:"
+
e
.
getMessage
(),
e
);
...
...
@@ -156,7 +155,7 @@ public class FavoritesServiceImpl implements FavoritesService {
@Override
public
Result
itemList
(
FavoritesRequestDto
dto
)
{
try
{
PageInfo
<
Item
ResponseVo
>
page
=
new
PageInfo
<>();
PageInfo
<
AgentTrance
ResponseVo
>
page
=
new
PageInfo
<>();
page
.
setPageNum
(
dto
.
getPage
());
page
.
setPageSize
(
dto
.
getSize
());
page
.
setTotal
(
0L
);
...
...
@@ -165,7 +164,7 @@ public class FavoritesServiceImpl implements FavoritesService {
if
(
relationPage
.
getList
().
isEmpty
())
{
return
Result
.
success
(
page
);
}
List
<
Item
ResponseVo
>
list
=
new
ArrayList
<>();
List
<
AgentTrance
ResponseVo
>
list
=
new
ArrayList
<>();
for
(
FavoritesItemsRelation
relation
:
relationPage
.
getList
())
{
ItemResponseVo
vo
=
new
ItemResponseVo
();
Item
item
=
itemManager
.
findDetails
(
relation
.
getItemId
());
...
...
@@ -176,7 +175,12 @@ public class FavoritesServiceImpl implements FavoritesService {
vo
.
setDetail
(
item
.
getDetail
());
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
relation
.
getItemId
())
?
1
:
0
);
vo
.
setCollectCount
(
favoritesItemsRelationDao
.
countByItemId
(
relation
.
getItemId
()));
list
.
add
(
vo
);
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setViewType
(
2
);
agentTranceResponseVo
.
setDetail
(
vo
);
list
.
add
(
agentTranceResponseVo
);
}
page
.
setTotal
(
favoritesItemsRelationDao
.
countByFavoritesId
(
dto
.
getId
()));
page
.
setList
(
list
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
460f8e34
...
...
@@ -13,6 +13,7 @@ import com.wwdz.ch.db.domain.Item;
import
com.wwdz.ch.db.domain.UserItemsRelation
;
import
com.wwdz.ch.db.dto.request.CoinRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.service.ItemService
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -23,10 +24,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.*
;
@Service
public
class
ItemServiceImpl
implements
ItemService
{
...
...
@@ -48,7 +46,7 @@ public class ItemServiceImpl implements ItemService {
coinRequestDto
.
setPage
(
dto
.
getPage
());
coinRequestDto
.
setLimit
(
dto
.
getSize
());
PageInfo
<
Item
>
page
=
itemManager
.
findByPage
(
coinRequestDto
);
PageInfo
<
Item
ResponseVo
>
result
=
new
PageInfo
<>();
PageInfo
<
AgentTrance
ResponseVo
>
result
=
new
PageInfo
<>();
result
.
setPageNum
(
page
.
getPageNum
());
result
.
setPageSize
(
page
.
getPageSize
());
result
.
setTotal
(
page
.
getTotal
());
...
...
@@ -56,7 +54,7 @@ public class ItemServiceImpl implements ItemService {
if
(
CollectionUtils
.
isEmpty
(
page
.
getList
()))
{
return
Result
.
success
(
result
);
}
List
<
Item
ResponseVo
>
resultList
=
new
ArrayList
<>();
List
<
AgentTrance
ResponseVo
>
resultList
=
new
ArrayList
<>();
for
(
Item
item
:
page
.
getList
())
{
ItemResponseVo
vo
=
new
ItemResponseVo
();
vo
.
setId
(
item
.
getId
());
...
...
@@ -66,9 +64,15 @@ public class ItemServiceImpl implements ItemService {
vo
.
setDetail
(
item
.
getDetail
());
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
vo
.
setCollectCount
(
favoritesItemsRelationDao
.
countByItemId
(
item
.
getId
()));
resultList
.
add
(
vo
);
AgentTranceResponseVo
agentTranceResponseVo
=
new
AgentTranceResponseVo
();
agentTranceResponseVo
.
setAgentTraceInfo_
(
""
);
agentTranceResponseVo
.
setViewType
(
1
);
agentTranceResponseVo
.
setDetail
(
vo
);
resultList
.
add
(
agentTranceResponseVo
);
}
result
.
setList
(
resultList
);
logger
.
info
(
"【请求结束】查询首页列表成功"
);
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询首页列表失败"
,
e
);
...
...
@@ -149,6 +153,7 @@ public class ItemServiceImpl implements ItemService {
itemResponseVo
.
setIsCollected
(
0
);
}
itemResponseVo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
logger
.
info
(
"【请求结束】查看藏品详情成功"
);
return
Result
.
success
(
itemResponseVo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查看藏品详情失败,原因:"
+
e
.
getMessage
(),
e
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
460f8e34
...
...
@@ -78,6 +78,7 @@ public class UserServiceImpl implements UserService {
return
Result
.
failed
(
"获取微信用户手机号失败"
);
}
Date
now
=
new
Date
();
User
user
=
userDao
.
queryByMobile
(
mobile
);
if
(
Objects
.
isNull
(
user
))
{
user
=
new
User
();
...
...
@@ -85,15 +86,24 @@ public class UserServiceImpl implements UserService {
BCryptPasswordEncoder
bCryptPasswordEncoder
=
new
BCryptPasswordEncoder
();
user
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
"Aa123456"
));
user
.
setWeixinOpenid
(
""
);
user
.
setProfile
(
""
);
user
.
setBackground
(
""
);
user
.
setWechatId
(
""
);
user
.
setMobile
(
mobile
);
user
.
setAvatar
(
avatarUrl
);
user
.
setNickname
(
"收藏家"
+
StringUtil
.
generateRandomString
(
10
));
user
.
setGender
((
byte
)
0
);
user
.
setUserLevel
((
byte
)
0
);
user
.
setStatus
((
byte
)
0
);
user
.
setLastLoginTime
(
new
Date
());
user
.
setDeleted
(
false
);
user
.
setAddTime
(
now
);
user
.
setUpdateTime
(
now
);
user
.
setLastLoginTime
(
now
);
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
user
.
setShareUserId
(
dto
.
getShareUserId
());
user
.
setShareUserId
(
0L
);
if
(
Objects
.
nonNull
(
dto
.
getShareUserId
()))
{
user
.
setShareUserId
(
dto
.
getShareUserId
());
}
userDao
.
insert
(
user
);
FavoritesRequestDto
favoritesRequestDto
=
new
FavoritesRequestDto
();
...
...
@@ -189,6 +199,7 @@ public class UserServiceImpl implements UserService {
return
Result
.
failed
(
"验证码不正确"
);
}
Date
now
=
new
Date
();
// 判断手机号用户是否存在
User
user
=
userDao
.
queryByMobile
(
dto
.
getMobile
());
if
(
Objects
.
isNull
(
user
))
{
...
...
@@ -197,14 +208,24 @@ public class UserServiceImpl implements UserService {
BCryptPasswordEncoder
bCryptPasswordEncoder
=
new
BCryptPasswordEncoder
();
user
.
setPassword
(
bCryptPasswordEncoder
.
encode
(
"Aa123456"
));
user
.
setWeixinOpenid
(
""
);
user
.
setProfile
(
""
);
user
.
setBackground
(
""
);
user
.
setWechatId
(
""
);
user
.
setMobile
(
dto
.
getMobile
());
user
.
setAvatar
(
avatarUrl
);
user
.
setNickname
(
"收藏家"
+
StringUtil
.
generateRandomString
(
10
));
user
.
setGender
((
byte
)
0
);
user
.
setUserLevel
((
byte
)
0
);
user
.
setStatus
((
byte
)
0
);
user
.
setLastLoginTime
(
new
Date
());
user
.
setDeleted
(
false
);
user
.
setAddTime
(
now
);
user
.
setUpdateTime
(
now
);
user
.
setLastLoginTime
(
now
);
user
.
setLastLoginIp
(
IpUtil
.
client
(
request
));
user
.
setShareUserId
(
0L
);
if
(
Objects
.
nonNull
(
dto
.
getShareUserId
()))
{
user
.
setShareUserId
(
dto
.
getShareUserId
());
}
userDao
.
insert
(
user
);
FavoritesRequestDto
favoritesRequestDto
=
new
FavoritesRequestDto
();
...
...
@@ -267,6 +288,7 @@ public class UserServiceImpl implements UserService {
}
user
.
setProfile
(
dto
.
getProfile
());
userDao
.
updateById
(
user
);
logger
.
info
(
"【请求结束】用户修改个性签名成功"
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"用户修改个性签名失败"
,
e
);
...
...
@@ -285,6 +307,7 @@ public class UserServiceImpl implements UserService {
}
user
.
setBackground
(
dto
.
getBackground
());
userDao
.
updateById
(
user
);
logger
.
info
(
"【请求结束】用户修改背景成功"
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"用户修改背景失败"
,
e
);
...
...
@@ -306,6 +329,7 @@ public class UserServiceImpl implements UserService {
}
user
.
setNickname
(
dto
.
getNickname
());
userDao
.
updateById
(
user
);
logger
.
info
(
"【请求结束】用户修改昵称成功"
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"用户修改昵称失败"
,
e
);
...
...
@@ -324,6 +348,7 @@ public class UserServiceImpl implements UserService {
}
user
.
setAvatar
(
dto
.
getAvatarUrl
());
userDao
.
updateById
(
user
);
logger
.
info
(
"【请求结束】用户修改头像成功"
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"用户修改头像失败"
,
e
);
...
...
@@ -332,27 +357,6 @@ public class UserServiceImpl implements UserService {
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Result
bindWechatId
(
UserRequestDto
dto
)
{
try
{
User
user
=
userDao
.
queryById
(
dto
.
getUserId
());
if
(
Objects
.
isNull
(
user
))
{
return
Result
.
failed
(
"数据异常,用户不存在"
);
}
if
(
userDao
.
isExistedByWechatId
(
dto
.
getUserId
(),
dto
.
getWechatId
()))
{
return
Result
.
failed
(
"无法绑定,该微信号已被绑定"
);
}
user
.
setWechatId
(
dto
.
getWechatId
());
userDao
.
updateById
(
user
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"用户绑定微信号失败"
,
e
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
Result
.
failed
(
"绑定微信号失败"
);
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
Result
updateMobile
(
UserRequestDto
dto
)
{
...
...
@@ -373,6 +377,7 @@ public class UserServiceImpl implements UserService {
}
user
.
setMobile
(
dto
.
getAfterMobile
());
userDao
.
updateById
(
user
);
logger
.
info
(
"【请求结束】用户修改手机号成功"
);
return
Result
.
success
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"用户修改手机号失败"
,
e
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserService.java
View file @
460f8e34
...
...
@@ -20,7 +20,5 @@ public interface UserService {
Result
updateAvatar
(
UserRequestDto
dto
);
Result
bindWechatId
(
UserRequestDto
dto
);
Result
updateMobile
(
UserRequestDto
dto
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
View file @
460f8e34
...
...
@@ -2,8 +2,11 @@ package com.wwdz.ch.wx.web;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.entity.request.CategoryRequestDto
;
import
com.wwdz.ch.wx.entity.request.KlDataRequestDto
;
import
com.wwdz.ch.wx.service.CategoryService
;
import
com.xxdxxs.utils.JsonUtils
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -22,13 +25,41 @@ public class WxCategoryController {
@ApiOperation
(
value
=
"分类分页"
)
@PostMapping
(
value
=
"/top"
)
public
Result
top
(
@RequestBody
CategoryRequestDto
dto
)
{
public
Result
top
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】查询分类列表,请求参数,kl_data:{}"
,
json
);
String
level
=
JsonUtils
.
getValueByPath
(
json
,
"level"
);
String
page
=
JsonUtils
.
getValueByPath
(
json
,
"page"
);
String
size
=
JsonUtils
.
getValueByPath
(
json
,
"size"
);
if
(
StringUtils
.
isBlank
(
level
))
{
return
Result
.
failed
(
"分类级别不能为空"
);
}
if
(
StringUtils
.
isBlank
(
page
))
{
return
Result
.
failed
(
"当前页不能为空"
);
}
if
(
StringUtils
.
isBlank
(
size
))
{
return
Result
.
failed
(
"页面大小不能为空"
);
}
CategoryRequestDto
dto
=
new
CategoryRequestDto
();
dto
.
setLevel
(
Integer
.
parseInt
(
level
));
dto
.
setPage
(
Integer
.
parseInt
(
page
));
dto
.
setSize
(
Integer
.
parseInt
(
size
));
return
categoryService
.
top
(
dto
);
}
@ApiOperation
(
value
=
"子分类"
)
@PostMapping
(
value
=
"/child"
)
public
Result
child
(
@RequestBody
CategoryRequestDto
dto
)
{
public
Result
child
(
@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不能为空"
);
}
CategoryRequestDto
dto
=
new
CategoryRequestDto
();
dto
.
setId
(
Integer
.
parseInt
(
id
));
return
categoryService
.
child
(
dto
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
View file @
460f8e34
package
com.wwdz.ch.wx.web
;
import
com.github.pagehelper.Page
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.entity.request.FavoritesRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.KlDataRequestDto
;
import
com.wwdz.ch.wx.service.FavoritesService
;
import
com.xxdxxs.support.Delete
;
import
com.xxdxxs.support.Select
;
import
com.xxdxxs.utils.JsonUtils
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -31,10 +32,44 @@ public class WxFavoritesController {
@ApiOperation
(
value
=
"分页查询"
)
@PostMapping
(
"/page"
)
public
Result
page
(
@RequestBody
@Validated
(
Page
.
class
)
FavoritesRequestDto
dto
)
{
public
Result
page
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】收藏册分页查询,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
page
=
JsonUtils
.
getValueByPath
(
json
,
"page"
);
String
size
=
JsonUtils
.
getValueByPath
(
json
,
"size"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
page
))
{
return
Result
.
failed
(
"当前页不能为空"
);
}
if
(
StringUtils
.
isBlank
(
size
))
{
return
Result
.
failed
(
"页面大小不能为空"
);
}
FavoritesRequestDto
dto
=
new
FavoritesRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setPage
(
Integer
.
parseInt
(
page
));
dto
.
setSize
(
Integer
.
parseInt
(
size
));
return
favoritesService
.
page
(
dto
);
}
@ApiOperation
(
value
=
"列表查询"
)
@PostMapping
(
"/list"
)
public
Result
list
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】收藏册分页查询,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
FavoritesRequestDto
dto
=
new
FavoritesRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
return
favoritesService
.
list
(
dto
);
}
@ApiOperation
(
value
=
"新增"
)
@PostMapping
(
"/add"
)
public
Result
add
(
@RequestBody
FavoritesRequestDto
dto
)
{
...
...
@@ -80,9 +115,28 @@ public class WxFavoritesController {
return
favoritesService
.
info
(
dto
);
}
@ApiOperation
(
value
=
"
详情
"
)
@ApiOperation
(
value
=
"
收藏册下藏品列表
"
)
@PostMapping
(
"/itemList"
)
public
Result
itemList
(
@RequestBody
@Validated
(
Select
.
class
)
FavoritesRequestDto
dto
)
{
public
Result
itemList
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】收藏册下藏品列表分页查询,请求参数,kl_data:{}"
,
json
);
String
id
=
JsonUtils
.
getValueByPath
(
json
,
"id"
);
String
page
=
JsonUtils
.
getValueByPath
(
json
,
"page"
);
String
size
=
JsonUtils
.
getValueByPath
(
json
,
"size"
);
if
(
StringUtils
.
isBlank
(
id
))
{
return
Result
.
failed
(
"收藏册id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
page
))
{
return
Result
.
failed
(
"当前页不能为空"
);
}
if
(
StringUtils
.
isBlank
(
size
))
{
return
Result
.
failed
(
"页面大小不能为空"
);
}
FavoritesRequestDto
dto
=
new
FavoritesRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
id
));
dto
.
setPage
(
Integer
.
parseInt
(
page
));
dto
.
setSize
(
Integer
.
parseInt
(
size
));
return
favoritesService
.
itemList
(
dto
);
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
View file @
460f8e34
...
...
@@ -2,8 +2,11 @@ package com.wwdz.ch.wx.web;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.KlDataRequestDto
;
import
com.wwdz.ch.wx.service.ItemService
;
import
com.xxdxxs.utils.JsonUtils
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -22,7 +25,26 @@ public class WxItemController {
@ApiOperation
(
value
=
"分页查询"
)
@PostMapping
(
"/page"
)
public
Result
page
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
page
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】藏品列表分页查询,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
page
=
JsonUtils
.
getValueByPath
(
json
,
"page"
);
String
size
=
JsonUtils
.
getValueByPath
(
json
,
"size"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
page
))
{
return
Result
.
failed
(
"当前页不能为空"
);
}
if
(
StringUtils
.
isBlank
(
size
))
{
return
Result
.
failed
(
"页面大小不能为空"
);
}
ItemRequestDto
dto
=
new
ItemRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setPage
(
Integer
.
parseInt
(
page
));
dto
.
setSize
(
Integer
.
parseInt
(
size
));
return
itemService
.
page
(
dto
);
}
...
...
@@ -46,7 +68,21 @@ public class WxItemController {
@ApiOperation
(
value
=
"详情"
)
@PostMapping
(
"/info"
)
public
Result
info
(
@RequestBody
ItemRequestDto
dto
)
{
public
Result
info
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】藏品详情查询,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
id
=
JsonUtils
.
getValueByPath
(
json
,
"id"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
id
))
{
return
Result
.
failed
(
"当前页不能为空"
);
}
ItemRequestDto
dto
=
new
ItemRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setId
(
Long
.
parseLong
(
id
));
return
itemService
.
info
(
dto
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
View file @
460f8e34
...
...
@@ -3,14 +3,15 @@ package com.wwdz.ch.wx.web;
import
com.alibaba.fastjson.JSONObject
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.JacksonUtil
;
import
com.wwdz.ch.core.util.ResponseUtil
;
import
com.wwdz.ch.db.domain.UserAccountObsolete
;
import
com.wwdz.ch.db.service.DtsAccountService
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
com.wwdz.ch.wx.constant.CacheCodeEnum
;
import
com.wwdz.ch.wx.entity.request.KlDataRequestDto
;
import
com.wwdz.ch.wx.entity.request.UserRequestDto
;
import
com.wwdz.ch.wx.service.UserService
;
import
com.xxdxxs.utils.JsonUtils
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -91,9 +92,10 @@ public class WxUserController {
@ApiOperation
(
value
=
"微信登录"
)
@PostMapping
(
"/loginByWx"
)
public
Result
loginByWx
(
@RequestBody
String
kl_data
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】微信登录,请求参数,kl_data:{}"
,
kl_data
);
String
code
=
JacksonUtil
.
parseString
(
kl_data
,
"code"
);
public
Result
loginByWx
(
@RequestBody
KlDataRequestDto
klDataRequestDto
,
HttpServletRequest
request
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】微信登录,请求参数,kl_data:{}"
,
json
);
String
code
=
JsonUtils
.
getValueByPath
(
json
,
"code"
);
if
(
StringUtils
.
isBlank
(
code
))
{
return
Result
.
failed
(
"授权码不能为空"
);
}
...
...
@@ -105,9 +107,10 @@ public class WxUserController {
@ApiOperation
(
value
=
"登录手机验证码"
)
@PostMapping
(
"/loginRegCaptcha"
)
public
Object
registerCaptcha
(
@RequestBody
String
kl_data
)
{
logger
.
info
(
"【请求开始】请求登录手机验证码,请求参数,kl_data:{}"
,
kl_data
);
String
mobile
=
JacksonUtil
.
parseString
(
kl_data
,
"mobile"
);
public
Object
registerCaptcha
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】请求登录手机验证码,请求参数,kl_data:{}"
,
json
);
String
mobile
=
JsonUtils
.
getValueByPath
(
json
,
"mobile"
);
if
(
StringUtils
.
isBlank
(
mobile
))
{
return
Result
.
failed
(
"手机号不能为空"
);
}
...
...
@@ -120,10 +123,11 @@ public class WxUserController {
@ApiOperation
(
value
=
"手机验证码登录"
)
@PostMapping
(
"/loginByMobile"
)
public
Result
loginByMobile
(
@RequestBody
String
kl_data
,
HttpServletRequest
request
)
{
logger
.
info
(
"【请求开始】手机号登录,请求参数,kl_data:{}"
,
kl_data
);
String
mobile
=
JacksonUtil
.
parseString
(
kl_data
,
"mobile"
);
String
smsCode
=
JacksonUtil
.
parseString
(
kl_data
,
"smsCode"
);
public
Result
loginByMobile
(
@RequestBody
KlDataRequestDto
klDataRequestDto
,
HttpServletRequest
request
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】手机号登录,请求参数,kl_data:{}"
,
json
);
String
mobile
=
JsonUtils
.
getValueByPath
(
json
,
"mobile"
);
String
smsCode
=
JsonUtils
.
getValueByPath
(
json
,
"smsCode"
);
if
(
StringUtils
.
isBlank
(
mobile
))
{
return
Result
.
failed
(
"手机号不能为空"
);
}
...
...
@@ -139,97 +143,127 @@ public class WxUserController {
@ApiOperation
(
value
=
"修改个性签名"
)
@PostMapping
(
"/updateProfile"
)
public
Result
updateProfile
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改个性签名,请求参数,userRequestDto:{}"
,
JSONObject
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
()))
{
public
Result
updateProfile
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改个性签名,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
profile
=
JsonUtils
.
getValueByPath
(
json
,
"profile"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getProfile
()
))
{
if
(
StringUtils
.
isBlank
(
profile
))
{
return
Result
.
failed
(
"个性签名不能为空"
);
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setProfile
(
profile
);
return
userService
.
updateProfile
(
dto
);
}
@ApiOperation
(
value
=
"修改背景"
)
@PostMapping
(
"/updateBackground"
)
public
Result
updateBackground
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改背景,请求参数,userRequestDto:{}"
,
JSONObject
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
()))
{
public
Result
updateBackground
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改背景,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
background
=
JsonUtils
.
getValueByPath
(
json
,
"background"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getBackground
()
))
{
if
(
StringUtils
.
isBlank
(
background
))
{
return
Result
.
failed
(
"背景图片路径不能为空"
);
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setBackground
(
background
);
return
userService
.
updateBackground
(
dto
);
}
@ApiOperation
(
value
=
"修改昵称"
)
@PostMapping
(
"/updateNickname"
)
public
Result
updateNickname
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改昵称,请求参数,userRequestDto:{}"
,
JSONObject
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
()))
{
public
Result
updateNickname
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改昵称,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
nickname
=
JsonUtils
.
getValueByPath
(
json
,
"nickname"
);
if
(
Objects
.
isNull
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getNickname
()
))
{
if
(
StringUtils
.
isBlank
(
nickname
))
{
return
Result
.
failed
(
"昵称不能为空"
);
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setNickname
(
nickname
);
return
userService
.
updateNickname
(
dto
);
}
@ApiOperation
(
value
=
"修改头像"
)
@PostMapping
(
"/updateAvatar"
)
public
Result
updateAvatar
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改头像,请求参数,userRequestDto:{}"
,
JSONObject
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
()))
{
public
Result
updateAvatar
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改头像,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
avatarUrl
=
JsonUtils
.
getValueByPath
(
json
,
"avatarUrl"
);
if
(
Objects
.
isNull
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getAvatarUrl
()
))
{
if
(
StringUtils
.
isBlank
(
avatarUrl
))
{
return
Result
.
failed
(
"头像图片路径不能为空"
);
}
return
userService
.
updateAvatar
(
dto
);
}
@ApiOperation
(
value
=
"绑定微信号"
)
@PostMapping
(
"/bindWechatId"
)
public
Result
bindWechatId
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】绑定微信号,请求参数,userRequestDto:{}"
,
JSONObject
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
()))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getWechatId
()))
{
return
Result
.
failed
(
"微信号不能为空"
);
}
return
userService
.
bindWechatId
(
dto
);
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setAvatarUrl
(
avatarUrl
);
return
userService
.
updateAvatar
(
dto
);
}
@ApiOperation
(
value
=
"修改手机验证码"
)
@PostMapping
(
"/updateRegCaptcha"
)
public
Object
updateRegCaptcha
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】请求修改手机验证码,请求参数,mobile:{}"
,
dto
.
getMobile
());
if
(
StringUtils
.
isBlank
(
dto
.
getMobile
()))
{
public
Object
updateRegCaptcha
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】请求修改手机验证码,请求参数,kl_data:{}"
,
json
);
String
mobile
=
JsonUtils
.
getValueByPath
(
json
,
"mobile"
);
if
(
StringUtils
.
isBlank
(
mobile
))
{
return
Result
.
failed
(
"手机号不能为空"
);
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setMobile
(
mobile
);
dto
.
setSmsType
(
CacheCodeEnum
.
SmsTypeEnum
.
UPDATE
.
getCode
());
return
userService
.
regCaptcha
(
dto
);
}
@ApiOperation
(
value
=
"修改手机号"
)
@PostMapping
(
"/updateMobile"
)
public
Result
updateMobile
(
@RequestBody
UserRequestDto
dto
)
{
logger
.
info
(
"【请求开始】修改手机号,请求参数,userRequestDto:{}"
,
JSONObject
.
toJSONString
(
dto
));
if
(
Objects
.
isNull
(
dto
.
getUserId
()))
{
public
Result
updateMobile
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改手机号,请求参数,kl_data:{}"
,
json
);
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
beforeMobile
=
JsonUtils
.
getValueByPath
(
json
,
"beforeMobile"
);
String
afterMobile
=
JsonUtils
.
getValueByPath
(
json
,
"afterMobile"
);
String
smsCode
=
JsonUtils
.
getValueByPath
(
json
,
"smsCode"
);
if
(
Objects
.
isNull
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getBeforeMobile
()
))
{
if
(
StringUtils
.
isBlank
(
beforeMobile
))
{
return
Result
.
failed
(
"原手机号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getAfterMobile
()
))
{
if
(
StringUtils
.
isBlank
(
afterMobile
))
{
return
Result
.
failed
(
"新手机号不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getSmsCode
()
))
{
if
(
StringUtils
.
isBlank
(
smsCode
))
{
return
Result
.
failed
(
"验证码不能为空"
);
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setBeforeMobile
(
beforeMobile
);
dto
.
setAfterMobile
(
afterMobile
);
dto
.
setSmsCode
(
smsCode
);
return
userService
.
updateMobile
(
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