瀏覽代碼

Merge remote-tracking branch 'origin/master'

raojiaolong@163.com 2 年之前
父節點
當前提交
8f5e3fa4af

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

@@ -20,6 +20,7 @@ public class Booking {
   private String hotelHpositionWens; // 民宿经纬度
   private String hotelHpositionWens; // 民宿经纬度
   private String hotelPhone; // 民宿联系电话
   private String hotelPhone; // 民宿联系电话
   private String hotelPerson; // 民宿联系人
   private String hotelPerson; // 民宿联系人
+  private String hotelManagerId; // 所属商家id
   private String hotelTownship; // 民宿所属乡镇
   private String hotelTownship; // 民宿所属乡镇
   private String hotelConfig; // 民宿配置
   private String hotelConfig; // 民宿配置
   private String hotelType; // 民宿类型
   private String hotelType; // 民宿类型
@@ -413,4 +414,11 @@ public class Booking {
     this.remake = remake;
     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;
 package com.happy.Model;
 
 
+import java.util.List;
+
 /**
 /**
  * @Description  
  * @Description  
  * @Author  raojiaolong
  * @Author  raojiaolong
@@ -124,6 +126,8 @@ public class Hotel {
 	 */
 	 */
 	private Integer status;
 	private Integer status;
 
 
+	private List<House> houseList;
+
 	public Integer getId() {
 	public Integer getId() {
 		return id;
 		return id;
 	}
 	}
@@ -307,4 +311,12 @@ public class Hotel {
 	public void setStatus(Integer status) {
 	public void setStatus(Integer status) {
 		this.status = status;
 		this.status = status;
 	}
 	}
+
+	public List getHouseList() {
+		return houseList;
+	}
+
+	public void setHouseList(List houseList) {
+		this.houseList = houseList;
+	}
 }
 }

+ 1 - 0
mhotel/src/com/happy/Model/Message/111

@@ -0,0 +1 @@
+111

+ 53 - 0
mhotel/src/com/happy/Model/Message/Mp_template_msg.java

@@ -0,0 +1,53 @@
+package com.happy.Model.Message;
+
+
+import com.alibaba.fastjson.JSONObject;
+
+public class Mp_template_msg {
+
+    public String appid;
+    public String template_id;
+    public String url;
+    public JSONObject miniprogram;
+    public JSONObject data;
+
+    public String getAppid() {
+        return appid;
+    }
+
+    public void setAppid(String appid) {
+        this.appid = appid;
+    }
+
+    public String getTemplate_id() {
+        return template_id;
+    }
+
+    public void setTemplate_id(String template_id) {
+        this.template_id = template_id;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public JSONObject getMiniprogram() {
+        return miniprogram;
+    }
+
+    public void setMiniprogram(JSONObject miniprogram) {
+        this.miniprogram = miniprogram;
+    }
+
+    public JSONObject getData() {
+        return data;
+    }
+
+    public void setData(JSONObject data) {
+        this.data = data;
+    }
+}

+ 26 - 0
mhotel/src/com/happy/Until/DateUtil.java

@@ -2,6 +2,7 @@ package com.happy.Until;
 
 
 
 
 import java.io.File;
 import java.io.File;
+import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -391,4 +392,29 @@ public class DateUtil
         }
         }
     }
     }
 
 
+    /**
+     * 获取两个日期之间相差多少天
+     * @param date1
+     * @param date2
+     * @return
+     */
+    public static int getDayDiff(String date1,String date2)
+    {
+        DateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
+        Date star = parseDateOnly(date1);
+        Date endDay=parseDateOnly(date2);
+        Date nextDay=star;
+        int i=0;
+        while(nextDay.before(endDay)){//当明天不在结束时间之前是终止循环
+            Calendar cld = Calendar.getInstance();
+            cld.setTime(star);
+            cld.add(Calendar.DATE, 1);
+            star = cld.getTime();
+            //获得下一天日期字符串
+            nextDay = star;
+            i++;
+        }
+        return i;
+    }
+
 }
 }

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

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

