|
@@ -1,10 +1,15 @@
|
1
|
1
|
package com.huiju.estateagents.service.impl;
|
2
|
2
|
|
3
|
3
|
import com.alibaba.fastjson.JSONObject;
|
|
4
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
4
|
5
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
6
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
6
|
7
|
import com.huiju.estateagents.base.ResponseBean;
|
|
8
|
+import com.huiju.estateagents.common.CommConstant;
|
|
9
|
+import com.huiju.estateagents.entity.TaPoster;
|
7
|
10
|
import com.huiju.estateagents.entity.TaSalesBatch;
|
|
11
|
+import com.huiju.estateagents.entity.TaShareContent;
|
|
12
|
+import com.huiju.estateagents.mapper.TaPosterMapper;
|
8
|
13
|
import com.huiju.estateagents.mapper.TaSalesBatchMapper;
|
9
|
14
|
import com.huiju.estateagents.service.ITaSalesBatchService;
|
10
|
15
|
import org.slf4j.Logger;
|
|
@@ -13,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
13
|
18
|
import org.springframework.stereotype.Service;
|
14
|
19
|
|
15
|
20
|
import java.math.BigDecimal;
|
|
21
|
+import java.util.ArrayList;
|
16
|
22
|
import java.util.List;
|
17
|
23
|
import java.util.Map;
|
18
|
24
|
|
|
@@ -32,6 +38,12 @@ public class TaSalesBatchServiceImpl extends ServiceImpl<TaSalesBatchMapper, TaS
|
32
|
38
|
@Autowired
|
33
|
39
|
private TaSalesBatchMapper taSalesBatchMapper;
|
34
|
40
|
|
|
41
|
+ @Autowired
|
|
42
|
+ TaPosterMapper taPosterMapper;
|
|
43
|
+
|
|
44
|
+ @Autowired
|
|
45
|
+ private ShareContentServiceImpl shareContentService;
|
|
46
|
+
|
35
|
47
|
@Override
|
36
|
48
|
public IPage<TaSalesBatch> selectByCondition(IPage<TaSalesBatch> page, String salesBatchName, String buildingId, Integer status, Integer orgId) {
|
37
|
49
|
return taSalesBatchMapper.selectByCondition(page, salesBatchName, buildingId, status, orgId);
|
|
@@ -74,15 +86,51 @@ public class TaSalesBatchServiceImpl extends ServiceImpl<TaSalesBatchMapper, TaS
|
74
|
86
|
Map<String, Object> result = taSalesBatchMapper.getTotalHousesAndHeat(salesBatchId);
|
75
|
87
|
if (result != null) {
|
76
|
88
|
totalHouses = (Long) result.get("totalHouses");
|
77
|
|
- totalRealHeat = (BigDecimal)result.get("totalRealHeat");
|
|
89
|
+ totalRealHeat = (BigDecimal) result.get("totalRealHeat");
|
78
|
90
|
}
|
79
|
91
|
|
80
|
92
|
JSONObject obj = new JSONObject();
|
81
|
93
|
obj.put("preselectionStartTime", salesBatch.getPreselectionStartTime());
|
82
|
94
|
obj.put("preselectionEndTime", salesBatch.getPreselectionEndTime());
|
83
|
|
- obj.put("salesNumber", totalHouses == null ? 0:totalHouses);
|
|
95
|
+ obj.put("salesNumber", totalHouses == null ? 0 : totalHouses);
|
84
|
96
|
obj.put("preselectionNumber", totalRealHeat == null ? 0 : totalRealHeat);
|
85
|
97
|
responseBean.addSuccess(obj);
|
86
|
98
|
return responseBean;
|
87
|
99
|
}
|
|
100
|
+
|
|
101
|
+ /**
|
|
102
|
+ * 获取销售批次详情
|
|
103
|
+ *
|
|
104
|
+ * @param salesBatchId
|
|
105
|
+ * @return
|
|
106
|
+ */
|
|
107
|
+ @Override
|
|
108
|
+ public ResponseBean getSalesBatchById(Integer salesBatchId) {
|
|
109
|
+ logger.info("getSalesBatchById 接收参数:saleBatchId:{}", salesBatchId);
|
|
110
|
+
|
|
111
|
+ ResponseBean responseBean = new ResponseBean();
|
|
112
|
+ TaSalesBatch result = getById(salesBatchId);
|
|
113
|
+ if (result == null) {
|
|
114
|
+ responseBean.addSuccess(null);
|
|
115
|
+ return responseBean;
|
|
116
|
+ }
|
|
117
|
+
|
|
118
|
+ // 获取海报信息
|
|
119
|
+ QueryWrapper<TaPoster>queryWrapper = new QueryWrapper<>();
|
|
120
|
+ queryWrapper.eq("target_id",salesBatchId + "");
|
|
121
|
+ queryWrapper.eq("target_type","house");
|
|
122
|
+ queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
|
|
123
|
+ TaPoster poster =taPosterMapper.selectOne(queryWrapper);
|
|
124
|
+
|
|
125
|
+ // 获取分享内容信息
|
|
126
|
+ List<TaShareContent> shareContentList = shareContentService.getPostersForTarget(salesBatchId + "", "house");
|
|
127
|
+
|
|
128
|
+ List<TaPoster> posterList = new ArrayList<>();
|
|
129
|
+ posterList.add(poster);
|
|
130
|
+
|
|
131
|
+ result.setPosters(posterList);
|
|
132
|
+ result.setShareContents(shareContentList);
|
|
133
|
+ responseBean.addSuccess(result);
|
|
134
|
+ return responseBean;
|
|
135
|
+ }
|
88
|
136
|
}
|