Browse Source

定时任务

魏超 5 years ago
parent
commit
157ed41978
25 changed files with 200 additions and 213 deletions
  1. 21
    78
      src/main/java/com/huiju/estateagents/job/JudglActivityTimeJob.java
  2. 2
    2
      src/main/java/com/huiju/estateagents/mapper/HelpActivityMapper.java
  3. 1
    1
      src/main/java/com/huiju/estateagents/mapper/HelpInitiateRecordMapper.java
  4. 2
    4
      src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java
  5. 2
    4
      src/main/java/com/huiju/estateagents/mapper/TaShareActivityMapper.java
  6. 1
    1
      src/main/java/com/huiju/estateagents/mapper/TaShareChildRecordMapper.java
  7. 1
    1
      src/main/java/com/huiju/estateagents/mapper/TaShareRecordMapper.java
  8. 2
    3
      src/main/java/com/huiju/estateagents/service/IHelpActivityService.java
  9. 1
    1
      src/main/java/com/huiju/estateagents/service/IHelpInitiateRecordService.java
  10. 2
    4
      src/main/java/com/huiju/estateagents/service/ITaBuildingDynamicService.java
  11. 4
    6
      src/main/java/com/huiju/estateagents/service/ITaShareActivityService.java
  12. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaShareChildRecordService.java
  13. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaShareRecordService.java
  14. 4
    8
      src/main/java/com/huiju/estateagents/service/impl/HelpActivityServiceImpl.java
  15. 2
    10
      src/main/java/com/huiju/estateagents/service/impl/HelpInitiateRecordServiceImpl.java
  16. 4
    8
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingDynamicServiceImpl.java
  17. 4
    9
      src/main/java/com/huiju/estateagents/service/impl/TaShareActivityServiceImpl.java
  18. 2
    11
      src/main/java/com/huiju/estateagents/service/impl/TaShareChildRecordServiceImpl.java
  19. 2
    11
      src/main/java/com/huiju/estateagents/service/impl/TaShareRecordServiceImpl.java
  20. 37
    11
      src/main/resources/mapper/HelpActivityMapper.xml
  21. 12
    6
      src/main/resources/mapper/HelpInitiateRecordMapper.xml
  22. 36
    11
      src/main/resources/mapper/TaBuildingDynamicMapper.xml
  23. 36
    11
      src/main/resources/mapper/TaShareActivityMapper.xml
  24. 9
    5
      src/main/resources/mapper/TaShareChildRecordMapper.xml
  25. 11
    5
      src/main/resources/mapper/TaShareRecordMapper.xml

+ 21
- 78
src/main/java/com/huiju/estateagents/job/JudglActivityTimeJob.java View File

1
 package com.huiju.estateagents.job;
1
 package com.huiju.estateagents.job;
2
 
2
 
3
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
-import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.huiju.estateagents.base.BaseController;
3
 import com.huiju.estateagents.base.BaseController;
6
-import com.huiju.estateagents.base.ResponseBean;
7
-import com.huiju.estateagents.common.StringUtils;
8
-import com.huiju.estateagents.entity.HelpActivity;
9
-import com.huiju.estateagents.entity.TaBuildingDynamic;
10
-import com.huiju.estateagents.entity.TaShareActivity;
11
 import com.huiju.estateagents.service.*;
4
 import com.huiju.estateagents.service.*;
12
-import io.swagger.models.auth.In;
13
 import org.springframework.beans.factory.annotation.Autowired;
5
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.context.annotation.Configuration;
6
 import org.springframework.context.annotation.Configuration;
15
 import org.springframework.scheduling.annotation.EnableScheduling;
7
 import org.springframework.scheduling.annotation.EnableScheduling;
16
 import org.springframework.scheduling.annotation.Scheduled;
8
 import org.springframework.scheduling.annotation.Scheduled;
17
 import org.springframework.stereotype.Component;
9
 import org.springframework.stereotype.Component;
18
 
10
 
19
-import java.time.LocalDateTime;
20
-import java.util.ArrayList;
21
-import java.util.List;
22
-
23
 /**
11
 /**
24
  * @author admin
12
  * @author admin
25
  * @Title: JudglActivityTimeJob
13
  * @Title: JudglActivityTimeJob
56
      * 开启定时任务,每天1230执行
44
      * 开启定时任务,每天1230执行
57
      */
45
      */
58
     @Scheduled(cron = "* 0/5 ** * * ?")
46
     @Scheduled(cron = "* 0/5 ** * * ?")
