Browse Source

我的。页面接口代码提交

Administrator 2 years ago
parent
commit
555778cad9

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

@@ -19,6 +19,7 @@ public class Booking {
   private String hotelHpositionWens; // 民宿经纬度
   private String hotelPhone; // 民宿联系电话
   private String hotelPerson; // 民宿联系人
+  private String hotelManagerId; // 所属商家id
   private String hotelTownship; // 民宿所属乡镇
   private String hotelConfig; // 民宿配置
   private String hotelType; // 民宿类型
@@ -398,4 +399,11 @@ public class Booking {
     this.remake = remake;
   }
 
+  public String getHotelManagerId() {
+    return hotelManagerId;
+  }
+
+  public void setHotelManagerId(String hotelManagerId) {
+    this.hotelManagerId = hotelManagerId;
+  }
 }

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

@@ -1,5 +1,7 @@
 package com.happy.Model;
 
+import java.util.List;
+
 /**
  * @Description  
  * @Author  raojiaolong
@@ -119,6 +121,8 @@ public class Hotel {
 	 */
 	private Integer status;
 
+	private List<House> houseList;
+
 	public Integer getId() {
 		return id;
 	}
@@ -294,4 +298,12 @@ public class Hotel {
 	public void setStatus(Integer status) {
 		this.status = status;
 	}
+
+	public List getHouseList() {
+		return houseList;
+	}
+
+	public void setHouseList(List houseList) {
+		this.houseList = houseList;
+	}
 }

+ 3 - 0
mhotel/src/com/happy/Until/Enum/B.java

@@ -1,5 +1,8 @@
 package com.happy.Until.Enum;
 
+/**
+ * 返回数据枚举类型
+ */
 public enum B {
     CODE, MESSAGE,DATA;
 }

+ 9 - 0
mhotel/src/com/happy/Until/Enum/PayEnum.java

@@ -0,0 +1,9 @@
+package com.happy.Until.Enum;
+
+/**
+ * 订单支付九种状态:
+ *     待支付,支付超时,已支付,已取消,已退单,待入住,已入住,已退款,已消费;
+ */
+public enum PayEnum {
+    待支付,支付超时,已支付,已取消,已退单,待入住,已入住,已退款,已消费;
+}

+ 35 - 0
mhotel/src/com/happy/Until/ResponseUtil.java

@@ -1,5 +1,6 @@
 package com.happy.Until;
 
+import com.happy.dto.IPage;
 import net.sf.json.JSONObject;
 import org.apache.poi.ss.usermodel.Workbook;
 
@@ -63,6 +64,40 @@ public class ResponseUtil {
 		}
 	}
 
