Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
f14b0564
提交
f14b0564
authored
2月 27, 2021
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
结算金额提交
上级
4a692207
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
44 行增加
和
14 行删除
+44
-14
TbCfHomePageEntityController.java
...afrishop_v3/controllers/TbCfHomePageEntityController.java
+25
-13
TbCfClassification.java
...va/com/example/afrishop_v3/models/TbCfClassification.java
+17
-1
TbCfClassificationRepository.java
.../afrishop_v3/repository/TbCfClassificationRepository.java
+2
-0
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/TbCfHomePageEntityController.java
浏览文件 @
f14b0564
...
...
@@ -48,14 +48,14 @@ public class TbCfHomePageEntityController extends Controller {
}
@GetMapping
(
"/store"
)
public
Result
getStores
(
@RequestParam
(
required
=
false
,
defaultValue
=
"0"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"10"
,
required
=
false
)
Integer
pageSize
)
{
public
Result
getStores
(
@RequestParam
(
required
=
false
,
defaultValue
=
"0"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"10"
,
required
=
false
)
Integer
pageSize
)
{
return
new
Result
<>(
storeRepository
.
findAll
(
PageRequest
.
of
(
pageNum
,
pageSize
)));
return
new
Result
<>(
storeRepository
.
findAll
(
PageRequest
.
of
(
pageNum
,
pageSize
)));
}
//Fetch recommended items
@GetMapping
(
"home/listPosts/recommend"
)
public
List
<
Post
>
postList2
(
@RequestParam
(
value
=
"userId"
,
required
=
false
)
String
id
,
@RequestParam
(
value
=
"pageNo"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
)
Integer
pageSize
)
{
public
List
<
Post
>
postList2
(
@RequestParam
(
value
=
"userId"
,
required
=
false
)
String
id
,
@RequestParam
(
value
=
"pageNo"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
)
Integer
pageSize
)
{
//Optional<TbCfUserInfo> byId = userRepository.findById(id);
//if( !byId.isPresent() ) return new ArrayList<>();
...
...
@@ -63,7 +63,6 @@ public class TbCfHomePageEntityController extends Controller {
}
private
Visit
visitPost
(
Post
post
)
{
Visit
visit
=
new
Visit
();
visit
.
setPost
(
post
);
...
...
@@ -86,7 +85,7 @@ public class TbCfHomePageEntityController extends Controller {
//List users who are eligible to receive firebase cloud messages to their devices
@GetMapping
(
"/home/clientWithFcm"
)
public
Result
getClientList
(
@RequestParam
(
value
=
"pageNo"
,
required
=
false
,
defaultValue
=
"20"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
required
=
false
,
defaultValue
=
"20"
)
Integer
pageSize
)
{
public
Result
getClientList
(
@RequestParam
(
value
=
"pageNo"
,
required
=
false
,
defaultValue
=
"20"
)
Integer
pageNo
,
@RequestParam
(
value
=
"pageSize"
,
required
=
false
,
defaultValue
=
"20"
)
Integer
pageSize
)
{
List
<
TbCfUserInfo
>
allByFcmIsNotNull
=
userRepository
.
findAllByFcmIsNotNullOrderByLastLoginTimeDesc
(
PageRequest
.
of
(
pageNo
,
pageSize
));
//Map list to Small map to minimize amount of json serialized information
return
new
Result
<>(
allByFcmIsNotNull
.
stream
().
map
(
TbCfUserInfo:
:
smallMap
).
collect
(
Collectors
.
toList
()));
...
...
@@ -94,20 +93,21 @@ public class TbCfHomePageEntityController extends Controller {
//Send notification to the user by his code
@GetMapping
(
"/home/sendNotification/byCode/{code}"
)
public
Result
sendFcm
(
@PathVariable
(
"code"
)
String
id
,
@RequestParam
(
"content"
)
String
content
,
@RequestParam
(
"title"
)
String
title
)
{
public
Result
sendFcm
(
@PathVariable
(
"code"
)
String
id
,
@RequestParam
(
"content"
)
String
content
,
@RequestParam
(
"title"
)
String
title
)
{
Optional
<
TbCfUserInfo
>
byId
=
userRepository
.
findByCode
(
id
);
if
(
byId
.
isPresent
()
&&
byId
.
get
().
hasFcm
()
)
{
if
(
byId
.
isPresent
()
&&
byId
.
get
().
hasFcm
())
{
TbCfUserInfo
userInfo
=
byId
.
get
();
sendNotification
(
userInfo
.
getFcm
(),
title
,
content
);
sendNotification
(
userInfo
.
getFcm
(),
title
,
content
);
return
new
Result
();
}
return
new
Result
(
ResultCodeEnum
.
SUCCESS
.
getCode
(),
"No firebase messaging token found"
);
return
new
Result
(
ResultCodeEnum
.
SUCCESS
.
getCode
(),
"No firebase messaging token found"
);
}
@GetMapping
(
"/home/middleColumn"
)
public
Result
getMiddleColumn
(
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"4"
)
Integer
limit
){
public
Result
getMiddleColumn
(
@RequestParam
(
value
=
"limit"
,
defaultValue
=
"4"
)
Integer
limit
,
@RequestParam
(
value
=
"types"
,
defaultValue
=
"0"
)
Integer
types
)
{
Result
result
=
new
Result
<>();
try
{
List
<
TbCfSort
>
moduleList
=
sortRepository
.
findAll
(
Sort
.
by
(
Sort
.
Order
.
asc
(
"sort"
)));
...
...
@@ -119,13 +119,25 @@ public class TbCfHomePageEntityController extends Controller {
//分类导航栏
if
(
"1"
.
equals
(
type
))
{
/*moduleMap.put("class_title", getTitleImage(1));*/
List
<
TbCfClassification
>
classificationList
=
classificationRepository
.
findAll
(
Sort
.
by
(
Sort
.
Order
.
asc
(
"sort"
)));
// List<TbCfClassification> classificationList = classificationRepository.findAll(Sort.by(Sort.Order.asc("sort")));
List
<
TbCfClassification
>
classificationList
;
if
(
types
==
1
)
{
classificationList
=
classificationRepository
.
findAllByType
(
1
,
Sort
.
by
(
Sort
.
Order
.
asc
(
"sort"
)));
classificationList
.
forEach
(
c
->
{
String
[]
ids
=
c
.
getCategoryId
().
split
(
","
);
int
length
=
ids
.
length
;
c
.
setNum
(
length
);
c
.
setCategoryId
(
ids
[
length
-
1
]);
});
}
else
{
classificationList
=
classificationRepository
.
findAllByType
(
0
,
Sort
.
by
(
Sort
.
Order
.
asc
(
"sort"
)));
}
moduleMap
.
put
(
"classificationList"
,
classificationList
);
}
//爬虫品牌
if
(
"2"
.
equals
(
type
))
{
moduleMap
.
put
(
"store_title"
,
getTitleImage
(
2
));
List
<
TbCfStore
>
storeStationList
=
storeRepository
.
findAll
(
PageRequest
.
of
(
0
,
limit
,
Sort
.
by
(
Sort
.
Order
.
desc
(
"enableFlag"
),
Sort
.
Order
.
desc
(
"storeCode"
)))).
toList
();
List
<
TbCfStore
>
storeStationList
=
storeRepository
.
findAll
(
PageRequest
.
of
(
0
,
limit
,
Sort
.
by
(
Sort
.
Order
.
desc
(
"enableFlag"
),
Sort
.
Order
.
desc
(
"storeCode"
)))).
toList
();
moduleMap
.
put
(
"storeStationList"
,
storeStationList
);
}
//海报图
...
...
@@ -136,7 +148,7 @@ public class TbCfHomePageEntityController extends Controller {
}
list
.
add
(
moduleMap
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
TbCfColumn
>
hotColumnList
=
columnRepository
.
findAllByColumnType
(
4
);
map
.
put
(
"hot_title"
,
hotColumnList
);
list
.
add
(
map
);
...
...
src/main/java/com/example/afrishop_v3/models/TbCfClassification.java
浏览文件 @
f14b0564
package
com
.
example
.
afrishop_v3
.
models
;
import
lombok.Data
;
import
org.hibernate.annotations.Where
;
import
org.hibernate.sql.ast.Clause
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Transient
;
import
java.io.Serializable
;
/**
...
...
@@ -15,7 +18,8 @@ import java.io.Serializable;
*/
@Entity
@Data
public
class
TbCfClassification
{
@Where
(
clause
=
"is_show=1"
)
public
class
TbCfClassification
{
/**
* 首页分类导航ID
...
...
@@ -43,6 +47,13 @@ public class TbCfClassification{
*/
private
String
isShow
;
private
Integer
type
;
private
String
categoryId
;
@Transient
private
Integer
num
;
/**
* 设置:首页分类导航ID
*/
...
...
@@ -56,6 +67,7 @@ public class TbCfClassification{
public
String
getId
()
{
return
id
;
}
/**
* 设置:一级分类ID
*/
...
...
@@ -69,6 +81,7 @@ public class TbCfClassification{
public
String
getGoodtypeId
()
{
return
goodtypeId
;
}
/**
* 设置:标题
*/
...
...
@@ -82,6 +95,7 @@ public class TbCfClassification{
public
String
getClassTitle
()
{
return
classTitle
;
}
/**
* 设置:图片
*/
...
...
@@ -95,6 +109,7 @@ public class TbCfClassification{
public
String
getPicture
()
{
return
picture
;
}
/**
* 设置:排序
*/
...
...
@@ -108,6 +123,7 @@ public class TbCfClassification{
public
Integer
getSort
()
{
return
sort
;
}
/**
* 设置:是否展示
*/
...
...
src/main/java/com/example/afrishop_v3/repository/TbCfClassificationRepository.java
浏览文件 @
f14b0564
...
...
@@ -8,4 +8,6 @@ import java.util.List;
public
interface
TbCfClassificationRepository
extends
PagingAndSortingRepository
<
TbCfClassification
,
String
>
{
List
<
TbCfClassification
>
findAll
(
Sort
sort
);
List
<
TbCfClassification
>
findAllByType
(
Integer
type
,
Sort
sort
);
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论