59
-//    @Scheduled(cron = "0/5 * * * * ?")
60
     private void configureTasks() {
47
     private void configureTasks() {
61
 
48
 
62
-        //活动列表
63
-        QueryWrapper<TaBuildingDynamic> buildingDynamicQueryWrapper = new QueryWrapper<>();
64
-        buildingDynamicQueryWrapper.ne("activity_status", "2");
65
-        List<TaBuildingDynamic> taBuildingDynamics = iTaBuildingDynamicService.list(buildingDynamicQueryWrapper);
66
-
67
-        //拼团活动列表
68
-        QueryWrapper<TaShareActivity> shareActivityQueryWrapper = new QueryWrapper<>();
69
-        shareActivityQueryWrapper.ne("activity_status", "2");
70
-        List<TaShareActivity> taShareActivities = iTaShareActivityService.list(shareActivityQueryWrapper);
71
-
72
-        //助力活动列表
73
-        QueryWrapper<HelpActivity> activityQueryWrapper = new QueryWrapper<>();
74
-        activityQueryWrapper.ne("activity_status", "2");
75
-        List<HelpActivity> helpActivities = iHelpActivityService.list(activityQueryWrapper);
76
-
77
-        LocalDateTime nowTime = LocalDateTime.now();
78
-
79
-        List<String> startActivityIds = new ArrayList<>();
80
-        List<String> endActivityIds = new ArrayList<>();
81
-        for (TaBuildingDynamic taBuildingDynamic : taBuildingDynamics){
82
-            LocalDateTime startTime = taBuildingDynamic.getStartDate();
83
-            LocalDateTime endTime = taBuildingDynamic.getEndDate();
84
-            if (nowTime.isAfter(startTime) && endTime.isAfter(nowTime)){
85
-                startActivityIds.add(taBuildingDynamic.getDynamicId());
86
-            }
87
-            if (nowTime.isAfter(endTime)){
88
-                endActivityIds.add(taBuildingDynamic.getDynamicId());
89
-            }
90
-        }
91
-        iTaBuildingDynamicService.updateUnStartActivity(startActivityIds);
92
-        iTaBuildingDynamicService.updateEndActivity(endActivityIds);
93
-
94
-
95
-        List<Integer> startGroupActivityIds = new ArrayList<>();
96
-        List<Integer> endGroupActivityIds = new ArrayList<>();
97
-        for (TaShareActivity taShareActivity : taShareActivities){
98
-            LocalDateTime startTime = taShareActivity.getStartTime();
99
-            LocalDateTime endTime = taShareActivity.getEndTime();
100
-            if (nowTime.isAfter(startTime) && endTime.isAfter(nowTime)){
101
-                startGroupActivityIds.add(taShareActivity.getGroupActivityId());
102
-            }
103
-            if (nowTime.isAfter(endTime)){
104
-                endGroupActivityIds.add(taShareActivity.getGroupActivityId());
105
-            }
106
-        }
107
-        iTaShareActivityService.updateUnStartActivity(startGroupActivityIds);
108
-        iTaShareActivityService.updateEndActivity(endGroupActivityIds);
109
-        iTaShareRecordService.updateEndActivity(endGroupActivityIds);
110
-        iTaShareChildRecordService.updateEndActivity(endGroupActivityIds);
111
-
112
-        List<Integer> startHelpActivityIds = new ArrayList<>();
113
-        List<Integer> endHelpActivityIds = new ArrayList<>();
114
-        for (HelpActivity helpActivity : helpActivities){
115
-            LocalDateTime startTime = helpActivity.getStartDate();
116
-            LocalDateTime endTime = helpActivity.getEndDate();
117
-            if (nowTime.isAfter(startTime) && endTime.isAfter(nowTime)){
118
-                startHelpActivityIds.add(helpActivity.getHelpActivityId());
119
-            }
120
-            if (nowTime.isAfter(endTime)){
121
-                endHelpActivityIds.add(helpActivity.getHelpActivityId());
122
-            }
123
-        }
124
-        iHelpActivityService.updateUnStartActivity(startHelpActivityIds);
125
-        iHelpActivityService.updateEndActivity(endHelpActivityIds);
126
-        iHelpInitiateRecordService.updateEndActivity(endHelpActivityIds);
49
+        //未开始活动更新为已开始
50
+        iTaBuildingDynamicService.updateUnStartActivity();
51
+        //进行中活动更新为已结束
52
+        iTaBuildingDynamicService.updateProcessingActivity();
53
+
54
+        //未开始拼团活动更新为已开始
55
+        iTaShareActivityService.updateUnStartGroupActivity();
56
+        //进行中拼团活动更新为已结束
57
+        iTaShareActivityService.updateProcessingGroupActivity();
58
+
59
+        //更新拼团者和参团者数据为已结束
60
+        iTaShareRecordService.updateActivityProcessToEnd();
61
+        iTaShareChildRecordService.updateActivityProcessToEnd();
62
+
63
+        //未开始助力活动更新为已开始
64
+        iHelpActivityService.updateUnStartHelpActivity();
65
+        //进行中助力活动更新为已结束
66
+        iHelpActivityService.updateProcessingHelpActivity();
67
+
68
+        //更新助力者和发起者数据为已结束
69
+        iHelpInitiateRecordService.updateHelpActivityProcessToEnd();
127
     }
70
     }
