Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
c7cea86e
Commit
c7cea86e
authored
May 08, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加自动增加房间标签定时任务
parent
29341e77
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
1 deletions
+55
-1
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+51
-0
RoomLabel.java
...e-system/src/main/java/share/system/domain/RoomLabel.java
+3
-0
SCouponMapper.xml
...system/src/main/resources/mapper/system/SCouponMapper.xml
+1
-1
No files found.
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
c7cea86e
...
@@ -78,6 +78,12 @@ public class RedisTask {
...
@@ -78,6 +78,12 @@ public class RedisTask {
@Autowired
@Autowired
private
TiktokService
tiktokService
;
private
TiktokService
tiktokService
;
@Autowired
private
LabelService
labelService
;
@Autowired
private
RoomLabelService
roomLabelService
;
//15分钟的常量
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
final
long
FIFTEEN_MINUTES
=
60
*
15
;
...
@@ -437,4 +443,49 @@ public class RedisTask {
...
@@ -437,4 +443,49 @@ public class RedisTask {
});
});
}
}
public
void
AutoAddRoomLabel
()
{
List
<
RoomLabel
>
roomLabelList
=
roomLabelService
.
list
();
//获取roomLabelList中的roomId,去重
List
<
Long
>
roomIds
=
roomLabelList
.
stream
().
map
(
RoomLabel:
:
getRoomId
).
distinct
().
collect
(
Collectors
.
toList
());
List
<
SRoom
>
roomList
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
roomIds
))
{
LambdaQueryWrapper
<
SRoom
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
notIn
(
SRoom:
:
getId
,
roomIds
);
roomList
=
roomService
.
list
(
queryWrapper
);
}
else
{
roomList
=
roomService
.
list
();
}
if
(
CollectionUtils
.
isEmpty
(
roomList
))
{
return
;
}
List
<
RoomLabel
>
roomLabels
=
new
ArrayList
<>();
List
<
Label
>
labelList
=
labelService
.
list
();
roomList
.
stream
().
forEach
(
room
->
{
labelList
.
stream
().
forEach
(
label
->
{
RoomLabel
roomLabel
=
new
RoomLabel
();
roomLabel
.
setRoomId
(
room
.
getId
());
roomLabel
.
setStoreId
(
room
.
getStoreId
());
roomLabel
.
setLabelId
(
label
.
getId
());
if
(
label
.
getType
().
equals
(
0L
)
&&
Integer
.
valueOf
(
label
.
getDuration
())
>=
4
&&
Integer
.
valueOf
(
label
.
getDuration
())
<
8
)
{
roomLabel
.
setPromotionDuration
(
"4"
);
if
(
room
.
getPrice
().
equals
(
new
BigDecimal
(
"20"
)))
{
roomLabel
.
setPromotionAmount
(
new
BigDecimal
(
"49.90"
));
}
else
if
(
room
.
getPrice
().
equals
(
new
BigDecimal
(
"25"
)))
{
roomLabel
.
setPromotionAmount
(
new
BigDecimal
(
"63.80"
));
}
else
if
(
room
.
getPrice
().
equals
(
new
BigDecimal
(
"30"
)))
{
roomLabel
.
setPromotionAmount
(
new
BigDecimal
(
"83.80"
));
}
}
else
if
(
label
.
getType
().
equals
(
0L
)
&&
Integer
.
parseInt
(
label
.
getDuration
())
>=
8
)
{
roomLabel
.
setPromotionDuration
(
"8"
);
roomLabel
.
setPromotionAmount
(
new
BigDecimal
(
"138"
));
}
else
{
roomLabel
.
setPromotionDuration
(
String
.
valueOf
(
YesNoEnum
.
no
.
getIndex
()));
roomLabel
.
setPromotionAmount
(
new
BigDecimal
(
"0"
));
}
roomLabels
.
add
(
roomLabel
);
});
});
if
(!
CollectionUtils
.
isEmpty
(
roomLabels
))
roomLabelService
.
saveBatch
(
roomLabels
);
}
}
}
share-system/src/main/java/share/system/domain/RoomLabel.java
View file @
c7cea86e
package
share
.
system
.
domain
;
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
...
@@ -23,6 +25,7 @@ public class RoomLabel extends BaseEntity {
...
@@ -23,6 +25,7 @@ public class RoomLabel extends BaseEntity {
/**
/**
* ID
* ID
*/
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
private
Long
id
;
/**
/**
...
...
share-system/src/main/resources/mapper/system/SCouponMapper.xml
View file @
c7cea86e
...
@@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where 1=1 and coupon_type = #{couponType}
where 1=1 and coupon_type = #{couponType}
<if
test=
"name != null and name != ''"
>
and name like concat('%', #{name}, '%')
</if>
<if
test=
"name != null and name != ''"
>
and name like concat('%', #{name}, '%')
</if>
<if
test=
"startDate != null"
>
and start_date
<
= #{startDate}
</if>
<if
test=
"startDate != null"
>
and start_date
<
= #{startDate}
</if>
<
if
test=
"endDate == null"
>
and end_date >= NOW()
</if
>
<
!-- <if test="endDate == null">and end_date >= NOW()</if> --
>
<if
test=
"endDate != null"
>
and end_date >= #{endDate}
</if>
<if
test=
"endDate != null"
>
and end_date >= #{endDate}
</if>
<if
test=
"orderType != null"
>
and order_type = #{orderType}
</if>
<if
test=
"orderType != null"
>
and order_type = #{orderType}
</if>
<if
test=
"packIds != null"
>
and pack_ids = #{packIds}
</if>
<if
test=
"packIds != null"
>
and pack_ids = #{packIds}
</if>
...
...
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