Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	mhotel/src/com/happy/service/impl/AppBookImplService.java
#	mhotel/src/com/happy/service/impl/UserServiceImpl.java
raojiaolong@163.com 2 лет назад
Родитель
Сommit
2a5addd61b

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

@@ -86,6 +86,7 @@ public class Hotel {
 	 */
 	 */
 	private String hconfig;
 	private String hconfig;
 
 
+	private List hconfigList;
 	/**
 	/**
 	 * 接单设置(1自动接单 2手动接单)
 	 * 接单设置(1自动接单 2手动接单)
 	 */
 	 */
@@ -126,7 +127,19 @@ public class Hotel {
 	 */
 	 */
 	private Integer status;
 	private Integer status;
 
 
+	/**
+	 * 当前酒店最低价
+	 */
 	private String min_price;
 	private String min_price;
+	/**
+	 * 关联商家联系人电话
+	 */
+	private String managerPhone;
+
+	/**
+	 * 关联商家所属乡镇
+	 */
+	private String hotelTownshipName;
 	private List<House> houseList;
 	private List<House> houseList;
 
 
 	public Integer getId() {
 	public Integer getId() {
@@ -331,4 +344,29 @@ public class Hotel {
 	public void setMin_price(String min_price) {
 	public void setMin_price(String min_price) {
 		this.min_price = min_price;
 		this.min_price = min_price;
 	}
 	}
+
+	public String getManagerPhone() {
+		return managerPhone;
+	}
+
+	public void setManagerPhone(String managerPhone) {
+		this.managerPhone = managerPhone;
+	}
+
+	public String getHotelTownshipName() {
+		return hotelTownshipName;
+	}
+
+	public void setHotelTownshipName(String hotelTownshipName) {
+		this.hotelTownshipName = hotelTownshipName;
+	}
+
+
+	public List getHconfigList() {
+		return hconfigList;
+	}
+
+	public void setHconfigList(List hconfigList) {
+		this.hconfigList = hconfigList;
+	}
 }
 }

+ 1 - 1
mhotel/src/com/happy/Model/HotelDict.java

@@ -12,7 +12,7 @@ public class HotelDict {
 	private Integer id;
 	private Integer id;
 
 
     /**
     /**
-     * 编码
+     * 编码(1.民宿类型;2.民宿服务;3.房型名称;4.房型服务)
      */
      */
     private Integer code;
     private Integer code;
 
 

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

@@ -46,6 +46,7 @@ public class House {
 	 */
 	 */
 	private String hConfig;
 	private String hConfig;
 
 
+	private  List hConfigList;
 	/**
 	/**
 	 * 备注
 	 * 备注
 	 */
 	 */
@@ -189,4 +190,12 @@ public class House {
 	public void setRemainRooms(String remainRooms) {
 	public void setRemainRooms(String remainRooms) {
 		this.remainRooms = remainRooms;
 		this.remainRooms = remainRooms;
 	}
 	}
+
+	public List gethConfigList() {
+		return hConfigList;
+	}
+
+	public void sethConfigList(List hConfigList) {
+		this.hConfigList = hConfigList;
+	}
 }
 }

+ 9 - 11
mhotel/src/com/happy/Model/weixin/WeiXinUtil.java

@@ -2,22 +2,20 @@ package com.happy.Model.weixin;
 
 
 public class WeiXinUtil {
 public class WeiXinUtil {
 
 
-    // 诚欣公众号
-    public static String appid_c = "wxa5cc2178ff34bc8e";
+    // 创海公众号
+    public static String appid_c = "wx2fc3f45732fae5d3";
+    public static String screct_c = "7eee4a49a4470a77f9222995e8511547";
+
+    public static String ip_h = "https://chtech.ncjti.edu.cn/hotelReservation/zhotel";
+    //public static String ip_q = "https://chtech.ncjti.edu.cn/hotelReservation/dist";
+    public static String ip_q = "http://192.168.161.227:8000/hotelReservation/dist";
+
     public static String ip = "171.34.223.11";
     public static String ip = "171.34.223.11";
-    public static String screct_c = "7e6b036298b718da6d1afe4ae5364a1f";
     public static String key = "v2";
     public static String key = "v2";
-    // 诚欣测试号
-    /*public static String appid_c = "wx5fcbd4d313aa4c15";
-    public static String screct_c = "a72db0c99cde741eb391af69067aacfa";*/
-
-    // 学校公众号
     public static String appid = "9FFFACD6D09F15D2";
     public static String appid = "9FFFACD6D09F15D2";
     public static String screct = "2F0F57080E311542B8411A2A33C44329";
     public static String screct = "2F0F57080E311542B8411A2A33C44329";
     public static String APIid = "chuanghaikejichuanghaikeji123456";
     public static String APIid = "chuanghaikejichuanghaikeji123456";
     public static String account = "1648595577";
     public static String account = "1648595577";
-    public static String ip_h = "https://chtech.ncjti.edu.cn/hotelReservation/zhotel";
-    //public static String ip_q = "https://chtech.ncjti.edu.cn/hotelReservation/dist";
-    public static String ip_q = "http://192.168.161.227:8000/hotelReservation/dist";
+
 
 
 }
 }

+ 1 - 1
mhotel/src/com/happy/Until/DateUtil.java

@@ -22,7 +22,7 @@ public class DateUtil
 
 
     }
     }
 
 
-    public static String Time_Formatter_Day = "yyyy/MM/dd";
+    public static String Time_Formatter_Day = "yyyy-MM-dd";
     public static String Time_Formatter_Second = "yyyy-MM-dd HH:mm:ss";
     public static String Time_Formatter_Second = "yyyy-MM-dd HH:mm:ss";
 
 
     public static String getCurrentYear() {
     public static String getCurrentYear() {

+ 7 - 1
mhotel/src/com/happy/Until/Func.java

@@ -295,7 +295,13 @@ public class Func {
         }
         }
 
 
         try {
         try {
-            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateStr);
+            return new SimpleDateFormat("yyyy/MM/dd").parse(dateStr);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+
+        try {
+            return new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").parse(dateStr);
         } catch (ParseException e) {
         } catch (ParseException e) {
             try {
             try {
                 SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", java.util.Locale.US);
                 SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", java.util.Locale.US);

+ 6 - 5
mhotel/src/com/happy/action/AppBookingAction.java

@@ -128,10 +128,9 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
 
 
 
 
     /**
     /**
-     * hotelId; // 酒店id
      * houseId; // 房型id
      * houseId; // 房型id
-     * startTime; // 订房开始时间
-     * endTime;   // 订房结束时间
+     * startTime; // 订房开始时间 2023/08/04
+     * endTime;   // 订房结束时间 2023/08/05
      * houseOrderNumber; // 订房数量
      * houseOrderNumber; // 订房数量
      * userName; // 住客姓名
      * userName; // 住客姓名
      * userPhone; // 住客联系电话
      * userPhone; // 住客联系电话
@@ -155,14 +154,15 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
 
 
         // 创建订单之前,先验证是否有房间
         // 创建订单之前,先验证是否有房间
         String backMessage = appBookService.varificationHouse(houseId, startDate, endDate);
         String backMessage = appBookService.varificationHouse(houseId, startDate, endDate);
-        if (Func.checkNull(backMessage)) {
+        if (!Func.checkNull(backMessage)) {
             jsonObject.put(B.code, ResultStatusCode.CANNTBOOKING.getStatus());
             jsonObject.put(B.code, ResultStatusCode.CANNTBOOKING.getStatus());
             jsonObject.put(B.message, backMessage);
             jsonObject.put(B.message, backMessage);
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
             return null;
         }
         }
 
 
-        String mess = appBookService.createOrder(houseId, startDate, endDate, houseOrderNumber, userName, userPhone, userId);
+        String  bookingId= Func.parseStr(UUIDUtil.generateID());
+        String mess = appBookService.createOrder(bookingId, houseId, startDate, endDate, houseOrderNumber, userName, userPhone, userId);
         if (!Func.checkNull(mess)) {
         if (!Func.checkNull(mess)) {
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.message, mess);
             jsonObject.put(B.message, mess);
@@ -172,6 +172,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
 
 
         jsonObject.put(B.code, ResultStatusCode.OK.getStatus());
         jsonObject.put(B.code, ResultStatusCode.OK.getStatus());
         jsonObject.put(B.message, ResultStatusCode.OK.getMsg());
         jsonObject.put(B.message, ResultStatusCode.OK.getMsg());
+        jsonObject.put(B.data, bookingId);
         ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
         ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
         return null;
         return null;
     }
     }

+ 4 - 4
mhotel/src/com/happy/action/AppHomePageAction.java

@@ -128,7 +128,7 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
     {
     {
         JSONObject jsonObject = new JSONObject();
         JSONObject jsonObject = new JSONObject();
         // 如果未赋值,则直接跳出
         // 如果未赋值,则直接跳出
-        if (Func.checkNull(hotelId))
+        if (Func.checkNull(hotelId) || Func.checkNull(queryStartTime) || Func.checkNull(queryEndTime))
         {
         {
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.message,ResultStatusCode.BAD_REQUEST.getMsg());
             jsonObject.put(B.message,ResultStatusCode.BAD_REQUEST.getMsg());
@@ -137,9 +137,9 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
         }
         }
 
 
         // 使用天去查"yyyy/MM/dd"
         // 使用天去查"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);
+        String startDate = DateUtil.parseDateToStr((Func.parseDate(queryStartTime)), DateUtil.Time_Formatter_Day);
+        String endDate = DateUtil.parseDateToStr((Func.parseDate(queryEndTime)),  DateUtil.Time_Formatter_Day);
+        Hotel hotel = appHomePageService.getHotelAndHouseByHotelId(hotelId,startDate, endDate);
 
 
         // 通过时间区间查询房间信息,并带好是否有房标识给前台
         // 通过时间区间查询房间信息,并带好是否有房标识给前台
         jsonObject.put(B.code,ResultStatusCode.OK.getStatus());
         jsonObject.put(B.code,ResultStatusCode.OK.getStatus());

+ 61 - 15
mhotel/src/com/happy/action/AppMePageAction.java

@@ -2,14 +2,15 @@ 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.weixin.Users;
-import com.happy.Model.weixin.Wechat_userinfo;
-import com.happy.Model.weixin.WeiXinUtil;
+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.constant.ResultStatusCode;
 import com.happy.constant.ResultStatusCode;
+import com.happy.dto.IPage;
+import com.happy.service.AppService;
 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;
@@ -36,6 +37,8 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
     public BookService bookService;
     public BookService bookService;
     @Resource
     @Resource
     public UserService userService;
     public UserService userService;
+    @Resource
+    public AppService appService;
 
 
     private String contactUserName; // 常用联系人姓名
     private String contactUserName; // 常用联系人姓名
     private String contactUserIdNum; // 常用联系人身份证
     private String contactUserIdNum; // 常用联系人身份证
@@ -134,9 +137,9 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
             querySql.append(" and contact_id = '").append(userId).append("' ");
             querySql.append(" and contact_id = '").append(userId).append("' ");
         }
         }
         querySql.append(" and data_type = '").append(DataType.关联数据.toString()).append("' ");
         querySql.append(" and data_type = '").append(DataType.关联数据.toString()).append("' ");
-        int total = userService.queryUserTotal(querySql.toString()); // 查询表中的总记录数
-        List<Users> listPage = userService.queryUserPage(querySql.toString(), page, rows); // 查询分页
-        ResponseUtil.writeJsonPageData(ServletActionContext.getResponse(),listPage,this.page,this.rows,total);
+
+        IPage listPage = userService.queryUserPage(querySql.toString(), page, rows); // 查询分页
+        ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),listPage);
     }
     }
 
 
     /**
     /**
@@ -255,14 +258,13 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
         ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
     }
     }
 
 
-
     /**
     /**
-     * 用户登录小程序授权
+     * 判断是否有当前用户(加访问记录)
      */
      */
-    public void authorizationUser()
+    public String isHaveUser()
     {
     {
         if (Func.checkNull(this.code))
         if (Func.checkNull(this.code))
-            return;
+            return null;
 
 
         String OPEN_ID = "";
         String OPEN_ID = "";
         JSONObject resultJson = new JSONObject();
         JSONObject resultJson = new JSONObject();
@@ -274,10 +276,52 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
                 + "&code="
                 + "&code="
                 + this.getCode() + "&grant_type=authorization_code";
                 + this.getCode() + "&grant_type=authorization_code";
 
 
-            // String json = HttpUtils.get(requestUrl);
-            String json = HttpsClient.sendPost(requestUrl, "");
-            Wechat_userinfo result = new Gson().fromJson(json, Wechat_userinfo.class);
-            OPEN_ID = result.getOpenid();
+        // String json = HttpUtils.get(requestUrl);
+        String json = HttpsClient.sendPost(requestUrl, "");
+        Wechat_userinfo result = new Gson().fromJson(json, Wechat_userinfo.class);
+        OPEN_ID = result.getOpenid();
+        if (Func.checkNull(OPEN_ID))
+        {
+            resultJson.put(B.code,ResultStatusCode.BAD_REQUEST.getStatus());
+            resultJson.put(B.message,"未获取到OpenId");
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        }
+
+        /*
+         *  手机号前端过来,昵称、省份、性别等其他信息已保存的result中,
+         * 查询用户openid是否存在,存在就返回信息给前端,不存在就保存到数据库
+         * */
+        Users users = userService.queryByOpenid(OPEN_ID);
+        if (users == null)
+        {
+            resultJson.put(B.code,ResultStatusCode.BAD_REQUEST.getStatus());
+            resultJson.put(B.message," 当前用户未授权");
+            resultJson.put(B.data,users);
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+            return null;
+        }
+
+        resultJson.put(B.code,ResultStatusCode.OK.getStatus());
+        resultJson.put(B.message," 当前用户已授权");
+        resultJson.put(B.data,users);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        return null;
+
+    }
+
+    /**
+     * 用户登录小程序授权
+     */
+    public void authorizationUser()
+    {
+        if (Func.checkNull(this.code))
+            return;
+
+        String OPEN_ID = "";
+        JSONObject resultJson = new JSONObject();
+        CodeEntity codeEntity = appService.getCodeInfo(code);
+        OPEN_ID = codeEntity.getOpenid();
+            System.out.println(OPEN_ID);
             if (Func.checkNull(OPEN_ID))
             if (Func.checkNull(OPEN_ID))
             {
             {
                 resultJson.put(B.code,ResultStatusCode.BAD_REQUEST.getStatus());
                 resultJson.put(B.code,ResultStatusCode.BAD_REQUEST.getStatus());
@@ -293,8 +337,10 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
             if (users == null)
             if (users == null)
             {
             {
                 users = new Users();
                 users = new Users();
+                // 确定默认用户名,默认用户头像
+                String userName = "微信用户" + Func.parseStr(WxUtil.mchOrderNo());
                 users.setUser_name(userName);
                 users.setUser_name(userName);
-                users.setHeadPhoto(headPhoto);
+                users.setHeadPhoto("http://172.16.20.88:80/mhotel/download/orderS.png");
                 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 - 1
mhotel/src/com/happy/action/appAction.java

@@ -286,7 +286,7 @@ public class appAction extends ActionSupport implements ServletRequestAware {
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
             return null;
         }
         }
-        if (login.getLevel().equals("2")){
+        if (login.getLevel().equals("1")){
             resultJson.put("message", "管理员无权限绑定");
             resultJson.put("message", "管理员无权限绑定");
             resultJson.put("code", 205);
             resultJson.put("code", 205);
             resultJson.put("data","");
             resultJson.put("data","");
@@ -294,6 +294,7 @@ public class appAction extends ActionSupport implements ServletRequestAware {
             return null;
             return null;
         }
         }
         CodeEntity codeEntity = appService.getCodeInfo(code);
         CodeEntity codeEntity = appService.getCodeInfo(code);
+        System.out.println(codeEntity.getOpenid());
         AdminManager admin = appService.queryMaByNameAndOpenid(admin_name,codeEntity.getOpenid());
         AdminManager admin = appService.queryMaByNameAndOpenid(admin_name,codeEntity.getOpenid());
         if (admin!=null){
         if (admin!=null){
             resultJson.put("message",  "该账户已绑定,请勿重复绑定");
             resultJson.put("message",  "该账户已绑定,请勿重复绑定");

+ 16 - 5
mhotel/src/com/happy/dao/impl/HotelImplDao.java

@@ -101,7 +101,12 @@ public class HotelImplDao implements HotelDao {
 
 
     @Override
     @Override
     public Hotel getById(int id) {
     public Hotel getById(int id) {
-        String sql = "SELECT * FROM `hotel` WHERE id = :id ";
+
+        String sql = " SELECT   a.*, c.manager_phone, b.hotel_township_name  FROM `hotel` a  " +
+                " LEFT JOIN (SELECT   manager_id, corpn_phone manager_phone, hotel_township FROM  admin_manager  GROUP BY  manager_id) c ON a.manager_id = c.manager_id " +
+                " LEFT JOIN (  SELECT  id,name as hotel_township_name  FROM  hotel_dict GROUP BY  id) b ON b.id = c.hotel_township   "+
+                " WHERE  a.STATUS = 1  AND a.id =  :id ";
+//        String sql = "SELECT * FROM `hotel` WHERE id = :id ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("id",id);
         sps.addValue("id",id);
         List<Hotel> list = null;
         List<Hotel> list = null;
@@ -133,9 +138,10 @@ public class HotelImplDao implements HotelDao {
     @Override
     @Override
     public List<Hotel> queryPagePrice(String sqlx, int page, int rows) {
     public List<Hotel> queryPagePrice(String sqlx, int page, int rows) {
         int start = (page - 1) * rows;// 每页的起始下标
         int start = (page - 1) * rows;// 每页的起始下标
-        String sql = "SELECT a.*,b.min_price,c.hotel_township FROM `hotel` a " +
+        String sql = "SELECT a.*,b.min_price,c.hotel_township , d.hotel_township_name FROM `hotel` a " +
                 "left join (select manager_id,min(price) min_price from house group by manager_id) b on a.manager_id = b.manager_id " +
                 "left join (select manager_id,min(price) min_price from house group by manager_id) b on a.manager_id = b.manager_id " +
                 "left join (select manager_id,hotel_township hotel_township from admin_manager group by manager_id) c on a.manager_id = c.manager_id " +
                 "left join (select manager_id,hotel_township hotel_township from admin_manager group by manager_id) c on a.manager_id = c.manager_id " +
+                "LEFT JOIN (  SELECT  id,name as hotel_township_name  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
                 " WHERE status=1 "+sqlx+" ORDER BY id DESC limit :start,:rows ";
                 " WHERE status=1 "+sqlx+" ORDER BY id DESC limit :start,:rows ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("start", start);
         sps.addValue("start", start);
@@ -147,11 +153,16 @@ public class HotelImplDao implements HotelDao {
     }
     }
     @Override
     @Override
     public int queryTotalPrice(String sqlx) {
     public int queryTotalPrice(String sqlx) {
-        String sql = "SELECT count(*) FROM`hotel` a " +
+//        String sql = "SELECT count(*) FROM`hotel` a " +
+//                "left join (select manager_id,min(price) min_price from house group by manager_id) b on a.manager_id = b.manager_id " +
+//                "left join (select manager_id,hotel_township hotel_township from admin_manager group by manager_id) c on a.manager_id = c.manager_id " +
+//                "where status=1 "+sqlx;
+
+        String sql = "SELECT count(*) FROM `hotel` a " +
                 "left join (select manager_id,min(price) min_price from house group by manager_id) b on a.manager_id = b.manager_id " +
                 "left join (select manager_id,min(price) min_price from house group by manager_id) b on a.manager_id = b.manager_id " +
                 "left join (select manager_id,hotel_township hotel_township from admin_manager group by manager_id) c on a.manager_id = c.manager_id " +
                 "left join (select manager_id,hotel_township hotel_township from admin_manager group by manager_id) c on a.manager_id = c.manager_id " +
-                "where status=1 "+sqlx;
-
+                "LEFT JOIN (  SELECT  id,name as hotel_township_name  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
+                " WHERE status=1 "+sqlx;
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
     }
     }

+ 1 - 1
mhotel/src/com/happy/dao/impl/UserDaoImpl.java

@@ -30,7 +30,7 @@ public class UserDaoImpl implements UserDao {
     }
     }
 
 
     public int insert(Users users){
     public int insert(Users users){
-        String sql = "insert into `users`(card_number,user_name,user_phone,user_zz,openid,create_time,remark,identity_type,contact_id,contact_name,data_type,head_photo) values(:card_number,:user_name,:user_phone,:user_zz,:openid,:create_time,:remark,:identity_typecontact_id,:contact_name,:data_type,:head_photo) ";
+        String sql = "insert into `users`(card_number,user_name,user_phone,user_zz,openid,create_time,remark,identity_type,contact_id,contact_name,data_type,head_photo) values(:card_number,:user_name,:user_phone,:user_zz,:openid,:create_time,:remark,:identity_type,:contact_id,:contact_name,:data_type,:head_photo) ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("card_number", users.getCard_number());
         sps.addValue("card_number", users.getCard_number());
         sps.addValue("user_name", users.getUser_name());
         sps.addValue("user_name", users.getUser_name());

+ 1 - 1
mhotel/src/com/happy/service/AppBookService.java

@@ -19,7 +19,7 @@ public interface AppBookService {
      * @param userId
      * @param userId
      * @return
      * @return
      */
      */
-    public String createOrder(String houseId,String startTime,String endTime,String houseOrderNumber,String userName,String userPhone, String userId);
+    public String createOrder(String bookingId, String houseId,String startTime,String endTime,String houseOrderNumber,String userName,String userPhone, String userId);
 
 
 
 
     /**
     /**

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

@@ -5,6 +5,7 @@ import com.happy.Model.HotelDict;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 public interface HotelService {
 public interface HotelService {
 
 
@@ -62,6 +63,11 @@ public interface HotelService {
     List<Hotel> queryList(String sqlx);
     List<Hotel> queryList(String sqlx);
 
 
     /**
     /**
+     * 获取酒店配置字典map
+     * @return
+     */
+    public Map queryHotelDicMap();
+    /**
      * 描述:查询一条数据
      * 描述:查询一条数据
      * @param sqlx
      * @param sqlx
      * @return
      * @return

+ 2 - 1
mhotel/src/com/happy/service/UserService.java

@@ -2,6 +2,7 @@ package com.happy.service;
 
 
 import com.happy.Model.Booking;
 import com.happy.Model.Booking;
 import com.happy.Model.weixin.Users;
 import com.happy.Model.weixin.Users;
+import com.happy.dto.IPage;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -34,5 +35,5 @@ public interface UserService {
 
 
     public int queryUserTotal(String sqlStr);
     public int queryUserTotal(String sqlStr);
 
 
-    public List<Users> queryUserPage(String sqlx, int page, int rows);
+    public IPage<Users> queryUserPage(String sqlx, int page, int rows);
 }
 }

+ 199 - 192
mhotel/src/com/happy/service/impl/AppBookImplService.java

@@ -1,192 +1,199 @@
-//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.Enum.PayEnum;
-//import com.happy.Until.Func;
-//import com.happy.Until.TimeExchange;
-//import com.happy.common.wx.WxUtil;
-//import com.happy.constant.ResultStatusCode;
-//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.HashMap;
-//import java.util.List;
-//import java.util.Map;
-//
-//
-//@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 houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId) {
-//        if (Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
-//                ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
-//            return null;
-//
-//        House house = houseService.getById(Func.parseInt(houseId));
-//        StringBuilder s1 = new StringBuilder("");
-//        s1.append(" and manager_id = '").append(house.getManagerId()).append("'");
-//        Hotel hotel = hotelService.getOen(s1.toString());
-//        Users user = userService.queryByUserId(userId);
-//        AdminManager adminManager = adminManagerService.getById(Func.parseInt(house.getManagerId()));
-//        if (house == null || hotel == null || user == null  || adminManager == null)
-//            return "无法获取数据";
-//
-//        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.setHotelManagerId(house.getManagerId());
-//
-//        // 设置房型信息
-//        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(startTime);
-//        booking.setOrderEndTime(endTime);
-//        int day = DateUtil.getDayDiff(startTime,endTime);
-//        String orderLiveTime= day+ OrderEnum.间.toString()+ day +OrderEnum.晚.toString();
-//        booking.setOrderLiveTime(orderLiveTime);
-//
-//        // 订单信息
-//        booking.setOrderNum(Func.parseStr(WxUtil.mchOrderNo()));// 订单号
-//        booking.setOrderStatus(Func.parseStr(PayEnum.ONE.getNum())); // 1待支付状态
-//        booking.setCreateTime(DateUtil.getFormatPaternDate(DateUtil.getCurrentDate()));
-//        int i = bookService.insertBooking(booking);
-//        if ( i == 0)
-//            return ResultStatusCode.CANNTBOOKING.CANNTBOOKING.getMsg();
-//
-//        return null;
-//    }
-//
-//    @Override
-//    public String reCreateOrder(String houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId) {
-//        if (Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
-//                ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
-//            return null;
-//
-//        House house = houseService.getById(Func.parseInt(houseId));
-//        StringBuilder s1 = new StringBuilder("");
-//        s1.append(" and manager_id = '").append(house.getManagerId()).append("'");
-//        Hotel hotel = hotelService.getOen(s1.toString());
-//        Users user = userService.queryByUserId(userId);
-//        AdminManager adminManager = adminManagerService.getById(Func.parseInt(house.getManagerId()));
-//        if (house == null || hotel == null || user == null  || adminManager == null)
-//            return "无法获取数据";
-//
-//        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.setHotelManagerId(house.getManagerId());
-//
-//        // 设置房型信息
-//        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(startTime);
-//        booking.setOrderEndTime(endTime);
-//        int day = DateUtil.getDayDiff(startTime,endTime);
-//        String orderLiveTime= day+ OrderEnum.间.toString()+ day +OrderEnum.晚.toString();
-//        booking.setOrderLiveTime(orderLiveTime);
-//
-//        // 订单信息
-//        booking.setOrderNum(Func.parseStr(WxUtil.mchOrderNo()));// 订单号
-//        booking.setOrderStatus(Func.parseStr(PayEnum.ONE.getNum())); // 待支付状态
-//        booking.setCreateTime(DateUtil.getFormatPaternDate(DateUtil.getCurrentDate()));
-//        bookService.insertBooking(booking);
-//
-//
-//        return null;
-//    }
-//
-//    @Override
-//    public String varificationHouse(String houseId, String startTime, String endTime) {
-//
-//        House house = houseService.getById(Func.parseInt(houseId));
-//        if (house == null)
-//            return "无此房间,请重新查询";
-//
-//        // 判断是否有房间,对每个房型进行标识
-//        StringBuffer strSqlBook = new StringBuffer();
-//        strSqlBook.append(" and house_id = '").append(house.getId()).append("' ");
-//        strSqlBook.append(" and hotel_manager_id = '").append(house.getManagerId()).append("' ");
-//        strSqlBook.append(" and order_start_time >= '").append(startTime).append("' ");
-//        strSqlBook.append(" and order_end_time < '").append(endTime).append("' ");
-//
-//        //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款
-//        strSqlBook.append(" and order_status = '").append(PayEnum.ONE.getNum()).append("' ");
-//        strSqlBook.append(" or order_status = '").append(PayEnum.TWO.getNum()).append("' ");
-//        strSqlBook.append(" or order_status = '").append(PayEnum.THREE.getNum()).append("' ");
-//        strSqlBook.append(" or order_status = '").append(PayEnum.FOUR.getNum()).append("' ");
-//
-//        List<Booking> bookList = bookService.queryList(strSqlBook.toString());
-//
-//        int totalNum = 0;
-//        for (Booking booking: bookList) {
-//            if (Func.checkNull(booking.getHouseId()))
-//                continue;
-//
-//            totalNum += booking.getHouseOrderNumber();
-//        }
-//
-//        if (totalNum >= house.getNumber())
-//            return OrderEnum.房间已满.toString();
-//        return null;
-//    }
-//}
+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.Enum.PayEnum;
+import com.happy.Until.Func;
+import com.happy.Until.TimeExchange;
+import com.happy.Until.UUIDUtil;
+import com.happy.common.wx.WxUtil;
+import com.happy.constant.ResultStatusCode;
+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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+@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 bookingId, String houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId) {
+        if (Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
+                ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
+            return null;
+
+        House house = houseService.getById(Func.parseInt(houseId));
+        StringBuilder s1 = new StringBuilder("");
+        s1.append(" and manager_id = '").append(house.getManagerId()).append("'");
+        Hotel hotel = hotelService.getOen(s1.toString());
+        Users user = userService.queryByUserId(userId);
+        AdminManager adminManager = adminManagerService.getById(Func.parseInt(house.getManagerId()));
+        if (house == null || hotel == null || user == null  || adminManager == null)
+            return "无法获取数据";
+
+        Booking booking = new Booking();
+
+        // 设置民宿信息
+        booking.setHouseId(Func.parseStr(hotel.getId()));
+        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.setHotelManagerId(house.getManagerId());
+        booking.setHotelPhone(adminManager.getCorpnPhone());
+        booking.setHotelPerson(adminManager.getCorpnName());
+
+        // 设置房型信息
+        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(startTime);
+        booking.setOrderEndTime(endTime);
+        int day = DateUtil.getDayDiff(startTime,endTime);
+        String orderLiveTime= day+ OrderEnum.间.toString()+ day +OrderEnum.晚.toString();
+        booking.setOrderLiveTime(orderLiveTime);
+
+        // 订单信息
+        booking.setOrderNum(Func.parseStr(WxUtil.mchOrderNo()));// 订单号
+        booking.setOrderStatus(Func.parseStr(PayEnum.ONE.getNum())); // 1待支付状态
+        booking.setCreateTime(DateUtil.getFormatPaternDate(DateUtil.getCurrentDate()));
+        booking.setCreateUserid(userId);
+        booking.setId(Func.parseInt(bookingId));
+        int i = bookService.insertBooking(booking);
+        if ( i == 0)
+            return ResultStatusCode.CANNTBOOKING.CANNTBOOKING.getMsg();
+
+        return null;
+    }
+
+    @Override
+    public String reCreateOrder(String houseId, String startTime, String endTime, String houseOrderNumber, String userName, String userPhone, String userId) {
+        if (Func.checkNull(houseId) ||Func.checkNull(startTime) ||Func.checkNull(endTime)
+                ||Func.checkNull(houseOrderNumber) ||Func.checkNull(userName) ||Func.checkNull(userPhone) ||Func.checkNull(userId))
+            return null;
+
+        House house = houseService.getById(Func.parseInt(houseId));
+        StringBuilder s1 = new StringBuilder("");
+        s1.append(" and manager_id = '").append(house.getManagerId()).append("'");
+        Hotel hotel = hotelService.getOen(s1.toString());
+        Users user = userService.queryByUserId(userId);
+        AdminManager adminManager = adminManagerService.getById(Func.parseInt(house.getManagerId()));
+        if (house == null || hotel == null || user == null  || adminManager == null)
+            return "无法获取数据";
+
+        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.setHotelManagerId(house.getManagerId());
+
+        // 设置房型信息
+        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(startTime);
+        booking.setOrderEndTime(endTime);
+        int day = DateUtil.getDayDiff(startTime,endTime);
+        String orderLiveTime= day+ OrderEnum.间.toString()+ day +OrderEnum.晚.toString();
+        booking.setOrderLiveTime(orderLiveTime);
+
+        // 订单信息
+        booking.setOrderNum(Func.parseStr(WxUtil.mchOrderNo()));// 订单号
+        booking.setOrderStatus(Func.parseStr(PayEnum.ONE.getNum())); // 待支付状态
+        booking.setCreateTime(DateUtil.getFormatPaternDate(DateUtil.getCurrentDate()));
+        bookService.insertBooking(booking);
+
+
+        return null;
+    }
+
+    @Override
+    public String varificationHouse(String houseId, String startTime, String endTime) {
+
+        House house = houseService.getById(Func.parseInt(houseId));
+        if (house == null)
+            return "无此房间,请重新查询";
+
+        // 判断是否有房间,对每个房型进行标识
+        StringBuffer strSqlBook = new StringBuffer();
+        strSqlBook.append(" and house_id = '").append(house.getId()).append("' ");
+        strSqlBook.append(" and hotel_manager_id = '").append(house.getManagerId()).append("' ");
+        strSqlBook.append(" and order_start_time >= '").append(startTime).append("' ");
+        strSqlBook.append(" and order_end_time < '").append(endTime).append("' ");
+
+        //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款
+        strSqlBook.append(" and order_status = '").append(PayEnum.ONE.getNum()).append("' ");
+        strSqlBook.append(" or order_status = '").append(PayEnum.TWO.getNum()).append("' ");
+        strSqlBook.append(" or order_status = '").append(PayEnum.THREE.getNum()).append("' ");
+        strSqlBook.append(" or order_status = '").append(PayEnum.FOUR.getNum()).append("' ");
+
+        List<Booking> bookList = bookService.queryList(strSqlBook.toString());
+
+        int totalNum = 0;
+        for (Booking booking: bookList) {
+            if (Func.checkNull(booking.getHouseId()))
+                continue;
+
+            totalNum += booking.getHouseOrderNumber();
+        }
+
+        if (totalNum >= house.getNumber())
+            return OrderEnum.房间已满.toString();
+        return null;
+    }
+}

+ 55 - 19
mhotel/src/com/happy/service/impl/AppHomePageImplService.java

@@ -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,18 +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.AppHomePageService;
-import com.happy.service.BookService;
-import com.happy.service.HotelService;
-import com.happy.service.HouseService;
+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 {
@@ -34,6 +30,10 @@ public class AppHomePageImplService implements AppHomePageService {
     public HotelService hotelService;
     public HotelService hotelService;
     @Resource
     @Resource
     public BookService bookService;
     public BookService bookService;
+    @Resource
+    public AdminManagerService adminManagerService;
+    @Resource
+    public FileService fileService;
 
 
 
 
     @Override
     @Override
@@ -63,9 +63,25 @@ public class AppHomePageImplService implements AppHomePageService {
         if (Func.checkNull(hotelId))
         if (Func.checkNull(hotelId))
             return new Hotel();
             return new Hotel();
         Hotel hotel = hotelService.getById(Func.parseInt(hotelId));
         Hotel hotel = hotelService.getById(Func.parseInt(hotelId));
-        if (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("' ");
@@ -73,19 +89,31 @@ 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();
-        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("' ");
+        strSqlBook.append(" and hotel_manager_id = '").append(hotel.getManagerId()).append("  ' ");
+        if (!Func.checkNull(queryStartTime))
+            strSqlBook.append(" and order_start_time >= '").append(queryStartTime).append(" 00:00:00  ' ");
+        if (!Func.checkNull(queryEndTime))
+            strSqlBook.append(" and order_end_time < '").append(queryEndTime).append(" 23:59:59 ' ");
 
 
         List<Booking> bookList = bookService.queryList(strSqlBook.toString());
         List<Booking> bookList = bookService.queryList(strSqlBook.toString());
 
 
@@ -108,12 +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()));
                 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);
         });
         });
 
 
 
 

+ 1 - 1
mhotel/src/com/happy/service/impl/BookImplService.java

@@ -134,7 +134,7 @@ public class BookImplService implements BookService {
         if (book == null)
         if (book == null)
             return "无此订单,请重新查询";
             return "无此订单,请重新查询";
 
 
-        book.setIsDelete(1);
+        book.setIsDelete(0);
         book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
         book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
         bookDao.updateBooking(book);
         bookDao.updateBooking(book);
         return null;
         return null;

+ 20 - 0
mhotel/src/com/happy/service/impl/HotelImplService.java

@@ -1,19 +1,26 @@
 package com.happy.service.impl;
 package com.happy.service.impl;
 
 
 import com.happy.Model.Hotel;
 import com.happy.Model.Hotel;
+import com.happy.Model.HotelDict;
+import com.happy.Until.Func;
 import com.happy.dao.HotelDao;
 import com.happy.dao.HotelDao;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
+import com.happy.service.HotelDictService;
 import com.happy.service.HotelService;
 import com.happy.service.HotelService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 @Service("HotelService")
 @Service("HotelService")
 public class HotelImplService implements HotelService {
 public class HotelImplService implements HotelService {
 
 
     @Resource
     @Resource
     public HotelDao hotelDao;
     public HotelDao hotelDao;
+    @Resource
+    public HotelDictService hotelDictService;
 
 
     @Override
     @Override
     public int insertHotel(Hotel hotel) {
     public int insertHotel(Hotel hotel) {
@@ -61,6 +68,19 @@ public class HotelImplService implements HotelService {
         return iPage;
         return iPage;
     }
     }
 
 
+    public Map queryHotelDicMap()
+    {
+        Map map = new HashMap<>();
+        List<HotelDict> list = hotelDictService.queryList("and code in (1,2,3,4) ");
+        for (HotelDict h:list) {
+            if (h == null || Func.checkNull(Func.parseStr(h.getId())))
+                continue;
+
+                map.put(h.getId(),h);
+        }
+        return map;
+    }
+
     @Override
     @Override
     public List<Hotel> queryList(String sqlx) {
     public List<Hotel> queryList(String sqlx) {
         return hotelDao.queryList(sqlx);
         return hotelDao.queryList(sqlx);

+ 15 - 2
mhotel/src/com/happy/service/impl/UserServiceImpl.java

@@ -1,8 +1,13 @@
 package com.happy.service.impl;
 package com.happy.service.impl;
 
 
+import com.happy.Model.Booking;
+import com.happy.Model.House;
 import com.happy.Model.weixin.Users;
 import com.happy.Model.weixin.Users;
 import com.happy.dao.UserDao;
 import com.happy.dao.UserDao;
+import com.happy.dto.IPage;
 import com.happy.service.UserService;
 import com.happy.service.UserService;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -49,9 +54,17 @@ public class UserServiceImpl implements UserService {
         return userDao.queryUserTotal(sqlStr);
         return userDao.queryUserTotal(sqlStr);
     }
     }
 
 
-    public List<Users> queryUserPage(String sqlx, int page, int rows){
+    public IPage<Users> queryUserPage(String sqlx, int page, int rows){
 
 
-            return userDao.queryUserPage(sqlx, page, rows);
+        IPage<Users> iPage = new IPage();
+        List<Users> usersList = userDao.queryUserPage(sqlx,page,rows);
+        int total = userDao.queryUserTotal(sqlx);
+        iPage.setPageList(usersList);
+        iPage.setPage(page);
+        iPage.setTotalPage( (int)Math.ceil((double)total/rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
     }
     }
 
 
 }
 }