Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
05acb29e
提交
05acb29e
authored
11月 20, 2020
作者:
Whispa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master'
上级
6226210f
ecf51ce3
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
240 行增加
和
8 行删除
+240
-8
AdvertisementController.java
...mple/afrishop_v3/controllers/AdvertisementController.java
+81
-0
DpoPayController.java
...com/example/afrishop_v3/controllers/DpoPayController.java
+1
-4
Advertisement.java
...in/java/com/example/afrishop_v3/models/Advertisement.java
+68
-0
AdvertisementItem.java
...ava/com/example/afrishop_v3/models/AdvertisementItem.java
+45
-0
AdvertisementItemRepository.java
...e/afrishop_v3/repository/AdvertisementItemRepository.java
+19
-0
AdvertisementRepository.java
...ample/afrishop_v3/repository/AdvertisementRepository.java
+18
-0
TbCfStationItemRepository.java
...ple/afrishop_v3/repository/TbCfStationItemRepository.java
+4
-0
application-test.yml
src/main/resources/application-test.yml
+2
-2
application.properties
src/main/resources/application.properties
+2
-2
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/AdvertisementController.java
0 → 100644
浏览文件 @
05acb29e
package
com
.
example
.
afrishop_v3
.
controllers
;
import
com.example.afrishop_v3.base.Result
;
import
com.example.afrishop_v3.models.Advertisement
;
import
com.example.afrishop_v3.models.TbCfStationItem
;
import
com.example.afrishop_v3.repository.AdvertisementItemRepository
;
import
com.example.afrishop_v3.repository.AdvertisementRepository
;
import
com.example.afrishop_v3.repository.TbCfStationItemRepository
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.data.domain.Sort
;
import
static
org
.
springframework
.
data
.
domain
.
Sort
.
Order
.
asc
;
import
static
org
.
springframework
.
data
.
domain
.
Sort
.
Order
.
desc
;
import
java.util.Date
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Optional
;
/**
* @Auther: wudepeng
* @Date: 2020/11/20
* @Description:广告投放页管理
*/
@RestController
@RequestMapping
(
"/advertisement"
)
public
class
AdvertisementController
{
private
final
AdvertisementRepository
advertisementRepository
;
private
final
TbCfStationItemRepository
itemRepository
;
public
AdvertisementController
(
AdvertisementRepository
advertisementRepository
,
TbCfStationItemRepository
itemRepository
)
{
this
.
advertisementRepository
=
advertisementRepository
;
this
.
itemRepository
=
itemRepository
;
}
/**
* 根据链接查询广告投放页
*/
@GetMapping
(
"/info/{link}"
)
public
Result
getAdvertisementById
(
@PathVariable
(
"link"
)
String
link
,
@RequestParam
(
value
=
"pageNum"
,
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"12"
)
Integer
pageSize
,
@RequestParam
(
value
=
"order"
,
required
=
false
)
String
order
)
{
LinkedHashMap
advertisementMap
=
new
LinkedHashMap
();
//广告投放信息主体
Optional
<
Advertisement
>
firstByAdLink
=
advertisementRepository
.
findFirstByAdLink
(
link
);
if
(
firstByAdLink
.
isPresent
())
{
Advertisement
advertisement
=
firstByAdLink
.
get
();
long
now
=
System
.
currentTimeMillis
();
Date
endTime
=
advertisement
.
getEndTime
();
//结束时间
//活动已结束
if
(
now
>
endTime
.
getTime
())
{
advertisement
.
setStatus
(
3
);
}
List
<
TbCfStationItem
>
itemList
=
itemRepository
.
getAdvertisementItem
(
advertisement
.
getId
(),
PageRequest
.
of
(
pageNum
-
1
,
pageSize
)).
toList
();
advertisementMap
.
put
(
"advertisement"
,
advertisement
);
advertisementMap
.
put
(
"itemList"
,
itemList
);
}
return
new
Result
(
advertisementMap
);
}
private
Sort
sort
(
String
order
)
{
String
col
=
"discountPrice"
;
return
Sort
.
by
(
order
(
order
,
col
));
}
private
Sort
.
Order
order
(
String
order
,
String
col
)
{
return
"desc"
.
equals
(
order
)
?
desc
(
col
)
:
asc
(
col
);
}
}
src/main/java/com/example/afrishop_v3/controllers/DpoPayController.java
浏览文件 @
05acb29e
...
...
@@ -63,10 +63,7 @@ public class DpoPayController extends Controller {
System
.
err
.
println
(
"transToken:"
+
transToken
);
//logger.info("DPO支付:" + "开始支付校验");
Optional
<
TbCfOrder
>
byId
=
repository
.
findById
(
orderId
);
String
orderSource
=
null
;
if
(
byId
.
isPresent
())
{
orderSource
=
byId
.
get
().
getOrderSource
().
toString
();
}
if
(!
StringUtils
.
isBlank
(
orderId
)
&&
!
StringUtils
.
isBlank
(
transToken
))
{
boolean
verifyPay
=
verifyPay
(
transToken
,
orderId
);
if
(
verifyPay
)
{
...
...
src/main/java/com/example/afrishop_v3/models/Advertisement.java
0 → 100644
浏览文件 @
05acb29e
package
com
.
example
.
afrishop_v3
.
models
;
import
lombok.Data
;
import
org.hibernate.annotations.Where
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 实体
* 表名 advertisement
*
* @author lipengjun
* @date 2020-09-28 17:54:01
*/
@Data
@Entity
public
class
Advertisement
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 广告投放ID
*/
@Id
private
String
id
;
private
String
itemIds
;
/**
* 广告名
*/
private
String
adName
;
/**
* 广告链接
*/
private
String
adLink
;
/**
* banner图
*/
private
String
picture
;
/**
* 状态 0:已删除 1:活动进行中 2:活动已关闭 3:活动已结束
*/
private
Integer
status
;
/**
* 活动开始时间
*/
private
Date
startTime
;
/**
* 活动结束时间
*/
private
Date
endTime
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 备注
*/
private
String
remark
;
}
src/main/java/com/example/afrishop_v3/models/AdvertisementItem.java
0 → 100644
浏览文件 @
05acb29e
package
com
.
example
.
afrishop_v3
.
models
;
import
lombok.Data
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 实体
* 表名 advertisement_item
*
* @author lipengjun
* @date 2020-10-13 17:30:21
*/
@Data
@Entity
public
class
AdvertisementItem
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 广告投放ID
*/
@Id
private
String
adId
;
/**
* 商品ID
*/
private
String
itemId
;
/**
* 是否置顶 0: 不置顶 1:置顶
*/
private
Integer
isTop
;
/**
* 排序
*/
private
Integer
sort
;
/**
* 商品添加时间
*/
private
Date
createTime
;
}
src/main/java/com/example/afrishop_v3/repository/AdvertisementItemRepository.java
0 → 100644
浏览文件 @
05acb29e
package
com
.
example
.
afrishop_v3
.
repository
;
import
com.example.afrishop_v3.models.Advertisement
;
import
com.example.afrishop_v3.models.AdvertisementItem
;
import
com.example.afrishop_v3.models.TbCfStationItem
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
/**
* @Auther: wudepeng
* @Date: 2020/11/20
* @Description:
*/
public
interface
AdvertisementItemRepository
extends
JpaRepository
<
AdvertisementItem
,
String
>
{
}
src/main/java/com/example/afrishop_v3/repository/AdvertisementRepository.java
0 → 100644
浏览文件 @
05acb29e
package
com
.
example
.
afrishop_v3
.
repository
;
import
com.example.afrishop_v3.models.Advertisement
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
java.util.Optional
;
/**
* @Auther: wudepeng
* @Date: 2020/11/20
* @Description:
*/
public
interface
AdvertisementRepository
extends
JpaRepository
<
Advertisement
,
String
>
{
// @Query("select a from Advertisement a where a.adLink=:adLink and a.status=1")
Optional
<
Advertisement
>
findFirstByAdLink
(
String
adLink
);
}
src/main/java/com/example/afrishop_v3/repository/TbCfStationItemRepository.java
浏览文件 @
05acb29e
...
...
@@ -35,4 +35,8 @@ public interface TbCfStationItemRepository extends PagingAndSortingRepository<Tb
Page
<
TbCfStationItem
>
findByItemCategory
(
String
itemName
,
Pageable
pageable
);
List
<
TbCfStationItem
>
findAllByItemDescritionId
(
String
id
);
@Query
(
value
=
"select i from #{#entityName} i inner join AdvertisementItem a on i.itemId=a.itemId where a.adId=?1 order by a.sort"
)
Page
<
TbCfStationItem
>
getAdvertisementItem
(
String
adId
,
Pageable
pageable
);
}
src/main/resources/application-test.yml
浏览文件 @
05acb29e
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)
...
...
src/main/resources/application.properties
浏览文件 @
05acb29e
server.servlet.context-path
=
/
zion
server.servlet.context-path
=
/
afrishop
spring.jpa.hibernate.ddl-auto
=
update
server.port
=
7000
server.port
=
8099
#spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:3306/afrishop_test?useUnicode=true&connectionCollation=utf8mb4_general_ci&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
#spring.datasource.username=root
#spring.datasource.password=Diaoyunnuli.8
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论