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
8e515540
Commit
8e515540
authored
Aug 22, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 我的接口
新增 接口或方法注释
parent
df7307f4
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
724 additions
and
179 deletions
+724
-179
ch-core/src/main/java/com/wwdz/ch/core/captcha/CaptchaCodeManager.java
...ain/java/com/wwdz/ch/core/captcha/CaptchaCodeManager.java
+8
-8
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
+18
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesDao.java
+67
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
...in/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
+97
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/FootPrintDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/FootPrintDao.java
+51
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
+6
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserDao.java
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserDao.java
+51
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserItemsRelationDao.java
...rc/main/java/com/wwdz/ch/db/dao/UserItemsRelationDao.java
+29
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
...rc/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
+6
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+32
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
+32
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+25
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+6
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/CaptchaCodeManager.java
.../main/java/com/wwdz/ch/wx/manager/CaptchaCodeManager.java
+0
-65
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
...rc/main/java/com/wwdz/ch/wx/service/FavoritesService.java
+74
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FootPrintService.java
...rc/main/java/com/wwdz/ch/wx/service/FootPrintService.java
+20
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
...api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
+83
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserService.java
...api/src/main/java/com/wwdz/ch/wx/service/UserService.java
+50
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/WxLoginService.java
.../src/main/java/com/wwdz/ch/wx/service/WxLoginService.java
+27
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/util/StringUtil.java
ch-wx-api/src/main/java/com/wwdz/ch/wx/util/StringUtil.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFootprintController.java
...c/main/java/com/wwdz/ch/wx/web/WxFootprintController.java
+11
-30
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
+30
-73
No files found.
ch-core/src/main/java/com/wwdz/ch/core/captcha/CaptchaCodeManager.java
View file @
8e515540
package
com.wwdz.ch.core.captcha
;
package
com.wwdz.ch.core.captcha
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.Map.Entry
;
/**
/**
* 缓存系统中的验证码
* 缓存系统中的验证码
*/
*/
...
@@ -97,4 +93,8 @@ public class CaptchaCodeManager {
...
@@ -97,4 +93,8 @@ public class CaptchaCodeManager {
}
}
}
}
public
static
void
removeCacheData
(
String
flagUid
)
{
captchaCodeCache
.
remove
(
flagUid
);
}
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/CategoryDao.java
View file @
8e515540
...
@@ -7,14 +7,32 @@ public interface CategoryDao {
...
@@ -7,14 +7,32 @@ public interface CategoryDao {
List
<
Category
>
queryByLevel
(
Integer
level
,
Integer
offset
,
Integer
limit
);
List
<
Category
>
queryByLevel
(
Integer
level
,
Integer
offset
,
Integer
limit
);
/**
* 通过level查询未删除的分类列表
*
* @param level
* @return
*/
List
<
Category
>
listByLevel
(
Integer
level
);
List
<
Category
>
listByLevel
(
Integer
level
);
List
<
Category
>
queryByPid
(
Integer
pid
);
List
<
Category
>
queryByPid
(
Integer
pid
);
Category
findById
(
Integer
id
);
Category
findById
(
Integer
id
);
/**
* 通过名称精确查询未删除的分类
*
* @param name
* @return
*/
Category
findByName
(
String
name
);
Category
findByName
(
String
name
);
/**
* 通过名称模糊查询未删除的分类列表
*
* @param name
* @return
*/
List
<
Category
>
queryByName
(
String
name
);
List
<
Category
>
queryByName
(
String
name
);
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
);
List
<
Category
>
querySelective
(
String
id
,
String
name
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesDao.java
View file @
8e515540
...
@@ -6,13 +6,80 @@ import com.wwdz.ch.db.domain.Favorites;
...
@@ -6,13 +6,80 @@ import com.wwdz.ch.db.domain.Favorites;
import
java.util.List
;
import
java.util.List
;
public
interface
FavoritesDao
{
public
interface
FavoritesDao
{
/**
* 插入新记录
*
* @param record
* @return
*/
int
insert
(
Favorites
record
);
int
insert
(
Favorites
record
);
/**
* 删除记录
*
* @param id
* @return
*/
int
delete
(
Long
id
);
int
delete
(
Long
id
);
/**
* 更新记录
*
* @param record
* @return
*/
int
update
(
Favorites
record
);
int
update
(
Favorites
record
);
/**
* 通过id查询单条记录
*
* @param id
* @return
*/
Favorites
info
(
Long
id
);
Favorites
info
(
Long
id
);
/**
* 通过用户id查询列表
*
* @param userId
* @return
*/
List
<
Favorites
>
listByUserId
(
Long
userId
);
List
<
Favorites
>
listByUserId
(
Long
userId
);
/**
* 通过用户id分页查询
*
* @param userId
* @param page
* @param size
* @return
*/
PageInfo
<
Favorites
>
pageByUserId
(
Long
userId
,
int
page
,
int
size
);
PageInfo
<
Favorites
>
pageByUserId
(
Long
userId
,
int
page
,
int
size
);
/**
* 判断是否存在相同title的记录(排除自己)
*
* @param id
* @param userId
* @param title
* @return
*/
boolean
isExisted
(
Long
id
,
Long
userId
,
String
title
);
boolean
isExisted
(
Long
id
,
Long
userId
,
String
title
);
/**
* 批量删除记录
*
* @param id
* @param ids
* @return
*/
int
delete
(
Long
id
,
List
<
Long
>
ids
);
int
delete
(
Long
id
,
List
<
Long
>
ids
);
/**
* 通过用户id获取默认的收藏册记录
*
* @param userId
* @return
*/
Favorites
defaultFavorites
(
Long
userId
);
Favorites
defaultFavorites
(
Long
userId
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/FavoritesItemsRelationDao.java
View file @
8e515540
...
@@ -8,17 +8,114 @@ import java.util.List;
...
@@ -8,17 +8,114 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
public
interface
FavoritesItemsRelationDao
{
public
interface
FavoritesItemsRelationDao
{
/**
* 插入新纪录
*
* @param record
* @return
*/
int
insert
(
FavoritesItemsRelation
record
);
int
insert
(
FavoritesItemsRelation
record
);
/**
* 批量插入新纪录
*
* @param list
* @return
*/
int
batchInsert
(
List
<
FavoritesItemsRelation
>
list
);
int
batchInsert
(
List
<
FavoritesItemsRelation
>
list
);
/**
* 通过收藏册id批量删除记录
*
* @param favoritesId
* @param favoritesIds
* @return
*/
int
deleteByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
);
int
deleteByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
);
/**
* 通过收藏册id和藏品id列表删除对应的记录
*
* @param favoritesId
* @param itemIds
* @return
*/
int
deleteByChosen
(
Long
favoritesId
,
List
<
Long
>
itemIds
);
int
deleteByChosen
(
Long
favoritesId
,
List
<
Long
>
itemIds
);
/**
* 通过用户id和藏品id删除对应的记录
*
* @param userId
* @param itemId
* @return
*/
int
deleteByUserIdItemId
(
Long
userId
,
Long
itemId
);
int
deleteByUserIdItemId
(
Long
userId
,
Long
itemId
);
/**
* 通过收藏册id查询列表
*
* @param favoritesId
* @param favoritesIds
* @return
*/
List
<
FavoritesItemsRelation
>
listByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
);
List
<
FavoritesItemsRelation
>
listByFavoritesId
(
Long
favoritesId
,
List
<
Long
>
favoritesIds
);
/**
* 通过用户id和藏品id获取对应的记录
*
* @param userId
* @param itemId
* @return
*/
FavoritesItemsRelation
selectByUserIdItemId
(
Long
userId
,
Long
itemId
);
FavoritesItemsRelation
selectByUserIdItemId
(
Long
userId
,
Long
itemId
);
/**
* 通过收藏册id分页查询
*
* @param favoritesId
* @param page
* @param size
* @return
*/
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
);
PageInfo
<
FavoritesItemsRelation
>
pageByFavoritesId
(
Long
favoritesId
,
int
page
,
int
size
);
/**
* 通过藏品id统计记录数
*
* @param itemId
* @return
*/
long
countByItemId
(
Long
itemId
);
long
countByItemId
(
Long
itemId
);
/**
* 判断是否已经存在用户id和藏品id对应的记录
*
* @param userId
* @param itemId
* @return
*/
boolean
isCollected
(
Long
userId
,
Long
itemId
);
boolean
isCollected
(
Long
userId
,
Long
itemId
);
/**
* 通过收藏册id统计记录数
*
* @param favoritesId
* @return
*/
long
countByFavoritesId
(
Long
favoritesId
);
long
countByFavoritesId
(
Long
favoritesId
);
/**
* 通过藏品id分组统计记录数量最多的20条记录
*
* @return
*/
List
<
Map
<
String
,
Object
>>
findItemIdByCount
();
List
<
Map
<
String
,
Object
>>
findItemIdByCount
();
/**
* 连表查询获取藏品的图片
*
* @param favoritesId
* @return
*/
List
<
FavoritesItemsDto
>
queryItemImages
(
Long
favoritesId
);
List
<
FavoritesItemsDto
>
queryItemImages
(
Long
favoritesId
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/FootPrintDao.java
View file @
8e515540
...
@@ -5,11 +5,62 @@ import com.wwdz.ch.db.domain.Footprint;
...
@@ -5,11 +5,62 @@ import com.wwdz.ch.db.domain.Footprint;
import
java.util.List
;
import
java.util.List
;
public
interface
FootPrintDao
{
public
interface
FootPrintDao
{
/**
* 通过用户id查询列表
*
* @param userId
* @return
*/
List
<
Footprint
>
listByUserId
(
Long
userId
);
List
<
Footprint
>
listByUserId
(
Long
userId
);
/**
* 通过用户id分页查询
*
* @param userId
* @param page
* @param size
* @return
*/
List
<
Footprint
>
pageByUserId
(
Long
userId
,
Integer
page
,
Integer
size
);
List
<
Footprint
>
pageByUserId
(
Long
userId
,
Integer
page
,
Integer
size
);
/**
* 通过用户id统计记录数
*
* @param userId
* @return
*/
long
countByUserId
(
Long
userId
);
long
countByUserId
(
Long
userId
);
/**
* 批量删除记录
*
* @param ids
* @return
*/
int
delete
(
List
<
Long
>
ids
);
int
delete
(
List
<
Long
>
ids
);
/**
* 通过用户id和藏品id获取对应的记录
*
* @param userId
* @param itemId
* @return
*/
Footprint
selectByUserIdItem
(
Long
userId
,
Long
itemId
);
Footprint
selectByUserIdItem
(
Long
userId
,
Long
itemId
);
/**
* 插入新记录
*
* @param footprint
* @return
*/
int
insert
(
Footprint
footprint
);
int
insert
(
Footprint
footprint
);
/**
* 更新记录时间
*
* @param footprint
* @return
*/
int
upateTime
(
Footprint
footprint
);
int
upateTime
(
Footprint
footprint
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/ItemDao.java
View file @
8e515540
...
@@ -13,6 +13,12 @@ public interface ItemDao {
...
@@ -13,6 +13,12 @@ public interface ItemDao {
List
<
Item
>
findList
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findList
(
CoinRequestDto
coinRequestDto
);
/**
* 获取未删除的列表
*
* @param coinRequestDto
* @return
*/
List
<
Item
>
findListNotDeleted
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListNotDeleted
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
);
List
<
Item
>
findListByPage
(
CoinRequestDto
coinRequestDto
);
...
...
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserDao.java
View file @
8e515540
...
@@ -3,19 +3,70 @@ package com.wwdz.ch.db.dao;
...
@@ -3,19 +3,70 @@ package com.wwdz.ch.db.dao;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.User
;
public
interface
UserDao
{
public
interface
UserDao
{
/**
* 通过oid查询未删除的记录
*
* @param openId
* @return
*/
User
queryByOid
(
String
openId
);
User
queryByOid
(
String
openId
);
/**
* 通过手机号查询未删除的记录
*
* @param mobile
* @return
*/
User
queryByMobile
(
String
mobile
);
User
queryByMobile
(
String
mobile
);
/**
* 通过id查询未删除的记录
*
* @param id
* @return
*/
User
queryById
(
Long
id
);
User
queryById
(
Long
id
);
/**
* 判断是否已存在相同昵称的记录
*
* @param userId
* @param nickname
* @return
*/
boolean
isExistedByNickname
(
Long
userId
,
String
nickname
);
boolean
isExistedByNickname
(
Long
userId
,
String
nickname
);
/**
* 判断是否已存在相同微信号的记录
*
* @param userId
* @param wechatId
* @return
*/
boolean
isExistedByWechatId
(
Long
userId
,
String
wechatId
);
boolean
isExistedByWechatId
(
Long
userId
,
String
wechatId
);
/**
* 插入新记录
*
* @param user
* @return
*/
int
insert
(
User
user
);
int
insert
(
User
user
);
/**
* 更新记录
*
* @param user
* @return
*/
int
updateById
(
User
user
);
int
updateById
(
User
user
);
/**
* 判断手机号是否已经存在
*
* @param beforeMobile
* @param afterMobile
* @return
*/
boolean
isExistedByMobile
(
String
beforeMobile
,
String
afterMobile
);
boolean
isExistedByMobile
(
String
beforeMobile
,
String
afterMobile
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/UserItemsRelationDao.java
View file @
8e515540
...
@@ -5,8 +5,37 @@ import com.wwdz.ch.db.domain.UserItemsRelation;
...
@@ -5,8 +5,37 @@ import com.wwdz.ch.db.domain.UserItemsRelation;
import
java.util.List
;
import
java.util.List
;
public
interface
UserItemsRelationDao
{
public
interface
UserItemsRelationDao
{
/**
* 插入新记录
*
* @param record
* @return
*/
int
insert
(
UserItemsRelation
record
);
int
insert
(
UserItemsRelation
record
);
/**
* 通过用户id查询列表
*
* @param userId
* @param userIds
* @return
*/
List
<
UserItemsRelation
>
listByUserIds
(
Long
userId
,
List
<
Long
>
userIds
);
List
<
UserItemsRelation
>
listByUserIds
(
Long
userId
,
List
<
Long
>
userIds
);
/**
* 判断是否已存在用户id和藏品id对应的记录
*
* @param userId
* @param itemId
* @return
*/
boolean
isExisted
(
Long
userId
,
Long
itemId
);
boolean
isExisted
(
Long
userId
,
Long
itemId
);
/**
* 通过藏品id获取单条记录
*
* @param itemId
* @return
*/
UserItemsRelation
find
(
Long
itemId
);
UserItemsRelation
find
(
Long
itemId
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/CategoryServiceImpl.java
View file @
8e515540
...
@@ -122,6 +122,12 @@ public class CategoryServiceImpl implements CategoryService {
...
@@ -122,6 +122,12 @@ public class CategoryServiceImpl implements CategoryService {
return
root
.
getChild
();
return
root
.
getChild
();
}
}
/**
* 实体转换
*
* @param category
* @return
*/
private
CategoryResponseVo
toCategoryResponseVo
(
Category
category
)
{
private
CategoryResponseVo
toCategoryResponseVo
(
Category
category
)
{
CategoryResponseVo
vo
=
new
CategoryResponseVo
();
CategoryResponseVo
vo
=
new
CategoryResponseVo
();
vo
.
setCid
(
category
.
getId
());
vo
.
setCid
(
category
.
getId
());
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
8e515540
...
@@ -435,6 +435,12 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -435,6 +435,12 @@ public class FavoritesServiceImpl implements FavoritesService {
}
}
}
}
/**
* 获取展示图片
*
* @param item
* @return
*/
private
Map
<
String
,
Object
>
getImage
(
Item
item
)
{
private
Map
<
String
,
Object
>
getImage
(
Item
item
)
{
Map
<
String
,
Object
>
homePageMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
homePageMap
=
new
HashMap
<>();
homePageMap
.
put
(
"url"
,
""
);
homePageMap
.
put
(
"url"
,
""
);
...
@@ -470,6 +476,12 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -470,6 +476,12 @@ public class FavoritesServiceImpl implements FavoritesService {
return
homePageMap
;
return
homePageMap
;
}
}
/**
* 获取图片的长宽
*
* @param image
* @return
*/
private
Map
<
String
,
Object
>
getImageMap
(
String
image
)
{
private
Map
<
String
,
Object
>
getImageMap
(
String
image
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
[]
_image
=
image
.
split
(
"_"
);
String
[]
_image
=
image
.
split
(
"_"
);
...
@@ -480,6 +492,13 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -480,6 +492,13 @@ public class FavoritesServiceImpl implements FavoritesService {
return
map
;
return
map
;
}
}
/**
* 获取藏品的收藏数
*
* @param itemId
* @param sourceType
* @return
*/
private
String
getCollectCount
(
Long
itemId
,
Integer
sourceType
)
{
private
String
getCollectCount
(
Long
itemId
,
Integer
sourceType
)
{
String
countString
=
""
;
String
countString
=
""
;
// 设置收藏数
// 设置收藏数
...
@@ -495,6 +514,13 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -495,6 +514,13 @@ public class FavoritesServiceImpl implements FavoritesService {
return
countString
;
return
countString
;
}
}
/**
* 获取格式化后的金额
*
* @param price
* @return
*/
private
String
getPrice
(
Long
price
)
{
private
String
getPrice
(
Long
price
)
{
String
priceString
=
""
;
String
priceString
=
""
;
if
(
price
%
100
==
0
)
{
if
(
price
%
100
==
0
)
{
...
@@ -505,6 +531,12 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -505,6 +531,12 @@ public class FavoritesServiceImpl implements FavoritesService {
return
StringUtil
.
formatAmount
(
priceString
);
return
StringUtil
.
formatAmount
(
priceString
);
}
}
/**
* 获取收藏册封面图
*
* @param id
* @return
*/
private
List
<
String
>
getFavoritesImage
(
Long
id
)
{
private
List
<
String
>
getFavoritesImage
(
Long
id
)
{
List
<
String
>
images
=
new
ArrayList
<>();
List
<
String
>
images
=
new
ArrayList
<>();
List
<
FavoritesItemsDto
>
favoritesItemsDtos
=
favoritesItemsRelationDao
.
queryItemImages
(
id
);
List
<
FavoritesItemsDto
>
favoritesItemsDtos
=
favoritesItemsRelationDao
.
queryItemImages
(
id
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
View file @
8e515540
...
@@ -136,6 +136,8 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -136,6 +136,8 @@ public class FootPrintServiceImpl implements FootPrintService {
monthVo
.
setTimeType
(
4
);
monthVo
.
setTimeType
(
4
);
monthVo
.
setItems
(
monthList
);
monthVo
.
setItems
(
monthList
);
result
.
add
(
monthVo
);
result
.
add
(
monthVo
);
logger
.
info
(
"【请求结束】用户足迹列表查询成功"
);
return
Result
.
success
(
result
);
return
Result
.
success
(
result
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询用户足迹列表失败"
,
e
);
logger
.
error
(
"查询用户足迹列表失败"
,
e
);
...
@@ -253,9 +255,11 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -253,9 +255,11 @@ public class FootPrintServiceImpl implements FootPrintService {
result
.
add
(
monthVo
);
result
.
add
(
monthVo
);
map
.
put
(
"dataList"
,
result
);
map
.
put
(
"dataList"
,
result
);
logger
.
info
(
"【请求结束】用户足迹分页查询成功"
);
return
Result
.
success
(
map
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"
分页查询用户足迹列表失败
"
,
e
);
logger
.
error
(
"
用户足迹分页查询
"
,
e
);
return
Result
.
failed
(
"查询失败"
);
return
Result
.
failed
(
"查询失败"
);
}
}
}
}
...
@@ -265,13 +269,20 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -265,13 +269,20 @@ public class FootPrintServiceImpl implements FootPrintService {
public
Result
delete
(
FootPrintRequestDto
dto
)
{
public
Result
delete
(
FootPrintRequestDto
dto
)
{
try
{
try
{
footPrintDao
.
delete
(
dto
.
getIds
());
footPrintDao
.
delete
(
dto
.
getIds
());
logger
.
info
(
"【请求结束】用户足迹删除成功"
);
return
Result
.
success
();
return
Result
.
success
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"
删除用户足迹
失败"
,
e
);
logger
.
error
(
"
用户足迹删除
失败"
,
e
);
return
Result
.
failed
(
"删除足迹失败"
);
return
Result
.
failed
(
"删除足迹失败"
);
}
}
}
}
/**
* 获取展示图片
*
* @param item
* @return
*/
private
Map
<
String
,
Object
>
getImage
(
Item
item
)
{
private
Map
<
String
,
Object
>
getImage
(
Item
item
)
{
Map
<
String
,
Object
>
homePageMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
homePageMap
=
new
HashMap
<>();
homePageMap
.
put
(
"url"
,
""
);
homePageMap
.
put
(
"url"
,
""
);
...
@@ -307,6 +318,12 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -307,6 +318,12 @@ public class FootPrintServiceImpl implements FootPrintService {
return
homePageMap
;
return
homePageMap
;
}
}
/**
* 获取图片的长宽
*
* @param image
* @return
*/
private
Map
<
String
,
Object
>
getImageMap
(
String
image
)
{
private
Map
<
String
,
Object
>
getImageMap
(
String
image
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
[]
_image
=
image
.
split
(
"_"
);
String
[]
_image
=
image
.
split
(
"_"
);
...
@@ -317,6 +334,13 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -317,6 +334,13 @@ public class FootPrintServiceImpl implements FootPrintService {
return
map
;
return
map
;
}
}
/**
* 获取藏品的收藏数
*
* @param itemId
* @param sourceType
* @return
*/
private
String
getCollectCount
(
Long
itemId
,
Integer
sourceType
)
{
private
String
getCollectCount
(
Long
itemId
,
Integer
sourceType
)
{
String
countString
=
""
;
String
countString
=
""
;
// 设置收藏数
// 设置收藏数
...
@@ -332,6 +356,12 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -332,6 +356,12 @@ public class FootPrintServiceImpl implements FootPrintService {
return
countString
;
return
countString
;
}
}
/**
* 获取格式化后的金额
*
* @param price
* @return
*/
private
String
getPrice
(
Long
price
)
{
private
String
getPrice
(
Long
price
)
{
String
priceString
=
""
;
String
priceString
=
""
;
if
(
price
%
100
==
0
)
{
if
(
price
%
100
==
0
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
8e515540
...
@@ -547,6 +547,12 @@ public class ItemServiceImpl implements ItemService {
...
@@ -547,6 +547,12 @@ public class ItemServiceImpl implements ItemService {
return
null
;
return
null
;
}
}
/**
* 获取展示图片
*
* @param es
* @return
*/
private
Map
<
String
,
Object
>
getImage
(
ItemOfEs
es
)
{
private
Map
<
String
,
Object
>
getImage
(
ItemOfEs
es
)
{
Map
<
String
,
Object
>
homePageMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
homePageMap
=
new
HashMap
<>();
homePageMap
.
put
(
"url"
,
""
);
homePageMap
.
put
(
"url"
,
""
);
...
@@ -582,6 +588,12 @@ public class ItemServiceImpl implements ItemService {
...
@@ -582,6 +588,12 @@ public class ItemServiceImpl implements ItemService {
return
homePageMap
;
return
homePageMap
;
}
}
/**
* 获取图片的长宽
*
* @param image
* @return
*/
private
Map
<
String
,
Object
>
getImageMap
(
String
image
)
{
private
Map
<
String
,
Object
>
getImageMap
(
String
image
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
[]
_image
=
image
.
split
(
"_"
);
String
[]
_image
=
image
.
split
(
"_"
);
...
@@ -592,6 +604,13 @@ public class ItemServiceImpl implements ItemService {
...
@@ -592,6 +604,13 @@ public class ItemServiceImpl implements ItemService {
return
map
;
return
map
;
}
}
/**
* 获取藏品的收藏数
*
* @param itemId
* @param sourceType
* @return
*/
private
String
getCollectCount
(
Long
itemId
,
Integer
sourceType
)
{
private
String
getCollectCount
(
Long
itemId
,
Integer
sourceType
)
{
String
countString
=
""
;
String
countString
=
""
;
// 设置收藏数
// 设置收藏数
...
@@ -607,6 +626,12 @@ public class ItemServiceImpl implements ItemService {
...
@@ -607,6 +626,12 @@ public class ItemServiceImpl implements ItemService {
return
countString
;
return
countString
;
}
}
/**
* 获取格式化后的金额
*
* @param price
* @return
*/
private
String
getPrice
(
Long
price
)
{
private
String
getPrice
(
Long
price
)
{
String
priceString
=
""
;
String
priceString
=
""
;
if
(
price
%
100
==
0
)
{
if
(
price
%
100
==
0
)
{
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
8e515540
...
@@ -213,6 +213,9 @@ public class UserServiceImpl implements UserService {
...
@@ -213,6 +213,9 @@ public class UserServiceImpl implements UserService {
public
Result
loginByMobile
(
UserRequestDto
dto
,
HttpServletRequest
request
)
{
public
Result
loginByMobile
(
UserRequestDto
dto
,
HttpServletRequest
request
)
{
try
{
try
{
String
mobileCode
=
CaptchaCodeManager
.
getCachedCaptcha
(
CacheCodeConstants
.
SmsTypeEnum
.
LOGIN
.
getCode
()
+
dto
.
getMobile
());
String
mobileCode
=
CaptchaCodeManager
.
getCachedCaptcha
(
CacheCodeConstants
.
SmsTypeEnum
.
LOGIN
.
getCode
()
+
dto
.
getMobile
());
if
(
StringUtils
.
isBlank
(
mobileCode
))
{
return
Result
.
failed
(
"验证码已过期"
);
}
if
(!
StringUtils
.
equals
(
dto
.
getSmsCode
(),
mobileCode
))
{
if
(!
StringUtils
.
equals
(
dto
.
getSmsCode
(),
mobileCode
))
{
return
Result
.
failed
(
"验证码不正确"
);
return
Result
.
failed
(
"验证码不正确"
);
}
}
...
@@ -390,6 +393,9 @@ public class UserServiceImpl implements UserService {
...
@@ -390,6 +393,9 @@ public class UserServiceImpl implements UserService {
return
Result
.
failed
(
"原手机号码不正确"
);
return
Result
.
failed
(
"原手机号码不正确"
);
}
}
String
mobileCode
=
CaptchaCodeManager
.
getCachedCaptcha
(
CacheCodeConstants
.
SmsTypeEnum
.
UPDATE
.
getCode
()
+
dto
.
getAfterMobile
());
String
mobileCode
=
CaptchaCodeManager
.
getCachedCaptcha
(
CacheCodeConstants
.
SmsTypeEnum
.
UPDATE
.
getCode
()
+
dto
.
getAfterMobile
());
if
(
StringUtils
.
isBlank
(
mobileCode
))
{
return
Result
.
failed
(
"验证码已过期"
);
}
if
(!
StringUtils
.
equals
(
dto
.
getSmsCode
(),
mobileCode
))
{
if
(!
StringUtils
.
equals
(
dto
.
getSmsCode
(),
mobileCode
))
{
return
Result
.
failed
(
"验证码不正确"
);
return
Result
.
failed
(
"验证码不正确"
);
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/CaptchaCodeManager.java
deleted
100644 → 0
View file @
df7307f4
package
com.wwdz.ch.wx.manager
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.Map
;
import
com.wwdz.ch.wx.dao.CaptchaItem
;
/**
* 缓存系统中的验证码
*/
public
class
CaptchaCodeManager
{
private
static
Map
<
String
,
CaptchaItem
>
captchaCodeCache
=
new
HashMap
<>();
/**
* 添加到缓存
*
* @param phoneNumber
* 电话号码
* @param code
* 验证码
*/
public
static
boolean
addToCache
(
String
phoneNumber
,
String
code
)
{
// 已经发过验证码且验证码还未过期
if
(
captchaCodeCache
.
get
(
phoneNumber
)
!=
null
)
{
if
(
captchaCodeCache
.
get
(
phoneNumber
).
getExpireTime
().
isAfter
(
LocalDateTime
.
now
()))
{
return
false
;
}
else
{
// 存在但是已过期,删掉
captchaCodeCache
.
remove
(
phoneNumber
);
}
}
CaptchaItem
captchaItem
=
new
CaptchaItem
();
captchaItem
.
setPhoneNumber
(
phoneNumber
);
captchaItem
.
setCode
(
code
);
// 有效期为1分钟
captchaItem
.
setExpireTime
(
LocalDateTime
.
now
().
plusMinutes
(
1
));
captchaCodeCache
.
put
(
phoneNumber
,
captchaItem
);
return
true
;
}
/**
* 获取缓存的验证码
*
* @param phoneNumber
* 关联的电话号码
* @return 验证码
*/
public
static
String
getCachedCaptcha
(
String
phoneNumber
)
{
// 没有这个电话记录
if
(
captchaCodeCache
.
get
(
phoneNumber
)
==
null
)
return
null
;
// 有电话记录但是已经过期
if
(
captchaCodeCache
.
get
(
phoneNumber
).
getExpireTime
().
isBefore
(
LocalDateTime
.
now
()))
{
return
null
;
}
return
captchaCodeCache
.
get
(
phoneNumber
).
getCode
();
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FavoritesService.java
View file @
8e515540
...
@@ -5,25 +5,99 @@ import com.wwdz.ch.wx.entity.request.ItemRequestDto;
...
@@ -5,25 +5,99 @@ import com.wwdz.ch.wx.entity.request.ItemRequestDto;
import
com.wwdz.ch.db.dto.request.FavoritesRequestDto
;
import
com.wwdz.ch.db.dto.request.FavoritesRequestDto
;
public
interface
FavoritesService
{
public
interface
FavoritesService
{
/**
* 新增默认收藏册
*
* @param dto
* @return
*/
Result
addDefault
(
FavoritesRequestDto
dto
);
Result
addDefault
(
FavoritesRequestDto
dto
);
/**
* 收藏册分页
*
* @param dto
* @return
*/
Result
page
(
FavoritesRequestDto
dto
);
Result
page
(
FavoritesRequestDto
dto
);
/**
* 收藏册列表
*
* @param dto
* @return
*/
Result
list
(
FavoritesRequestDto
dto
);
Result
list
(
FavoritesRequestDto
dto
);
/**
* 新增收藏册
*
* @param dto
* @return
*/
Result
add
(
FavoritesRequestDto
dto
);
Result
add
(
FavoritesRequestDto
dto
);
/**
* 更新收藏册
*
* @param dto
* @return
*/
Result
update
(
FavoritesRequestDto
dto
);
Result
update
(
FavoritesRequestDto
dto
);
/**
* 收藏册基本详情
*
* @param dto
* @return
*/
Result
info
(
FavoritesRequestDto
dto
);
Result
info
(
FavoritesRequestDto
dto
);
/**
* 收藏册下藏品列表
*
* @param dto
* @return
*/
Result
itemList
(
FavoritesRequestDto
dto
);
Result
itemList
(
FavoritesRequestDto
dto
);
/**
* 单个删除收藏册
*
* @param dto
* @return
*/
Result
delete
(
FavoritesRequestDto
dto
);
Result
delete
(
FavoritesRequestDto
dto
);
/**
* 批量删除收藏册
*
* @param dto
* @return
*/
Result
batchDelete
(
FavoritesRequestDto
dto
);
Result
batchDelete
(
FavoritesRequestDto
dto
);
/**
* 收藏
*
* @param dto
* @return
*/
Result
addItem
(
ItemRequestDto
dto
);
Result
addItem
(
ItemRequestDto
dto
);
/**
* 取消收藏
*
* @param dto
* @return
*/
Result
removeItem
(
ItemRequestDto
dto
);
Result
removeItem
(
ItemRequestDto
dto
);
/**
* 移动藏品
*
* @param dto
* @return
*/
Result
moveItem
(
ItemRequestDto
dto
);
Result
moveItem
(
ItemRequestDto
dto
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/FootPrintService.java
View file @
8e515540
...
@@ -4,7 +4,27 @@ import com.wwdz.ch.core.type.Result;
...
@@ -4,7 +4,27 @@ import com.wwdz.ch.core.type.Result;
import
com.wwdz.ch.wx.entity.request.FootPrintRequestDto
;
import
com.wwdz.ch.wx.entity.request.FootPrintRequestDto
;
public
interface
FootPrintService
{
public
interface
FootPrintService
{
/**
* 用户足迹列表查询
*
* @param dto
* @return
*/
Result
listAll
(
FootPrintRequestDto
dto
);
Result
listAll
(
FootPrintRequestDto
dto
);
/**
* 用户足迹分页查询
*
* @param dto
* @return
*/
Result
page
(
FootPrintRequestDto
dto
);
Result
page
(
FootPrintRequestDto
dto
);
/**
* 用户足迹删除
*
* @param dto
* @return
*/
Result
delete
(
FootPrintRequestDto
dto
);
Result
delete
(
FootPrintRequestDto
dto
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/ItemService.java
View file @
8e515540
...
@@ -7,25 +7,108 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -7,25 +7,108 @@ import org.springframework.web.multipart.MultipartFile;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
public
interface
ItemService
{
public
interface
ItemService
{
/**
* 搜索用藏品名称联想
*
* @param dto
* @return
*/
Result
nameList
(
ItemRequestDto
dto
);
Result
nameList
(
ItemRequestDto
dto
);
/**
* 搜索用藏品名称推荐
*
* @return
*/
Result
recommend
();
Result
recommend
();
/**
* 藏品分页
*
* @param dto
* @return
*/
Result
page
(
ItemRequestDto
dto
);
Result
page
(
ItemRequestDto
dto
);
/**
* 藏品列表
*
* @param dto
* @return
*/
Result
list
(
ItemRequestDto
dto
);
Result
list
(
ItemRequestDto
dto
);
/**
* 新增藏品
*
* @param dto
* @return
*/
Result
add
(
ItemRequestDto
dto
);
Result
add
(
ItemRequestDto
dto
);
/**
* 藏品详情
*
* @param dto
* @return
*/
Result
info
(
ItemRequestDto
dto
);
Result
info
(
ItemRequestDto
dto
);
/**
* 收藏(仅首页使用)
*
* @param dto
* @return
*/
Result
collect
(
ItemRequestDto
dto
);
Result
collect
(
ItemRequestDto
dto
);
/**
* 取消收藏(仅首页使用)
*
* @param dto
* @return
*/
Result
cancel
(
ItemRequestDto
dto
);
Result
cancel
(
ItemRequestDto
dto
);
/**
* 更新藏品
*
* @param dto
* @return
*/
Result
update
(
ItemRequestDto
dto
);
Result
update
(
ItemRequestDto
dto
);
/**
* 获取微信小程序小程序码
*
* @param page
* @param scene
* @param response
* @return
*/
Result
getWxacode
(
String
page
,
String
scene
,
HttpServletResponse
response
);
Result
getWxacode
(
String
page
,
String
scene
,
HttpServletResponse
response
);
/**
* 获取微信小程序短链接
*
* @param pageUrl
* @return
*/
Result
getWxLink
(
String
pageUrl
);
Result
getWxLink
(
String
pageUrl
);
/**
* 上传图片
*
* @param file
* @return
*/
Result
uploadImage
(
MultipartFile
file
);
Result
uploadImage
(
MultipartFile
file
);
/**
* 上传视频
*
* @param file
* @return
*/
Result
uploadVedio
(
MultipartFile
file
);
Result
uploadVedio
(
MultipartFile
file
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserService.java
View file @
8e515540
...
@@ -6,19 +6,69 @@ import com.wwdz.ch.wx.entity.request.UserRequestDto;
...
@@ -6,19 +6,69 @@ import com.wwdz.ch.wx.entity.request.UserRequestDto;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
public
interface
UserService
{
public
interface
UserService
{
/**
* 微信登录
*
* @param dto
* @param request
* @return
*/
Result
loginByWx
(
UserRequestDto
dto
,
HttpServletRequest
request
);
Result
loginByWx
(
UserRequestDto
dto
,
HttpServletRequest
request
);
/**
* 发送手机验证码
*
* @param dto
* @return
*/
Result
regCaptcha
(
UserRequestDto
dto
);
Result
regCaptcha
(
UserRequestDto
dto
);
/**
* 手机号登录
*
* @param dto
* @param request
* @return
*/
Result
loginByMobile
(
UserRequestDto
dto
,
HttpServletRequest
request
);
Result
loginByMobile
(
UserRequestDto
dto
,
HttpServletRequest
request
);
/**
* 修改个性签名
*
* @param dto
* @return
*/
Result
updateProfile
(
UserRequestDto
dto
);
Result
updateProfile
(
UserRequestDto
dto
);
/**
* 修改背景图片
*
* @param dto
* @return
*/
Result
updateBackground
(
UserRequestDto
dto
);
Result
updateBackground
(
UserRequestDto
dto
);
/**
* 修改昵称
*
* @param dto
* @return
*/
Result
updateNickname
(
UserRequestDto
dto
);
Result
updateNickname
(
UserRequestDto
dto
);
/**
* 修改头像
*
* @param dto
* @return
*/
Result
updateAvatar
(
UserRequestDto
dto
);
Result
updateAvatar
(
UserRequestDto
dto
);
/**
* 修改手机号
*
* @param dto
* @return
*/
Result
updateMobile
(
UserRequestDto
dto
);
Result
updateMobile
(
UserRequestDto
dto
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/WxLoginService.java
View file @
8e515540
...
@@ -5,8 +5,35 @@ import com.wwdz.ch.wx.entity.request.UserRequestDto;
...
@@ -5,8 +5,35 @@ import com.wwdz.ch.wx.entity.request.UserRequestDto;
import
java.io.InputStream
;
import
java.io.InputStream
;
public
interface
WxLoginService
{
public
interface
WxLoginService
{
/**
* 获取微信用户手机号
*
* @param dto
* @return
*/
String
getPhone
(
UserRequestDto
dto
);
String
getPhone
(
UserRequestDto
dto
);
/**
* 获取微信用户授权access_token
*
* @return
*/
String
getAccessToken
();
String
getAccessToken
();
/**
* 获取微信小程序小程序码图片流
*
* @param path
* @param scene
* @return
*/
InputStream
getWxacodeStream
(
String
path
,
String
scene
);
InputStream
getWxacodeStream
(
String
path
,
String
scene
);
/**
* 获取微信小程序短链接
*
* @param pageUrl
* @return
*/
String
getLink
(
String
pageUrl
);
String
getLink
(
String
pageUrl
);
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/util/StringUtil.java
View file @
8e515540
...
@@ -21,7 +21,7 @@ public class StringUtil {
...
@@ -21,7 +21,7 @@ public class StringUtil {
}
}
/**
/**
* 格式化金额
* 格式化金额
(国际格式)
*
*
* @param amount
* @param amount
* @return
* @return
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFootprintController.java
View file @
8e515540
package
com.wwdz.ch.wx.web
;
package
com.wwdz.ch.wx.web
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.entity.request.FootPrintRequestDto
;
import
com.wwdz.ch.wx.entity.request.FootPrintRequestDto
;
import
com.wwdz.ch.wx.entity.request.KlDataRequestDto
;
import
com.wwdz.ch.wx.service.FootPrintService
;
import
com.wwdz.ch.wx.service.FootPrintService
;
import
com.xxdxxs.utils.JsonUtils
;
import
org.apache.commons.collections.CollectionUtils
;
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
;
...
@@ -15,9 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -15,9 +14,7 @@ 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.Arrays
;
import
java.util.Objects
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 用户访问足迹服务
* 用户访问足迹服务
...
@@ -31,42 +28,26 @@ public class WxFootprintController {
...
@@ -31,42 +28,26 @@ public class WxFootprintController {
private
FootPrintService
footPrintService
;
private
FootPrintService
footPrintService
;
@PostMapping
(
"/page"
)
@PostMapping
(
"/page"
)
public
Result
page
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
page
(
@RequestBody
FootPrintRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】用户足迹列表查询,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】用户足迹列表查询,请求参数,kl_data:{}"
,
json
);
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
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不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
page
)
)
{
if
(
Objects
.
isNull
(
dto
.
getPage
())
||
dto
.
getPage
()
<=
0
)
{
return
Result
.
failed
(
"当前页不能为空"
);
return
Result
.
failed
(
"当前页不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
size
)
)
{
if
(
Objects
.
isNull
(
dto
.
getSize
())
||
dto
.
getSize
()
<=
0
)
{
return
Result
.
failed
(
"页面大小不能为空"
);
return
Result
.
failed
(
"页面大小不能为空"
);
}
}
FootPrintRequestDto
dto
=
new
FootPrintRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setPage
(
Integer
.
parseInt
(
page
));
dto
.
setSize
(
Integer
.
parseInt
(
size
));
return
footPrintService
.
page
(
dto
);
return
footPrintService
.
page
(
dto
);
}
}
@PostMapping
(
"/del"
)
@PostMapping
(
"/del"
)
public
Result
delete
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
delete
(
@RequestBody
FootPrintRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】用户足迹删除,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】收藏册收藏,请求参数,kl_data:{}"
,
json
);
if
(
CollectionUtils
.
isEmpty
(
dto
.
getIds
()))
{
String
ids
=
JsonUtils
.
getValueByPath
(
json
,
"ids"
);
if
(
StringUtils
.
isBlank
(
ids
))
{
return
Result
.
failed
(
"收藏册id不能为空"
);
return
Result
.
failed
(
"收藏册id不能为空"
);
}
}
List
<
Long
>
idss
=
Arrays
.
stream
(
ids
.
substring
(
1
,
ids
.
length
()
-
1
).
split
(
","
))
.
map
(
Long:
:
valueOf
).
collect
(
Collectors
.
toList
());
FootPrintRequestDto
dto
=
new
FootPrintRequestDto
();
dto
.
setIds
(
idss
);
return
footPrintService
.
delete
(
dto
);
return
footPrintService
.
delete
(
dto
);
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
View file @
8e515540
package
com.wwdz.ch.wx.web
;
package
com.wwdz.ch.wx.web
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.constant.CacheCodeConstants
;
import
com.wwdz.ch.wx.constant.CacheCodeConstants
;
import
com.wwdz.ch.wx.entity.request.KlDataRequestDto
;
import
com.wwdz.ch.wx.entity.request.KlDataRequestDto
;
...
@@ -98,127 +99,83 @@ public class WxUserController {
...
@@ -98,127 +99,83 @@ public class WxUserController {
@ApiOperation
(
value
=
"修改个性签名"
)
@ApiOperation
(
value
=
"修改个性签名"
)
@PostMapping
(
"/updateProfile"
)
@PostMapping
(
"/updateProfile"
)
public
Result
updateProfile
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
updateProfile
(
@RequestBody
UserRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改个性签名,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】修改个性签名,请求参数,kl_data:{}"
,
json
);
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
profile
=
JsonUtils
.
getValueByPath
(
json
,
"profile"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
profile
))
{
if
(
StringUtils
.
isBlank
(
dto
.
getProfile
()
))
{
return
Result
.
failed
(
"个性签名不能为空
"
);
dto
.
setProfile
(
"
"
);
}
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setProfile
(
profile
);
return
userService
.
updateProfile
(
dto
);
return
userService
.
updateProfile
(
dto
);
}
}
@ApiOperation
(
value
=
"修改背景"
)
@ApiOperation
(
value
=
"修改背景"
)
@PostMapping
(
"/updateBackground"
)
@PostMapping
(
"/updateBackground"
)
public
Result
updateBackground
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
updateBackground
(
@RequestBody
UserRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改背景,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】修改背景,请求参数,kl_data:{}"
,
json
);
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
background
=
JsonUtils
.
getValueByPath
(
json
,
"background"
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
background
))
{
if
(
StringUtils
.
isBlank
(
dto
.
getBackground
()
))
{
return
Result
.
failed
(
"背景图片路径不能为空
"
);
dto
.
setBackground
(
"
"
);
}
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setBackground
(
background
);
return
userService
.
updateBackground
(
dto
);
return
userService
.
updateBackground
(
dto
);
}
}
@ApiOperation
(
value
=
"修改昵称"
)
@ApiOperation
(
value
=
"修改昵称"
)
@PostMapping
(
"/updateNickname"
)
@PostMapping
(
"/updateNickname"
)
public
Result
updateNickname
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
updateNickname
(
@RequestBody
UserRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改昵称,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】修改昵称,请求参数,kl_data:{}"
,
json
);
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
nickname
=
JsonUtils
.
getValueByPath
(
json
,
"nickname"
);
if
(
Objects
.
isNull
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
nickname
))
{
if
(
StringUtils
.
isBlank
(
dto
.
getNickname
()
))
{
return
Result
.
failed
(
"昵称不能为空"
);
return
Result
.
failed
(
"昵称不能为空"
);
}
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setNickname
(
nickname
);
return
userService
.
updateNickname
(
dto
);
return
userService
.
updateNickname
(
dto
);
}
}
@ApiOperation
(
value
=
"修改头像"
)
@ApiOperation
(
value
=
"修改头像"
)
@PostMapping
(
"/updateAvatar"
)
@PostMapping
(
"/updateAvatar"
)
public
Result
updateAvatar
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
updateAvatar
(
@RequestBody
UserRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改头像,请求参数:{}"
,
JSON
.
toJSONString
(
true
));
logger
.
info
(
"【请求开始】修改头像,请求参数,kl_data:{}"
,
json
);
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
String
userId
=
JsonUtils
.
getValueByPath
(
json
,
"userId"
);
String
avatarUrl
=
JsonUtils
.
getValueByPath
(
json
,
"avatarUrl"
);
if
(
Objects
.
isNull
(
userId
))
{
return
Result
.
failed
(
"用户id不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
avatarUrl
))
{
if
(
StringUtils
.
isBlank
(
dto
.
getAvatarUrl
()
))
{
return
Result
.
failed
(
"
头像图片路径不能为空
"
);
return
Result
.
failed
(
"
请上传头像
"
);
}
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setUserId
(
Long
.
parseLong
(
userId
));
dto
.
setAvatarUrl
(
avatarUrl
);
return
userService
.
updateAvatar
(
dto
);
return
userService
.
updateAvatar
(
dto
);
}
}
@ApiOperation
(
value
=
"修改手机验证码"
)
@ApiOperation
(
value
=
"修改手机验证码"
)
@PostMapping
(
"/updateRegCaptcha"
)
@PostMapping
(
"/updateRegCaptcha"
)
public
Object
updateRegCaptcha
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Object
updateRegCaptcha
(
@RequestBody
UserRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】请求修改手机验证码,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】请求修改手机验证码,请求参数,kl_data:{}"
,
json
);
if
(
StringUtils
.
isBlank
(
dto
.
getMobile
()))
{
String
mobile
=
JsonUtils
.
getValueByPath
(
json
,
"mobile"
);
if
(
StringUtils
.
isBlank
(
mobile
))
{
return
Result
.
failed
(
"手机号不能为空"
);
return
Result
.
failed
(
"手机号不能为空"
);
}
}
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setMobile
(
mobile
);
dto
.
setSmsType
(
CacheCodeConstants
.
SmsTypeEnum
.
UPDATE
.
getCode
());
dto
.
setSmsType
(
CacheCodeConstants
.
SmsTypeEnum
.
UPDATE
.
getCode
());
return
userService
.
regCaptcha
(
dto
);
return
userService
.
regCaptcha
(
dto
);
}
}
@ApiOperation
(
value
=
"修改手机号"
)
@ApiOperation
(
value
=
"修改手机号"
)
@PostMapping
(
"/updateMobile"
)
@PostMapping
(
"/updateMobile"
)
public
Result
updateMobile
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
updateMobile
(
@RequestBody
UserRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】修改手机号,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】修改手机号,请求参数,kl_data:{}"
,
json
);
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
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不能为空"
);
return
Result
.
failed
(
"用户id不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
beforeMobile
))
{
if
(
StringUtils
.
isBlank
(
dto
.
getBeforeMobile
()
))
{
return
Result
.
failed
(
"原手机号不能为空"
);
return
Result
.
failed
(
"原手机号不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
afterMobile
))
{
if
(
StringUtils
.
isBlank
(
dto
.
getAfterMobile
()
))
{
return
Result
.
failed
(
"新手机号不能为空"
);
return
Result
.
failed
(
"新
绑定
手机号不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
smsCode
))
{
if
(
StringUtils
.
isBlank
(
dto
.
getSmsCode
()
))
{
return
Result
.
failed
(
"验证码不能为空"
);
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
);
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