傅行帆 5 年 前
コミット
ba437de79f

+ 1
- 1
src/main/java/com/huiju/estateagents/job/CustomerStatisticTimeJob.java ファイルの表示

@@ -50,7 +50,7 @@ public class CustomerStatisticTimeJob extends BaseController {
50 50
      *
51 51
      * 开启定时任务,每天23:50执行
52 52
      */
53
-    @Scheduled(cron = "* 50 23 * * ?")
53
+    @Scheduled(cron = "00 50 23 * * ?")
54 54
     private void configureTasks() {
55 55
         LocalDateTime nowDate = LocalDateTime.now();
56 56
     

+ 2
- 0
src/main/java/com/huiju/estateagents/statistic/mapper/TaCustomerStatisticDailyMapper.java ファイルの表示

@@ -52,4 +52,6 @@ public interface TaCustomerStatisticDailyMapper extends BaseMapper<TaCustomerSta
52 52
 	 * @return
53 53
 	 */
54 54
 	List<TaCustomerStatisticDaily> getDailyList(@Param("customerType") String customerType,@Param("orgId")  Integer orgId,@Param("nowDate")  LocalDateTime nowDate,@Param("beforeDate")  LocalDateTime beforeDate);
55
+	
56
+	int deleteNowDate(@Param("nowDate") LocalDateTime nowDate,@Param("customerType") String customerType);
55 57
 }

+ 3
- 0
src/main/java/com/huiju/estateagents/statistic/service/impl/TaCustomerStatisticDailyServiceImpl.java ファイルの表示

@@ -98,6 +98,9 @@ public class TaCustomerStatisticDailyServiceImpl extends ServiceImpl<TaCustomerS
98 98
 	 * @param customerType
99 99
 	 */
100 100
 	private void statisticDailySaveBatch(List<TaCustomerStatisticDaily> list, LocalDateTime nowDate, String customerType) {
101
+		//先删除当天数据在添加防止有脏数据
102
+		customerStatisticDailyMapper.deleteNowDate(nowDate,customerType);
103
+		
101 104
 		list.forEach(e -> {
102 105
 			e.setCreateDate(nowDate);
103 106
 			e.setCustomerType(customerType);

+ 6
- 0
src/main/resources/mapper/statistic/TaCustomerStatisticDailyMapper.xml ファイルの表示

@@ -2,6 +2,12 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.huiju.estateagents.statistic.mapper.TaCustomerStatisticDailyMapper">
4 4
 
5
+    <delete id="deleteNowDate">
6
+        delete from ta_customer_statistic_daily
7
+        where customer_type = #{customerType}
8
+        AND date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
9
+    </delete>
10
+
5 11
     <select id="getFollowUpData" resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily">
6 12
         SELECT
7 13
             org_id,