+ 5 - 0
mhotel/src/com/happy/Until/Enum/OrderEnum.java

@@ -0,0 +1,5 @@
+package com.happy.Until.Enum;
+
+public enum OrderEnum {
+    间, 晚;
+}

+ 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;
 package com.happy.Until;
 
 
+import com.happy.dto.IPage;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONObject;
 import org.apache.poi.ss.usermodel.Workbook;
 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) {
 	public static void writeJson(HttpServletResponse respone, String result) {
 		respone.setContentType("application/json;charset=utf-8");
 		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(){
     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());
         return sp.format(new Date());
     }
     }
 
 
@@ -405,7 +405,6 @@ public class TimeExchange {
      * 如果时间1大于时间2,接口返回false
      * 如果时间1大于时间2,接口返回false
      * @param dateOne 时间1
      * @param dateOne 时间1
      * @param dateTwo 时间2
      * @param dateTwo 时间2
-     * @param Forma 时间格式
      * @return
      * @return
      * @throws ParseException
      * @throws ParseException
      */
      */

+ 41 - 3
mhotel/src/com/happy/action/AppBookingAction.java

@@ -1,9 +1,16 @@
 package com.happy.action;
 package com.happy.action;
 
 
-import com.happy.common.util.CommonResult;
-import com.happy.service.AppHomePageService;
+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.service.AppBookService;
 import com.happy.service.BookService;
 import com.happy.service.BookService;
+import com.happy.service.HotelService;
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.ActionSupport;
+import net.sf.json.JSONObject;
+import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.interceptor.ServletRequestAware;
 import org.apache.struts2.interceptor.ServletRequestAware;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -20,11 +27,21 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
 
 
     @Resource
     @Resource
     public BookService bookService;
     public BookService bookService;
+    @Resource
+    public AppBookService appBookService;
 
 
     public int page; // 当前页
     public int page; // 当前页
     public int rows;// 每页显示的行数rows
     public int rows;// 每页显示的行数rows
     public Integer id;
     public Integer id;
     public String status;
     public String status;
+    public String hotelId; // 酒店id
+    public String houseId; // 房型id
+    public String startTime; // 订房开始时间
+    public String endTime;   // 订房结束时间
+    public String houseOrderNumber; // 订房数量
+    public String userName; // 住客姓名
+    public String userPhone; // 住客联系电话
+    public String userId; // 下单人id
 
 
     public HttpServletRequest getRequest() {
     public HttpServletRequest getRequest() {
         return request;
         return request;
@@ -85,7 +102,28 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
     public String createOrder()
     public String createOrder()
     {
     {
         // 插入订单数据到表中
         // 插入订单数据到表中
-
+//        public String hotelId; // 酒店id
+//        public String houseId; // 房型id
+//        public String startTime; // 订房开始时间
+//        public String endTime;   // 订房结束时间
+//        public String houseOrderNumber; // 订房数量
+//        public String userName; // 住客姓名
+//        public String userPhone; // 住客联系电话
+        //public String userId; // 下单人id
+        JSONObject jsonObject = new JSONObject();
+        if (Func.checkNull(hotelId) ||Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
+                ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
+        {
+            jsonObject.put(B.CODE, ResultStatusCode.BAD_REQUEST.getStatus());
+            jsonObject.put(B.MESSAGE,ResultStatusCode.BAD_REQUEST.getMsg());
+            ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
+            return null;
+        }
+
+        appBookService.createOrder(hotelId, houseId, startTime, endTime, houseOrderNumber,userName,userPhone, userId);
+
+        jsonObject.put(B.CODE, ResultStatusCode.OK.getStatus());
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),jsonObject.toString());
         return null;
         return null;
     }
     }
 
 

+ 57 - 18
mhotel/src/com/happy/action/AppHomePageAction.java

@@ -1,17 +1,16 @@
 package com.happy.action;
 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.DateUtil;
+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.AppHomePageService;
 import com.happy.service.BookService;
 import com.happy.service.BookService;
+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;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.ServletActionContext;
@@ -20,7 +19,6 @@ import org.apache.struts2.interceptor.ServletRequestAware;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
-import java.text.ParseException;
 import java.util.*;
 import java.util.*;
 
 
 /**
 /**
@@ -35,18 +33,22 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
     public BookService bookService;
     public BookService bookService;
     @Resource
     @Resource
     public AppHomePageService appHomePageService;
     public AppHomePageService appHomePageService;
+    @Resource
+    public HotelService hotelService;
 
 
     public int page; // 当前页
     public int page; // 当前页
     public int rows;// 每页显示的行数rows
     public int rows;// 每页显示的行数rows
 
 
     public Integer id = new Integer(0);
     public Integer id = new Integer(0);
     public String status;
     public String status;
-    private int hotelId = 0; //选择的当前酒店的id
+    public String hotelId; //选择的当前酒店的id
+    public String queryStartTime; // 查询开始时间
+    public String queryEndTime; // 查询结束时间
 
 
     public String userCode; // 第一次进来获取用户的code
     public String userCode; // 第一次进来获取用户的code
     public String queryValue; // 首页查寻搜索关键词
     public String queryValue; // 首页查寻搜索关键词
-    private Date startTimeQuery; // 查询订房开始时间
-    private Date endTimeQuery; // 查询订房结束时间
+    public Date startTimeQuery; // 查询订房开始时间
+    public Date endTimeQuery; // 查询订房结束时间
 
 
     public HttpServletRequest getRequest() {
     public HttpServletRequest getRequest() {
         return request;
         return request;
@@ -113,7 +115,8 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
         //getUserInfo();
         //getUserInfo();
 
 
         // 获取民宿列表
         // 获取民宿列表
-       appHomePageService.getHotelList(queryValue,rows,page);
+        IPage iPage = appHomePageService.getHotelList(queryValue,rows,page);
+        ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),iPage);
 
 
         return null;
         return null;
     }
     }
@@ -124,12 +127,48 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
      */
      */
     public String getHouseByHotelId()
     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;
             return null;
+        }
+
+        // 使用天去查"yyyy/MM/dd"
+//        Date startDate = DateUtil.parseDate(queryStartTime,DateUtil.Time_Formatter_Day);
+//        Date endDate = DateUtil.parseDate(queryStartTime,DateUtil.Time_Formatter_Day);
+        Hotel hotel = appHomePageService.getHotelAndHouseByHotelId(hotelId,queryStartTime, queryEndTime);
 
 
         // 通过时间区间查询房间信息,并带好是否有房标识给前台
         // 通过时间区间查询房间信息,并带好是否有房标识给前台
+        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;
         return null;
     }
     }
 
 
