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
18ea215a
Commit
18ea215a
authored
Aug 25, 2023
by
muhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 小程序去除kl_data
parent
776c8d18
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
138 additions
and
367 deletions
+138
-367
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+25
-27
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
...rc/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
+11
-25
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
...c/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
+52
-150
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
+36
-128
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
+13
-36
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
18ea215a
...
@@ -261,7 +261,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -261,7 +261,7 @@ public class FavoritesServiceImpl implements FavoritesService {
// 设置是否收藏或是否是自己发布的
// 设置是否收藏或是否是自己发布的
vo
.
setIsCollected
(
0
);
vo
.
setIsCollected
(
0
);
vo
.
setIsMine
(
0
);
vo
.
setIsMine
(
0
);
if
(
dto
.
getUserId
()
!=
0L
)
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
dto
.
getUserId
()
!=
0L
)
{
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
relation
.
getItemId
())
?
1
:
0
);
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
relation
.
getItemId
())
?
1
:
0
);
vo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
vo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
item
.
getId
())
?
1
:
0
);
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
18ea215a
...
@@ -37,7 +37,6 @@ import java.io.ByteArrayInputStream;
...
@@ -37,7 +37,6 @@ import java.io.ByteArrayInputStream;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.lang.System
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -70,7 +69,6 @@ public class ItemServiceImpl implements ItemService {
...
@@ -70,7 +69,6 @@ public class ItemServiceImpl implements ItemService {
public
Result
nameList
(
ItemRequestDto
dto
)
{
public
Result
nameList
(
ItemRequestDto
dto
)
{
try
{
try
{
List
<
String
>
names
=
new
ArrayList
<>();
List
<
String
>
names
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
dto
.
getName
()))
{
EsSearchRequestDto
esSearchRequestDto
=
new
EsSearchRequestDto
();
EsSearchRequestDto
esSearchRequestDto
=
new
EsSearchRequestDto
();
esSearchRequestDto
.
setContent
(
dto
.
getName
());
esSearchRequestDto
.
setContent
(
dto
.
getName
());
esSearchRequestDto
.
setSize
(
16
);
esSearchRequestDto
.
setSize
(
16
);
...
@@ -94,7 +92,6 @@ public class ItemServiceImpl implements ItemService {
...
@@ -94,7 +92,6 @@ public class ItemServiceImpl implements ItemService {
}
}
}
}
}
}
}
return
Result
.
success
(
names
);
return
Result
.
success
(
names
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询藏品名称联想失败"
,
e
);
logger
.
error
(
"查询藏品名称联想失败"
,
e
);
...
@@ -141,7 +138,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -141,7 +138,7 @@ public class ItemServiceImpl implements ItemService {
// 设置是否收藏和是否是自己发布的
// 设置是否收藏和是否是自己发布的
vo
.
setIsCollected
(
0
);
vo
.
setIsCollected
(
0
);
vo
.
setIsMine
(
0
);
vo
.
setIsMine
(
0
);
if
(!
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
es
.
getId
())
?
1
:
0
);
vo
.
setIsCollected
(
favoritesItemsRelationDao
.
isCollected
(
dto
.
getUserId
(),
es
.
getId
())
?
1
:
0
);
vo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
es
.
getId
())
?
1
:
0
);
vo
.
setIsMine
(
userItemsRelationDao
.
isExisted
(
dto
.
getUserId
(),
es
.
getId
())
?
1
:
0
);
}
}
...
@@ -223,7 +220,8 @@ public class ItemServiceImpl implements ItemService {
...
@@ -223,7 +220,8 @@ public class ItemServiceImpl implements ItemService {
try
{
try
{
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
if
(
Objects
.
isNull
(
item
))
{
if
(
Objects
.
isNull
(
item
))
{
if
(!
dto
.
getUserId
().
equals
(
0L
))
{
//TODO 足迹如果删除如何处理
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
// 如果当前用户已收藏该藏品,则删除收藏关联
// 如果当前用户已收藏该藏品,则删除收藏关联
favoritesItemsRelationDao
.
deleteByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
favoritesItemsRelationDao
.
deleteByUserIdItemId
(
dto
.
getUserId
(),
dto
.
getId
());
}
}
...
@@ -263,7 +261,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -263,7 +261,7 @@ public class ItemServiceImpl implements ItemService {
// 设置是否收藏或是否是自己发布的
// 设置是否收藏或是否是自己发布的
itemResponseVo
.
setIsCollected
(
0
);
itemResponseVo
.
setIsCollected
(
0
);
itemResponseVo
.
setIsMine
(
0
);
itemResponseVo
.
setIsMine
(
0
);
if
(!
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
nonNull
(
dto
.
getUserId
())
&&
!
dto
.
getUserId
().
equals
(
0L
))
{
FavoritesItemsRelation
favoritesItemsRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
item
.
getId
());
FavoritesItemsRelation
favoritesItemsRelation
=
favoritesItemsRelationDao
.
selectByUserIdItemId
(
dto
.
getUserId
(),
item
.
getId
());
if
(
Objects
.
nonNull
(
favoritesItemsRelation
))
{
if
(
Objects
.
nonNull
(
favoritesItemsRelation
))
{
itemResponseVo
.
setIsCollected
(
1
);
itemResponseVo
.
setIsCollected
(
1
);
...
@@ -311,7 +309,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -311,7 +309,7 @@ public class ItemServiceImpl implements ItemService {
@Override
@Override
public
Result
collect
(
ItemRequestDto
dto
)
{
public
Result
collect
(
ItemRequestDto
dto
)
{
try
{
try
{
if
(
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"您尚未登录,请先登录"
);
return
Result
.
failed
(
"您尚未登录,请先登录"
);
}
}
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
...
@@ -353,7 +351,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -353,7 +351,7 @@ public class ItemServiceImpl implements ItemService {
@Override
@Override
public
Result
cancel
(
ItemRequestDto
dto
)
{
public
Result
cancel
(
ItemRequestDto
dto
)
{
try
{
try
{
if
(
dto
.
getUserId
().
equals
(
0L
))
{
if
(
Objects
.
isNull
(
dto
.
getUserId
())
||
dto
.
getUserId
().
equals
(
0L
))
{
return
Result
.
failed
(
"您尚未登录,请先登录"
);
return
Result
.
failed
(
"您尚未登录,请先登录"
);
}
}
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
Item
item
=
itemDao
.
findById
(
dto
.
getId
());
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxCategoryController.java
View file @
18ea215a
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.CategoryRequestDto
;
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.wwdz.ch.wx.service.CategoryService
;
import
com.xxdxxs.utils.JsonUtils
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
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,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -15,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Objects
;
@RestController
@RestController
@RequestMapping
(
"/wx/category"
)
@RequestMapping
(
"/wx/category"
)
public
class
WxCategoryController
{
public
class
WxCategoryController
{
...
@@ -25,41 +25,27 @@ public class WxCategoryController {
...
@@ -25,41 +25,27 @@ public class WxCategoryController {
@ApiOperation
(
value
=
"分类分页"
)
@ApiOperation
(
value
=
"分类分页"
)
@PostMapping
(
value
=
"/top"
)
@PostMapping
(
value
=
"/top"
)
public
Result
top
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
top
(
@RequestBody
CategoryRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】查询分类列表,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】查询分类列表,请求参数,kl_data:{}"
,
json
);
if
(
Objects
.
isNull
(
dto
.
getLevel
()))
{
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
(
"分类级别不能为空"
);
return
Result
.
failed
(
"分类级别不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
page
))
{
if
(
Objects
.
isNull
(
dto
.
getPage
()
))
{
return
Result
.
failed
(
"当前页不能为空"
);
return
Result
.
failed
(
"当前页不能为空"
);
}
}
if
(
StringUtils
.
isBlank
(
size
))
{
if
(
Objects
.
isNull
(
dto
.
getSize
()
))
{
return
Result
.
failed
(
"页面大小不能为空"
);
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
);
return
categoryService
.
top
(
dto
);
}
}
@ApiOperation
(
value
=
"子分类"
)
@ApiOperation
(
value
=
"子分类"
)
@PostMapping
(
value
=
"/child"
)
@PostMapping
(
value
=
"/child"
)
public
Result
child
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Result
child
(
@RequestBody
CategoryRequestDto
dto
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】查询子分类列表,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】查询子分类列表,请求参数,kl_data:{}"
,
json
);
if
(
Objects
.
isNull
(
dto
.
getId
()))
{
String
id
=
JsonUtils
.
getValueByPath
(
json
,
"id"
);
if
(
StringUtils
.
isBlank
(
id
))
{
return
Result
.
failed
(
"分类id不能为空"
);
return
Result
.
failed
(
"分类id不能为空"
);
}
}
CategoryRequestDto
dto
=
new
CategoryRequestDto
();
dto
.
setId
(
Integer
.
parseInt
(
id
));
return
categoryService
.
child
(
dto
);
return
categoryService
.
child
(
dto
);
}
}
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxFavoritesController.java
View file @
18ea215a
This diff is collapsed.
Click to expand it.
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
View file @
18ea215a
This diff is collapsed.
Click to expand it.
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxUserController.java
View file @
18ea215a
...
@@ -4,10 +4,8 @@ package com.wwdz.ch.wx.web;
...
@@ -4,10 +4,8 @@ package com.wwdz.ch.wx.web;
import
com.alibaba.fastjson.JSON
;
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.UserRequestDto
;
import
com.wwdz.ch.wx.entity.request.UserRequestDto
;
import
com.wwdz.ch.wx.service.UserService
;
import
com.wwdz.ch.wx.service.UserService
;
import
com.xxdxxs.utils.JsonUtils
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -36,64 +34,43 @@ public class WxUserController {
...
@@ -36,64 +34,43 @@ public class WxUserController {
@ApiOperation
(
value
=
"微信登录"
)
@ApiOperation
(
value
=
"微信登录"
)
@PostMapping
(
"/loginByWx"
)
@PostMapping
(
"/loginByWx"
)
public
Result
loginByWx
(
@RequestBody
KlDataRequestDto
klDataRequestDto
,
HttpServletRequest
request
)
{
public
Result
loginByWx
(
@RequestBody
UserRequestDto
dto
,
HttpServletRequest
request
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】微信登录,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】微信登录,请求参数,kl_data:{}"
,
json
);
if
(
StringUtils
.
isBlank
(
dto
.
getCode
()))
{
String
code
=
JsonUtils
.
getValueByPath
(
json
,
"code"
);
if
(
StringUtils
.
isBlank
(
code
))
{
return
Result
.
failed
(
"授权码不能为空"
);
return
Result
.
failed
(
"授权码不能为空"
);
}
}
if
(
!
json
.
contains
(
"type"
))
{
if
(
Objects
.
isNull
(
dto
.
getType
()
))
{
return
Result
.
failed
(
"版本类型不能为空"
);
return
Result
.
failed
(
"版本类型不能为空"
);
}
}
Integer
type
=
Integer
.
parseInt
(
JsonUtils
.
getValueByPath
(
json
,
"type"
));
if
(
dto
.
getType
()
==
2
)
{
if
(
StringUtils
.
isBlank
(
dto
.
getEncryptedData
())
||
StringUtils
.
isBlank
(
dto
.
getIv
()))
{
UserRequestDto
dto
=
new
UserRequestDto
();
dto
.
setCode
(
code
);
dto
.
setType
(
type
);
if
(
type
==
2
)
{
if
(!
json
.
contains
(
"encryptedData"
)
||
!
json
.
contains
(
"iv"
))
{
return
Result
.
failed
(
"encryptedData或iv不能为空"
);
return
Result
.
failed
(
"encryptedData或iv不能为空"
);
}
}
dto
.
setEncryptedData
(
JsonUtils
.
getValueByPath
(
json
,
"encryptedData"
));
dto
.
setIv
(
JsonUtils
.
getValueByPath
(
json
,
"iv"
));
}
}
return
userService
.
loginByWx
(
dto
,
request
);
return
userService
.
loginByWx
(
dto
,
request
);
}
}
@ApiOperation
(
value
=
"登录手机验证码"
)
@ApiOperation
(
value
=
"登录手机验证码"
)
@PostMapping
(
"/loginRegCaptcha"
)
@PostMapping
(
"/loginRegCaptcha"
)
public
Object
registerCaptcha
(
@RequestBody
KlDataRequestDto
klDataRequestDto
)
{
public
Object
registerCaptcha
(
@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
.
LOGIN
.
getCode
());
dto
.
setSmsType
(
CacheCodeConstants
.
SmsTypeEnum
.
LOGIN
.
getCode
());
return
userService
.
regCaptcha
(
dto
);
return
userService
.
regCaptcha
(
dto
);
}
}
@ApiOperation
(
value
=
"手机验证码登录"
)
@ApiOperation
(
value
=
"手机验证码登录"
)
@PostMapping
(
"/loginByMobile"
)
@PostMapping
(
"/loginByMobile"
)
public
Result
loginByMobile
(
@RequestBody
KlDataRequestDto
klDataRequestDto
,
HttpServletRequest
request
)
{
public
Result
loginByMobile
(
@RequestBody
UserRequestDto
dto
,
HttpServletRequest
request
)
{
String
json
=
klDataRequestDto
.
getKl_data
();
logger
.
info
(
"【请求开始】手机号登录,请求参数,kl_data:{}"
,
JSON
.
toJSONString
(
dto
));
logger
.
info
(
"【请求开始】手机号登录,请求参数,kl_data:{}"
,
json
);
if
(
StringUtils
.
isBlank
(
dto
.
getMobile
()))
{
String
mobile
=
JsonUtils
.
getValueByPath
(
json
,
"mobile"
);
String
smsCode
=
JsonUtils
.
getValueByPath
(
json
,
"smsCode"
);
if
(
StringUtils
.
isBlank
(
mobile
))
{
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
.
setMobile
(
mobile
);
dto
.
setSmsCode
(
smsCode
);
return
userService
.
loginByMobile
(
dto
,
request
);
return
userService
.
loginByMobile
(
dto
,
request
);
}
}
...
...
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