傅行帆 5 年 前
コミット
ba437de79f

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

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

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

52
 	 * @return
52
 	 * @return
53
 	 */
53
 	 */
54
 	List<TaCustomerStatisticDaily> getDailyList(@Param("customerType") String customerType,@Param("orgId")  Integer orgId,@Param("nowDate")  LocalDateTime nowDate,@Param("beforeDate")  LocalDateTime beforeDate);
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
 	 * @param customerType
98
 	 * @param customerType
99
 	 */
99
 	 */
100
 	private void statisticDailySaveBatch(List<TaCustomerStatisticDaily> list, LocalDateTime nowDate, String customerType) {
100
 	private void statisticDailySaveBatch(List<TaCustomerStatisticDaily> list, LocalDateTime nowDate, String customerType) {
101
+		//先删除当天数据在添加防止有脏数据
102
+		customerStatisticDailyMapper.deleteNowDate(nowDate,customerType);
103
+		
101
 		list.forEach(e -> {
104
 		list.forEach(e -> {
102
 			e.setCreateDate(nowDate);
105
 			e.setCreateDate(nowDate);
103
 			e.setCustomerType(customerType);
106
 			e.setCustomerType(customerType);

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

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.huiju.estateagents.statistic.mapper.TaCustomerStatisticDailyMapper">
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
     <select id="getFollowUpData" resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily">
11
     <select id="getFollowUpData" resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily">
6
         SELECT
12
         SELECT
7
             org_id,
13
             org_id,