顾绍勇 vor 5 Jahren
Ursprung
Commit
6ef99b7021

+ 12
- 32
src/main/java/com/huiju/estateagents/service/impl/TaSalesBatchServiceImpl.java Datei anzeigen

@@ -1,10 +1,9 @@
1 1
 package com.huiju.estateagents.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 6
 import com.huiju.estateagents.base.ResponseBean;
7
-import com.huiju.estateagents.common.DateUtils;
8 7
 import com.huiju.estateagents.entity.TaSalesBatch;
9 8
 import com.huiju.estateagents.mapper.TaSalesBatchMapper;
10 9
 import com.huiju.estateagents.service.ITaSalesBatchService;
@@ -13,9 +12,6 @@ import org.slf4j.LoggerFactory;
13 12
 import org.springframework.beans.factory.annotation.Autowired;
14 13
 import org.springframework.stereotype.Service;
15 14
 
16
-import java.time.LocalDateTime;
17
-import java.util.ArrayList;
18
-import java.util.Date;
19 15
 import java.util.List;
20 16
 import java.util.Map;
21 17
 
@@ -70,38 +66,22 @@ public class TaSalesBatchServiceImpl extends ServiceImpl<TaSalesBatchMapper, TaS
70 66
             return responseBean;
71 67
         }
72 68
 
73
-        List<String> noticeList = new ArrayList<>();
74
-        // 当前时间万余预选结束时间
75
-        if (DateUtils.isAfter(salesBatch.getPreselectionEndTime())) {
76
-            noticeList.add("预选已结束,请关注下轮预选");
77
-            responseBean.addSuccess(noticeList);
78
-            return responseBean;
79
-        }
80
-
81
-        // 当前时间早于预选开始时间
82
-        if (DateUtils.isBefore(salesBatch.getPreselectionStartTime())) {
83
-            String str = DateUtils.diffTime(DateUtils.timeToLocalDateTime(salesBatch.getPreselectionStartTime()), LocalDateTime.now());
84
-            noticeList.add("距离预选开始还有" + str);
85
-            responseBean.addSuccess(noticeList);
86
-            return responseBean;
87
-        }
88
-
89
-        // 当前时间在预选时间内
90
-        if (DateUtils.isAfter(salesBatch.getPreselectionStartTime()) && DateUtils.isBefore(salesBatch.getPreselectionEndTime())) {
91
-            String str = DateUtils.diffTime(LocalDateTime.now(), DateUtils.timeToLocalDateTime(salesBatch.getPreselectionEndTime()));
92
-            noticeList.add("距离预选结束还有" + str);
93
-        }
69
+        Long totalHouses = null;
70
+        Long totalRealHeat = null;
94 71
 
95 72
         // 获取房源预选数量
96 73
         Map<String, Long> result = taSalesBatchMapper.getTotalHousesAndHeat(salesBatchId);
97 74
         if (result != null) {
98
-            Long totalHouses = result.get("totalHouses");
99
-            Long totalRealHeat = result.get("totalRealHeat");
100
-            if (totalRealHeat != null && totalRealHeat > 0) {
101
-                noticeList.add("当前" + totalHouses + "套房源已有" + totalRealHeat + "人成功预选 ");
102
-            }
75
+            totalHouses = result.get("totalHouses");
76
+            totalRealHeat = result.get("totalRealHeat");
103 77
         }
104
-        responseBean.addSuccess(noticeList);
78
+
79
+        JSONObject obj = new JSONObject();
80
+        obj.put("preselectionStartTime", salesBatch.getPreselectionStartTime());
81
+        obj.put("preselectionEndTime", salesBatch.getPreselectionEndTime());
82
+        obj.put("salesNumber", totalHouses == null ? 0 : totalHouses);
83
+        obj.put("preselectionNumber", totalRealHeat == null ? 0 : totalRealHeat);
84
+        responseBean.addSuccess(obj);
105 85
         return responseBean;
106 86
     }
107 87
 }