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
50618e8e
Commit
50618e8e
authored
Aug 10, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构
parent
434bf76c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
39 deletions
+58
-39
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserInfoService.java
...src/main/java/com/wwdz/ch/wx/service/UserInfoService.java
+3
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCollectController.java
...src/main/java/com/wwdz/ch/wx/web/WxCollectController.java
+11
-8
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFeedbackController.java
...rc/main/java/com/wwdz/ch/wx/web/WxFeedbackController.java
+7
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFootprintController.java
...c/main/java/com/wwdz/ch/wx/web/WxFootprintController.java
+10
-6
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxGoodsController.java
...i/src/main/java/com/wwdz/ch/wx/web/WxGoodsController.java
+4
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxHomeController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxHomeController.java
+2
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxSearchController.java
.../src/main/java/com/wwdz/ch/wx/web/WxSearchController.java
+10
-7
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxStorageController.java
...src/main/java/com/wwdz/ch/wx/web/WxStorageController.java
+5
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserFormId.java
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserFormId.java
+6
-4
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/UserInfoService.java
View file @
50618e8e
package
com.wwdz.ch.wx.service
;
package
com.wwdz.ch.wx.service
;
import
com.wwdz.ch.db.dao.dts.DtsUserDao
;
import
com.wwdz.ch.wx.dao.UserInfo
;
import
com.wwdz.ch.wx.dao.UserInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -10,10 +11,10 @@ import com.wwdz.ch.db.domain.User;
...
@@ -10,10 +11,10 @@ import com.wwdz.ch.db.domain.User;
@Service
@Service
public
class
UserInfoService
{
public
class
UserInfoService
{
@Autowired
@Autowired
private
DtsUserDao
userService
;
private
DtsUserDao
dtsUserDao
;
public
UserInfo
getInfo
(
Long
userId
)
{
public
UserInfo
getInfo
(
Long
userId
)
{
User
user
=
userService
.
findById
(
userId
);
User
user
=
dtsUserDao
.
findById
(
userId
);
Assert
.
state
(
user
!=
null
,
"用户不存在"
);
Assert
.
state
(
user
!=
null
,
"用户不存在"
);
UserInfo
userInfo
=
new
UserInfo
();
UserInfo
userInfo
=
new
UserInfo
();
userInfo
.
setNickName
(
user
.
getNickname
());
userInfo
.
setNickName
(
user
.
getNickname
());
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCollectController.java
View file @
50618e8e
...
@@ -7,6 +7,8 @@ import java.util.Map;
...
@@ -7,6 +7,8 @@ import java.util.Map;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
com.wwdz.ch.db.dao.ItemDao
;
import
com.wwdz.ch.db.dao.dts.DtsCollectDao
;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
...
@@ -36,9 +38,10 @@ public class WxCollectController {
...
@@ -36,9 +38,10 @@ public class WxCollectController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxCollectController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxCollectController
.
class
);
@Autowired
@Autowired
private
DtsCollectDao
collectService
;
private
DtsCollectDao
dtsCollectDao
;
@Autowired
@Autowired
private
Item
OldDao
itemService
;
private
Item
Dao
itemDao
;
/**
/**
* 用户收藏列表
* 用户收藏列表
...
@@ -62,8 +65,8 @@ public class WxCollectController {
...
@@ -62,8 +65,8 @@ public class WxCollectController {
return
ResponseUtil
.
unlogin
();
return
ResponseUtil
.
unlogin
();
}
}
List
<
CollectObsolete
>
collectList
=
collectService
.
queryByType
(
userId
,
type
,
page
,
size
);
List
<
CollectObsolete
>
collectList
=
dtsCollectDao
.
queryByType
(
userId
,
type
,
page
,
size
);
int
count
=
collectService
.
countByType
(
userId
,
type
);
int
count
=
dtsCollectDao
.
countByType
(
userId
,
type
);
int
totalPages
=
(
int
)
Math
.
ceil
((
double
)
count
/
size
);
int
totalPages
=
(
int
)
Math
.
ceil
((
double
)
count
/
size
);
List
<
Object
>
collects
=
new
ArrayList
<>(
collectList
.
size
());
List
<
Object
>
collects
=
new
ArrayList
<>(
collectList
.
size
());
...
@@ -73,7 +76,7 @@ public class WxCollectController {
...
@@ -73,7 +76,7 @@ public class WxCollectController {
c
.
put
(
"type"
,
collect
.
getType
());
c
.
put
(
"type"
,
collect
.
getType
());
c
.
put
(
"valueId"
,
collect
.
getValueId
());
c
.
put
(
"valueId"
,
collect
.
getValueId
());
Item
item
=
item
Service
.
findById
(
collect
.
getValueId
().
longValue
());
Item
item
=
item
Dao
.
findById
(
collect
.
getValueId
().
longValue
());
c
.
put
(
"name"
,
item
.
getName
());
c
.
put
(
"name"
,
item
.
getName
());
c
.
put
(
"picUrl"
,
item
.
getImages
().
split
(
";"
)[
0
]);
c
.
put
(
"picUrl"
,
item
.
getImages
().
split
(
";"
)[
0
]);
c
.
put
(
"retailPrice"
,
item
.
getPrice
());
c
.
put
(
"retailPrice"
,
item
.
getPrice
());
...
@@ -115,19 +118,19 @@ public class WxCollectController {
...
@@ -115,19 +118,19 @@ public class WxCollectController {
return
ResponseUtil
.
badArgument
();
return
ResponseUtil
.
badArgument
();
}
}
CollectObsolete
collect
=
collectService
.
queryByTypeAndValue
(
userId
,
type
,
valueId
);
CollectObsolete
collect
=
dtsCollectDao
.
queryByTypeAndValue
(
userId
,
type
,
valueId
);
String
handleType
=
null
;
String
handleType
=
null
;
if
(
collect
!=
null
)
{
if
(
collect
!=
null
)
{
handleType
=
"delete"
;
handleType
=
"delete"
;
collectService
.
deleteById
(
collect
.
getId
());
dtsCollectDao
.
deleteById
(
collect
.
getId
());
}
else
{
}
else
{
handleType
=
"add"
;
handleType
=
"add"
;
collect
=
new
CollectObsolete
();
collect
=
new
CollectObsolete
();
collect
.
setUserId
(
userId
);
collect
.
setUserId
(
userId
);
collect
.
setValueId
(
valueId
);
collect
.
setValueId
(
valueId
);
collect
.
setType
(
type
);
collect
.
setType
(
type
);
collectService
.
add
(
collect
);
dtsCollectDao
.
add
(
collect
);
}
}
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFeedbackController.java
View file @
50618e8e
package
com.wwdz.ch.wx.web
;
package
com.wwdz.ch.wx.web
;
import
com.wwdz.ch.db.dao.dts.DtsFeedbackDao
;
import
com.wwdz.ch.db.dao.dts.DtsUserDao
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -31,9 +33,10 @@ public class WxFeedbackController {
...
@@ -31,9 +33,10 @@ public class WxFeedbackController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxFeedbackController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxFeedbackController
.
class
);
@Autowired
@Autowired
private
DtsFeedbackDao
feedbackService
;
private
DtsFeedbackDao
dtsFeedbackDao
;
@Autowired
@Autowired
private
DtsUserDao
userService
;
private
DtsUserDao
dtsUserDao
;
private
Object
validate
(
Feedback
feedback
)
{
private
Object
validate
(
Feedback
feedback
)
{
String
content
=
feedback
.
getContent
();
String
content
=
feedback
.
getContent
();
...
@@ -84,14 +87,14 @@ public class WxFeedbackController {
...
@@ -84,14 +87,14 @@ public class WxFeedbackController {
return
error
;
return
error
;
}
}
User
user
=
userService
.
findById
(
userId
);
User
user
=
dtsUserDao
.
findById
(
userId
);
String
username
=
user
.
getUsername
();
String
username
=
user
.
getUsername
();
feedback
.
setId
(
null
);
feedback
.
setId
(
null
);
feedback
.
setUserId
(
userId
);
feedback
.
setUserId
(
userId
);
feedback
.
setUsername
(
username
);
feedback
.
setUsername
(
username
);
// 状态默认是0,1表示状态已发生变化
// 状态默认是0,1表示状态已发生变化
feedback
.
setStatus
(
1
);
feedback
.
setStatus
(
1
);
feedbackService
.
add
(
feedback
);
dtsFeedbackDao
.
add
(
feedback
);
logger
.
info
(
"【请求结束】添加意见反馈,响应结果:{}"
,
JSONObject
.
toJSONString
(
feedback
));
logger
.
info
(
"【请求结束】添加意见反馈,响应结果:{}"
,
JSONObject
.
toJSONString
(
feedback
));
return
ResponseUtil
.
ok
();
return
ResponseUtil
.
ok
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFootprintController.java
View file @
50618e8e
...
@@ -5,6 +5,8 @@ import com.github.pagehelper.PageInfo;
...
@@ -5,6 +5,8 @@ import com.github.pagehelper.PageInfo;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.JacksonUtil
;
import
com.wwdz.ch.core.util.JacksonUtil
;
import
com.wwdz.ch.core.util.ResponseUtil
;
import
com.wwdz.ch.core.util.ResponseUtil
;
import
com.wwdz.ch.db.dao.ItemDao
;
import
com.wwdz.ch.db.dao.dts.DtsFootprintDao
;
import
com.wwdz.ch.db.domain.Footprint
;
import
com.wwdz.ch.db.domain.Footprint
;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.db.domain.Item
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
...
@@ -29,9 +31,11 @@ public class WxFootprintController {
...
@@ -29,9 +31,11 @@ public class WxFootprintController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxFootprintController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxFootprintController
.
class
);
@Autowired
@Autowired
private
DtsFootprintDao
footprintService
;
private
DtsFootprintDao
dtsFootprintDao
;
@Autowired
@Autowired
private
ItemOldDao
itemService
;
private
ItemDao
itemDao
;
@Autowired
@Autowired
private
FootPrintService
footPrintService
;
private
FootPrintService
footPrintService
;
...
@@ -60,7 +64,7 @@ public class WxFootprintController {
...
@@ -60,7 +64,7 @@ public class WxFootprintController {
if
(
footprintId
==
null
)
{
if
(
footprintId
==
null
)
{
return
ResponseUtil
.
badArgument
();
return
ResponseUtil
.
badArgument
();
}
}
Footprint
footprint
=
footprintService
.
findById
(
footprintId
);
Footprint
footprint
=
dtsFootprintDao
.
findById
(
footprintId
);
if
(
footprint
==
null
)
{
if
(
footprint
==
null
)
{
return
ResponseUtil
.
badArgumentValue
();
return
ResponseUtil
.
badArgumentValue
();
...
@@ -69,7 +73,7 @@ public class WxFootprintController {
...
@@ -69,7 +73,7 @@ public class WxFootprintController {
return
ResponseUtil
.
badArgumentValue
();
return
ResponseUtil
.
badArgumentValue
();
}
}
footprintService
.
deleteById
(
footprintId
);
dtsFootprintDao
.
deleteById
(
footprintId
);
logger
.
info
(
"【请求结束】删除用户足迹成功!"
);
logger
.
info
(
"【请求结束】删除用户足迹成功!"
);
return
ResponseUtil
.
ok
();
return
ResponseUtil
.
ok
();
...
@@ -94,7 +98,7 @@ public class WxFootprintController {
...
@@ -94,7 +98,7 @@ public class WxFootprintController {
return
ResponseUtil
.
unlogin
();
return
ResponseUtil
.
unlogin
();
}
}
List
<
Footprint
>
footprintList
=
footprintService
.
queryByAddTime
(
userId
,
page
,
size
);
List
<
Footprint
>
footprintList
=
dtsFootprintDao
.
queryByAddTime
(
userId
,
page
,
size
);
long
count
=
PageInfo
.
of
(
footprintList
).
getTotal
();
long
count
=
PageInfo
.
of
(
footprintList
).
getTotal
();
int
totalPages
=
(
int
)
Math
.
ceil
((
double
)
count
/
size
);
int
totalPages
=
(
int
)
Math
.
ceil
((
double
)
count
/
size
);
...
@@ -105,7 +109,7 @@ public class WxFootprintController {
...
@@ -105,7 +109,7 @@ public class WxFootprintController {
c
.
put
(
"coinsId"
,
footprint
.
getItemId
());
c
.
put
(
"coinsId"
,
footprint
.
getItemId
());
c
.
put
(
"addTime"
,
footprint
.
getAddTime
());
c
.
put
(
"addTime"
,
footprint
.
getAddTime
());
Item
item
=
item
Service
.
findById
(
footprint
.
getItemId
().
longValue
());
Item
item
=
item
Dao
.
findById
(
footprint
.
getItemId
().
longValue
());
c
.
put
(
"name"
,
item
.
getName
());
c
.
put
(
"name"
,
item
.
getName
());
c
.
put
(
"retailPrice"
,
item
.
getPrice
());
c
.
put
(
"retailPrice"
,
item
.
getPrice
());
c
.
put
(
"image"
,
item
.
getImages
().
split
(
";"
)[
0
]);
c
.
put
(
"image"
,
item
.
getImages
().
split
(
";"
)[
0
]);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxGoodsController.java
View file @
50618e8e
...
@@ -9,6 +9,7 @@ import com.wwdz.ch.core.util.ResponseUtil;
...
@@ -9,6 +9,7 @@ import com.wwdz.ch.core.util.ResponseUtil;
import
com.wwdz.ch.core.util.ZincUtil
;
import
com.wwdz.ch.core.util.ZincUtil
;
import
com.wwdz.ch.core.validator.Order
;
import
com.wwdz.ch.core.validator.Order
;
import
com.wwdz.ch.core.validator.Sort
;
import
com.wwdz.ch.core.validator.Sort
;
import
com.wwdz.ch.db.dao.ItemDao
;
import
com.wwdz.ch.db.dao.dts.*
;
import
com.wwdz.ch.db.dao.dts.*
;
import
com.wwdz.ch.db.impl.CategoryDaoImpl
;
import
com.wwdz.ch.db.impl.CategoryDaoImpl
;
import
com.wwdz.ch.db.domain.Category
;
import
com.wwdz.ch.db.domain.Category
;
...
@@ -44,7 +45,7 @@ public class WxGoodsController {
...
@@ -44,7 +45,7 @@ public class WxGoodsController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxGoodsController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxGoodsController
.
class
);
@Autowired
@Autowired
private
Item
OldDao
itemService
;
private
Item
Dao
itemDao
;
@Autowired
@Autowired
private
DtsGoodsProductDao
productService
;
private
DtsGoodsProductDao
productService
;
...
@@ -99,7 +100,7 @@ public class WxGoodsController {
...
@@ -99,7 +100,7 @@ public class WxGoodsController {
logger
.
info
(
"【请求开始】商品详情,请求参数,userId:{},id:{}"
,
userId
,
id
);
logger
.
info
(
"【请求开始】商品详情,请求参数,userId:{},id:{}"
,
userId
,
id
);
// 商品信息
// 商品信息
Item
item
=
item
Service
.
findById
(
id
);
Item
item
=
item
Dao
.
findById
(
id
);
// 用户收藏
// 用户收藏
int
userHasCollect
=
0
;
int
userHasCollect
=
0
;
...
@@ -306,7 +307,7 @@ public class WxGoodsController {
...
@@ -306,7 +307,7 @@ public class WxGoodsController {
@GetMapping
(
"count"
)
@GetMapping
(
"count"
)
public
Object
count
()
{
public
Object
count
()
{
logger
.
info
(
"【请求开始】在售的商品总数..."
);
logger
.
info
(
"【请求开始】在售的商品总数..."
);
Integer
goodsCount
=
item
Service
.
count
();
Integer
goodsCount
=
item
Dao
.
count
();
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"goodsCount"
,
goodsCount
);
data
.
put
(
"goodsCount"
,
goodsCount
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxHomeController.java
View file @
50618e8e
...
@@ -12,6 +12,7 @@ import java.util.concurrent.TimeUnit;
...
@@ -12,6 +12,7 @@ import java.util.concurrent.TimeUnit;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
com.wwdz.ch.db.dao.ItemDao
;
import
com.wwdz.ch.db.impl.CategoryDaoImpl
;
import
com.wwdz.ch.db.impl.CategoryDaoImpl
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
com.wwdz.ch.wx.service.HomeCacheManager
;
import
com.wwdz.ch.wx.service.HomeCacheManager
;
...
@@ -36,7 +37,7 @@ public class WxHomeController {
...
@@ -36,7 +37,7 @@ public class WxHomeController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxHomeController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxHomeController
.
class
);
@Autowired
@Autowired
private
Item
OldDao
goodsService
;
private
Item
Dao
itemDao
;
@Autowired
@Autowired
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxSearchController.java
View file @
50618e8e
...
@@ -7,6 +7,8 @@ import java.util.Map;
...
@@ -7,6 +7,8 @@ import java.util.Map;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
com.wwdz.ch.db.dao.dts.DtsKeywordDao
;
import
com.wwdz.ch.db.dao.dts.DtsSearchHistoryDao
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -35,9 +37,10 @@ public class WxSearchController {
...
@@ -35,9 +37,10 @@ public class WxSearchController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxSearchController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxSearchController
.
class
);
@Autowired
@Autowired
private
DtsKeywordDao
keywordsService
;
private
DtsKeywordDao
dtsKeywordDao
;
@Autowired
@Autowired
private
DtsSearchHistoryDao
searchHistoryService
;
private
DtsSearchHistoryDao
dtsSearchHistoryDao
;
/**
/**
* 搜索页面信息
* 搜索页面信息
...
@@ -53,15 +56,15 @@ public class WxSearchController {
...
@@ -53,15 +56,15 @@ public class WxSearchController {
logger
.
info
(
"【请求开始】搜索页面信息展示,请求参数,userId:{}"
,
userId
);
logger
.
info
(
"【请求开始】搜索页面信息展示,请求参数,userId:{}"
,
userId
);
// 取出输入框默认的关键词
// 取出输入框默认的关键词
Keyword
defaultKeyword
=
keywordsService
.
queryDefault
();
Keyword
defaultKeyword
=
dtsKeywordDao
.
queryDefault
();
// 取出热闹关键词
// 取出热闹关键词
List
<
Keyword
>
hotKeywordList
=
keywordsService
.
queryHots
();
List
<
Keyword
>
hotKeywordList
=
dtsKeywordDao
.
queryHots
();
List
<
SearchHistory
>
historyList
=
null
;
List
<
SearchHistory
>
historyList
=
null
;
if
(
userId
!=
null
)
{
if
(
userId
!=
null
)
{
// 取出用户历史关键字
// 取出用户历史关键字
historyList
=
searchHistoryService
.
queryByUid
(
userId
);
historyList
=
dtsSearchHistoryDao
.
queryByUid
(
userId
);
}
else
{
}
else
{
historyList
=
new
ArrayList
<>(
0
);
historyList
=
new
ArrayList
<>(
0
);
}
}
...
@@ -89,7 +92,7 @@ public class WxSearchController {
...
@@ -89,7 +92,7 @@ public class WxSearchController {
@RequestParam
(
defaultValue
=
"10"
)
Integer
size
)
{
@RequestParam
(
defaultValue
=
"10"
)
Integer
size
)
{
logger
.
info
(
"【请求开始】关键字提醒,请求参数,keyword:{}"
,
keyword
);
logger
.
info
(
"【请求开始】关键字提醒,请求参数,keyword:{}"
,
keyword
);
List
<
Keyword
>
keywordsList
=
keywordsService
.
queryByKeyword
(
keyword
,
page
,
size
);
List
<
Keyword
>
keywordsList
=
dtsKeywordDao
.
queryByKeyword
(
keyword
,
page
,
size
);
String
[]
keys
=
new
String
[
keywordsList
.
size
()];
String
[]
keys
=
new
String
[
keywordsList
.
size
()];
int
index
=
0
;
int
index
=
0
;
for
(
Keyword
key
:
keywordsList
)
{
for
(
Keyword
key
:
keywordsList
)
{
...
@@ -114,7 +117,7 @@ public class WxSearchController {
...
@@ -114,7 +117,7 @@ public class WxSearchController {
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
return
ResponseUtil
.
unlogin
();
return
ResponseUtil
.
unlogin
();
}
}
searchHistoryService
.
deleteByUid
(
userId
);
dtsSearchHistoryDao
.
deleteByUid
(
userId
);
logger
.
info
(
"【请求结束】清除用户搜索历史,响应结果:{}"
,
"成功"
);
logger
.
info
(
"【请求结束】清除用户搜索历史,响应结果:{}"
,
"成功"
);
return
ResponseUtil
.
ok
();
return
ResponseUtil
.
ok
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxStorageController.java
View file @
50618e8e
...
@@ -7,6 +7,7 @@ import java.util.concurrent.CountDownLatch;
...
@@ -7,6 +7,7 @@ import java.util.concurrent.CountDownLatch;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
com.wwdz.ch.db.dao.dts.DtsStorageDao
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -45,7 +46,7 @@ public class WxStorageController {
...
@@ -45,7 +46,7 @@ public class WxStorageController {
private
StorageService
storageService
;
private
StorageService
storageService
;
@Autowired
@Autowired
private
DtsStorageDao
D
tsStorageDao
;
private
DtsStorageDao
d
tsStorageDao
;
private
ExecutorService
threadPool
=
Executors
.
newFixedThreadPool
(
20
);
private
ExecutorService
threadPool
=
Executors
.
newFixedThreadPool
(
20
);
...
@@ -59,7 +60,7 @@ public class WxStorageController {
...
@@ -59,7 +60,7 @@ public class WxStorageController {
do
{
do
{
key
=
CharUtil
.
getRandomString
(
20
)
+
suffix
;
key
=
CharUtil
.
getRandomString
(
20
)
+
suffix
;
storageInfo
=
D
tsStorageDao
.
findByKey
(
key
);
storageInfo
=
d
tsStorageDao
.
findByKey
(
key
);
}
while
(
storageInfo
!=
null
);
}
while
(
storageInfo
!=
null
);
return
key
;
return
key
;
...
@@ -138,7 +139,7 @@ public class WxStorageController {
...
@@ -138,7 +139,7 @@ public class WxStorageController {
public
ResponseEntity
<
Resource
>
fetch
(
@PathVariable
String
key
)
{
public
ResponseEntity
<
Resource
>
fetch
(
@PathVariable
String
key
)
{
// logger.info("【请求开始】访问存储对象,请求参数,key:{}", key);
// logger.info("【请求开始】访问存储对象,请求参数,key:{}", key);
Storage
DtsStorage
=
D
tsStorageDao
.
findByKey
(
key
);
Storage
DtsStorage
=
d
tsStorageDao
.
findByKey
(
key
);
if
(
key
==
null
)
{
if
(
key
==
null
)
{
return
ResponseEntity
.
notFound
().
build
();
return
ResponseEntity
.
notFound
().
build
();
}
}
...
@@ -166,7 +167,7 @@ public class WxStorageController {
...
@@ -166,7 +167,7 @@ public class WxStorageController {
@GetMapping
(
"/download/{key:.+}"
)
@GetMapping
(
"/download/{key:.+}"
)
public
ResponseEntity
<
Resource
>
download
(
@PathVariable
String
key
)
{
public
ResponseEntity
<
Resource
>
download
(
@PathVariable
String
key
)
{
// logger.info("【请求开始】访问存储对象,请求参数,key:{}", key);
// logger.info("【请求开始】访问存储对象,请求参数,key:{}", key);
Storage
DtsStorage
=
D
tsStorageDao
.
findByKey
(
key
);
Storage
DtsStorage
=
d
tsStorageDao
.
findByKey
(
key
);
if
(
key
==
null
)
{
if
(
key
==
null
)
{
return
ResponseEntity
.
notFound
().
build
();
return
ResponseEntity
.
notFound
().
build
();
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserFormId.java
View file @
50618e8e
...
@@ -4,6 +4,8 @@ import java.time.LocalDateTime;
...
@@ -4,6 +4,8 @@ import java.time.LocalDateTime;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
com.wwdz.ch.db.dao.dts.DtsUserDao
;
import
com.wwdz.ch.db.dao.dts.DtsUserFormIdDao
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
com.wwdz.ch.wx.annotation.LoginUser
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -25,10 +27,10 @@ public class WxUserFormId {
...
@@ -25,10 +27,10 @@ public class WxUserFormId {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxUserFormId
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxUserFormId
.
class
);
@Autowired
@Autowired
private
DtsUserDao
userService
;
private
DtsUserDao
dtsUserDao
;
@Autowired
@Autowired
private
DtsUserFormIdDao
formIdService
;
private
DtsUserFormIdDao
dtsUserFormIdDao
;
/**
/**
* 创建微信访问fromID
* 创建微信访问fromID
...
@@ -46,14 +48,14 @@ public class WxUserFormId {
...
@@ -46,14 +48,14 @@ public class WxUserFormId {
return
ResponseUtil
.
unlogin
();
return
ResponseUtil
.
unlogin
();
}
}
User
user
=
userService
.
findById
(
userId
);
User
user
=
dtsUserDao
.
findById
(
userId
);
UserFormidObsolete
userFormid
=
new
UserFormidObsolete
();
UserFormidObsolete
userFormid
=
new
UserFormidObsolete
();
userFormid
.
setOpenid
(
user
.
getWeixinOpenid
());
userFormid
.
setOpenid
(
user
.
getWeixinOpenid
());
userFormid
.
setFormid
(
formId
);
userFormid
.
setFormid
(
formId
);
userFormid
.
setIsprepay
(
false
);
userFormid
.
setIsprepay
(
false
);
userFormid
.
setUseamount
(
1
);
userFormid
.
setUseamount
(
1
);
userFormid
.
setExpireTime
(
LocalDateTime
.
now
().
plusDays
(
7
));
userFormid
.
setExpireTime
(
LocalDateTime
.
now
().
plusDays
(
7
));
formIdService
.
addUserFormid
(
userFormid
);
dtsUserFormIdDao
.
addUserFormid
(
userFormid
);
logger
.
info
(
"【请求结束】创建微信访问fromID,响应结果:{}"
,
JSONObject
.
toJSONString
(
userFormid
));
logger
.
info
(
"【请求结束】创建微信访问fromID,响应结果:{}"
,
JSONObject
.
toJSONString
(
userFormid
));
return
ResponseUtil
.
ok
();
return
ResponseUtil
.
ok
();
...
...
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