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
10e3defb
Commit
10e3defb
authored
Dec 14, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
寄售单详情-返回类目名称
parent
2c7ca810
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
2 deletions
+43
-2
ch-admin-api/src/main/java/com/wwdz/ch/admin/entity/vo/CoinVo.java
...api/src/main/java/com/wwdz/ch/admin/entity/vo/CoinVo.java
+6
-1
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/ItemServiceImpl.java
...src/main/java/com/wwdz/ch/admin/impl/ItemServiceImpl.java
+5
-0
ch-core/src/main/java/com/wwdz/ch/core/util/CacheUtil.java
ch-core/src/main/java/com/wwdz/ch/core/util/CacheUtil.java
+32
-1
No files found.
ch-admin-api/src/main/java/com/wwdz/ch/admin/entity/vo/CoinVo.java
View file @
10e3defb
...
@@ -17,10 +17,15 @@ public class CoinVo implements Entity {
...
@@ -17,10 +17,15 @@ public class CoinVo implements Entity {
private
String
name
;
private
String
name
;
/**
/**
*
钱币
所属类目ID
*
商品
所属类目ID
*/
*/
private
Integer
cid
;
private
Integer
cid
;
/**
* 商品所属类目名称
*/
private
String
cidName
;
/**
/**
* 是否上架
* 是否上架
*/
*/
...
...
ch-admin-api/src/main/java/com/wwdz/ch/admin/impl/ItemServiceImpl.java
View file @
10e3defb
...
@@ -10,6 +10,7 @@ import com.wwdz.ch.core.consts.CommonEnum;
...
@@ -10,6 +10,7 @@ import com.wwdz.ch.core.consts.CommonEnum;
import
com.wwdz.ch.core.consts.ItemStateEnum
;
import
com.wwdz.ch.core.consts.ItemStateEnum
;
import
com.wwdz.ch.core.storage.QiniuStorage
;
import
com.wwdz.ch.core.storage.QiniuStorage
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.CacheUtil
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.core.util.StringUtil
;
import
com.wwdz.ch.core.util.StringUtil
;
import
com.wwdz.ch.db.bean.ItemOfEs
;
import
com.wwdz.ch.db.bean.ItemOfEs
;
...
@@ -63,6 +64,9 @@ public class ItemServiceImpl implements ItemService {
...
@@ -63,6 +64,9 @@ public class ItemServiceImpl implements ItemService {
@Autowired
@Autowired
RedisUtils
redisUtils
;
RedisUtils
redisUtils
;
@Autowired
CacheUtil
cacheUtil
;
@Override
@Override
public
List
<
CoinVo
>
findList
(
CoinRequestDto
coinRequestDto
)
{
public
List
<
CoinVo
>
findList
(
CoinRequestDto
coinRequestDto
)
{
try
{
try
{
...
@@ -94,6 +98,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -94,6 +98,7 @@ public class ItemServiceImpl implements ItemService {
}
}
}
}
CoinVo
itemVo
=
convertEntity
(
item
);
CoinVo
itemVo
=
convertEntity
(
item
);
itemVo
.
setCidName
(
cacheUtil
.
getCategoryNameByCode
(
item
.
getCid
()));
//用于展示商品归属的类目(页面级联下拉控件数据展示)
//用于展示商品归属的类目(页面级联下拉控件数据展示)
Integer
categoryId
=
item
.
getCid
();
Integer
categoryId
=
item
.
getCid
();
Category
category
=
categoryDao
.
findById
(
categoryId
);
Category
category
=
categoryDao
.
findById
(
categoryId
);
...
...
ch-core/src/main/java/com/wwdz/ch/core/util/CacheUtil.java
View file @
10e3defb
...
@@ -91,6 +91,16 @@ public class CacheUtil {
...
@@ -91,6 +91,16 @@ public class CacheUtil {
}
}
public
String
getCategoryNameByCode
(
int
key
)
{
try
{
return
categoryCache
.
get
(
key
).
get
(
3
,
TimeUnit
.
SECONDS
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
/**
* ai机器人缓存
* ai机器人缓存
*/
*/
...
@@ -126,6 +136,15 @@ public class CacheUtil {
...
@@ -126,6 +136,15 @@ public class CacheUtil {
.
buildAsync
(
k
->
getSystemUserList
(
k
));
.
buildAsync
(
k
->
getSystemUserList
(
k
));
/**
* 类目缓存
*/
public
AsyncLoadingCache
<
Integer
,
String
>
categoryCache
=
Caffeine
.
newBuilder
()
.
maximumSize
(
500
)
.
expireAfterWrite
(
30
,
TimeUnit
.
MINUTES
)
.
buildAsync
(
k
->
getCategoryName
(
k
));
/**
/**
* 查询小程序会员
* 查询小程序会员
*
*
...
@@ -184,7 +203,7 @@ public class CacheUtil {
...
@@ -184,7 +203,7 @@ public class CacheUtil {
/**
/**
* 查询
后台用户
* 查询
所有类目
*
*
* @return
* @return
*/
*/
...
@@ -203,4 +222,16 @@ public class CacheUtil {
...
@@ -203,4 +222,16 @@ public class CacheUtil {
return
map
.
get
(
pid
);
return
map
.
get
(
pid
);
}
}
/**
* 查询所有类目
*
* @return
*/
public
String
getCategoryName
(
int
id
)
{
Category
category
=
categoryDao
.
findById
(
id
);
return
category
.
getName
();
}
}
}
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