Administrator %!s(int64=2) %!d(string=hai) anos
pai
achega
f6700cca5e

+ 9 - 0
mhotel/src/com/happy/Model/Booking.java

@@ -61,6 +61,7 @@ public class Booking {
 
 
   private String lockTime; // 锁定时间
   private String lockTime; // 锁定时间
 
 
+  private List<FileInfo> houseFileInfoList; // 房型详细图
   public Integer getId() {
   public Integer getId() {
     return id;
     return id;
   }
   }
@@ -488,4 +489,12 @@ public class Booking {
   public void setLiveTime(String liveTime) {
   public void setLiveTime(String liveTime) {
     this.liveTime = liveTime;
     this.liveTime = liveTime;
   }
   }
+
+  public List<FileInfo> getHouseFileInfoList() {
+    return houseFileInfoList;
+  }
+
+  public void setHouseFileInfoList(List<FileInfo> houseFileInfoList) {
+    this.houseFileInfoList = houseFileInfoList;
+  }
 }
 }

+ 13 - 0
mhotel/src/com/happy/Model/Hotel.java

@@ -152,6 +152,11 @@ public class Hotel {
 	private String hotelTownshipName;
 	private String hotelTownshipName;
 	private List<House> houseList;
 	private List<House> houseList;
 
 
+	/**
+	 * 酒店详细图
+	 */
+	private List<FileInfo> hotelFileInfoList;
+
 	public Integer getId() {
 	public Integer getId() {
 		return id;
 		return id;
 	}
 	}
@@ -395,4 +400,12 @@ public class Hotel {
 	public void setHotel_name(String hotel_name) {
 	public void setHotel_name(String hotel_name) {
 		this.hotel_name = hotel_name;
 		this.hotel_name = hotel_name;
 	}
 	}
+
+	public List<FileInfo> getHotelFileInfoList() {
+		return hotelFileInfoList;
+	}
+
+	public void setHotelFileInfoList(List<FileInfo> hotelFileInfoList) {
+		this.hotelFileInfoList = hotelFileInfoList;
+	}
 }
 }

+ 6 - 0
mhotel/src/com/happy/action/AppHomePageAction.java

@@ -10,6 +10,7 @@ import com.happy.constant.ResultStatusCode;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
 import com.happy.service.AppHomePageService;
 import com.happy.service.AppHomePageService;
 import com.happy.service.BookService;
 import com.happy.service.BookService;
+import com.happy.service.FileService;
 import com.happy.service.HotelService;
 import com.happy.service.HotelService;
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.ActionSupport;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONObject;
@@ -35,6 +36,8 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
     public AppHomePageService appHomePageService;
     public AppHomePageService appHomePageService;
     @Resource
     @Resource
     public HotelService hotelService;
     public HotelService hotelService;
+    @Resource
+    public FileService fileService;
 
 
     public int page; // 当前页
     public int page; // 当前页
     public int rows;// 每页显示的行数rows
     public int rows;// 每页显示的行数rows
@@ -141,6 +144,7 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
         String endDate = DateUtil.parseDateToStr((Func.parseDate(queryEndTime)),  DateUtil.Time_Formatter_Day);
         String endDate = DateUtil.parseDateToStr((Func.parseDate(queryEndTime)),  DateUtil.Time_Formatter_Day);
 
 
         Hotel hotel = appHomePageService.getHotelAndHouseByHotelId(hotelId,startDate, endDate);
         Hotel hotel = appHomePageService.getHotelAndHouseByHotelId(hotelId,startDate, endDate);
+        hotel.setHotelFileInfoList(fileService.queryListByLinkId(hotelId));
 
 
         // 通过时间区间查询房间信息,并带好是否有房标识给前台
         // 通过时间区间查询房间信息,并带好是否有房标识给前台
         jsonObject.put(B.code,ResultStatusCode.OK.getStatus());
         jsonObject.put(B.code,ResultStatusCode.OK.getStatus());
@@ -175,6 +179,8 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
             return null;
             return null;
         }
         }
 
 
+        hotel.setHotelFileInfoList(fileService.queryListByLinkId(hotelId));
+
         jsonObject.put(B.code,ResultStatusCode.OK.getStatus());
         jsonObject.put(B.code,ResultStatusCode.OK.getStatus());
         jsonObject.put(B.data,hotel);
         jsonObject.put(B.data,hotel);
         ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
         ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());

