|
@@ -16,6 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
16
|
16
|
import org.springframework.web.bind.annotation.*;
|
17
|
17
|
|
18
|
18
|
import javax.servlet.http.HttpServletRequest;
|
|
19
|
+import java.time.LocalDateTime;
|
|
20
|
+import java.util.ArrayList;
|
|
21
|
+import java.util.Collections;
|
19
|
22
|
import java.util.List;
|
20
|
23
|
import java.util.stream.Collectors;
|
21
|
24
|
import java.util.stream.Stream;
|
|
@@ -42,22 +45,21 @@ public class TaBuildingPanoramaController extends BaseController {
|
42
|
45
|
private ITaBuildingApartmentService taBuildingApartmentService;
|
43
|
46
|
|
44
|
47
|
/**
|
45
|
|
- * 分页查询列表
|
46
|
|
- * @param pageNum
|
47
|
|
- * @param pageSize
|
|
48
|
+ * 查询列表
|
48
|
49
|
* @return
|
49
|
50
|
*/
|
50
|
|
- @RequestMapping(value="/panorama",method= RequestMethod.GET)
|
51
|
|
- public ResponseBean taBuildingPanoramaList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
52
|
|
- @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
|
|
51
|
+ @RequestMapping(value="/admin/panorama/{buildingId}",method= RequestMethod.GET)
|
|
52
|
+ public ResponseBean taBuildingPanoramaList(@PathVariable String buildingId,HttpServletRequest request){
|
53
|
53
|
ResponseBean responseBean = new ResponseBean();
|
54
|
54
|
try {
|
55
|
|
- //使用分页插件
|
56
|
|
- IPage<TaBuildingPanorama> pg = new Page<>(pageNum, pageSize);
|
57
|
55
|
QueryWrapper<TaBuildingPanorama> queryWrapper = new QueryWrapper<>();
|
|
56
|
+ queryWrapper.eq("org_id",getOrgId(request));
|
|
57
|
+ queryWrapper.eq("building_id",buildingId);
|
|
58
|
+ queryWrapper.eq("status",CommConstant.STATUS_NORMAL);
|
|
59
|
+
|
58
|
60
|
queryWrapper.orderByDesc("create_date");
|
|
61
|
+ List<TaBuildingPanorama> result = iTaBuildingPanoramaService.list(queryWrapper);
|
59
|
62
|
|
60
|
|
- IPage<TaBuildingPanorama> result = iTaBuildingPanoramaService.page(pg, queryWrapper);
|
61
|
63
|
responseBean.addSuccess(result);
|
62
|
64
|
}catch (Exception e){
|
63
|
65
|
e.printStackTrace();
|
|
@@ -72,7 +74,7 @@ public class TaBuildingPanoramaController extends BaseController {
|
72
|
74
|
* 获取全景图的户型列表
|
73
|
75
|
* @return
|
74
|
76
|
*/
|
75
|
|
- @RequestMapping(value="/panorama/apartment",method= RequestMethod.GET)
|
|
77
|
+ @RequestMapping(value="/admin/panorama/apartment",method= RequestMethod.GET)
|
76
|
78
|
public ResponseBean getApartmentList(@RequestParam(value ="buildingId") String buildingId,
|
77
|
79
|
HttpServletRequest request){
|
78
|
80
|
ResponseBean responseBean = new ResponseBean();
|
|
@@ -82,7 +84,6 @@ public class TaBuildingPanoramaController extends BaseController {
|
82
|
84
|
queryWrapper.eq("status",CommConstant.STATUS_NORMAL);
|
83
|
85
|
queryWrapper.eq("apartment_type",CommConstant.APARTMENT_TYPR_APART);
|
84
|
86
|
queryWrapper.eq("building_id",buildingId);
|
85
|
|
- queryWrapper.eq("org_id",getOrgId(request));
|
86
|
87
|
List<TaBuildingApartment> apartmentList = taBuildingApartmentService.list(queryWrapper);
|
87
|
88
|
|
88
|
89
|
//获取此楼盘下所有已经有全景图的户型
|
|
@@ -92,8 +93,15 @@ public class TaBuildingPanoramaController extends BaseController {
|
92
|
93
|
panoramaQueryWrapper.eq("building_id",buildingId);
|
93
|
94
|
panoramaQueryWrapper.eq("org_id",getOrgId(request));
|
94
|
95
|
List<TaBuildingPanorama> panoramaList = iTaBuildingPanoramaService.list(panoramaQueryWrapper);
|
95
|
|
- //去除已经有全景图的户型
|
96
|
|
- List<TaBuildingApartment> resultList = apartmentList.stream().filter(x -> !x.getApartmentId().equals(panoramaList.stream().map(e -> e.getApartmentId()))).collect(Collectors.toList());
|
|
96
|
+ List<String> stringList = panoramaList.stream().map(TaBuildingPanorama::getApartmentId).collect(Collectors.toList());
|
|
97
|
+
|
|
98
|
+ List<TaBuildingApartment> resultList = new ArrayList<>();
|
|
99
|
+ //过滤已经选择的
|
|
100
|
+ apartmentList.forEach(e -> {
|
|
101
|
+ if (!stringList.contains(e.getApartmentId())){
|
|
102
|
+ resultList.add(e);
|
|
103
|
+ }
|
|
104
|
+ });
|
97
|
105
|
|
98
|
106
|
responseBean.addSuccess(resultList);
|
99
|
107
|
}catch (Exception e){
|
|
@@ -110,9 +118,17 @@ public class TaBuildingPanoramaController extends BaseController {
|
110
|
118
|
* @return
|
111
|
119
|
*/
|
112
|
120
|
@RequestMapping(value="/admin/panorama",method= RequestMethod.POST)
|
113
|
|
- public ResponseBean taBuildingPanoramaAdd(@RequestBody TaBuildingPanorama taBuildingPanorama){
|
|
121
|
+ public ResponseBean taBuildingPanoramaAdd(@RequestBody TaBuildingPanorama taBuildingPanorama,HttpServletRequest request){
|
114
|
122
|
ResponseBean responseBean = new ResponseBean();
|
115
|
123
|
try {
|
|
124
|
+ taBuildingPanorama.setStatus(CommConstant.STATUS_NORMAL);
|
|
125
|
+ taBuildingPanorama.setCreateDate(LocalDateTime.now());
|
|
126
|
+ taBuildingPanorama.setOrgId(getOrgId(request));
|
|
127
|
+ //把户型给内容
|
|
128
|
+ if (taBuildingPanorama.getPanoramaType().equals(CommConstant.PANORAMA_TYPE_APARTMENT)){
|
|
129
|
+ TaBuildingApartment apartment = taBuildingApartmentService.getById(taBuildingPanorama.getApartmentId());
|
|
130
|
+ taBuildingPanorama.setContent(apartment.getApartmentName());
|
|
131
|
+ }
|
116
|
132
|
if (iTaBuildingPanoramaService.save(taBuildingPanorama)){
|
117
|
133
|
responseBean.addSuccess(taBuildingPanorama);
|
118
|
134
|
}else {
|