128
 
71
 
129
 }
72
 }

+ 2
- 2
src/main/java/com/huiju/estateagents/mapper/HelpActivityMapper.java View File

33
      */
33
      */
34
     IPage<HelpActivity> helpActivityListPage(IPage<HelpActivity> pg, @Param("cityId")Integer cityId, @Param("buildingId")String buildingId, @Param("title")String title, @Param("startDate")String startDate, @Param("endDate") String endDate, @Param("activityStatus")Integer activityStatus, @Param("orgId")Integer orgId);
34
     IPage<HelpActivity> helpActivityListPage(IPage<HelpActivity> pg, @Param("cityId")Integer cityId, @Param("buildingId")String buildingId, @Param("title")String title, @Param("startDate")String startDate, @Param("endDate") String endDate, @Param("activityStatus")Integer activityStatus, @Param("orgId")Integer orgId);
35
 
35
 
36
-    void updateUnStartHelpActivity(@Param("list") List<Integer> startHelpActivityId);
36
+    void updateUnStartHelpActivity();
37
 
37
 
38
-    void updateEndHelpActivity(@Param("list")List<Integer> endHelpActivityId);
38
+    void updateProcessingHelpActivity();
39
 
39
 
40
     /**
40
     /**
41
      * 微信端查询拼团和助力推首页的活动的
41
      * 微信端查询拼团和助力推首页的活动的

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/HelpInitiateRecordMapper.java View File

56
 
56
 
57
     List<HelpInitiateRecordSucceed> getHelpInitiateRecordSucceedExportList(@Param("pageCode") int i, @Param("pageSize") Integer pageSize, @Param("tel") Integer tel, @Param("helpActivityId") Integer helpActivityId);
57
     List<HelpInitiateRecordSucceed> getHelpInitiateRecordSucceedExportList(@Param("pageCode") int i, @Param("pageSize") Integer pageSize, @Param("tel") Integer tel, @Param("helpActivityId") Integer helpActivityId);
58
 
58
 
59
-    void updateEndGroupActivity(List<Integer> endHelpActivityIds);
59
+    void updateHelpActivityProcessToEnd();
60
 	/**
60
 	/**
61
 	 * 获取我的助力列表
61
 	 * 获取我的助力列表
62
 	 * @param pg
62
 	 * @param pg

+ 2
- 4
src/main/java/com/huiju/estateagents/mapper/TaBuildingDynamicMapper.java View File

74
 
74
 
75
     /**
75
     /**
76
      * 更新未开始的活动
76
      * 更新未开始的活动
77
-     * @param startActivityIds
78
      */
77
      */
79
-    void updateUnStartActivity(@Param("list") List<String> startActivityIds);
78
+    void updateUnStartActivity();
80
 
79
 
81
     /**
80
     /**
82
      * 更新结束的活动
81
      * 更新结束的活动
83
-     * @param endActivityIds
84
      */
82
      */
85
-    void updateEndActivity(@Param("list") List<String> endActivityIds);
83
+    void updateProcessingActivity();
86
 }
84
 }

+ 2
- 4
src/main/java/com/huiju/estateagents/mapper/TaShareActivityMapper.java View File