+	public static void writeJsonIPage(HttpServletResponse respone, IPage iPage) {
+		respone.setContentType("application/json;charset=utf-8");
+
+		JSONObject resultJson = new JSONObject();
+		if (iPage.getPageList() == null || iPage.getPageList().size() == 0) {
+			resultJson.put("rows", "");
+			resultJson.put("total", 0);
+		} else {
+			resultJson.put("code", 200);
+			resultJson.put("rows", iPage.getRows());
+			// int total = listAll.size();
+			resultJson.put("total", iPage.getTotal());// 总记录数
+			int totalPage = iPage.getTotal() % iPage.getRows() == 0 ? (iPage.getTotal() / iPage.getRows()) : (iPage.getTotal() / iPage.getRows()) + 1;// 总页数
+			resultJson.put("totalPage", totalPage);
+			resultJson.put("currentPage", iPage.getPage());// 当前页
+			resultJson.put("numPerPage", iPage.getRows());// 每页数
+			resultJson.put("nextPage", totalPage - iPage.getPage() == 0 ? iPage.getPage() : iPage.getPage() + 1);// 下一页
+			resultJson.put("previousPage", iPage.getPage() - 0 == 1 ? iPage.getPage() : iPage.getPage() - 1);// 上一页
+			resultJson.put("hasPreviousPage", true);// 有上一页
+			resultJson.put("hasNextPage", true);// 有下一页
+			resultJson.put("firstPage", true);// 首页
+			resultJson.put("lastPage", true);// 尾页
+		}
+
+		PrintWriter out;
+		try {
+			out = respone.getWriter();
+			out.print(resultJson.toString());
+			out.flush();
+			out.close();
+		} catch (Exception e) {
+			// //System.out.println("Comm_Util_writeJson---->" + e);
+		}
+	}
 
 	public static void writeJson(HttpServletResponse respone, String result) {
 		respone.setContentType("application/json;charset=utf-8");

+ 1 - 2
mhotel/src/com/happy/Until/TimeExchange.java

@@ -194,7 +194,7 @@ public class TimeExchange {
 
     // 获取当前日期
     public static String getDate(){
-        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         return sp.format(new Date());
     }
 
@@ -405,7 +405,6 @@ public class TimeExchange {
      * 如果时间1大于时间2,接口返回false
      * @param dateOne 时间1
      * @param dateTwo 时间2
-     * @param Forma 时间格式
      * @return
      * @throws ParseException
      */

+ 0 - 2
mhotel/src/com/happy/action/AppBookingAction.java

@@ -1,7 +1,5 @@
 package com.happy.action;
 
-import com.happy.common.util.CommonResult;
-import com.happy.service.AppHomePageService;
 import com.happy.service.BookService;
 import com.opensymphony.xwork2.ActionSupport;
 import org.apache.struts2.interceptor.ServletRequestAware;

+ 49 - 16
mhotel/src/com/happy/action/AppHomePageAction.java

@@ -1,17 +1,15 @@
 package com.happy.action;
 
-import com.happy.Model.House;
-import com.happy.Model.weixin.PayResult;
-import com.happy.Model.weixin.WechatUnifiedOrder;
-import com.happy.Model.weixin.WeiXinUtil;
-import com.happy.Until.*;
-import com.happy.Until.Excel.toExcel;
-import com.happy.Until.weixin.JaxbUtil;
-import com.happy.Until.weixin.PayWxUtil;
-import com.happy.common.util.CommonResult;
-import com.happy.common.wx.WxUtil;
+import com.happy.Model.Hotel;
+import com.happy.Until.Enum.B;
+import com.happy.Until.Func;
+import com.happy.Until.ResponseUtil;
+import com.happy.Until.ResultUtil;
+import com.happy.constant.ResultStatusCode;
+import com.happy.dto.IPage;
 import com.happy.service.AppHomePageService;
 import com.happy.service.BookService;
+import com.happy.service.HotelService;
 import com.opensymphony.xwork2.ActionSupport;
 import net.sf.json.JSONObject;
 import org.apache.struts2.ServletActionContext;
@@ -20,7 +18,6 @@ import org.apache.struts2.interceptor.ServletRequestAware;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.text.ParseException;
 import java.util.*;
 
 /**
@@ -35,13 +32,15 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
     public BookService bookService;
     @Resource
     public AppHomePageService appHomePageService;
+    @Resource
+    public HotelService hotelService;
 
     public int page; // 当前页
     public int rows;// 每页显示的行数rows
 
     public Integer id = new Integer(0);
     public String status;
-    private int hotelId = 0; //选择的当前酒店的id
+    private String hotelId; //选择的当前酒店的id
 
     public String userCode; // 第一次进来获取用户的code
     public String queryValue; // 首页查寻搜索关键词
@@ -113,7 +112,8 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
         //getUserInfo();
 
         // 获取民宿列表
-       appHomePageService.getHotelList(queryValue,rows,page);
+        IPage iPage = appHomePageService.getHotelList(queryValue,rows,page);
+        ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),iPage);
 
         return null;
     }
@@ -124,12 +124,45 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
      */
     public String getHouseByHotelId()
     {
+        JSONObject jsonObject = new JSONObject();
         // 如果未赋值,则直接跳出
-        if (hotelId == 0 )
+        if (Func.checkNull(hotelId))
+        {
+            jsonObject.put(B.CODE, ResultStatusCode.BAD_REQUEST.getStatus());
+            jsonObject.put(B.MESSAGE,ResultStatusCode.BAD_REQUEST.getMsg());
+            ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
             return null;
+        }
+
+        Hotel hotel = appHomePageService.getHotelAndHouseByHotelId(hotelId);
 
         // 通过时间区间查询房间信息,并带好是否有房标识给前台
+        jsonObject.put(B.DATA,ResultUtil.ok(hotel));
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
+        return null;
+    }
+
+
+    /**
+     * 通过酒店的id获取到酒店具体信息
+     * @return
+     */
+    public String getHotelInfoByHotelId()
+    {
+        JSONObject jsonObject = new JSONObject();
+        // 如果未赋值,则直接跳出
+        if (Func.checkNull(hotelId))
+        {
+            jsonObject.put(B.CODE, ResultStatusCode.BAD_REQUEST.getStatus());
+            jsonObject.put(B.MESSAGE,ResultStatusCode.BAD_REQUEST.getMsg());
+            ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
+            return null;
+        }
+
+        Hotel hotel = hotelService.getById(Func.parseInt(hotelId));
 
+        jsonObject.put(B.DATA,ResultUtil.ok(hotel));
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
         return null;
     }
 
@@ -151,11 +184,11 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
         this.queryValue = queryValue;
     }
 
-    public int getHotelId() {
+    public String getHotelId() {
         return hotelId;
     }
 
-    public void setHotelId(int hotelId) {
+    public void setHotelId(String hotelId) {
         this.hotelId = hotelId;
     }
 

+ 11 - 13
mhotel/src/com/happy/action/AppMePageAction.java

@@ -6,13 +6,11 @@ import com.happy.Until.Enum.B;
 import com.happy.Until.Enum.DataType;
 import com.happy.Until.Func;
 import com.happy.Until.ResponseUtil;
-import com.happy.common.util.CommonResult;
-import com.happy.common.util.ResponseStatusEnum;
-import com.happy.service.AppHomePageService;
+import com.happy.Until.TimeExchange;
+import com.happy.constant.ResultStatusCode;
 import com.happy.service.BookService;
 import com.happy.service.UserService;
 import com.opensymphony.xwork2.ActionSupport;
-import net.sf.json.JSON;
 import net.sf.json.JSONObject;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.interceptor.ServletRequestAware;
@@ -147,8 +145,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         Users users = userService.queryByUserId(userId);
 
         JSONObject resultJson = new JSONObject();
-        resultJson.put(B.CODE,ResponseStatusEnum.SUCCESS.getStatus());
-        resultJson.put(B.MESSAGE,ResponseStatusEnum.SUCCESS.getMsg());
+        resultJson.put(B.CODE, ResultStatusCode.OK.getStatus());
+        resultJson.put(B.MESSAGE,ResultStatusCode.OK.getMsg());
         resultJson.put(B.DATA,users);
         ResponseUtil.writeJson(ServletActionContext.getResponse(),resultJson.toString());
 
@@ -186,8 +184,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         users.setCard_number(contactUserIdNum);
         userService.update(users);
 
-        resultJson.put(B.CODE,ResponseStatusEnum.SUCCESS.getStatus());
-        resultJson.put(B.MESSAGE,ResponseStatusEnum.SUCCESS.getMsg());
+        resultJson.put(B.CODE,ResultStatusCode.OK.getStatus());
+        resultJson.put(B.MESSAGE,ResultStatusCode.OK.getMsg());
         ResponseUtil.writeJson(ServletActionContext.getResponse(),resultJson.toString());
     }
 
@@ -203,7 +201,7 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         Users users = new Users();
         users.setContactId(Func.parseInt(userId));
         users.setContactName(userName);
-        users.setCreate_time(Func.parseStr(new Date()));
+        users.setCreate_time(TimeExchange.getDate());
         users.setDataType(DataType.关联数据.toString());
         users.setUser_name(contactUserName);    // 相关联系人的名字
         users.setUser_phone(contactUserPhone);  // 相关联系人的手机号码
@@ -211,8 +209,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         userService.insert(users);
 
         JSONObject resultJson = new JSONObject();
-        resultJson.put(B.CODE,ResponseStatusEnum.SUCCESS.getStatus());
-        resultJson.put(B.MESSAGE,ResponseStatusEnum.SUCCESS.getMsg());
+        resultJson.put(B.CODE,ResultStatusCode.OK.getStatus());
+        resultJson.put(B.MESSAGE,ResultStatusCode.OK.getMsg());
         ResponseUtil.writeJson(ServletActionContext.getResponse(),resultJson.toString());
     }
 
@@ -227,8 +225,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         JSONObject resultJson = new JSONObject();
         userService.del(Func.parseInt(contactId));
 
-        resultJson.put(B.CODE,ResponseStatusEnum.SUCCESS.getStatus());
-        resultJson.put(B.MESSAGE,ResponseStatusEnum.SUCCESS.getMsg());
+        resultJson.put(B.CODE,ResultStatusCode.OK.getStatus());
+        resultJson.put(B.MESSAGE,ResultStatusCode.OK.getMsg());
         ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
     }
 

+ 0 - 35
mhotel/src/com/happy/common/util/BaseResult.java

@@ -1,35 +0,0 @@
-package com.happy.common.util;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @Author: codingliang
- * @Description: 接口统一返回基类
- * @Date: 20230731
- * @Version: V1.0
- **/
-@Data
-public abstract class BaseResult<T> implements Serializable {
-
-    /**
-     * 接口调用结果标识
-     */
-    private boolean success = false;
-
-    /**
-     * 接口调用结果信息
-     */
-    private String message;
-
-    /**
-     * 接口调用业务码
-     */
-    private String code;
-
-    /**
-     * 接口调用返回数据
-     */
-    private T data;
-}

+ 0 - 9
mhotel/src/com/happy/common/util/Code.java

@@ -1,9 +0,0 @@
-package com.happy.common.util;
-
-public interface Code {
-    Integer getStatus();
-    Boolean getSuccess();
-    String getMsg();
-
-}
-

+ 0 - 134
mhotel/src/com/happy/common/util/CommonResult.java

@@ -1,134 +0,0 @@
-package com.happy.common.util;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-
-import java.io.Serializable;
-import java.util.Map;
-
-/**
- * @Author: codingliang
- * @Description: 接口统一返回
- * @Date: 20230731
- * @Version: V1.0
- **/
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class CommonResult<T> extends BaseResult implements Serializable {
-
-
-    private Integer status;
-    // 调用是否成功
-    private Boolean success;
-    // 响应消息,可以为成功或者失败的消息
-    private String msg;
-
-    private T data;
-
-    private static final long serialVersionUID = 3616484754899974346L;
-
-
-    public static CommonResult ok() {
-        return ok(Integer.toString(ResponseStatusEnum.SUCCESS.getStatus()), ResponseStatusEnum.SUCCESS.getMsg());
-    }
-
-    public static <T> CommonResult<T> ok(T data) {
-        CommonResult<T> result = new CommonResult<T>(data);
-        return result;
-    }
-
-    public static <T> CommonResult<T> ok(String code, String msg) {
-        return baseCreate(code, msg, true);
-    }
-
-    public static CommonResult fail() {
-        return fail(Integer.toString(ResponseStatusEnum.FAILED.getStatus()), ResponseStatusEnum.FAILED.getMsg());
-    }
-
-    public static CommonResult fail(String code, String msg) {
-        return baseCreate(code, msg, false);
-    }
-
-    public static CommonResult fail(ResponseStatusEnum EnumCode){
-        return baseCreate(Integer.toString(EnumCode.getStatus()), EnumCode.getMsg(), false);
-    }
-
-    public CommonResult() {}
-
-    /**
-     * 用Code自定义返回信息
-     * 并把数据返回
-     */
-    public CommonResult(Code code, T data) {
-        this.status = code.getStatus();
-        this.msg = code.getMsg();
-        this.success = code.getSuccess();
-        this.data = data;
-    }
-
-    /**
-     * 成功的返回信息
-     */
-    public CommonResult(T data) {
-        this.setCode(Integer.toString(ResponseStatusEnum.SUCCESS.status()));
-        this.setMessage(ResponseStatusEnum.SUCCESS.msg());
-        this.setSuccess(ResponseStatusEnum.SUCCESS.success());
-        this.setData(data);
-    }
-
-
-
-    /**
-     * 自定义错误返回信息
-     * @param EnumCode 枚举错误信息
-     * @return
-     */
-    public CommonResult(ResponseStatusEnum EnumCode) {
-        this.setCode(Integer.toString(EnumCode.status()));
-        this.setMessage(EnumCode.msg());
-        this.setSuccess(EnumCode.success());
-    }
-
-
-    private static <T> CommonResult<T> baseCreate(String code, String msg, boolean success) {
-        CommonResult result = new CommonResult();
-        result.setCode(code);
-        result.setSuccess(success);
-        result.setMessage(msg);
-        return result;
-    }
-
-    public static CommonResult resultValue(ResponseStatusEnum responseStatus) {
-        return new CommonResult(responseStatus);
-    }
-
-    /**
-     * 错误返回,map中包含了多条错误信息,可以用于表单验证,把错误统一的全部返回出去
-     *
-     * @param map
-     * @return
-     */
-    public static CommonResult errorMap(Map map) {
-        return new CommonResult(ResponseStatusEnum.FAILED, map);
-    }
-
-    /**
-     * 错误返回,直接返回错误的消息
-     *
-     * @param msg 提示信息
-     * @return
-     */
-    public static CommonResult errorMsg(String msg) {
-        return new CommonResult(ResponseStatusEnum.FAILED, msg);
-    }
-
-    public CommonResult<T> setResult(T data) {
-        this.setData(data);
-        return this;
-    }
-
-    @Override
-    public T getData() {
-        return (T) super.getData();
-    }
-}

+ 0 - 78
mhotel/src/com/happy/common/util/ResponseStatusEnum.java

@@ -1,78 +0,0 @@
-package com.happy.common.util;
-
-/**
- * 响应结果枚举,用于提供给GraceJSONResult返回给前端的
- * 本枚举类中包含了很多的不同的状态码供使用,可以自定义
- * 便于更优雅的对状态码进行管理,一目了然
- */
-public enum ResponseStatusEnum implements Code{
-
-    EXISTS(999,false,"已存在"),
-    SUCCESS(200, true, "操作成功!"),
-    FAILED(500, false, "操作失败!"),
-    SEND_PARAMS(501,false,"传入参数数据结构错误"),
-    SEND_PARAMS_TYPE(502,false,"传入参数数据数据类型错误"),
-    UN_SERVICES_ERROR(505,false,"操作失败,请联系管理员"),
-
-    // 自定义系统级别异常 54x
-    SYSTEM_ERROR(540, false, "系统错误,错误未知!"),
-    SYSTEM_INDEX_OUT_OF_BOUNDS(541, false, "系统错误,数组越界!"),
-    SYSTEM_ARITHMETIC_BY_ZERO(542, false, "系统错误,无法除零!"),
-    SYSTEM_NULL_POINTER(543, false, "系统错误,空指针!"),
-    SYSTEM_NUMBER_FORMAT(544, false, "系统错误,数字转换异常!"),
-    SYSTEM_PARSE(545, false, "系统错误,解析异常!"),
-    SYSTEM_IO(546, false, "系统错误,IO输入输出异常!"),
-    SYSTEM_FILE_NOT_FOUND(547, false, "系统错误,文件未找到!"),
-    SYSTEM_CLASS_CAST(548, false, "系统错误,类型强制转换错误!"),
-    SYSTEM_PARSER_ERROR(549, false, "系统错误,解析出错!"),
-    SYSTEM_DATE_PARSER_ERROR(550, false, "系统错误,日期解析出错!"),
-    SYSTEM_ERROR_GLOBAL(551, false, "系统繁忙,请稍后再试!"),
-    SYSTEM_ERROR_ZUUL(552, false, "请求系统过于繁忙,请稍后再试!"),
-    SYSTEM_REQUEST_METHOD_ERROR(553, false, "请求类型错误"),
-    SYSTEM_MYSQL_TIMEOUT_ERROR(554, false, "Mysql连接超时"),
-    SYSTEM_MONGO_TIMEOUT_ERROR(555, false, "Mongo连接超时"),
-    SYSTEM_PHONE_ERROR(556,false,"手机号格式错误"),
-    SYSTEM_SEND_PHONE_ERROR(557,false,"发送验证码失败"),
-    SYSTEM_TOKEN_ERROR(558,false,"token为空"),
-    SYSTEM_LOGIN_ERROR(559,false,"无效token");
-
-    // 响应业务状态
-    private Integer status;
-    // 调用是否成功
-    private Boolean success;
-    // 响应消息,可以为成功或者失败的消息
-    private String msg;
-
-    ResponseStatusEnum(Integer status, Boolean success, String msg) {
-        this.status = status;
-        this.success = success;
-        this.msg = msg;
-    }
-
-    public Integer status() {
-        return status;
-    }
-    public Boolean success() {
-        return success;
-    }
-    public String msg() {
-        return msg;
-    }
-
-    @Override
-    public Integer getStatus() {
-        return status;
-    }
-
-    @Override
-    public Boolean getSuccess() {
-        return success;
-    }
-
-    @Override
-    public String getMsg() {
-        return msg;
-    }
-
-
-}

+ 11 - 1
mhotel/src/com/happy/service/AppHomePageService.java

@@ -1,6 +1,8 @@
 package com.happy.service;
 
 import com.happy.Model.Booking;
+import com.happy.Model.Hotel;
+import com.happy.dto.IPage;
 
 import java.util.List;
 
@@ -17,6 +19,14 @@ public interface AppHomePageService {
      * @param rows
      * @return
      */
-    public List getHotelList(String queryValue,int page, int rows);
+    public IPage getHotelList(String queryValue, int page, int rows);
 
+    public int getHotelTotal(String queryValue);
+
+    /**
+     * 通过民宿id找到相关民宿和房型信息(并标识是否可订房)
+     * @param hotelId
+     * @return
+     */
+    public Hotel getHotelAndHouseByHotelId(String hotelId);
 }

+ 43 - 16
mhotel/src/com/happy/service/impl/AppHomePageImplService.java

@@ -1,6 +1,7 @@
 package com.happy.service.impl;
 
 import com.happy.Model.Booking;
+import com.happy.Model.Hotel;
 import com.happy.Model.House;
 import com.happy.Until.Func;
 import com.happy.Until.TimeExchange;
@@ -9,6 +10,8 @@ import com.happy.dao.HouseDao;
 import com.happy.dto.IPage;
 import com.happy.service.AppHomePageService;
 import com.happy.service.BookService;
+import com.happy.service.HotelService;
+import com.happy.service.HouseService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -21,25 +24,49 @@ public class AppHomePageImplService implements AppHomePageService {
     public BookDao bookDao;
     @Resource
     public HouseDao houseDao;
+    @Resource
+    public HouseService houseService;
+    @Resource
+    public HotelService hotelService;
 
 
     @Override
-    public List getHotelList(String queryValue, int page, int rows) {
-
-//        IPage<House> iPage = new IPage();
-//        StringBuilder s1 = new StringBuilder("");
-//        if (!Func.checkNull(queryValue)){
-//            s1.append(" and hname like '%").append(queryValue).append("%' ");
-//        }
-//
-//        int total = hotel.queryHouseTotal(s1.toString()); // 查询表中的总记录数
-//        List<House> houseList = houseDao.queryPage(sqlx,page,rows);
-//        int total = houseDao.queryTotal(sqlx);
-//        iPage.setPageList(houseList);
-//        iPage.setPageCount( (int)Math.ceil((double)total/rows));
-//        iPage.setRows(rows);
-//        iPage.setTotal(total);
-//        return iPage;
+    public IPage<Hotel> getHotelList(String queryValue, int page, int rows) {
+        IPage<Hotel> iPage = new IPage();
+        StringBuilder strSql = new StringBuilder("");
+        if (!Func.checkNull(queryValue)){
+            strSql.append(" and hname like '%").append(queryValue).append("%' ");
+        }
+
+        return hotelService.queryPage(strSql.toString(),page,rows);
+    }
+
+    @Override
+    public int getHotelTotal(String queryValue) {
+
+
+
+        return 0;
+    }
+
+    @Override
+    public Hotel getHotelAndHouseByHotelId(String hotelId) {
+        if (Func.checkNull(hotelId))
+            return new Hotel();
+        Hotel hotel = hotelService.getById(Func.parseInt(hotelId));
+        if (Func.checkNull(hotel.getManagerId()))
+            return hotel;
+
+        hotel.getManagerId();// 需求确定使用商户id关联房型
+        StringBuffer strSql = new StringBuffer();
+        strSql.append(" and manager_id = '").append(hotel.getManagerId()).append("' ");
+        List houseList = houseService.queryList(strSql.toString());
+
+        // 判断是否有房间,对每个房型进行标识
+//        hotel.
+
+
+
         return null;
     }
 }

+ 1 - 20
mhotel/src/test2.java

@@ -1,23 +1,5 @@
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Random;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
 import com.happy.Model.weixin.Users;
-import com.happy.Until.Func;
-import com.happy.common.util.CommonResult;
 import net.sf.json.JSONObject;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
 
 /**
  * 使用JAVA DOM PARSER:修改 XML 文件
@@ -34,8 +16,7 @@ public class test2 {
         users.setUser_name("321");
         users.setContactId(3);
         obj.put("map", users);
-        System.out.println(CommonResult.ok(obj));
-        System.out.println(CommonResult.ok("200","成功"));
+
 //        System.out.printf(Func.parseStr(new Date()));
 //        for (int i = 0; i < 10; i++) {
 //            Thread.sleep(1000);