@@ -151,11 +190,11 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
         this.queryValue = queryValue;
         this.queryValue = queryValue;
     }
     }
 
 
-    public int getHotelId() {
+    public String getHotelId() {
         return hotelId;
         return hotelId;
     }
     }
 
 
-    public void setHotelId(int hotelId) {
+    public void setHotelId(String hotelId) {
         this.hotelId = hotelId;
         this.hotelId = hotelId;
     }
     }
 
 

+ 12 - 16
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.Enum.DataType;
 import com.happy.Until.Func;
 import com.happy.Until.Func;
 import com.happy.Until.ResponseUtil;
 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.BookService;
 import com.happy.service.UserService;
 import com.happy.service.UserService;
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.ActionSupport;
-import net.sf.json.JSON;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONObject;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.interceptor.ServletRequestAware;
 import org.apache.struts2.interceptor.ServletRequestAware;
@@ -111,9 +109,7 @@ 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("' ");
         }
         }
-        int total = bookService.queryBookTotal(querySql.toString()); // 查询表中的总记录数
-        List<Booking> listPage = bookService.queryBookPage(querySql.toString(), page, rows); // 查询分页
-        ResponseUtil.writeJsonPageData(ServletActionContext.getResponse(),listPage,this.page,this.rows,total);
+        ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),bookService.queryPage(querySql.toString(), page, rows));
         return null;
         return null;
     }
     }
 
 