20
 public interface TaShareActivityMapper extends BaseMapper<TaShareActivity> {
20
 public interface TaShareActivityMapper extends BaseMapper<TaShareActivity> {
21
     TaShareActivity selectTaShareActivityById(@Param("activityId")Integer activityId);
21
     TaShareActivity selectTaShareActivityById(@Param("activityId")Integer activityId);
22
 
22
 
23
-    void updateJoinPeople(@Param("activityId") Integer activityId);
23
+    void updateUnStartGroupActivity();
24
 
24
 
25
-    void updateUnStartGroupActivity(@Param("list") List<Integer> startGroupActivityId);
26
-
27
-    void updateEndGroupActivity(@Param("list")List<Integer> endGroupActivityId);
25
+    void updateProcessGroupActivity();
28
 
26
 
29
     Integer calParticipateNum(@Param("groupActivityId") Integer groupActivityId);
27
     Integer calParticipateNum(@Param("groupActivityId") Integer groupActivityId);
30
 }
28
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaShareChildRecordMapper.java View File

21
 public interface TaShareChildRecordMapper extends BaseMapper<TaShareChildRecord> {
21
 public interface TaShareChildRecordMapper extends BaseMapper<TaShareChildRecord> {
22
     IPage<TaShareChildRecord> getList(IPage<TaShareChildRecord> pg, @Param("groupActivityId") Integer groupActivityId, @Param("status") Integer status, @Param("recordId") Integer recordId, @Param("orgId") Integer orgId);
22
     IPage<TaShareChildRecord> getList(IPage<TaShareChildRecord> pg, @Param("groupActivityId") Integer groupActivityId, @Param("status") Integer status, @Param("recordId") Integer recordId, @Param("orgId") Integer orgId);
23
     List<ShareChildRecordExport> getShareRecordExportList(@Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("recordId") Integer recordId , @Param("status")Integer status, @Param("groupActivityId") Integer groupActivityId);
23
     List<ShareChildRecordExport> getShareRecordExportList(@Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("recordId") Integer recordId , @Param("status")Integer status, @Param("groupActivityId") Integer groupActivityId);
24
-    void updateEndGroupActivity(List<Integer> endGroupActivityIds);
24
+    void updateEndGroupActivity();
25
 }
25
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaShareRecordMapper.java View File

28
     List<ShareRecordSuccessExport> getShareRecordSuccessExportList(@Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("recordId") Integer recordId , @Param("status")Integer status, @Param("groupActivityId") Integer groupActivityId);
28
     List<ShareRecordSuccessExport> getShareRecordSuccessExportList(@Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("recordId") Integer recordId , @Param("status")Integer status, @Param("groupActivityId") Integer groupActivityId);
29
     List<ShareRecordFailExport> getShareRecordFailExportList(@Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("recordId") Integer recordId , @Param("status")Integer status, @Param("groupActivityId") Integer groupActivityId);
29
     List<ShareRecordFailExport> getShareRecordFailExportList(@Param("pageCode") Integer pageCode, @Param("pageSize") Integer pageSize, @Param("recordId") Integer recordId , @Param("status")Integer status, @Param("groupActivityId") Integer groupActivityId);
30
 	List<TaShareRecord> getShareRecordList(Page<TaShareRecord> pg,@Param("orgId") Integer orgId,@Param("personId") String personId);
30
 	List<TaShareRecord> getShareRecordList(Page<TaShareRecord> pg,@Param("orgId") Integer orgId,@Param("personId") String personId);
31
-    void updateEndGroupActivity(@Param("list")List<Integer> endGroupActivityIds);
31
+    void updateEndGroupActivity();
32
 }
32
 }

+ 2
- 3
src/main/java/com/huiju/estateagents/service/IHelpActivityService.java View File

118
     /**
118
     /**
119
      * 开始助力活动
119
      * 开始助力活动
120
      */
120
      */
121
-    void updateUnStartActivity(List<Integer> startGroupActivityIds);
121
+    void updateUnStartHelpActivity();
122
 
122
 
123
     /**
123
     /**
124
      * 结束助力活动
124
      * 结束助力活动
125
-     * @param endGroupActivityIds
126
      */
125
      */
127
-    void updateEndActivity(List<Integer> endGroupActivityIds);
126
+    void updateProcessingHelpActivity();
128
 
127
 
129
     /**
128
     /**
130
      * 微信端查询拼团和助力推首页的活动的
129
      * 微信端查询拼团和助力推首页的活动的

+ 1
- 1
src/main/java/com/huiju/estateagents/service/IHelpInitiateRecordService.java View File

26
 	 */
26
 	 */
27
 	ResponseBean getInitiateRecord(Integer pageNum, Integer pageSize, Integer orgId, String personId);
27
 	ResponseBean getInitiateRecord(Integer pageNum, Integer pageSize, Integer orgId, String personId);
28
 
28
 
29
-	void updateEndActivity(List<Integer> endHelpActivityIds);
29
+	void updateHelpActivityProcessToEnd();
30
 }
30
 }

+ 2
- 4
src/main/java/com/huiju/estateagents/service/ITaBuildingDynamicService.java View File

89
 
89
 
90
     /**
90
     /**
91
      * 开始未进行的活动
91
      * 开始未进行的活动
92
-     * @param startActivityId
93
      */
92
      */
94
-    void updateUnStartActivity(List<String> startActivityId);
93
+    void updateUnStartActivity();
95
 
94
 
96
     /**
95
     /**
97
      * 结束过期的活动
96
      * 结束过期的活动
98
-     * @param endActivityId
99
      */
97
      */
100
-    void updateEndActivity(List<String> endActivityId);
98
+    void updateProcessingActivity();
101
 
99
 
102
     /**
100
     /**
103
      * 报名记录导出当前总数
101
      * 报名记录导出当前总数

+ 4
- 6
src/main/java/com/huiju/estateagents/service/ITaShareActivityService.java View File

20
     ResponseBean getList(Integer pageNum, Integer pageSize, String buildingId, String activityName, String status, LocalDateTime startTime, LocalDateTime endTime, Integer cityId, Integer orgId);
20
     ResponseBean getList(Integer pageNum, Integer pageSize, String buildingId, String activityName, String status, LocalDateTime startTime, LocalDateTime endTime, Integer cityId, Integer orgId);
21
 
21
 
22
     /**
22
     /**
23
-     * 开始未进行的活动
24
-     * @param startGroupActivityId
23
+     * 活动未开始更新为进行中
25
      */
24
      */
26
-    void updateUnStartActivity(List<Integer> startGroupActivityId);
25
+    void updateUnStartGroupActivity();
27
 
