Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
553251a5
提交
553251a5
authored
11月 24, 2020
作者:
Whispa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
8221c39c
1f90f7c6
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
131 行增加
和
24 行删除
+131
-24
AuthController.java
...a/com/example/afrishop_v3/controllers/AuthController.java
+1
-0
CouponController.java
...com/example/afrishop_v3/controllers/CouponController.java
+35
-10
ItemController.java
...a/com/example/afrishop_v3/controllers/ItemController.java
+2
-2
TbCfStationItemRepository.java
...ple/afrishop_v3/repository/TbCfStationItemRepository.java
+4
-2
WebSecurityConfig.java
...a/com/example/afrishop_v3/security/WebSecurityConfig.java
+3
-2
StationToGoodsType.java
...n/java/com/example/afrishop_v3/vo/StationToGoodsType.java
+46
-0
ColumnController.java
...mple/afrishop_v3/website/controller/ColumnController.java
+33
-6
application-test.yml
src/main/resources/application-test.yml
+7
-2
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/AuthController.java
浏览文件 @
553251a5
...
...
@@ -508,6 +508,7 @@ public class AuthController extends Controller {
private
void
fillUserNecessayInfo
(
TbCfUserInfo
tbCfUserInfoVo
)
{
if
(
tbCfUserInfoVo
.
getAvatar
()
==
null
)
tbCfUserInfoVo
.
setAvatar
(
domainProperties
.
getProperty
(
"user.avatar"
));
tbCfUserInfoVo
.
setNick
(
tbCfUserInfoVo
.
getAccount
());
tbCfUserInfoVo
.
setUserNo
(
IdUtil
.
createIdByDate
());
tbCfUserInfoVo
.
setPhoneFlag
(
StateConstant
.
INVALID
);
tbCfUserInfoVo
.
setLoginCount
(
0
);
...
...
src/main/java/com/example/afrishop_v3/controllers/CouponController.java
浏览文件 @
553251a5
...
...
@@ -8,8 +8,8 @@ import com.example.afrishop_v3.repository.TbCfToicouponRepository;
import
com.example.afrishop_v3.security.services.AuthenticationUser
;
import
org.springframework.web.bind.annotation.*
;
import
java.
util.LinkedHashMap
;
import
java.util.
List
;
import
java.
math.BigDecimal
;
import
java.util.
*
;
@RestController
@RequestMapping
(
"/coupon"
)
...
...
@@ -24,36 +24,36 @@ public class CouponController {
@GetMapping
public
Result
getUserCoupons
(){
public
Result
getUserCoupons
()
{
return
queryCouponByUserId
(
user
.
userId
());
}
@GetMapping
(
"queryCouponByUserId"
)
public
Result
queryCouponByUserId
(
@RequestParam
(
"userId"
)
String
userId
){
public
Result
queryCouponByUserId
(
@RequestParam
(
"userId"
)
String
userId
)
{
List
<
TbCfToicoupon
>
availableCoupons
=
repository
.
queryUserAvailableCoupon
(
userId
);
List
<
TbCfToicoupon
>
expiredCoupons
=
repository
.
queryUserExpiredCoupon
(
userId
);
List
<
TbCfToicoupon
>
usedCoupons
=
repository
.
queryUserUsedCoupon
(
userId
);
LinkedHashMap
<
String
,
Object
>
hashMap
=
new
LinkedHashMap
<>();
hashMap
.
put
(
"validCouponList"
,
availableCoupons
);
hashMap
.
put
(
"usedCouponList"
,
usedCoupons
);
hashMap
.
put
(
"expiredCouponList"
,
expiredCoupons
);
hashMap
.
put
(
"validCouponList"
,
availableCoupons
);
hashMap
.
put
(
"usedCouponList"
,
usedCoupons
);
hashMap
.
put
(
"expiredCouponList"
,
expiredCoupons
);
return
new
Result
<>(
hashMap
);
}
@GetMapping
(
"{couponId}"
)
public
Result
queryCouponDetails
(
@PathVariable
(
"couponId"
)
String
couponId
){
public
Result
queryCouponDetails
(
@PathVariable
(
"couponId"
)
String
couponId
)
{
return
new
Result
<>(
repository
.
findById
(
couponId
));
}
@GetMapping
(
"take/{couponId}"
)
public
Result
couponTake
(
@PathVariable
(
"couponId"
)
String
couponId
){
public
Result
couponTake
(
@PathVariable
(
"couponId"
)
String
couponId
)
{
// TODO
//TbCfCouponEntity tbCfCouponEntity=grabCoupon(couponId);
// if(tbCfCouponEntity!=null) {
...
...
@@ -63,6 +63,31 @@ public class CouponController {
// //result.setMessage("Successfully received");
// } else {
// }
return
new
Result
(
ResultCodeEnum
.
ERROR
.
getCode
(),
"The coupon has been snapped up"
);
return
new
Result
(
ResultCodeEnum
.
ERROR
.
getCode
(),
"The coupon has been snapped up"
);
}
/**
* 查询用户未使用的优惠券,可用的排在顶部
*/
@GetMapping
(
"/selectCoupon"
)
public
Result
queryUserAvailableCoupons
(
@RequestParam
(
"orderPrice"
)
BigDecimal
orderPrice
)
{
Map
<
String
,
Object
>
couponMap
=
new
HashMap
<>();
//可使用的优惠券
LinkedList
<
TbCfToicoupon
>
availableCoupon
=
new
LinkedList
();
//不可使用的优惠券
LinkedList
<
TbCfToicoupon
>
unAvailableCoupon
=
new
LinkedList
();
List
<
TbCfToicoupon
>
couponList
=
repository
.
queryUserAvailableCoupon
(
user
.
userId
());
couponList
.
forEach
(
coupon
->
{
boolean
available
=
orderPrice
.
compareTo
(
coupon
.
withAmount
())
>=
0
;
if
(
available
)
{
availableCoupon
.
add
(
coupon
);
}
else
{
unAvailableCoupon
.
add
(
coupon
);
}
});
couponMap
.
put
(
"availableCoupon"
,
availableCoupon
);
couponMap
.
put
(
"unAvailableCoupon"
,
unAvailableCoupon
);
return
new
Result
(
couponMap
);
}
}
src/main/java/com/example/afrishop_v3/controllers/ItemController.java
浏览文件 @
553251a5
...
...
@@ -56,7 +56,7 @@ public class ItemController {
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"6"
)
Integer
pageSize
,
@RequestParam
(
value
=
"order"
,
required
=
false
)
String
order
)
{
return
new
Result
<>(
repository
.
findAllByItemCategorytwo
(
typeTwoId
,
PageRequest
.
of
(
pageNum
,
pageSize
,
sort
(
order
))));
return
new
Result
<>(
repository
.
findAllByItemCategorytwo
OrderByCreateTimeDesc
(
typeTwoId
,
PageRequest
.
of
(
pageNum
,
pageSize
,
sort
(
order
))));
}
@GetMapping
(
"/queryCategoryTwoByCid/{categoryId}"
)
...
...
@@ -133,7 +133,7 @@ public class ItemController {
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"0"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"6"
)
Integer
pageSize
,
@RequestParam
(
value
=
"order"
,
required
=
false
)
String
order
)
{
return
new
Result
<>(
repository
.
findAllByItemDescritionId
(
typeThreeId
,
PageRequest
.
of
(
pageNum
,
pageSize
,
sort
(
order
))));
return
new
Result
<>(
repository
.
findAllByItemDescritionId
OrderByCreateTimeDesc
(
typeThreeId
,
PageRequest
.
of
(
pageNum
,
pageSize
,
sort
(
order
))));
}
private
Sort
sort
(
String
order
){
...
...
src/main/java/com/example/afrishop_v3/repository/TbCfStationItemRepository.java
浏览文件 @
553251a5
...
...
@@ -12,9 +12,9 @@ import org.springframework.data.repository.query.Param;
import
java.util.List
;
public
interface
TbCfStationItemRepository
extends
PagingAndSortingRepository
<
TbCfStationItem
,
String
>
{
Page
<
TbCfStationItem
>
findAllByItemCategorytwo
(
String
category
,
Pageable
pageable
);
Page
<
TbCfStationItem
>
findAllByItemCategorytwo
OrderByCreateTimeDesc
(
String
category
,
Pageable
pageable
);
Page
<
TbCfStationItem
>
findAllByItemDescritionId
(
String
description
,
Pageable
pageable
);
Page
<
TbCfStationItem
>
findAllByItemDescritionId
OrderByCreateTimeDesc
(
String
description
,
Pageable
pageable
);
Page
<
TbCfStationItem
>
findAllByItemLabelContaining
(
String
label
,
Pageable
pageable
);
...
...
@@ -42,4 +42,6 @@ public interface TbCfStationItemRepository extends PagingAndSortingRepository<Tb
@Query
(
value
=
"select i from #{#entityName} i inner join AdvertisementItem a on i.itemId=a.itemId where a.adId=?1"
)
Page
<
TbCfStationItem
>
getAdvertisementItem2
(
String
adId
,
Pageable
pageable
);
List
<
TbCfStationItem
>
findTop4ByItemCategoryOrderByCreateTime
(
String
category
);
}
src/main/java/com/example/afrishop_v3/security/WebSecurityConfig.java
浏览文件 @
553251a5
...
...
@@ -48,7 +48,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
}
@Bean
@Override
public
AuthenticationManager
authenticationManagerBean
()
throws
Exception
{
...
...
@@ -65,7 +64,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
http
.
cors
().
and
().
csrf
().
disable
()
.
exceptionHandling
().
authenticationEntryPoint
(
unauthorizedHandler
).
and
()
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
).
and
()
.
authorizeRequests
().
antMatchers
(
"/api/auth/**"
,
"/search/image/**"
,
"/itemStation/**"
,
"/startPage/**"
,
"/goodsType/**"
,
"/home/**"
,
"/spider/**"
,
"/store/**"
,
"/shopify/**"
,
"/community/**"
,
"/version/**"
,
"/flutterwave/notify/**"
,
"/dpo/notify/**"
,
"/advertisement/**"
).
permitAll
()
.
authorizeRequests
().
antMatchers
(
"/api/auth/**"
,
"/search/image/**"
,
"/itemStation/**"
,
"/startPage/**"
,
"/goodsType/**"
,
"/home/**"
,
"/spider/**"
,
"/store/**"
,
"/shopify/**"
,
"/community/**"
,
"/version/**"
,
"/flutterwave/notify/**"
,
"/dpo/notify/**"
,
"/advertisement/**"
,
"/website/**"
).
permitAll
()
.
antMatchers
(
"/api/test/**"
).
permitAll
()
.
anyRequest
().
authenticated
();
...
...
src/main/java/com/example/afrishop_v3/vo/StationToGoodsType.java
0 → 100644
浏览文件 @
553251a5
package
com
.
example
.
afrishop_v3
.
vo
;
import
com.example.afrishop_v3.models.TbCfStationItem
;
import
java.util.List
;
public
class
StationToGoodsType
{
private
String
CategoryId
;
private
String
Goodstypetitle
;
private
String
GoodstypeUrl
;
private
List
<
TbCfStationItem
>
stationlist
;
public
String
getCategoryId
()
{
return
CategoryId
;
}
public
String
getGoodstypetitle
()
{
return
Goodstypetitle
;
}
public
List
<
TbCfStationItem
>
getStationlist
()
{
return
stationlist
;
}
public
void
setCategoryId
(
String
categoryId
)
{
CategoryId
=
categoryId
;
}
public
void
setGoodstypetitle
(
String
goodstypetitle
)
{
Goodstypetitle
=
goodstypetitle
;
}
public
void
setStationlist
(
List
<
TbCfStationItem
>
stationlist
)
{
this
.
stationlist
=
stationlist
;
}
public
String
getGoodstypeUrl
()
{
return
GoodstypeUrl
;
}
public
void
setGoodstypeUrl
(
String
goodstypeUrl
)
{
GoodstypeUrl
=
goodstypeUrl
;
}
}
src/main/java/com/example/afrishop_v3/website/controller/ColumnController.java
浏览文件 @
553251a5
...
...
@@ -4,10 +4,14 @@ package com.example.afrishop_v3.website.controller;
import
com.example.afrishop_v3.base.Result
;
import
com.example.afrishop_v3.models.TbCfDescripiton
;
import
com.example.afrishop_v3.models.TbCfGoodstwotype
;
import
com.example.afrishop_v3.models.TbCfGoodstype
;
import
com.example.afrishop_v3.models.TbCfStationItem
;
import
com.example.afrishop_v3.repository.TbCfDescripitonRepository
;
import
com.example.afrishop_v3.repository.TbCfGoodstwotypeRepository
;
import
com.example.afrishop_v3.repository.TbCfGoodstypeRepository
;
import
com.example.afrishop_v3.repository.TbCfStationItemRepository
;
import
com.example.afrishop_v3.vo.Category
;
import
com.example.afrishop_v3.vo.StationToGoodsType
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -18,10 +22,10 @@ import java.util.*;
/**
* @Auther: wudepeng
* @Date: 2020/11/23
* @Description:PC官网首页
商品分类
管理
* @Description:PC官网首页
内容
管理
*/
@RestController
@RequestMapping
(
value
=
"/website
/column
"
)
@RequestMapping
(
value
=
"/website"
)
public
class
ColumnController
{
private
final
TbCfGoodstypeRepository
repository
;
...
...
@@ -30,17 +34,19 @@ public class ColumnController {
private
final
TbCfDescripitonRepository
tertiaryRepository
;
public
ColumnController
(
TbCfGoodstypeRepository
repository
,
TbCfGoodstwotypeRepository
secondaryRepository
,
TbCfDescripitonRepository
tertiaryRepository
)
{
private
final
TbCfStationItemRepository
itemRepository
;
public
ColumnController
(
TbCfGoodstypeRepository
repository
,
TbCfGoodstwotypeRepository
secondaryRepository
,
TbCfDescripitonRepository
tertiaryRepository
,
TbCfStationItemRepository
itemRepository
)
{
this
.
repository
=
repository
;
this
.
secondaryRepository
=
secondaryRepository
;
this
.
tertiaryRepository
=
tertiaryRepository
;
this
.
itemRepository
=
itemRepository
;
}
/**
* 查询所有一级分类
*/
@GetMapping
@GetMapping
(
"/column"
)
public
Result
findTopCategory
()
{
return
new
Result
(
repository
.
findAll
());
...
...
@@ -49,7 +55,7 @@ public class ColumnController {
/**
* 查询一级分类的子分类
*/
@GetMapping
(
"/{id}"
)
@GetMapping
(
"/
column/
{id}"
)
public
Result
findCategoryChildrens
(
@PathVariable
(
"id"
)
String
id
)
{
LinkedList
<
Category
>
categoryList
=
new
LinkedList
();
...
...
@@ -69,4 +75,25 @@ public class ColumnController {
return
new
Result
(
categoryList
);
}
/**
* 首页商品分类商品展示(每个分类展示4个)
*/
@GetMapping
(
"/findItemByCategory"
)
public
Result
findItemByCategory
()
{
List
<
StationToGoodsType
>
listStation
=
new
ArrayList
<>();
Iterable
<
TbCfGoodstype
>
list
=
repository
.
findAll
();
for
(
TbCfGoodstype
goods
:
list
)
{
StationToGoodsType
goodsType
=
new
StationToGoodsType
();
goodsType
.
setCategoryId
(
goods
.
getGoodstypeId
());
goodsType
.
setGoodstypetitle
(
goods
.
getGoodstypeTitle
());
goodsType
.
setGoodstypeUrl
(
goods
.
getGoodstypeUrl
());
List
<
TbCfStationItem
>
station
=
itemRepository
.
findTop4ByItemCategoryOrderByCreateTime
(
goods
.
getGoodstypeId
());
goodsType
.
setStationlist
(
station
);
listStation
.
add
(
goodsType
);
}
return
new
Result
(
listStation
);
}
}
src/main/resources/application-test.yml
浏览文件 @
553251a5
server
:
servlet
:
context-path
:
/afrishop
port
:
8099
spring
:
datasource
:
url
:
jdbc:mysql://
47.106.242.175:3306/afrishop_test
?useUnicode=true&connectionCollation=utf8mb4_general_ci&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
url
:
jdbc:mysql://
159.138.48.71:3306/chinafrica_ref
?useUnicode=true&connectionCollation=utf8mb4_general_ci&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
username
:
root
driver-class-name
:
com.mysql.cj.jdbc.Driver
password
:
diaoyun666
password
:
Diaoyunnuli.8
redis
:
#Redis数据库分片索引(默认为0)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论