|
@@ -11,6 +11,7 @@ import com.shigongli.constants.StatusConstant;
|
11
|
11
|
import com.shigongli.entity.TaPerson;
|
12
|
12
|
import com.shigongli.entity.TaShop;
|
13
|
13
|
import com.shigongli.entity.TaShopKeeper;
|
|
14
|
+import com.shigongli.service.ITaHouseSurroundService;
|
14
|
15
|
import com.shigongli.service.ITaShopKeeperService;
|
15
|
16
|
import com.shigongli.service.ITaShopService;
|
16
|
17
|
import io.swagger.annotations.Api;
|
|
@@ -25,6 +26,7 @@ import com.shigongli.service.ITaHouseService;
|
25
|
26
|
import com.shigongli.entity.TaHouse;
|
26
|
27
|
|
27
|
28
|
import javax.servlet.http.HttpServletRequest;
|
|
29
|
+import java.time.LocalDateTime;
|
28
|
30
|
import java.util.HashMap;
|
29
|
31
|
import java.util.List;
|
30
|
32
|
import java.util.Map;
|
|
@@ -57,6 +59,9 @@ public class TaHouseController extends BaseController {
|
57
|
59
|
@Autowired
|
58
|
60
|
ITaShopService iTaShopService;
|
59
|
61
|
|
|
62
|
+ @Autowired
|
|
63
|
+ ITaHouseSurroundService iTaHouseSurroundService;
|
|
64
|
+
|
60
|
65
|
@Autowired
|
61
|
66
|
ScreenShotUtil screenShotUtil;
|
62
|
67
|
|
|
@@ -91,6 +96,7 @@ public class TaHouseController extends BaseController {
|
91
|
96
|
@ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
|
92
|
97
|
public ResponseBean houseList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
93
|
98
|
@ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
99
|
+ @ApiParam("商铺ID") @RequestParam(value ="shopId", required = false) String shopId,
|
94
|
100
|
HttpServletRequest request) throws Exception{
|
95
|
101
|
|
96
|
102
|
TaPerson taPerson = getPerson(request);
|
|
@@ -99,7 +105,7 @@ public class TaHouseController extends BaseController {
|
99
|
105
|
}
|
100
|
106
|
|
101
|
107
|
IPage<TaHouse> pg = new Page<>(pageNum, pageSize);
|
102
|
|
- IPage<TaHouse> result = iTaHouseService.getHousesOfKeeper(pg, taPerson);
|
|
108
|
+ IPage<TaHouse> result = iTaHouseService.getHousesOfKeeper(pg, taPerson, shopId);
|
103
|
109
|
return ResponseBean.success(result);
|
104
|
110
|
}
|
105
|
111
|
|
|
@@ -138,7 +144,19 @@ public class TaHouseController extends BaseController {
|
138
|
144
|
taHouse.setShopId(shopKeeperList.get(0).getShopId());
|
139
|
145
|
}
|
140
|
146
|
|
|
147
|
+ taHouse.setCreateDate(LocalDateTime.now());
|
|
148
|
+
|
|
149
|
+ // 复制房源
|
|
150
|
+ if (!StringUtils.isEmpty(taHouse.getOriginId())) {
|
|
151
|
+ taHouse.setTitle(String.format("%s(复制)", taHouse.getTitle() + ""));
|
|
152
|
+ }
|
|
153
|
+
|
141
|
154
|
if (iTaHouseService.save(taHouse)){
|
|
155
|
+ // 复制房源
|
|
156
|
+ if (!StringUtils.isEmpty(taHouse.getOriginId())) {
|
|
157
|
+ iTaHouseSurroundService.copySurroundByHouse(taHouse.getOriginId(), taHouse.getHouseId());
|
|
158
|
+ }
|
|
159
|
+
|
142
|
160
|
return ResponseBean.success(taHouse);
|
143
|
161
|
} else {
|
144
|
162
|
return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
@@ -199,9 +217,10 @@ public class TaHouseController extends BaseController {
|
199
|
217
|
* 查询当前房源
|
200
|
218
|
* @param id 实体ID
|
201
|
219
|
*/
|
202
|
|
- @RequestMapping(value="/ma/taHouse/{id}",method= RequestMethod.GET)
|
|
220
|
+ @RequestMapping(value="/{client}/taHouse/{id}",method= RequestMethod.GET)
|
203
|
221
|
@ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
|
204
|
|
- public ResponseBean houseDetail(@ApiParam("房源ID") @PathVariable String id) throws Exception{
|
|
222
|
+ public ResponseBean houseDetail(@ApiParam("客户端") @PathVariable String client,
|
|
223
|
+ @ApiParam("房源ID") @PathVariable String id) throws Exception{
|
205
|
224
|
TaHouse taHouse = iTaHouseService.getById(id);
|
206
|
225
|
TaShop taShop = iTaShopService.getById(taHouse.getShopId());
|
207
|
226
|
taHouse.setTaShop(taShop);
|