@@ -147,8 +143,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         Users users = userService.queryByUserId(userId);
         Users users = userService.queryByUserId(userId);
 
 
         JSONObject resultJson = new JSONObject();
         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);
         resultJson.put(B.DATA,users);
         ResponseUtil.writeJson(ServletActionContext.getResponse(),resultJson.toString());
         ResponseUtil.writeJson(ServletActionContext.getResponse(),resultJson.toString());
 
 
@@ -186,8 +182,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         users.setCard_number(contactUserIdNum);
         users.setCard_number(contactUserIdNum);
         userService.update(users);
         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());
         ResponseUtil.writeJson(ServletActionContext.getResponse(),resultJson.toString());
     }
     }
 
 
@@ -203,7 +199,7 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         Users users = new Users();
         Users users = new Users();
         users.setContactId(Func.parseInt(userId));
         users.setContactId(Func.parseInt(userId));
         users.setContactName(userName);
         users.setContactName(userName);
-        users.setCreate_time(Func.parseStr(new Date()));
+        users.setCreate_time(TimeExchange.getDate());
         users.setDataType(DataType.关联数据.toString());
         users.setDataType(DataType.关联数据.toString());
         users.setUser_name(contactUserName);    // 相关联系人的名字
         users.setUser_name(contactUserName);    // 相关联系人的名字
         users.setUser_phone(contactUserPhone);  // 相关联系人的手机号码
         users.setUser_phone(contactUserPhone);  // 相关联系人的手机号码
@@ -211,8 +207,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         userService.insert(users);
         userService.insert(users);
 
 
         JSONObject resultJson = new JSONObject();
         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());
         ResponseUtil.writeJson(ServletActionContext.getResponse(),resultJson.toString());
     }
     }
 
 
@@ -227,8 +223,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         JSONObject resultJson = new JSONObject();
         JSONObject resultJson = new JSONObject();
         userService.del(Func.parseInt(contactId));
         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());
         ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
     }
     }
 
 

+ 9 - 9
mhotel/src/com/happy/action/autoAction.java

@@ -52,15 +52,15 @@ public class autoAction extends ActionSupport implements ServletRequestAware {
     }
     }
 
 
     public String refund_room(){
     public String refund_room(){
-        JSONObject resultjson = new JSONObject();
-        List<Booking> list = bookService.queryEnd(TimeExchange.getDate());
-        if (list!=null){
-            for (int i = 0; i < list.size(); i++) {
-//                bookService.update_pay("6", list.get(i).getOrder_num());
-            }
-        }
-        resultjson.put("message", "退房成功");
-        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+//        JSONObject resultjson = new JSONObject();
+//        List<Booking> list = bookService.queryEnd(TimeExchange.getDate());
+//        if (list!=null){
+//            for (int i = 0; i < list.size(); i++) {
+////                bookService.update_pay("6", list.get(i).getOrder_num());
+//            }
+//        }
+//        resultjson.put("message", "退房成功");
+//        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
         return null;
         return null;
     }
     }
 }
 }

+ 77 - 0
mhotel/src/com/happy/common/http/Message2.java

