Parcourir la source

20230803代码更新

Administrator il y a 2 ans
Parent
commit
bd625291ef

+ 40 - 0
mhotel/src/com/happy/Model/AdminManager.java

@@ -16,6 +16,12 @@ public class AdminManager {
 	 */
 	private Integer id;
 
+
+	/**
+	 * 所属商家Id
+	 */
+	private Integer managerId;
+
 	/**
 	 * 账号
 	 */
@@ -92,6 +98,16 @@ public class AdminManager {
 	private Integer status;
 
 	/**
+	 * 备注
+	 */
+	private String remake;
+
+	/**
+	 * 营业执照
+	 */
+	private String fileListJson;
+
+	/**
 	 * 营业执照
 	 */
 	private List<File> fileList;
@@ -104,6 +120,14 @@ public class AdminManager {
 		this.id = id;
 	}
 
+	public Integer getManagerId() {
+		return managerId;
+	}
+
+	public void setManagerId(Integer managerId) {
+		this.managerId = managerId;
+	}
+
 	public String getAdminName() {
 		return adminName;
 	}
@@ -224,6 +248,22 @@ public class AdminManager {
 		this.status = status;
 	}
 
+	public String getRemake() {
+		return remake;
+	}
+
+	public void setRemake(String remake) {
+		this.remake = remake;
+	}
+
+	public String getFileListJson() {
+		return fileListJson;
+	}
+
+	public void setFileListJson(String fileListJson) {
+		this.fileListJson = fileListJson;
+	}
+
 	public List<File> getFileList() {
 		return fileList;
 	}

+ 3 - 1
mhotel/src/com/happy/Model/Hotel.java

@@ -127,7 +127,6 @@ public class Hotel {
 	private Integer status;
 
 	private String min_price;
-
 	private List<House> houseList;
 
 	public Integer getId() {
@@ -322,6 +321,9 @@ public class Hotel {
 		this.houseList = houseList;
 	}
 
+	/**
+	 * 酒店最低价
+	 */
 	public String getMin_price() {
 		return min_price;
 	}

+ 3 - 3
mhotel/src/com/happy/Model/weixin/Users.java

@@ -14,7 +14,7 @@ public class Users {
     public String create_time;
     public String remark;   // 备注
     public int identity_type;   // 用户分类
-    private int contactId;   // 关联人id(用于常联系人关联)
+    private String contactId;   // 关联人id(用于常联系人关联)
     private String contactName;   // 关联人姓名(用于常联系人关联)
     private String dataType; // 数据类型
     private String headPhoto; // 用户头像地址
@@ -91,11 +91,11 @@ public class Users {
         this.identity_type = identity_type;
     }
 
-    public int getContactId() {
+    public String getContactId() {
         return contactId;
     }
 
-    public void setContactId(int contactId) {
+    public void setContactId(String contactId) {
         this.contactId = contactId;
     }
 

+ 49 - 2
mhotel/src/com/happy/Until/GetHttpParam.java

@@ -75,11 +75,58 @@ public class GetHttpParam {
             String value=arr[i].substring( arr[i].indexOf("=")+1);
             map.put(key, value);
         }
+        return JSON.parseObject(mapToJson(map));
+    }
+
+    /**
+     *  获取request中参数
+     * @param request 页面请求
+     */
+    public static String getRequestStringParameters(HttpServletRequest request) {
+        String parameters="";//请求参数
+        if("GET".equals(request.getMethod())){//GET请求时的参数
+            String urlParameter=request.getQueryString();//网址中的参数
+            if(urlParameter!=null&&!"".equals(urlParameter)){
+                try {
+                    urlParameter= URLDecoder.decode(urlParameter,"UTF-8");
+                } catch (UnsupportedEncodingException e) {
+                    e.printStackTrace();
+                }
+            }else {
+                urlParameter="";
+            }
+            parameters=urlParameter;
+        }else if("POST".equals(request.getMethod())){//POST请求时的参数
+            String totalParameter="";//表单及网址中全部参数
+            Map<String, String[]> params = request.getParameterMap();
+            int parametersNum=request.getParameterMap().size();//参数个数
+            int flag=1;
+            for (String key : params.keySet()) {
+
+                String[] values = params.get(key);
+                for (int i = 0; i < values.length; i++) {
+                    String value = values[i];
+                    totalParameter+= key + "=" + value;
+                }
+                if(flag<parametersNum){
+                    totalParameter+="&";
+                }
+                flag+=1;
+            }
+            parameters=totalParameter;
+        }
+        Map<String, Object> map=new HashMap<String, Object>();
+        String[] arr=parameters.split("&");
+        for (int i = 0; i <arr.length; i++) {
+            String key=arr[i].substring(0, arr[i].indexOf("="));
+            String value=arr[i].substring( arr[i].indexOf("=")+1);
+            map.put(key, value);
+        }
         return mapToJson(map);
     }
 
-    public static JSONObject mapToJson(Map<String, Object> map) {
+    public static String mapToJson(Map<String, Object> map) {
         String data = JSON.toJSONString(map);
-        return JSON.parseObject(data);
+        return data;
     }
 }

+ 4 - 1
mhotel/src/com/happy/Until/ResponseUtil.java

@@ -38,7 +38,7 @@ public class ResponseUtil {
 			resultJson.put("total", 0);
 		} else {
 			resultJson.put("code", 200);
-			resultJson.put("rows", listPage);
+			resultJson.put("rows", rows);
 			// int total = listAll.size();
 			resultJson.put("total", total);// 总记录数
 			int totalPage = total % rows == 0 ? (total / rows) : (total / rows) + 1;// 总页数
@@ -51,6 +51,8 @@ public class ResponseUtil {
 			resultJson.put("hasNextPage", true);// 有下一页
 			resultJson.put("firstPage", true);// 首页
 			resultJson.put("lastPage", true);// 尾页
+			resultJson.put("listPage", listPage);
+
 		}
 
 		PrintWriter out;
@@ -86,6 +88,7 @@ public class ResponseUtil {
 			resultJson.put("hasNextPage", true);// 有下一页
 			resultJson.put("firstPage", true);// 首页
 			resultJson.put("lastPage", true);// 尾页
+			resultJson.put("pageList",iPage.getPageList()); // 分页数据
 		}
 
 		PrintWriter out;

+ 1 - 12
mhotel/src/com/happy/action/AppHomePageAction.java

@@ -115,24 +115,13 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
         //getUserInfo();
 
         // 获取民宿列表
-        IPage iPage = appHomePageService.getHotelList(queryValue,rows,page);
+        IPage iPage = appHomePageService.getHotelList(queryValue,page,rows);
         ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),iPage);
 
         return null;
     }
 
     /**
-     * 微信授权,进入页面
-     * @return
-     */
-    public String Authorization()
-    {
-        // TODO 微信授权,进入页面
-        return null;
-    }
-
-
-    /**
      * 通过酒店的id获取到房间信息
      * @return
      */

+ 31 - 3
mhotel/src/com/happy/action/AppMePageAction.java

@@ -1,6 +1,5 @@
 package com.happy.action;
 
-import com.happy.Model.Booking;
 import com.happy.Model.weixin.Users;
 import com.happy.Until.Enum.B;
 import com.happy.Until.Enum.DataType;
@@ -18,7 +17,6 @@ import org.apache.struts2.interceptor.ServletRequestAware;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -43,6 +41,7 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
     public int rows = 5;// 每页显示的行数rows
     private String userId; // 用户id
     private String userName; // 用户姓名
+    private String headPhoto; // 用户头像地址
     private String contactId; // 相关联系人的id
     public String status;
 
@@ -96,6 +95,7 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
 
 
     /**
+     * userId
      * 进入我的,查询订单列表
      * @return
      */
@@ -199,7 +199,7 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
 
         // 相关联系人
         Users users = new Users();
-        users.setContactId(Func.parseInt(userId));
+        users.setContactId(Func.parseStr(userId));
         users.setContactName(userName);
         users.setCreate_time(TimeExchange.getDate());
         users.setDataType(DataType.关联数据.toString());
@@ -215,6 +215,26 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
     }
 
     /**
+     * 用户点击保存,更新用户信息
+     */
+    public void updateUserInfo()
+    {
+        if (Func.checkNullOrEmpty(userId))
+            return;
+        Users users = userService.queryByUserId(userId);
+        users.setHeadPhoto(headPhoto);
+        users.setUser_name(userName);
+        users.setDataType(DataType.游客数据.toString());
+
+        userService.update(users);
+        JSONObject resultJson = new JSONObject();
+        resultJson.put(B.CODE,ResultStatusCode.OK.getStatus());
+        resultJson.put(B.MESSAGE,ResultStatusCode.OK.getMsg());
+        ResponseUtil.writeJson(ServletActionContext.getResponse(),resultJson.toString());
+    }
+
+    /**
+     * contactId
      * 用户可以删除自己相关联系人
      */
     public void delContact()
@@ -296,4 +316,12 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
     public void setContactId(String contactId) {
         this.contactId = contactId;
     }
+
+    public String getHeadPhoto() {
+        return headPhoto;
+    }
+
+    public void setHeadPhoto(String headPhoto) {
+        this.headPhoto = headPhoto;
+    }
 }

+ 1 - 1
mhotel/src/com/happy/action/HotelAction.java

@@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
-public class HotelAction extends ActionSupport implements ServletRequestAware {
+public class hotelAction extends ActionSupport implements ServletRequestAware {
 
     private HttpServletRequest request;
     public HttpServletResponse response;

+ 169 - 12
mhotel/src/com/happy/action/adminManagerAction.java

@@ -1,11 +1,10 @@
 package com.happy.action;
 
+import com.alibaba.fastjson.JSONArray;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
+import com.happy.Model.*;
 import com.happy.Model.AdminManager;
-import com.happy.Model.AdminManager;
-import com.happy.Model.AdminPower;
-import com.happy.Model.File;
 import com.happy.Until.GetHttpParam;
 import com.happy.Until.PwdDefind;
 import com.happy.Until.ResUtil;
@@ -14,6 +13,7 @@ import com.happy.dto.IPage;
 import com.happy.service.AdminManagerService;
 import com.happy.service.AdminService;
 import com.happy.service.FileService;
+import com.happy.service.HotelService;
 import com.opensymphony.xwork2.ActionSupport;
 import net.sf.json.JSONObject;
 import org.apache.struts2.ServletActionContext;
@@ -36,6 +36,9 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
     public AdminManagerService adminManagerService;
 
     @Resource
+    public HotelService hotelService;
+
+    @Resource
     public FileService fileService;
 
     public String adminName;
@@ -76,6 +79,13 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
                 .append(" and password = '").append(password).append("'");
         AdminManager login = adminManagerService.getOen(getOneSqlx.toString());
         if (login != null) {
+            //是否首次登录
+            Hotel hotel = hotelService.getOen("and manager_id = '"+login.getId()+"'");
+            if(hotel==null){
+                resultJson.put("isLogin",1);
+            }else{
+                resultJson.put("isLogin",0);
+            }
             login.setPassword("********");
             resultJson.put("message", "登录成功");
             resultJson.put("code", 200);
@@ -90,7 +100,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
     }
 
     /**
-     * 描述:新增民宿账号
+     * 描述:新增管理端民宿账号
      * @return
      */
     public String insertAdmin() {
@@ -134,12 +144,11 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
                 return null;
             }
             admin.setId(Math.toIntExact(UUIDUtil.generateID()));
+            admin.setManagerId(admin.getId());
             //保存详细图附件
-            if(admin.getFileList()!=null && admin.getFileList().size()>0){
-                if(admin.getId()!= null){
-                    fileService.delLinkFile(admin.getId());
-                }
-                for(File file : admin.getFileList()){
+            List<File> fileList = JSONArray.parseArray(admin.getFileListJson(), File.class);
+            if(fileList!=null && fileList.size()>0){
+                for(File file : fileList){
                     file.setLinkId(admin.getId());
                     fileService.insertFile(file);
                 }
@@ -170,7 +179,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
     }
 
     /**
-     * 描述:修改管理端管理员账号
+     * 描述:修改管理端民宿账号
      * @return
      */
     public String updateAdmin() {
@@ -197,7 +206,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 return null;
             }
-            if (admin.getAdminName()==null || admin.getHotelName()==null || admin.getHotelTownship()==null
+            if (admin.getAdminName()==null || admin.getCorpnName()==null || admin.getHotelTownship()==null
                     || admin.getLevel()==null || admin.getCardName()==null || admin.getCorpnPhone()==null){
                 resultJson.put("message", "各参数不能为空");
                 resultJson.put("code", 500);
@@ -220,6 +229,152 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 return null;
             }
+            //修改详细图附件
+            List<File> fileList = JSONArray.parseArray(admin.getFileListJson(), File.class);
+            if(fileList!=null && fileList.size()>0){
+                if(admin.getId()!= null){
+                    fileService.delLinkFile(admin.getId());
+                }
+                for(File file : fileList){
+                    file.setLinkId(admin.getId());
+                    fileService.insertFile(file);
+                }
+            }else{
+                resultJson.put("message", "请上传详细图");
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+            int m = adminManagerService.updateAdmin(admin);
+            if (m > 0) {
+                resultJson.put("message", "修改成功");
+                resultJson.put("code", 200);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            } else {
+                resultJson.put("message", "修改失败");
+                resultJson.put("code", 502);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        resultJson.put("message", "未知异常");
+        resultJson.put("code", 205);
+        ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        return null;
+    }
+
+    /**
+     * 描述:新增民宿端普通账号
+     * @return
+     */
+    public String insertAdminManager() {
+        JSONObject resultJson = new JSONObject();
+        Gson gson = new Gson();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getRequestParameters(request);
+        if (json == null) {
+            resultJson.put("message", "请传入参数");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+            return null;
+        }
+        AdminManager admin = null;
+        try {
+            admin = gson.fromJson(json.toString(), new TypeToken<AdminManager>() {}.getType());
+            if (admin == null) {
+                resultJson.put("message", "数据为空");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+            if (admin.getAdminName()==null || admin.getCorpnName()==null || admin.getCorpnPhone()==null
+                    || admin.getLevel()==null || admin.getPassword()==null){
+                resultJson.put("message", "各参数不能为空");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+            if (!PwdDefind.vertify(admin.getPassword())){
+                resultJson.put("message", "密码至少包含:大小写英文字母、数字、特殊符号,密码长度大于8位,小于20位");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+            StringBuilder getOneSqlx = new StringBuilder("");
+            getOneSqlx.append(" and admin_name = '").append(admin.getAdminName()).append("'");
+            AdminManager listc = adminManagerService.getOen(getOneSqlx.toString());
+            if (listc != null) {
+                resultJson.put("message", "该用户已存在");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+            int m = adminManagerService.insertAdmin(admin);
+            if (m > 0) {
+                resultJson.put("message", "添加成功");
+                resultJson.put("code", 200);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            } else {
+                resultJson.put("message", "添加失败");
+                resultJson.put("code", 502);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        resultJson.put("message", "未知异常");
+        resultJson.put("code", 205);
+        ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        return null;
+    }
+
+    /**
+     * 描述:修改民宿端普通账号
+     * @return
+     */
+    public String updateAdminManager() {
+        JSONObject resultJson = new JSONObject();
+        Gson gson = new Gson();
+        com.alibaba.fastjson.JSONObject json = GetHttpParam.getRequestParameters(request);
+        if (json == null) {
+            resultJson.put("message", "请传入参数");
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+            return null;
+        }
+        AdminManager admin = null;
+        try {
+            admin = gson.fromJson(json.toString(), new TypeToken<AdminManager>() {}.getType());
+            if (admin == null) {
+                resultJson.put("message", "数据为空");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+            if (admin.getAdminName()==null || admin.getCardName()==null || admin.getCorpnPhone()==null
+                    || admin.getLevel()==null || admin.getPassword()==null){
+                resultJson.put("message", "各参数不能为空");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+            if (!PwdDefind.vertify(admin.getPassword())){
+                resultJson.put("message", "密码至少包含:大小写英文字母、数字、特殊符号,密码长度大于8位,小于20位");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+            StringBuilder getOneSqlx = new StringBuilder("");
+            getOneSqlx.append(" and admin_name = '").append(admin.getAdminName()).append("'");
+            getOneSqlx.append(" and id != '").append(admin.getId()).append("'");
+            AdminManager listc = adminManagerService.getOen(getOneSqlx.toString());
+            if (listc != null) {
+                resultJson.put("message", "该用户已存在");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
             int m = adminManagerService.updateAdmin(admin);
             if (m > 0) {
                 resultJson.put("message", "修改成功");
@@ -313,7 +468,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
         }
         AdminManager admin = adminManagerService.getById(id);
         if (admin != null && !"".equals(admin)) {
-            admin.setStatus(0);
+            admin.setStatus(2);
             int m = adminManagerService.updateAdmin(admin);
             if(m > 0){
                 resultJson.put("message", "冻结成功");
@@ -407,6 +562,8 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
             return null;
         }
         AdminManager admin = adminManagerService.getById(id);
+        List<File> fileList = fileService.queryList("and link_id ='"+id+"'");
+        admin.setFileList(fileList);
         if (admin != null) {
             resultJson.put("message", "查询成功");
             resultJson.put("code", 200);

+ 4 - 12
mhotel/src/com/happy/action/appAction.java

@@ -45,8 +45,6 @@
 //    public HouseService houseService;
 //    @Resource
 //    public ConfigService configService;
-//    @Resource
-//    public LogsService logsService;
 //
 //    public String wxcode;
 //    public String state;
@@ -330,7 +328,7 @@
 //            System.out.println("支付成功回调,订单号:"+order_num);
 //            Booking booking = bookService.queryByOrder(order_num);
 //            // 支付成功
-//            if (result.getResult_code().equals("SUCCESS") && booking!=null && booking.getStatus().equals("1")) {
+//            if (result.getResult_code().equals("SUCCESS") && booking!=null && booking.getOrderStatus().equals("1")) {
 //                int m = bookService.update_pay("2", order_num);
 //                if (m>0){
 //                    String returnMsg = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
@@ -371,19 +369,19 @@
 //            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
 //            return null;
 //        }
-//        if (booking.getStatus().equals("1")){
+//        if (booking.getOrderStatus().equals("1")){
 //            resultJson.put("code", 503);
 //            resultJson.put("message", "订单未支付不可申请退款");
 //            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
 //            return null;
 //        }
-//        if (booking.getStatus().equals("3")){
+//        if (booking.getOrderStatus().equals("3")){
 //            resultJson.put("code", 503);
 //            resultJson.put("message", "已入住,请往前台办理");
 //            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
 //            return null;
 //        }
-//        if (booking.getStatus().equals("4") || booking.getStatus().equals("5") || booking.getStatus().equals("6")){
+//        if (booking.getOrderStatus().equals("4") || booking.getOrderStatus().equals("5") || booking.getOrderStatus().equals("6")){
 //            resultJson.put("code", 503);
 //            resultJson.put("message", "订单已完成,请往前台办理");
 //            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
@@ -450,12 +448,6 @@
 //            return null;
 //        }
 //        bookService.update_pay("7", order_num);  // 退款中
-//        Logs logs = new Logs();
-//        logs.setAdmin_name(booking.getUser_name());
-//        logs.setOrder_num(booking.getOrder_num());
-//        logs.setCreate_time(TimeExchange.getTime());
-//        logs.setRecord1("用户自己申请退款,时间:"+TimeExchange.getTime());
-//        logsService.insert(logs);
 //        resultJson.put("code", 200);
 //        resultJson.put("message", "退款申请已提交,请稍候查询");
 //        ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());

+ 9 - 10
mhotel/src/com/happy/dao/HotelDao.java

@@ -45,16 +45,6 @@ public interface HotelDao {
 
 
     /**
-     * 描述:分页查询,加最低价格
-     * @param sqlx
-     * @param page
-     * @param rows
-     * @return
-     */
-    List<Hotel> queryPagePrice(String sqlx, int page, int rows);
-
-
-    /**
      * 描述:获取总条数
      * @param sqlx
      * @return
@@ -68,4 +58,13 @@ public interface HotelDao {
      */
     List<Hotel> queryList(String sqlx);
 
+    /**
+     * 查询列表,加最底房价
+     * @param sqlx
+     * @param page
+     * @param rows
+     * @return
+     * 00
+     */
+    public List<Hotel> queryPagePrice(String sqlx, int page, int rows);
 }

+ 7 - 0
mhotel/src/com/happy/service/BookService.java

@@ -87,4 +87,11 @@ public interface BookService {
      * @return
      */
     String delBooking(String bookingId);
+
+    /**
+     * 描述:根据订单号获取订单
+     * @param orderNum
+     * @return
+     */
+    Booking queryByOrder(String orderNum);
 }

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

@@ -46,6 +46,15 @@ public interface HotelService {
     IPage<Hotel> queryPage(String sqlx, int page, int rows);
 
     /**
+     * 描述:分页查询带最低价
+     * @param sqlx
+     * @param page
+     * @param rows
+     * @return
+     */
+    IPage<Hotel> queryPagePrice(String sqlx, int page, int rows);
+
+    /**
      * 描述:查询列表
      * @param sqlx
      * @return

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

@@ -44,7 +44,7 @@ public class AppHomePageImplService implements AppHomePageService {
             strSql.append(" and hname like '%").append(queryValue).append("%' ");
         }
 
-        return hotelService.queryPage(strSql.toString(),page,rows);
+        return hotelService.queryPagePrice(strSql.toString(),page,rows);
     }
 
     @Override

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

@@ -11,6 +11,7 @@ import com.happy.service.BookService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.awt.print.Book;
 import java.util.Date;
 import java.util.List;
 
@@ -116,4 +117,13 @@ public class BookImplService implements BookService {
         bookDao.updateBooking(book);
         return null;
     }
+
+    @Override
+    public Booking queryByOrder(String orderNum) {
+        List<Booking> list = bookDao.queryList("and order_num = '"+orderNum+"'");
+        if(list!=null && list.size()>0) return list.get(0);
+        return null;
+    }
+
+
 }

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

@@ -49,6 +49,19 @@ public class HotelImplService implements HotelService {
     }
 
     @Override
+    public IPage<Hotel> queryPagePrice(String sqlx, int page, int rows) {
+        IPage<Hotel> iPage = new IPage();
+        List<Hotel> hotelList = hotelDao.queryPagePrice(sqlx,page,rows);
+        int total = hotelDao.queryTotal(sqlx);
+        iPage.setPageList(hotelList);
+        iPage.setPage(page);
+        iPage.setTotalPage( (int)Math.ceil((double)total/rows));
+        iPage.setRows(rows);
+        iPage.setTotal(total);
+        return iPage;
+    }
+
+    @Override
     public List<Hotel> queryList(String sqlx) {
         return hotelDao.queryList(sqlx);
     }