Commit 4d2c2bad by huluobin

# 更新

parent 90402558
...@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
...@@ -21,7 +22,7 @@ public interface CustomerBalanceRecordMapper extends BaseMapper<CustomerBalanceR ...@@ -21,7 +22,7 @@ public interface CustomerBalanceRecordMapper extends BaseMapper<CustomerBalanceR
* @param day 日期形如2020-03-03 * @param day 日期形如2020-03-03
* @return list * @return list
*/ */
List<CustomerBalanceRecord> getXcxChargeRecord(LocalDate day); List<CustomerBalanceRecord> getXcxChargeRecord(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
/** /**
* 查询会员卡消费记录 * 查询会员卡消费记录
......
...@@ -164,7 +164,7 @@ public class Schedule { ...@@ -164,7 +164,7 @@ public class Schedule {
} }
public void setChargeReferees(LocalDate localDate) { public void setChargeReferees(LocalDateTime startDate, LocalDateTime endDate) {
log.debug("设置推荐人:当天服务的技师为推荐人"); log.debug("设置推荐人:当天服务的技师为推荐人");
...@@ -177,7 +177,7 @@ public class Schedule { ...@@ -177,7 +177,7 @@ public class Schedule {
} }
//找到当天的订单的推荐人 //找到当天的订单的推荐人
List<CustomerBalanceRecord> list = balanceRecordDao.getXcxChargeRecord(localDate); List<CustomerBalanceRecord> list = balanceRecordDao.getXcxChargeRecord(startDate, endDate);
//遍历设置推荐人 //遍历设置推荐人
for (CustomerBalanceRecord customerBalanceRecord : list) { for (CustomerBalanceRecord customerBalanceRecord : list) {
...@@ -223,8 +223,7 @@ public class Schedule { ...@@ -223,8 +223,7 @@ public class Schedule {
@Scheduled(cron = "0 0 3 * * *") @Scheduled(cron = "0 0 3 * * *")
public void setChargeReferees() { public void setChargeReferees() {
log.debug("每天晚上03:00定时设置昨天服务的技师为推荐人** 任务开始"); log.debug("每天晚上03:00定时设置昨天服务的技师为推荐人** 任务开始");
LocalDate day = LocalDate.now().minusDays(1); this.setChargeReferees(LocalDateTime.now().minusDays(2),LocalDateTime.now());
this.setChargeReferees(day);
log.debug("每天晚上03:00定时设置昨天服务的技师为推荐人** 任务结束"); log.debug("每天晚上03:00定时设置昨天服务的技师为推荐人** 任务结束");
} }
......
...@@ -59,19 +59,19 @@ ...@@ -59,19 +59,19 @@
</select> </select>
<select id="getXcxChargeRecord" resultMap="BaseResultMap" parameterType="java.time.LocalDate"> <select id="getXcxChargeRecord" resultMap="BaseResultMap" parameterType="java.time.LocalDateTime">
select cbr.id, select cbr.id,
group_concat(os.technician_id) referee_id, group_concat(os.technician_id) referee_id,
(select om.department_id (select om.department_id
from order_manage om from order_manage om
where om.order_user = cbr.customer_id 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 limit 1) department_id
from customer_balance_record cbr from customer_balance_record cbr
left join order_manage om 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 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 (cbr.type = 1 or cbr.type = 2)
and (om.`status` = 3 or om.`status` = 4) and (om.`status` = 3 or om.`status` = 4)
and cbr.referee_id is null and cbr.referee_id is null
......
...@@ -8,7 +8,7 @@ import org.springframework.boot.test.context.SpringBootTest; ...@@ -8,7 +8,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import java.time.LocalDate; import java.time.LocalDateTime;
/** /**
* <p> * <p>
...@@ -29,7 +29,8 @@ public class ScheduleTest { ...@@ -29,7 +29,8 @@ public class ScheduleTest {
@Test @Test
public void setChargeReferees() { 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));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment