Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
08d8bf91
提交
08d8bf91
authored
1月 13, 2021
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品列表排序
上级
5e66ece8
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
45 行增加
和
20 行删除
+45
-20
ItemController.java
...a/com/example/afrishop_v3/controllers/ItemController.java
+2
-2
VisitController.java
.../com/example/afrishop_v3/controllers/VisitController.java
+5
-8
TbCfDescripiton.java
.../java/com/example/afrishop_v3/models/TbCfDescripiton.java
+10
-0
TbCfGoodstwotype.java
...java/com/example/afrishop_v3/models/TbCfGoodstwotype.java
+9
-0
TbCfDescripitonRepository.java
...ple/afrishop_v3/repository/TbCfDescripitonRepository.java
+1
-1
TbCfGoodstwotypeRepository.java
...le/afrishop_v3/repository/TbCfGoodstwotypeRepository.java
+1
-1
WebSecurityConfig.java
...a/com/example/afrishop_v3/security/WebSecurityConfig.java
+1
-1
HttpsUtil.java
src/main/java/com/example/afrishop_v3/util/HttpsUtil.java
+13
-4
Column2Controller.java
...xample/afrishop_v3/web/controllers/Column2Controller.java
+1
-1
ColumnController.java
...mple/afrishop_v3/website/controller/ColumnController.java
+2
-2
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/ItemController.java
浏览文件 @
08d8bf91
...
...
@@ -67,7 +67,7 @@ public class ItemController {
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Optional
<
TbCfGoodstype
>
byId
=
goodstypeRepository
.
findById
(
categoryId
);
List
<
TbCfGoodstwotype
>
allByGoodstypeId
=
goodstwotypeRepository
.
findAllByGoodstypeId
(
categoryId
);
List
<
TbCfGoodstwotype
>
allByGoodstypeId
=
goodstwotypeRepository
.
findAllByGoodstypeId
OrderBySort
(
categoryId
);
map
.
put
(
"category"
,
byId
.
orElse
(
null
));
map
.
put
(
"categoryTwoList"
,
allByGoodstypeId
);
return
new
Result
<>(
map
);
...
...
@@ -78,7 +78,7 @@ public class ItemController {
public
Result
queryDescriptionByCTwoId
(
@PathVariable
(
"categoryTwoId"
)
String
categoryTwoId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Optional
<
TbCfGoodstwotype
>
byId
=
goodstwotypeRepository
.
findById
(
categoryTwoId
);
List
<
TbCfDescripiton
>
allByGoodstwotypeId
=
descriptionRepository
.
findAllByGoodstwotypeId
(
categoryTwoId
);
List
<
TbCfDescripiton
>
allByGoodstwotypeId
=
descriptionRepository
.
findAllByGoodstwotypeId
OrderBySort
(
categoryTwoId
);
map
.
put
(
"category"
,
byId
.
orElse
(
null
));
map
.
put
(
"descriptionList"
,
allByGoodstwotypeId
);
return
new
Result
<>(
map
);
...
...
src/main/java/com/example/afrishop_v3/controllers/VisitController.java
浏览文件 @
08d8bf91
...
...
@@ -5,10 +5,7 @@ import com.example.afrishop_v3.models.TbCfVisit;
import
com.example.afrishop_v3.repository.TbCfVisitRepository
;
import
com.example.afrishop_v3.security.services.AuthenticationUser
;
import
com.example.afrishop_v3.util.IdUtil
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
...
...
@@ -24,16 +21,16 @@ public class VisitController extends Controller {
private
final
HttpServletRequest
request
;
//自动注入request
private
final
TbCfVisitRepository
visitRepository
;
private
final
AuthenticationUser
user
;
//
private final AuthenticationUser user;
public
VisitController
(
HttpServletRequest
request
,
TbCfVisitRepository
visitRepository
,
AuthenticationUser
user
)
{
public
VisitController
(
HttpServletRequest
request
,
TbCfVisitRepository
visitRepository
)
{
this
.
request
=
request
;
this
.
visitRepository
=
visitRepository
;
this
.
user
=
user
;
}
@
Ge
tMapping
(
"/getVisitCount"
)
@
Pos
tMapping
(
"/getVisitCount"
)
public
Result
getVisitCount
(
@RequestBody
TbCfVisit
visit
)
{
String
ip
=
getRealIpAddress
(
request
);
...
...
src/main/java/com/example/afrishop_v3/models/TbCfDescripiton.java
浏览文件 @
08d8bf91
...
...
@@ -63,6 +63,16 @@ public class TbCfDescripiton{
*/
private
String
twoType
;
private
Integer
sort
;
public
Integer
getSort
()
{
return
sort
;
}
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
public
String
getType
()
{
return
type
;
}
...
...
src/main/java/com/example/afrishop_v3/models/TbCfGoodstwotype.java
浏览文件 @
08d8bf91
...
...
@@ -44,10 +44,19 @@ public class TbCfGoodstwotype{
@Transient
private
boolean
autoLoad
=
false
;
private
Integer
sort
;
@OneToMany
(
mappedBy
=
"goodstwotypeId"
)
private
List
<
TbCfDescripiton
>
categoryList
=
new
ArrayList
<>();
public
Integer
getSort
()
{
return
sort
;
}
public
void
setSort
(
Integer
sort
)
{
this
.
sort
=
sort
;
}
/**
* 设置:商品二级分类Id
*/
...
...
src/main/java/com/example/afrishop_v3/repository/TbCfDescripitonRepository.java
浏览文件 @
08d8bf91
...
...
@@ -7,5 +7,5 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import
java.util.List
;
public
interface
TbCfDescripitonRepository
extends
PagingAndSortingRepository
<
TbCfDescripiton
,
String
>
{
List
<
TbCfDescripiton
>
findAllByGoodstwotypeId
(
String
categoryTwo
);
List
<
TbCfDescripiton
>
findAllByGoodstwotypeId
OrderBySort
(
String
categoryTwo
);
}
src/main/java/com/example/afrishop_v3/repository/TbCfGoodstwotypeRepository.java
浏览文件 @
08d8bf91
...
...
@@ -6,5 +6,5 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import
java.util.List
;
public
interface
TbCfGoodstwotypeRepository
extends
PagingAndSortingRepository
<
TbCfGoodstwotype
,
String
>
{
List
<
TbCfGoodstwotype
>
findAllByGoodstypeId
(
String
id
);
List
<
TbCfGoodstwotype
>
findAllByGoodstypeId
OrderBySort
(
String
id
);
}
src/main/java/com/example/afrishop_v3/security/WebSecurityConfig.java
浏览文件 @
08d8bf91
...
...
@@ -70,7 +70,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.
authorizeRequests
().
antMatchers
(
"/api/auth/**"
,
"/search/image/**"
,
"/itemStation/**"
,
"/startPage/**"
,
"/goodsType/**"
,
"/home/**"
,
"/spider/**"
,
"/store/**"
,
"/shopify/**"
,
"/community/**"
,
"/version/**"
,
"/flutterwave/notify/**"
,
"/dpo/notify/**"
,
"/advertisement/**"
,
"/website/**"
,
"/paypal/**"
,
"/discover/bonus/**"
,
"/problem/**"
,
"/cube/**"
,
"/activity/**"
,
"/attributes/**"
,
"/stripe/**"
,
"/coupon/**"
,
"/logistics/freeShippingThreshold"
).
permitAll
()
"/problem/**"
,
"/cube/**"
,
"/activity/**"
,
"/attributes/**"
,
"/stripe/**"
,
"/coupon/**"
,
"/logistics/freeShippingThreshold"
,
"/visit/**"
).
permitAll
()
.
antMatchers
(
"/api/test/**"
).
permitAll
()
.
anyRequest
().
authenticated
();
...
...
src/main/java/com/example/afrishop_v3/util/HttpsUtil.java
浏览文件 @
08d8bf91
...
...
@@ -305,9 +305,18 @@ public class HttpsUtil {
params
.
put
(
"lang"
,
"zh-CN"
);
String
result
=
HttpClientUtil
.
createConnection
(
url
,
params
,
"utf-8"
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
String
country
=
jsonObject
.
getString
(
"country"
);
System
.
out
.
println
(
"result:"
+
result
);
System
.
out
.
println
(
"country:"
+
country
);
return
country
;
String
status
=
jsonObject
.
getString
(
"status"
);
if
(
"success"
.
equals
(
status
))
{
String
country
=
jsonObject
.
getString
(
"country"
);
String
city
=
jsonObject
.
getString
(
"city"
);
if
(!
city
.
equals
(
country
))
{
country
=
country
+
"-"
+
city
;
}
System
.
out
.
println
(
"result:"
+
result
);
System
.
out
.
println
(
"country:"
+
country
);
return
country
;
}
return
null
;
}
}
src/main/java/com/example/afrishop_v3/web/controllers/Column2Controller.java
浏览文件 @
08d8bf91
...
...
@@ -33,7 +33,7 @@ public class Column2Controller {
@GetMapping
(
"/{id}"
)
public
Result
getColumnChildren
(
@PathVariable
String
id
)
{
List
<
TbCfGoodstwotype
>
list
=
goodstwotypeRepository
.
findAllByGoodstypeId
(
id
);
List
<
TbCfGoodstwotype
>
list
=
goodstwotypeRepository
.
findAllByGoodstypeId
OrderBySort
(
id
);
list
.
forEach
(
TbCfGoodstwotype:
:
enableAutoLoad
);
return
new
Result
<>(
list
);
}
...
...
src/main/java/com/example/afrishop_v3/website/controller/ColumnController.java
浏览文件 @
08d8bf91
...
...
@@ -60,11 +60,11 @@ public class ColumnController {
LinkedList
<
Category
>
categoryList
=
new
LinkedList
<>();
//二级分类
List
<
TbCfGoodstwotype
>
secondaryCategory
=
secondaryRepository
.
findAllByGoodstypeId
(
id
);
List
<
TbCfGoodstwotype
>
secondaryCategory
=
secondaryRepository
.
findAllByGoodstypeId
OrderBySort
(
id
);
secondaryCategory
.
forEach
(
category
->
{
//三级分类
List
<
TbCfDescripiton
>
tertiaryCategory
=
tertiaryRepository
.
findAllByGoodstwotypeId
(
category
.
getGoodstwotypeId
());
List
<
TbCfDescripiton
>
tertiaryCategory
=
tertiaryRepository
.
findAllByGoodstwotypeId
OrderBySort
(
category
.
getGoodstwotypeId
());
Category
c
=
new
Category
();
c
.
setId
(
category
.
getGoodstwotypeId
());
c
.
setCategory
(
category
.
getGoodstwotypeTitle
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论