+ 23 - 6
mhotel/src/com/happy/action/AppMePageAction.java

@@ -3,18 +3,17 @@ package com.happy.action;
 import com.baidubce.model.User;
 import com.baidubce.model.User;
 import com.google.gson.Gson;
 import com.google.gson.Gson;
 import com.happy.Model.Booking;
 import com.happy.Model.Booking;
+import com.happy.Model.FileInfo;
 import com.happy.Model.weixin.*;
 import com.happy.Model.weixin.*;
 import com.happy.Until.*;
 import com.happy.Until.*;
 import com.happy.Until.Enum.B;
 import com.happy.Until.Enum.B;
 import com.happy.Until.Enum.DataType;
 import com.happy.Until.Enum.DataType;
 import com.happy.common.http.HttpsClient;
 import com.happy.common.http.HttpsClient;
 import com.happy.common.wx.WxUtil;
 import com.happy.common.wx.WxUtil;
+import com.happy.constant.ConstDefault;
 import com.happy.constant.ResultStatusCode;
 import com.happy.constant.ResultStatusCode;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
-import com.happy.service.AppService;
-import com.happy.service.BookService;
-import com.happy.service.HotelService;
-import com.happy.service.UserService;
+import com.happy.service.*;
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.ActionSupport;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONObject;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.ServletActionContext;
@@ -42,6 +41,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
     public AppService appService;
     public AppService appService;
     @Resource
     @Resource
     public HotelService hotelService;
     public HotelService hotelService;
+    @Resource
+    public FileService fileService;
 
 
     private String contactUserName; // 常用联系人姓名
     private String contactUserName; // 常用联系人姓名
     private String contactUserIdNum; // 常用联系人身份证
     private String contactUserIdNum; // 常用联系人身份证
@@ -123,7 +124,19 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         if (!Func.checkNull(userId)){
         if (!Func.checkNull(userId)){
             querySql.append(" and create_userid = '").append(userId).append("' ");
             querySql.append(" and create_userid = '").append(userId).append("' ");
         }
         }
-        ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),bookService.queryPage(querySql.toString(), page, rows));
+
+        IPage<Booking> iPage = bookService.queryPage(querySql.toString(), page, rows);
+        List<Booking> bookList =iPage.getPageList();
+        for (Booking book: bookList) {
+            if (book == null || Func.checkNull(book.getHouseId()))
+                continue;
+
+            // 将房间图片,写入房型对象中
+            List<FileInfo> fileInfoList = fileService.queryListByLinkId(book.getHouseId());
+            book.setHouseFileInfoList(fileInfoList);
+        }
+
+        ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),iPage);
         return null;
         return null;
     }
     }
 
 
@@ -174,6 +187,10 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
             book.setHouseConfigList(houseDicList);
             book.setHouseConfigList(houseDicList);
         }
         }
 
 
+        // 将房间图片,写入房型对象中
+        List<FileInfo> fileInfoList = fileService.queryListByLinkId(book.getHouseId());
+        book.setHouseFileInfoList(fileInfoList);
+
         resultJson.put(B.code, ResultStatusCode.OK.getStatus());
         resultJson.put(B.code, ResultStatusCode.OK.getStatus());
         resultJson.put(B.message,ResultStatusCode.OK.getMsg());
         resultJson.put(B.message,ResultStatusCode.OK.getMsg());
         resultJson.put(B.data,book);
         resultJson.put(B.data,book);
@@ -418,7 +435,7 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
                 // 确定默认用户名,默认用户头像
                 // 确定默认用户名,默认用户头像
                 String userName = Func.parseStr(WxUtil.createDefaultUserName());
                 String userName = Func.parseStr(WxUtil.createDefaultUserName());
                 users.setUser_name(userName);
                 users.setUser_name(userName);
-                users.setHeadPhoto("https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/head.png");
+                users.setHeadPhoto(ConstDefault.DefaultHeadPhoto);
                 users.setOpenid(OPEN_ID);
                 users.setOpenid(OPEN_ID);
                 users.setCreate_time(DateUtil.getFormatPaternDate(new Date()));
                 users.setCreate_time(DateUtil.getFormatPaternDate(new Date()));
                 users.setDataType(DataType.游客数据.toString());
                 users.setDataType(DataType.游客数据.toString());

+ 2 - 0
mhotel/src/com/happy/constant/ConstDefault.java

