|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.example.wholeestate.service.impl;
|
2
|
2
|
|
|
3
|
+import com.alibaba.fastjson.JSONArray;
|
3
|
4
|
import com.alibaba.fastjson.JSONObject;
|
4
|
5
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
5
|
6
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -8,10 +9,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
8
|
9
|
import com.example.wholeestate.common.resp.ResponseBean;
|
9
|
10
|
import com.example.wholeestate.common.uuid.IdGen;
|
10
|
11
|
import com.example.wholeestate.dao.AppointmentMapper;
|
|
12
|
+import com.example.wholeestate.dao.BuildingImgMapper;
|
11
|
13
|
import com.example.wholeestate.dao.BuildingMapper;
|
12
|
14
|
import com.example.wholeestate.dao.CustomerMapper;
|
13
|
15
|
import com.example.wholeestate.model.Appointment;
|
14
|
16
|
import com.example.wholeestate.model.Building;
|
|
17
|
+import com.example.wholeestate.model.BuildingImg;
|
15
|
18
|
import com.example.wholeestate.model.Customer;
|
16
|
19
|
import com.example.wholeestate.service.IBuildingService;
|
17
|
20
|
import com.fasterxml.jackson.databind.util.ArrayBuilders;
|
|
@@ -43,6 +46,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
|
43
|
46
|
|
44
|
47
|
@Autowired
|
45
|
48
|
private CustomerMapper customerMapper;
|
|
49
|
+
|
|
50
|
+ @Autowired
|
|
51
|
+ private BuildingImgMapper buildingImgMapper;
|
46
|
52
|
private IdGen idGen = IdGen.get();
|
47
|
53
|
|
48
|
54
|
@Override
|
|
@@ -147,6 +153,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
|
147
|
153
|
|
148
|
154
|
JSONObject object= JSONObject.parseObject(parameter);
|
149
|
155
|
|
|
156
|
+ JSONArray contentImg = object.getJSONArray("img");
|
|
157
|
+ String imgType = object.getString("imgType");
|
|
158
|
+ String orderNo = object.getString("orderNo");
|
|
159
|
+ String[] contentImgArray = contentImg.toArray(new String[]{});
|
150
|
160
|
Building building = JSONObject.parseObject(parameter,Building.class);
|
151
|
161
|
// if (!"".equals(building.getBuildingId())&&null!=building.getBuildingId()){
|
152
|
162
|
// response.addError("楼盘名称不能为空");
|
|
@@ -165,6 +175,17 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
|
165
|
175
|
building.setCreateDate(LocalDateTime.now());
|
166
|
176
|
building.setStatus(0);
|
167
|
177
|
buildingMapper.insert(building);
|
|
178
|
+
|
|
179
|
+ for (String img : contentImgArray) {
|
|
180
|
+ BuildingImg Images = new BuildingImg();
|
|
181
|
+ Images.setBuildingId(building.getBuildingId());
|
|
182
|
+ Images.setImgType(imgType);
|
|
183
|
+ Images.setUrl(img);
|
|
184
|
+ Images.setOrderNo(Integer.valueOf(orderNo));
|
|
185
|
+ Images.setStatus(0);
|
|
186
|
+ Images.setCreateDate(LocalDateTime.now());
|
|
187
|
+ buildingImgMapper.insert(Images);
|
|
188
|
+ }
|
168
|
189
|
response.addSuccess("成功");
|
169
|
190
|
return response;
|
170
|
191
|
}
|