26
 
28
     /**
27
     /**
29
-     * 结束过期的活动
30
-     * @param endGroupActivityId
28
+     * 活动进行中更新为已结束
31
      */
29
      */
32
-    void updateEndActivity(List<Integer> endGroupActivityId);
30
+    void updateProcessingGroupActivity();
33
 
31
 
34
     /**
32
     /**
35
      * 查询拼团  已开始 和 未开始
33
      * 查询拼团  已开始 和 未开始

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaShareChildRecordService.java View File

22
     ResponseBean validateRule(TaShareChildRecord taShareChildRecord);
22
     ResponseBean validateRule(TaShareChildRecord taShareChildRecord);
23
     Integer getShareRecord(Integer recordId, Integer status);
23
     Integer getShareRecord(Integer recordId, Integer status);
24
     List<ShareChildRecordExport> getShareRecordExportList(Integer pageCode, Integer pageSize, Integer recordId, Integer status, Integer groupActivityId);
24
     List<ShareChildRecordExport> getShareRecordExportList(Integer pageCode, Integer pageSize, Integer recordId, Integer status, Integer groupActivityId);
25
-	void updateEndActivity(List<Integer> endGroupActivityIds);
25
+	void updateActivityProcessToEnd();
26
 	/**
26
 	/**
27
 	 * 微信端成为团员
27
 	 * 微信端成为团员
28
 	 *
28
 	 *

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaShareRecordService.java View File

29
     Integer getShareRecord(Integer recordId, Integer status);
29
     Integer getShareRecord(Integer recordId, Integer status);
30
     List<ShareRecordSuccessExport>  getShareRecordSuccessExportList(Integer pageCode, Integer pageSize, Integer recordId, Integer status, Integer groupActivityId);
30
     List<ShareRecordSuccessExport>  getShareRecordSuccessExportList(Integer pageCode, Integer pageSize, Integer recordId, Integer status, Integer groupActivityId);
31
     List<ShareRecordFailExport>  getShareRecordFailExportList(Integer pageCode, Integer pageSize, Integer recordId, Integer status, Integer groupActivityId);
31
     List<ShareRecordFailExport>  getShareRecordFailExportList(Integer pageCode, Integer pageSize, Integer recordId, Integer status, Integer groupActivityId);
32
-	void updateEndActivity(List<Integer> endGroupActivityIds);
32
+	void updateActivityProcessToEnd();
33
     /**
33
     /**
34
 	 * 分页获取微信端发起拼团记录
34
 	 * 分页获取微信端发起拼团记录
35
 	 * @param pageNum
35
 	 * @param pageNum

+ 4
- 8
src/main/java/com/huiju/estateagents/service/impl/HelpActivityServiceImpl.java View File

197
     }
197
     }
198
 
198
 
199
     @Override
199
     @Override
200
-    public void updateUnStartActivity(List<Integer> startHelpActivityIds) {
201
-        if (CollectionUtils.isNotEmpty(startHelpActivityIds)){
202
-            taHelpActivityMapper.updateUnStartHelpActivity(startHelpActivityIds);
203
-        }
200
+    public void updateUnStartHelpActivity() {
201
+        taHelpActivityMapper.updateUnStartHelpActivity();
204
     }
202
     }
205
 
203
 
206
     @Override
204
     @Override
207
-    public void updateEndActivity(List<Integer> endHelpActivityIds) {
208
-        if (CollectionUtils.isNotEmpty(endHelpActivityIds)){
209
-            taHelpActivityMapper.updateEndHelpActivity(endHelpActivityIds);
210
-        }
205
+    public void updateProcessingHelpActivity() {
206
+        taHelpActivityMapper.updateProcessingHelpActivity();
211
     }
207
     }
212
 
208
 
213
     @Override
209
     @Override

+ 2
- 10
src/main/java/com/huiju/estateagents/service/impl/HelpInitiateRecordServiceImpl.java View File

45
 	}
45
 	}
46
 
46
 
47
 	@Override
47
 	@Override
48
-	public void updateEndActivity(List<Integer> endHelpActivityIds) {
49
-		if (CollectionUtils.isNotEmpty(endHelpActivityIds)){
50
-			List<HelpInitiateRecord> helpInitiateRecords = helpInitiateRecordMapper.selectBatchIds(endHelpActivityIds);
51
-			for (HelpInitiateRecord helpInitiateRecord : helpInitiateRecords){
52
-				helpInitiateRecord.setStatus(2);
53
-				if (helpInitiateRecord.getStatus() != 0){
54
-					helpInitiateRecordMapper.updateById(helpInitiateRecord);
55
-				}
56
-			}
57
-		}
48
+	public void updateHelpActivityProcessToEnd() {
49
+		helpInitiateRecordMapper.updateHelpActivityProcessToEnd();
58
 	}
50
 	}
59
 }
51
 }

+ 4
- 8
src/main/java/com/huiju/estateagents/service/impl/TaBuildingDynamicServiceImpl.java View File

328
     }
328
     }
329
 
329
 
330
     @Override
330
     @Override
331
-    public void updateUnStartActivity(List<String> startActivityIds) {
332
-        if (CollectionUtils.isNotEmpty(startActivityIds)){
333
-            buildingDynamicMapper.updateUnStartActivity(startActivityIds);
334
-        }
331
+    public void updateUnStartActivity() {
332
+        buildingDynamicMapper.updateUnStartActivity();
335
     }
333
     }
336
 
334
 
337
     @Override
335
     @Override
338
-    public void updateEndActivity(List<String> endActivityIds) {
339
-        if (CollectionUtils.isNotEmpty(endActivityIds)){
340
-            buildingDynamicMapper.updateEndActivity(endActivityIds);
341
-        }
336
+    public void updateProcessingActivity() {
337
+        buildingDynamicMapper.updateProcessingActivity();
342
     }
338
     }
343
 
339
 
344
     @Override
340
     @Override

+ 4
- 9
src/main/java/com/huiju/estateagents/service/impl/TaShareActivityServiceImpl.java View File

60
     }
60
     }
61
 
61
 
62
     @Override
62
     @Override
63
-    public void updateUnStartActivity(List<Integer> startGroupActivityId) {
64
-        if (CollectionUtils.isNotEmpty(startGroupActivityId)){
65
-            taShareActivityMapper.updateUnStartGroupActivity(startGroupActivityId);
66
-        }
63
+    public void updateUnStartGroupActivity() {
64
+        taShareActivityMapper.updateUnStartGroupActivity();
67
     }
65
     }
68
 
66
 
69
     @Override
67
     @Override
70
-    public void updateEndActivity(List<Integer> endGroupActivityId) {
71
-
72
-        if (CollectionUtils.isNotEmpty(endGroupActivityId)){
73
-            taShareActivityMapper.updateEndGroupActivity(endGroupActivityId);
74
-        }
68
+    public void updateProcessingGroupActivity() {
69
+        taShareActivityMapper.updateProcessGroupActivity();
75
     }
70
     }
76
 
71
 
77
     @Override
72
     @Override

+ 2
- 11
src/main/java/com/huiju/estateagents/service/impl/TaShareChildRecordServiceImpl.java View File

80
             //扣取积分,更新参团人数
80
             //扣取积分,更新参团人数
81
             taPerson.setPoints(taPerson.getPoints() - taShareActivity.getIntegral());
81
             taPerson.setPoints(taPerson.getPoints() - taShareActivity.getIntegral());
82
             taPersonMapper.updateById(taPerson);
82
             taPersonMapper.updateById(taPerson);
83
-            activityMapper.updateJoinPeople(taShareChildRecord.getGroupActivityId());
84
             responseBean.addSuccess("您已成功参团");
83
             responseBean.addSuccess("您已成功参团");
85
 
84
 
86
         }catch (Exception e){
85
         }catch (Exception e){
106
     }
105
     }
107
 
106
 
108
     @Override
107
     @Override
109
-    public void updateEndActivity(List<Integer> endGroupActivityIds) {
110
-        if (CollectionUtils.isNotEmpty(endGroupActivityIds)){
111
-            List<TaShareChildRecord> taShareChildRecords = taShareChildRecordMapper.selectBatchIds(endGroupActivityIds);
112
-            for (TaShareChildRecord taShareChildRecord : taShareChildRecords){
113
-                taShareChildRecord.setStatus(2);
114
-                if (taShareChildRecord.getStatus() != 0){
115
-                    taShareChildRecordMapper.updateById(taShareChildRecord);
116
-                }
117
-            }
118
-        }
108
+    public void updateActivityProcessToEnd() {
109
+        taShareChildRecordMapper.updateEndGroupActivity();
119
     }
110
     }
120
 
111
 
121
     /**
112
     /**

+ 2
- 11
src/main/java/com/huiju/estateagents/service/impl/TaShareRecordServiceImpl.java View File

79
             //扣取积分,更新参团人数
79
             //扣取积分,更新参团人数
80
             taPerson.setPoints(taPerson.getPoints() - taShareActivity.getIntegral());
80
             taPerson.setPoints(taPerson.getPoints() - taShareActivity.getIntegral());
81
             taPersonMapper.updateById(taPerson);
81
             taPersonMapper.updateById(taPerson);
82
-            activityMapper.updateJoinPeople(taShareRecord.getGroupActivityId());
83
             responseBean.addSuccess("您已成功发起拼团,赶快邀请好友参团吧");
82
             responseBean.addSuccess("您已成功发起拼团,赶快邀请好友参团吧");
84
 
83
 
85
         }catch (Exception e){
84
         }catch (Exception e){
151
     }
150
     }
152
 
151
 
153
     @Override
152
     @Override
154
-    public void updateEndActivity(List<Integer> endGroupActivityIds) {
155
-        if (CollectionUtils.isNotEmpty(endGroupActivityIds)){
156
-            List<TaShareRecord> taShareRecords = taShareRecordMapper.selectBatchIds(endGroupActivityIds);
157
-            for (TaShareRecord taShareRecord : taShareRecords){
158
-                taShareRecord.setStatus(2);
159
-                if (taShareRecord.getStatus() != 0){
160
-                    taShareRecordMapper.updateById(taShareRecord);
161
-                }
162
-            }
163
-        }
153
+    public void updateActivityProcessToEnd() {
154
+        taShareRecordMapper.updateEndGroupActivity();
164
     }
155
     }
165
 
156
 
166
     /**
157
     /**

+ 37
- 11
src/main/resources/mapper/HelpActivityMapper.xml View File

38
     </select>
38
     </select>
39
 
39
 
40
     <update id="updateUnStartHelpActivity">
40
     <update id="updateUnStartHelpActivity">
41
-        update ta_help_activity t set t.activity_status = 0
42
-        where t.help_activity_id in
43
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
44
-            #{item}
45
-        </foreach>
41
+        update ta_help_activity
42
+        set activity_status = 0
43
+        where
44
+        help_activity_id in (
45
+            select
46
+            help_activity_id
47
+            from
48
+            (
49
+            select
50
+            t.help_activity_id
51
+            from
52
+            ta_help_activity t
53
+            where
54
+            t.activity_status != '2'
55
+            and NOW() > t.start_date
56
+            and NOW() &lt; t.end_date
57
+            ) s
58
+        )
46
     </update>
59
     </update>
47
 
60
 
48
-    <update id="updateEndHelpActivity">
49
-        update ta_help_activity t set t.activity_status = 2
50
-        where t.help_activity_id in
51
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
52
-            #{item}
53
-        </foreach>
61
+    <update id="updateProcessingHelpActivity">
62
+        update ta_help_activity
63
+        set activity_status = 2
64
+        where
65
+            help_activity_id in (
66
+                select
67
+                    help_activity_id
68
+                from
69
+                    (
70
+                        select
71
+                            t.help_activity_id
72
+                        from
73
+                            ta_help_activity t
74
+                        where
75
+                            t.activity_status != '2'
76
+                        and NOW() > t.end_date
77
+                    ) s
78
+            )
54
     </update>
79
     </update>
80
+
55
     <select id="selectWxhelpActivityAndGroup" resultType="com.huiju.estateagents.entity.HelpActivity">
81
     <select id="selectWxhelpActivityAndGroup" resultType="com.huiju.estateagents.entity.HelpActivity">
56
 		(
82
 		(
57
 			SELECT
83
 			SELECT

+ 12
- 6
src/main/resources/mapper/HelpInitiateRecordMapper.xml View File

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.mapper.HelpInitiateRecordMapper">
3
 <mapper namespace="com.huiju.estateagents.mapper.HelpInitiateRecordMapper">
4
 
4
 
5
-    <update id="updateEndGroupActivity">
6
-        update ta_help_initiate_record t set t.status = 2
7
-        where t.help_activity_id in
8
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
9
-            #{item}
10
-        </foreach>
5
+    <update id="updateHelpActivityProcessToEnd">
6
+      update ta_help_initiate_record a
7
+        set a.`status` = '2'
8
+        where
9
+            a.help_activity_id in (
10
+                select
11
+                    t.help_activity_id
12
+                from
13
+                    ta_help_activity t
14
+                where (NOW() > t.end_date or t.activity_status = '2')
15
+            )
16
+        and a.`status` = '1'
11
     </update>
17
     </update>
12
 
18
 
13
     <select id="selectPageList" resultType="com.huiju.estateagents.entity.HelpInitiateRecord">
19
     <select id="selectPageList" resultType="com.huiju.estateagents.entity.HelpInitiateRecord">

+ 36
- 11
src/main/resources/mapper/TaBuildingDynamicMapper.xml View File

96
     </update>
96
     </update>
97
 
97
 
98
     <update id="updateUnStartActivity">
98
     <update id="updateUnStartActivity">
99
-      update ta_building_dynamic t set t.activity_status = 0
100
-      where t.dynamic_id in
101
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
102
-            #{item}
103
-        </foreach>
99
+        update ta_building_dynamic
100
+        set activity_status = 0
101
+        where
102
+        dynamic_id in (
103
+            select
104
+            dynamic_id
105
+            from
106
+            (
107
+            select
108
+            t.dynamic_id
109
+            from
110
+            ta_building_dynamic t
111
+            where
112
+            t.activity_status != '2'
113
+            and NOW() > t.create_date
114
+            and NOW() &lt; t.end_date
115
+            ) s
116
+        )
104
     </update>
117
     </update>
105
 
118
 
106
-    <update id="updateEndActivity">
107
-        update ta_building_dynamic t set t.activity_status = 2
108
-        where t.dynamic_id in
109
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
110
-            #{item}
111
-        </foreach>
119
+    <update id="updateProcessingActivity">
120
+        update ta_building_dynamic
121
+        set activity_status = 2
122
+        where
123
+            dynamic_id in (
124
+                select
125
+                    dynamic_id
126
+                from
127
+                    (
128
+                        select
129
+                            t.dynamic_id
130
+                        from
131
+                            ta_building_dynamic t
132
+                        where
133
+                            t.activity_status != '2'
134
+                        and NOW() > t.end_date
135
+                    ) s
136
+            );
112
     </update>
137
     </update>
113
 
138
 
114
     <select id="updateTaBuildingDynamic">
139
     <select id="updateTaBuildingDynamic">

+ 36
- 11
src/main/resources/mapper/TaShareActivityMapper.xml View File

16
     </select>
16
     </select>
17
 
17
 
18
     <update id="updateUnStartGroupActivity">
18
     <update id="updateUnStartGroupActivity">
19
-        update ta_share_activity t set t.activity_status = 0
20
-        where t.group_activity_id in
21
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
22
-            #{item}
23
-        </foreach>
19
+        update ta_share_activity
20
+        set activity_status = 0
21
+        where
22
+        group_activity_id in (
23
+            select
24
+            group_activity_id
25
+            from
26
+            (
27
+            select
28
+            t.group_activity_id
29
+            from
30
+            ta_share_activity t
31
+            where
32
+            t.activity_status != '2'
33
+            and NOW() > t.start_time
34
+            and NOW() &lt; t.end_time
35
+            ) s
36
+        )
24
     </update>
37
     </update>
25
 
38
 
26
-    <update id="updateEndGroupActivity">
27
-        update ta_share_activity t set t.activity_status = 2
28
-        where t.group_activity_id in
29
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
30
-            #{item}
31
-        </foreach>
39
+    <update id="updateProcessGroupActivity">
40
+        update ta_share_activity
41
+        set activity_status = 2
42
+        where
43
+	    group_activity_id in (
44
+            select
45
+                group_activity_id
46
+            from
47
+                (
48
+                    select
49
+                        t.group_activity_id
50
+                    from
51
+                        ta_share_activity t
52
+                    where
53
+                        t.activity_status != '2'
54
+                    and NOW() > t.end_time
55
+                ) s
56
+	    )
32
     </update>
57
     </update>
33
 
58
 
34
     <select id="calParticipateNum" resultType="java.lang.Integer">
59
     <select id="calParticipateNum" resultType="java.lang.Integer">

+ 9
- 5
src/main/resources/mapper/TaShareChildRecordMapper.xml View File

3
 <mapper namespace="com.huiju.estateagents.mapper.TaShareChildRecordMapper">
3
 <mapper namespace="com.huiju.estateagents.mapper.TaShareChildRecordMapper">
4
 
4
 
5
     <update id="updateEndGroupActivity">
5
     <update id="updateEndGroupActivity">
6
-        update ta_share_child_record t set t.status = 2
7
-        where t.group_activity_id in
8
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
9
-            #{item}
10
-        </foreach>
6
+        update ta_share_child_record a
7
+        set a.`status` = '2'
8
+        where a.group_activity_id in (
9
+            select
10
+                    t.group_activity_id
11
+                from
12
+                    ta_share_activity t
13
+                where (NOW() > t.end_time or t.activity_status = '2')
14
+        ) and a.`status` = '1';
11
     </update>
15
     </update>
12
 
16
 
13
     <select id="getList" resultType="com.huiju.estateagents.entity.TaShareChildRecord">
17
     <select id="getList" resultType="com.huiju.estateagents.entity.TaShareChildRecord">

+ 11
- 5
src/main/resources/mapper/TaShareRecordMapper.xml View File

3
 <mapper namespace="com.huiju.estateagents.mapper.TaShareRecordMapper">
3
 <mapper namespace="com.huiju.estateagents.mapper.TaShareRecordMapper">
4
 
4
 
5
     <update id="updateEndGroupActivity">
5
     <update id="updateEndGroupActivity">
6
-        update ta_share_record t set t.status = 2
7
-        where t.group_activity_id in
8
-        <foreach collection="list" item="item" open="(" close=")" separator=",">
9
-            #{item}
10
-        </foreach>
6
+        update ta_share_record a
7
+        set a.`status` = '2'
8
+        where
9
+            a.group_activity_id in (
10
+                select
11
+                    t.group_activity_id
12
+                from
13
+                    ta_share_activity t
14
+                where (NOW() > t.end_time or t.activity_status = '2')
15
+            )
16
+        and a.`status` = '1';
11
     </update>
17
     </update>
12
 
18
 
13
     <select id="recordSuccessList" resultType="com.huiju.estateagents.entity.TaShareRecord">
19
     <select id="recordSuccessList" resultType="com.huiju.estateagents.entity.TaShareRecord">