@@ -0,0 +1,77 @@
+package com.happy.common.http;
+
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+import com.happy.Model.Message.Mp_template_msg;
+import java.util.HashMap;
+
+public class Message2 {
+
+    /** 小程序推送消息到公众号
+     * openid:用户小程序openid, order_num订单号,
+     *  h_type房型, live_end入住和离店日期:2023-08-02~2023-08-06
+     *  user_name:用户名, hotel_name:酒店名
+     * **/
+    public static String send(String openid,String order_num,
+                              String h_type,String live_end,
+                              String user_name,String hotel_name)
+            throws Exception {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("grant_type", "client_credential");
+        jsonObject.put("appid", "wx2fc3f45732fae5d3"); // 小程序
+        jsonObject.put("secret","7eee4a49a4470a77f9222995e8511547");
+        String msg3 = HttpsClient.sendJson2("https://api.weixin.qq.com/cgi-bin/stable_token",jsonObject);
+        Gson gson = new Gson();
+        HashMap<String, String> userMap = gson.fromJson(msg3.toString(), new TypeToken<HashMap<String, String>>() {}.getType());
+        JSONObject message = new JSONObject();
+        String token = userMap.get("access_token");
+        message.put("touser", openid);
+
+        Mp_template_msg mp_template_msg = new Mp_template_msg();
+        mp_template_msg.setAppid("wxa46ef222053a1047");  // 公众号
+        mp_template_msg.setTemplate_id("2qQLkDrxBpMcao35jONQSo8GIY6wwzFna-LLU7Q7qRM");
+        mp_template_msg.setUrl("index");
+        JSONObject jsonObject1 = new JSONObject();
+        jsonObject1.put("appid","wx2fc3f45732fae5d3");
+        jsonObject1.put("pagepath","pages/index/index");
+        mp_template_msg.setMiniprogram(jsonObject1);
+        // 订单号
+        JSONObject character_string1_ = new JSONObject();
+        character_string1_.put("value", order_num);
+        character_string1_.put("color", "#173177");
+        // 房型名称
+        JSONObject thing6 = new JSONObject();
+        thing6.put("value", h_type);
+        thing6.put("color", "#0000FF");
+        // 入离时间
+        JSONObject time11 = new JSONObject();
+        time11.put("value", live_end);
+        time11.put("color", "#173177");
+        // 客户名称
+        JSONObject thing10 = new JSONObject();
+        thing10.put("value", user_name);
+        thing10.put("color", "#173177");
+        // 酒店名称
+        JSONObject thing9_ = new JSONObject();
+        thing9_.put("value", hotel_name);
+        thing9_.put("color", "#173177");
+        // 封装data
+        JSONObject data = new JSONObject();
+        // 订单号
+        data.put("character_string1",character_string1_);
+        // 房型名称
+        data.put("thing6",thing6);
+        // 入离时间
+        data.put("time11",time11);
+        // 客户名称
+        data.put("thing10",thing10);
+        // 酒店名称
+        data.put("thing9",thing9_);
+        mp_template_msg.setData(data);
+        message.put("mp_template_msg",mp_template_msg);
+        return HttpsClient.sendJson("https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token="+token, message);
+    }
+
+
+}

+ 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;
-    }
-
-
-}

+ 15 - 0
mhotel/src/com/happy/service/AppBookService.java

@@ -0,0 +1,15 @@
+package com.happy.service;
+
+import com.happy.Model.Booking;
+import com.happy.dto.IPage;
+
+import java.util.List;
+
+public interface AppBookService {
+
+
+
+    public String createOrder(String hotelId,String houseId,String startTime,String endTime,String houseOrderNumber,String userName,String userPhone, String userId);
+
+
+}

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

@@ -1,6 +1,8 @@
 package com.happy.service;
 package com.happy.service;
 
 
 import com.happy.Model.Booking;
 import com.happy.Model.Booking;
+import com.happy.Model.Hotel;
+import com.happy.dto.IPage;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -17,6 +19,14 @@ public interface AppHomePageService {
      * @param rows
      * @param rows
      * @return
      * @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, String queryStartTime, String queryEndTime);
 }
 }

+ 89 - 0
mhotel/src/com/happy/service/impl/AppBookImplService.java

