|
@@ -1,6 +1,7 @@
|
|
|
package com.happy.service.impl;
|
|
package com.happy.service.impl;
|
|
|
|
|
|
|
|
import com.happy.Model.Booking;
|
|
import com.happy.Model.Booking;
|
|
|
|
|
+import com.happy.Model.FileInfo;
|
|
|
import com.happy.Model.Hotel;
|
|
import com.happy.Model.Hotel;
|
|
|
import com.happy.Model.House;
|
|
import com.happy.Model.House;
|
|
|
import com.happy.Until.DateUtil;
|
|
import com.happy.Until.DateUtil;
|
|
@@ -8,15 +9,13 @@ import com.happy.Until.Func;
|
|
|
import com.happy.Until.TimeExchange;
|
|
import com.happy.Until.TimeExchange;
|
|
|
import com.happy.dao.BookDao;
|
|
import com.happy.dao.BookDao;
|
|
|
import com.happy.dao.HouseDao;
|
|
import com.happy.dao.HouseDao;
|
|
|
|
|
+import com.happy.dao.impl.FileImplInfoDao;
|
|
|
import com.happy.dto.IPage;
|
|
import com.happy.dto.IPage;
|
|
|
import com.happy.service.*;
|
|
import com.happy.service.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
@Service("AppHomePageService")
|
|
@Service("AppHomePageService")
|
|
|
public class AppHomePageImplService implements AppHomePageService {
|
|
public class AppHomePageImplService implements AppHomePageService {
|
|
@@ -33,6 +32,8 @@ public class AppHomePageImplService implements AppHomePageService {
|
|
|
public BookService bookService;
|
|
public BookService bookService;
|
|
|
@Resource
|
|
@Resource
|
|
|
public AdminManagerService adminManagerService;
|
|
public AdminManagerService adminManagerService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ public FileService fileService;
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -65,6 +66,22 @@ public class AppHomePageImplService implements AppHomePageService {
|
|
|
if (hotel == null || Func.checkNull(hotel.getManagerId()))
|
|
if (hotel == null || Func.checkNull(hotel.getManagerId()))
|
|
|
return hotel;
|
|
return hotel;
|
|
|
|
|
|
|
|
|
|
+ // 数据字典写入hotel
|
|
|
|
|
+ Map dicMap = hotelService.queryHotelDicMap();
|
|
|
|
|
+ if (!Func.checkNull(hotel.getHconfig()))
|
|
|
|
|
+ {
|
|
|
|
|
+ List<String> list = Arrays.asList(hotel.getHconfig().split(","));
|
|
|
|
|
+ List hotelDicList = new ArrayList();
|
|
|
|
|
+ for (String hotelDicId:list) {
|
|
|
|
|
+ if (!dicMap.containsKey(Func.parseInt(hotelDicId)))
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
|
|
+ hotelDicList.add(dicMap.get(Func.parseInt(hotelDicId)));
|
|
|
|
|
+ }
|
|
|
|
|
+ hotel.setHconfigList(hotelDicList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
System.out.println(hotel.getManagerId());// 需求确定使用商户id关联房型
|
|
System.out.println(hotel.getManagerId());// 需求确定使用商户id关联房型
|
|
|
StringBuffer strSql = new StringBuffer();
|
|
StringBuffer strSql = new StringBuffer();
|
|
|
strSql.append(" and manager_id = '").append(hotel.getManagerId()).append("' ");
|
|
strSql.append(" and manager_id = '").append(hotel.getManagerId()).append("' ");
|
|
@@ -72,13 +89,23 @@ public class AppHomePageImplService implements AppHomePageService {
|
|
|
if (houseList == null )
|
|
if (houseList == null )
|
|
|
return hotel;
|
|
return hotel;
|
|
|
|
|
|
|
|
-// Map<String, House> houseMap = new HashMap();
|
|
|
|
|
-// houseList.forEach((House house) ->{
|
|
|
|
|
-// if (house.getId() == 0)
|
|
|
|
|
-// return;
|
|
|
|
|
-// houseMap.put(Func.parseStr(house.getId()),house);
|
|
|
|
|
-// });
|
|
|
|
|
|
|
+ // 数据字典写入hotel
|
|
|
|
|
+ List<String> hlist = new ArrayList<>();
|
|
|
|
|
+ List houseDicList = new ArrayList();
|
|
|
|
|
+ for (House house:houseList) {
|
|
|
|
|
+ if (house == null || Func.checkNull(Func.parseStr(house.getNumber())))
|
|
|
|
|
+ continue;
|
|
|
|
|
+ // “,”号分逗开来
|
|
|
|
|
+ hlist = Arrays.asList(house.gethConfig().split(","));
|
|
|
|
|
+ houseDicList = new ArrayList();
|
|
|
|
|
+ for (String houseDicId:hlist) {
|
|
|
|
|
+ if (!dicMap.containsKey(Func.parseInt(houseDicId)))
|
|
|
|
|
+ continue;
|
|
|
|
|
|
|
|
|
|
+ houseDicList.add(dicMap.get(Func.parseInt(houseDicId)));
|
|
|
|
|
+ }
|
|
|
|
|
+ house.sethConfigList(houseDicList);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 判断是否有房间,对每个房型进行标识
|
|
// 判断是否有房间,对每个房型进行标识
|
|
|
StringBuffer strSqlBook = new StringBuffer();
|
|
StringBuffer strSqlBook = new StringBuffer();
|
|
@@ -109,15 +136,20 @@ public class AppHomePageImplService implements AppHomePageService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
houseList.forEach((House house) ->{
|
|
houseList.forEach((House house) ->{
|
|
|
if (!houseBookingMap.containsKey(Func.parseStr(house.getId()))) {
|
|
if (!houseBookingMap.containsKey(Func.parseStr(house.getId()))) {
|
|
|
house.setRemainRooms(Func.parseStr(house.getNumber()));
|
|
house.setRemainRooms(Func.parseStr(house.getNumber()));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ StringBuilder fileSqlx = new StringBuilder("");
|
|
|
|
|
+ fileSqlx.append("and link_id = '").append(house.getId()).append("'");
|
|
|
|
|
+ List<FileInfo> fileInfoList = fileService.queryList(fileSqlx.toString());
|
|
|
|
|
|
|
|
int i = Func.parseInt(house.getNumber()) - Func.parseInt(houseBookingMap.get(house.getId()));
|
|
int i = Func.parseInt(house.getNumber()) - Func.parseInt(houseBookingMap.get(house.getId()));
|
|
|
house.setRemainRooms(Func.parseStr(i));
|
|
house.setRemainRooms(Func.parseStr(i));
|
|
|
|
|
+ house.setFileInfoList(fileInfoList);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
|