Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
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
huluobin
gogirl-miniapp-backend
Commits
4d2c2bad
Commit
4d2c2bad
authored
Mar 11, 2021
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# 更新
parent
90402558
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
11 deletions
+12
-11
CustomerBalanceRecordMapper.java
...ure/mapper/user/customer/CustomerBalanceRecordMapper.java
+2
-1
Schedule.java
...ain/java/com/gogirl/infrastructure/schedule/Schedule.java
+3
-4
CustomerBalanceRecordMapper.xml
...ain/resources/mapper/user/CustomerBalanceRecordMapper.xml
+4
-4
ScheduleTest.java
...java/com/gogirl/infrastructure/schedule/ScheduleTest.java
+3
-2
No files found.
src/main/java/com/gogirl/infrastructure/mapper/user/customer/CustomerBalanceRecordMapper.java
View file @
4d2c2bad
...
...
@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
import
org.springframework.stereotype.Repository
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
...
...
@@ -21,7 +22,7 @@ public interface CustomerBalanceRecordMapper extends BaseMapper<CustomerBalanceR
* @param day 日期形如2020-03-03
* @return list
*/
List
<
CustomerBalanceRecord
>
getXcxChargeRecord
(
LocalDate
day
);
List
<
CustomerBalanceRecord
>
getXcxChargeRecord
(
@Param
(
"startDate"
)
LocalDateTime
startDate
,
@Param
(
"endDate"
)
LocalDateTime
endDate
);
/**
* 查询会员卡消费记录
...
...
src/main/java/com/gogirl/infrastructure/schedule/Schedule.java
View file @
4d2c2bad
...
...
@@ -164,7 +164,7 @@ public class Schedule {
}
public
void
setChargeReferees
(
LocalDate
local
Date
)
{
public
void
setChargeReferees
(
LocalDate
Time
startDate
,
LocalDateTime
end
Date
)
{
log
.
debug
(
"设置推荐人:当天服务的技师为推荐人"
);
...
...
@@ -177,7 +177,7 @@ public class Schedule {
}
//找到当天的订单的推荐人
List
<
CustomerBalanceRecord
>
list
=
balanceRecordDao
.
getXcxChargeRecord
(
local
Date
);
List
<
CustomerBalanceRecord
>
list
=
balanceRecordDao
.
getXcxChargeRecord
(
startDate
,
end
Date
);
//遍历设置推荐人
for
(
CustomerBalanceRecord
customerBalanceRecord
:
list
)
{
...
...
@@ -223,8 +223,7 @@ public class Schedule {
@Scheduled
(
cron
=
"0 0 3 * * *"
)
public
void
setChargeReferees
()
{
log
.
debug
(
"每天晚上03:00定时设置昨天服务的技师为推荐人** 任务开始"
);
LocalDate
day
=
LocalDate
.
now
().
minusDays
(
1
);
this
.
setChargeReferees
(
day
);
this
.
setChargeReferees
(
LocalDateTime
.
now
().
minusDays
(
2
),
LocalDateTime
.
now
());
log
.
debug
(
"每天晚上03:00定时设置昨天服务的技师为推荐人** 任务结束"
);
}
...
...
src/main/resources/mapper/user/CustomerBalanceRecordMapper.xml
View file @
4d2c2bad
...
...
@@ -59,19 +59,19 @@
</select>
<select
id=
"getXcxChargeRecord"
resultMap=
"BaseResultMap"
parameterType=
"java.time.LocalDate"
>
<select
id=
"getXcxChargeRecord"
resultMap=
"BaseResultMap"
parameterType=
"java.time.LocalDate
Time
"
>
select cbr.id,
group_concat(os.technician_id) referee_id,
(select om.department_id
from order_manage om
where om.order_user = cbr.customer_id
and
date_format(om.create_time, '%Y-%m-%d') = #{day
}
and
om.create_time between #{startDate} and #{endDate
}
limit 1) department_id
from customer_balance_record cbr
left join order_manage om
on om.order_user = cbr.customer_id and
date_format(om.create_time, '%Y-%m-%d') = #{day
}
on om.order_user = cbr.customer_id and
om.create_time between #{startDate} and #{endDate
}
left join order_serve os on os.order_id = om.id
where
date_format(cbr.time, '%Y-%m-%d') = #{day
}
where
cbr.time between #{startDate} and #{endDate
}
and (cbr.type = 1 or cbr.type = 2)
and (om.`status` = 3 or om.`status` = 4)
and cbr.referee_id is null
...
...
src/test/java/com/gogirl/infrastructure/schedule/ScheduleTest.java
View file @
4d2c2bad
...
...
@@ -8,7 +8,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import
org.springframework.test.context.ActiveProfiles
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
java.time.LocalDate
;
import
java.time.LocalDate
Time
;
/**
* <p>
...
...
@@ -29,7 +29,8 @@ public class ScheduleTest {
@Test
public
void
setChargeReferees
()
{
schedule
.
setChargeReferees
(
LocalDate
.
of
(
2021
,
2
,
5
));
schedule
.
setChargeReferees
(
LocalDateTime
.
of
(
2021
,
2
,
1
,
0
,
0
,
0
),
LocalDateTime
.
of
(
2021
,
2
,
28
,
0
,
0
,
0
));
}
}
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