@@ -0,0 +1,89 @@
+package com.happy.service.impl;
+
+import com.baidubce.model.User;
+import com.happy.Model.AdminManager;
+import com.happy.Model.Booking;
+import com.happy.Model.Hotel;
+import com.happy.Model.House;
+import com.happy.Model.weixin.Users;
+import com.happy.Until.DateUtil;
+import com.happy.Until.Enum.OrderEnum;
+import com.happy.Until.Func;
+import com.happy.Until.TimeExchange;
+import com.happy.dao.BookDao;
+import com.happy.dto.IPage;
+import com.happy.service.*;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+
+@Service("AppBookService")
+public class AppBookImplService implements AppBookService {
+
+    @Resource
+    public BookService bookService;
+    @Resource
+    public HotelService hotelService;
+    @Resource
+    public HouseService houseService;
+    @Resource
+    public UserService userService;
+    @Resource
+    public AdminManagerService adminManagerService;
+
+    @Override
+    public String createOrder(String hotelId, String houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId) {
+        if (Func.checkNull(hotelId) ||Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
+                ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
+            return null;
+
+        Hotel hotel = hotelService.getById(Func.parseInt(hotelId));
+        House house = houseService.getById(Func.parseInt(houseId));
+        Users user = userService.queryByUserId(userId);
+        AdminManager adminManager = adminManagerService.getById(Func.parseInt(userId));
+
+
+        Booking booking = new Booking();
+
+        // 设置民宿信息
+        booking.setHotelName(hotel.getHname());
+        booking.setHotelHposition(hotel.getHposition());
+        booking.setHotelHpositionWens(hotel.getHpositionWens());
+        booking.setHotelManagerId(hotel.getManagerId());
+        booking.setHotelTownship(adminManager.getHotelTownship());
+        booking.setHotelConfig(hotel.getHconfig());
+        booking.setHotelType(hotel.getHtype());
+        booking.setHotelIsCanorder(Func.parseStr(hotel.getIsCanorder()));
+
+        // 设置房型信息
+        booking.setHouseId(Func.parseStr(house.getId()));
+        booking.setHouseName(house.gethName());
+        booking.setHouseConfig(house.gethConfig());
+        booking.setHouseUnitPrice(house.getPrice());
+        booking.setHouseOrderNumber(Func.parseInt(houseOrderNumber));
+        booking.setHouseAreas(house.gethAreas());
+        booking.setHouseRemake(house.getRemark());
+        double totalPrice = Func.parseInt(houseOrderNumber) * house.getPrice();
+        booking.setHouseTotalPrice(totalPrice);
+
+        // 设置住客信息
+        booking.setUserName(userName);
+        booking.setUserPhone(userPhone);
+        booking.setOrderStartTime(DateUtil.parseDateOnly(startTime));
+        booking.setOrderEndTime(DateUtil.parseDateOnly(endTime));
+        int day = DateUtil.getDayDiff(startTime,endTime);
+        String orderLiveTime= day+ OrderEnum.间.toString()+ day +OrderEnum.晚.toString();
+        booking.setOrderLiveTime(orderLiveTime);
+
+        // 订单信息
+        Integer orderNum = TimeExchange.StringToTimestamp(TimeExchange.getDate());// 订单号
+        booking.setOrderNum(Func.parseStr(orderNum));
+        booking.setCreateTime(DateUtil.getCurrentDate());
+        bookService.insertBooking(booking);
+
+
+        return null;
+    }
+}

+ 87 - 17
mhotel/src/com/happy/service/impl/AppHomePageImplService.java

@@ -1,7 +1,9 @@
 package com.happy.service.impl;
 package com.happy.service.impl;
 
 
 import com.happy.Model.Booking;
 import com.happy.Model.Booking;
+import com.happy.Model.Hotel;
 import com.happy.Model.House;
 import com.happy.Model.House;
+import com.happy.Until.DateUtil;
 import com.happy.Until.Func;
 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;
@@ -9,10 +11,15 @@ import com.happy.dao.HouseDao;
 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.HotelService;
+import com.happy.service.HouseService;
 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.List;
+import java.util.Map;
 
 
 @Service("AppHomePageService")
 @Service("AppHomePageService")
 public class AppHomePageImplService implements AppHomePageService {
 public class AppHomePageImplService implements AppHomePageService {
@@ -21,25 +28,88 @@ public class AppHomePageImplService implements AppHomePageService {
     public BookDao bookDao;
     public BookDao bookDao;
     @Resource
     @Resource
     public HouseDao houseDao;
     public HouseDao houseDao;
+    @Resource
+    public HouseService houseService;
+    @Resource
+    public HotelService hotelService;
+    @Resource
+    public BookService bookService;
+
+
+    @Override
+    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
     @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;
-        return null;
+    public Hotel getHotelAndHouseByHotelId(String hotelId, String queryStartTime, String queryEndTime) {
+        if (Func.checkNull(hotelId))
+            return new Hotel();
+        Hotel hotel = hotelService.getById(Func.parseInt(hotelId));
+        if (Func.checkNull(hotel.getManagerId()))
+            return hotel;
+
+        System.out.println(hotel.getManagerId());// 需求确定使用商户id关联房型
+        StringBuffer strSql = new StringBuffer();
+        strSql.append(" and manager_id = '").append(hotel.getManagerId()).append("' ");
+        List<House> houseList = houseService.queryList(strSql.toString());
+
+//        Map<String, House> houseMap =  new HashMap();
+//        houseList.forEach((House house) ->{
+//            if (house.getId() == 0)
+//                return;
+//            houseMap.put(Func.parseStr(house.getId()),house);
+//        });
+
+
+        // 判断是否有房间,对每个房型进行标识
+        StringBuffer strSqlBook = new StringBuffer();
+        strSqlBook.append(" and hotel_manager_id = '").append(hotel.getManagerId()).append("' ");
+        strSqlBook.append(" and order_start_time >= '").append(queryStartTime).append("' ");
+        strSqlBook.append(" and order_end_time < '").append(queryEndTime).append("' ");
+
+        List<Booking> bookList = bookService.queryList(strSqlBook.toString());
+
+        Map<String, Integer> houseBookingMap =  new HashMap();
+        Integer numberTemp = new Integer(0);
+        for (Booking booking: bookList) {
+            if (Func.checkNull(booking.getHouseId()))
+                continue;
+
+            if (houseBookingMap.containsKey(booking.getHouseId()))
+            {
+                numberTemp = houseBookingMap.get(booking.getHouseId());
+                int i = Func.parseInt(numberTemp) + booking.getHouseOrderNumber();
+                houseBookingMap.put(booking.getHouseId(),i);
+                continue;
+            }
+            houseBookingMap.put(booking.getHouseId(),booking.getHouseOrderNumber());
+        }
+
+        houseList.forEach((House house) ->{
+            if (!houseBookingMap.containsKey(house.getId()))
+                return;
+
+            int i = Func.parseInt(house.getNumber()) - Func.parseInt(houseBookingMap.get(house.getId()));
+            house.setRemark(Func.parseStr(i));
+        });
+
+
+        hotel.setHouseList(houseList);
+        return hotel;
     }
     }
 }
 }

+ 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.Model.weixin.Users;
-import com.happy.Until.Func;
-import com.happy.common.util.CommonResult;
 import net.sf.json.JSONObject;
 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 文件
  * 使用JAVA DOM PARSER:修改 XML 文件
@@ -34,8 +16,7 @@ public class test2 {
         users.setUser_name("321");
         users.setUser_name("321");
         users.setContactId(3);
         users.setContactId(3);
         obj.put("map", users);
         obj.put("map", users);
-        System.out.println(CommonResult.ok(obj));
-        System.out.println(CommonResult.ok("200","成功"));
+
 //        System.out.printf(Func.parseStr(new Date()));
 //        System.out.printf(Func.parseStr(new Date()));
 //        for (int i = 0; i < 10; i++) {
 //        for (int i = 0; i < 10; i++) {
 //            Thread.sleep(1000);
 //            Thread.sleep(1000);