@@ -11,6 +11,8 @@ import java.text.SimpleDateFormat;
  */
  */
 public final class ConstDefault {
 public final class ConstDefault {
 
 
+
+    public static final String DefaultHeadPhoto = "https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/head.png";   // 默认用户头像
     public static final String DATETIMES_FORMAT_STRING = "yyyy-MM-dd HH:mm:ss";
     public static final String DATETIMES_FORMAT_STRING = "yyyy-MM-dd HH:mm:ss";
     public static final String DATE_FORMAT_STRING = "yyyy-MM-dd";
     public static final String DATE_FORMAT_STRING = "yyyy-MM-dd";
     public static final String TIMES_FORMAT_STRING = "HH:mm:ss";
     public static final String TIMES_FORMAT_STRING = "HH:mm:ss";

+ 6 - 0
mhotel/src/com/happy/service/FileService.java

@@ -62,6 +62,12 @@ public interface FileService {
     List<FileInfo> queryList(String sqlx);
     List<FileInfo> queryList(String sqlx);
 
 
     /**
     /**
+     * 通过linkid获取文件列表
+     * @param linkId
+     * @return
+     */
+    public List<FileInfo> queryListByLinkId (String linkId);
+    /**
      * 描述:查询一条数据
      * 描述:查询一条数据
      * @param sqlx
      * @param sqlx
      * @return
      * @return

+ 0 - 2
mhotel/src/com/happy/service/impl/AppHomePageImplService.java

@@ -39,7 +39,6 @@ public class AppHomePageImplService implements AppHomePageService {
 
 
     @Override
     @Override
     public IPage<Hotel> getHotelList(String queryValue,String hotel_township, int page, int rows) {
     public IPage<Hotel> getHotelList(String queryValue,String hotel_township, int page, int rows) {
-        IPage<Hotel> iPage = new IPage();
         StringBuilder strSql = new StringBuilder(" and hstatus=1 "); // 酒店正在营业中才显示
         StringBuilder strSql = new StringBuilder(" and hstatus=1 "); // 酒店正在营业中才显示
         if (!Func.checkNull(queryValue)){
         if (!Func.checkNull(queryValue)){
             strSql.append(" and hname like '%").append(queryValue).append("%' ");
             strSql.append(" and hname like '%").append(queryValue).append("%' ");
@@ -47,7 +46,6 @@ public class AppHomePageImplService implements AppHomePageService {
         if (!Func.checkNull(hotel_township)){
         if (!Func.checkNull(hotel_township)){
             strSql.append(" and c.hotel_township = '").append(hotel_township).append("' ");
             strSql.append(" and c.hotel_township = '").append(hotel_township).append("' ");
         }
         }
-
         return hotelService.queryPagePrice(strSql.toString(),page,rows);
         return hotelService.queryPagePrice(strSql.toString(),page,rows);
     }
     }
 
 

+ 14 - 0
mhotel/src/com/happy/service/impl/FileImplService.java

@@ -1,6 +1,7 @@
 package com.happy.service.impl;
 package com.happy.service.impl;
 
 
 import com.happy.Model.FileInfo;
 import com.happy.Model.FileInfo;
+import com.happy.Until.Func;
 import com.happy.Until.ResponseUtil;
 import com.happy.Until.ResponseUtil;
 import com.happy.dao.FileInfoDao;
 import com.happy.dao.FileInfoDao;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
@@ -18,6 +19,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 @Service("FileService")
 @Service("FileService")
@@ -70,6 +72,18 @@ public class FileImplService implements FileService {
     }
     }
 
 
     @Override
     @Override
+    public List<FileInfo> queryListByLinkId (String linkId)
+    {
+        if (Func.checkNull(linkId))
+            return new ArrayList<>();
+
+        StringBuilder fileSqlx = new StringBuilder("");
+        fileSqlx.append(" and link_id = '").append(linkId).append("'");
+        List<FileInfo> fileInfoList = queryList(fileSqlx.toString());
+        return fileInfoList;
+    }
+
+    @Override
     public FileInfo getOen(String sqlx){
     public FileInfo getOen(String sqlx){
         List<FileInfo> list = fileDao.queryList(sqlx);
         List<FileInfo> list = fileDao.queryList(sqlx);
         if(list!=null && list.size()>0) return list.get(0);
         if(list!=null && list.size()>0) return list.get(0);