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

Merge branch 'master' of https://e.coding.net/chuanghaikeji/jinganxiangsu/Homestay_app_houtai

# Conflicts:
#	mhotel/src/com/happy/Model/Booking.java
lijie 2 лет назад
Родитель
Сommit
9a9ebb1fba
30 измененных файлов с 955 добавлено и 205 удалено
  1. 13 0
      mhotel/src/com/happy/Model/AdminManager.java
  2. 20 0
      mhotel/src/com/happy/Model/Booking.java
  3. 194 0
      mhotel/src/com/happy/Model/BookingComment.java
  4. 6 6
      mhotel/src/com/happy/Model/FileInfo.java
  5. 12 0
      mhotel/src/com/happy/Model/Hotel.java
  6. 89 100
      mhotel/src/com/happy/action/AppBookingAction.java
  7. 265 0
      mhotel/src/com/happy/action/AppBookingCommentAction.java
  8. 49 10
      mhotel/src/com/happy/action/AppHomePageAction.java
  9. 8 6
      mhotel/src/com/happy/action/AppMePageAction.java
  10. 5 45
      mhotel/src/com/happy/action/adminManagerAction.java
  11. 2 2
      mhotel/src/com/happy/action/hotelAction.java
  12. 3 3
      mhotel/src/com/happy/action/houseAction.java
  13. 2 1
      mhotel/src/com/happy/action/uploadAction.java
  14. 8 0
      mhotel/src/com/happy/dao/BookingCommentDao.java
  15. 3 3
      mhotel/src/com/happy/dao/FileInfoDao.java
  16. 13 3
      mhotel/src/com/happy/dao/impl/AdminManagerImplDao.java
  17. 2 2
      mhotel/src/com/happy/dao/impl/BookImplDao.java
  18. 76 0
      mhotel/src/com/happy/dao/impl/BookingCommentDaoImpl.java
  19. 3 3
      mhotel/src/com/happy/dao/impl/FileImplInfoDao.java
  20. 13 12
      mhotel/src/com/happy/dao/impl/HotelImplDao.java
  21. 7 2
      mhotel/src/com/happy/dao/impl/UserDaoImpl.java
  22. 5 1
      mhotel/src/com/happy/dao/impl/UserVisitsDaoImpl.java
  23. 37 0
      mhotel/src/com/happy/dto/OrderRateDto.java
  24. 9 0
      mhotel/src/com/happy/service/AppHomePageService.java
  25. 12 0
      mhotel/src/com/happy/service/BookingCommentService.java
  26. 5 3
      mhotel/src/com/happy/service/FileService.java
  27. 15 0
      mhotel/src/com/happy/service/impl/AppHomePageImplService.java
  28. 66 0
      mhotel/src/com/happy/service/impl/BookingCommentImplService.java
  29. 12 3
      mhotel/src/com/happy/service/impl/FileImplService.java
  30. 1 0
      mhotel/src/struts.xml

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

@@ -22,6 +22,11 @@ public class AdminManager {
 	 */
 	 */
 	private Integer type;
 	private Integer type;
 
 
+	/**
+	 * 全景链接
+	 */
+	private String linkProUrl;
+
 
 
 	/**
 	/**
 	 * 所属商家Id
 	 * 所属商家Id
@@ -136,6 +141,14 @@ public class AdminManager {
 		this.type = type;
 		this.type = type;
 	}
 	}
 
 
+	public String getLinkProUrl() {
+		return linkProUrl;
+	}
+
+	public void setLinkProUrl(String linkProUrl) {
+		this.linkProUrl = linkProUrl;
+	}
+
 	public Integer getManagerId() {
 	public Integer getManagerId() {
 		return managerId;
 		return managerId;
 	}
 	}

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

@@ -63,6 +63,10 @@ public class Booking {
 
 
   private String lockTime; // 锁定时间
   private String lockTime; // 锁定时间
 
 
+  private Integer hstatus;//酒店营业状态(1 营业 2.休息)
+
+  private Integer hotelStatus;//酒店状态(0删除 1正常,2冻结)
+
   private List<FileInfo> houseFileInfoList; // 房型详细图
   private List<FileInfo> houseFileInfoList; // 房型详细图
   public Integer getId() {
   public Integer getId() {
     return id;
     return id;
@@ -507,4 +511,20 @@ public class Booking {
   public void setHouseNumbers(List<HouseNumber> houseNumbers) {
   public void setHouseNumbers(List<HouseNumber> houseNumbers) {
     this.houseNumbers = houseNumbers;
     this.houseNumbers = houseNumbers;
   }
   }
+
+  public Integer getHstatus() {
+    return hstatus;
+  }
+
+  public void setHstatus(Integer hstatus) {
+    this.hstatus = hstatus;
+  }
+
+  public Integer getHotelStatus() {
+    return hotelStatus;
+  }
+
+  public void setHotelStatus(Integer hotelStatus) {
+    this.hotelStatus = hotelStatus;
+  }
 }
 }

+ 194 - 0
mhotel/src/com/happy/Model/BookingComment.java

@@ -0,0 +1,194 @@
+package com.happy.Model;
+
+
+import lombok.Builder;
+
+@Builder
+public class BookingComment {
+    //    主键
+    private Integer id;
+
+    //    回复评论id
+    private String commentId;
+
+    //    评论订单id
+    private String bookingId;
+
+    //    评论民宿id
+    private String hotelId;
+
+    //    评论房型id
+    private String houseId;
+
+    //    内容
+    private String content;
+
+    //    评价状态
+    private String commentStatus;
+
+    //    总评分
+    private Double score;
+
+    //    卫生评分
+    private Double scoreWs;
+
+    //    服务评分
+    private Double scoreFw;
+
+    //    设施评分
+    private Double scoreSs;
+
+    //    位置评分
+    private Double scoreWz;
+
+    //    创建人
+    private Integer createId;
+
+    private String createUsername;
+
+    //    创建时间
+    private String createDate;
+
+    //    修改时间
+    private String modifyDate;
+
+    //    状态(0删除 1正常)
+    private String status;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getCommentId() {
+        return commentId;
+    }
+
+    public void setCommentId(String commentId) {
+        this.commentId = commentId;
+    }
+
+    public String getBookingId() {
+        return bookingId;
+    }
+
+    public void setBookingId(String bookingId) {
+        this.bookingId = bookingId;
+    }
+
+    public String getHotelId() {
+        return hotelId;
+    }
+
+    public void setHotelId(String hotelId) {
+        this.hotelId = hotelId;
+    }
+
+    public String getHouseId() {
+        return houseId;
+    }
+
+    public void setHouseId(String houseId) {
+        this.houseId = houseId;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getCommentStatus() {
+        return commentStatus;
+    }
+
+    public void setCommentStatus(String commentStatus) {
+        this.commentStatus = commentStatus;
+    }
+
+    public Double getScore() {
+        return score;
+    }
+
+    public void setScore(Double score) {
+        this.score = score;
+    }
+
+    public Double getScoreWs() {
+        return scoreWs;
+    }
+
+    public void setScoreWs(Double scoreWs) {
+        this.scoreWs = scoreWs;
+    }
+
+    public Double getScoreFw() {
+        return scoreFw;
+    }
+
+    public void setScoreFw(Double scoreFw) {
+        this.scoreFw = scoreFw;
+    }
+
+    public Double getScoreSs() {
+        return scoreSs;
+    }
+
+    public void setScoreSs(Double scoreSs) {
+        this.scoreSs = scoreSs;
+    }
+
+    public Double getScoreWz() {
+        return scoreWz;
+    }
+
+    public void setScoreWz(Double scoreWz) {
+        this.scoreWz = scoreWz;
+    }
+
+    public Integer getCreateId() {
+        return createId;
+    }
+
+    public void setCreateId(Integer createId) {
+        this.createId = createId;
+    }
+
+    public String getCreateUsername() {
+        return createUsername;
+    }
+
+    public void setCreateUsername(String createUsername) {
+        this.createUsername = createUsername;
+    }
+
+    public String getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(String createDate) {
+        this.createDate = createDate;
+    }
+
+    public String getModifyDate() {
+        return modifyDate;
+    }
+
+    public void setModifyDate(String modifyDate) {
+        this.modifyDate = modifyDate;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+}

+ 6 - 6
mhotel/src/com/happy/Model/FileInfo.java

@@ -6,12 +6,12 @@ public class FileInfo {
     /**
     /**
      * id
      * id
      */
      */
-    private Integer id;
+    private String id;
 
 
 	/**
 	/**
      * 关联id
      * 关联id
      */
      */
-    private Integer linkId;
+    private String linkId;
 
 
     /**
     /**
      * 附件路径
      * 附件路径
@@ -25,19 +25,19 @@ public class FileInfo {
 
 
 
 
 
 
-	public Integer getId() {
+	public String getId() {
 		return id;
 		return id;
 	}
 	}
 
 
-	public void setId(Integer id) {
+	public void setId(String id) {
 		this.id = id;
 		this.id = id;
 	}
 	}
 
 
-	public Integer getLinkId() {
+	public String getLinkId() {
 		return linkId;
 		return linkId;
 	}
 	}
 
 
-	public void setLinkId(Integer linkId) {
+	public void setLinkId(String linkId) {
 		this.linkId = linkId;
 		this.linkId = linkId;
 	}
 	}
 
 

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

@@ -166,6 +166,10 @@ public class Hotel {
 
 
 	private String collect_hotel;
 	private String collect_hotel;
 	private boolean is_collect_hotel;
 	private boolean is_collect_hotel;
+	/**
+	 * 720全景图链接
+	 */
+	private String linkProUrl;
 
 
 	public Integer getId() {
 	public Integer getId() {
 		return id;
 		return id;
@@ -442,4 +446,12 @@ public class Hotel {
 	public void setIs_collect_hotel(boolean is_collect_hotel) {
 	public void setIs_collect_hotel(boolean is_collect_hotel) {
 		this.is_collect_hotel = is_collect_hotel;
 		this.is_collect_hotel = is_collect_hotel;
 	}
 	}
+
+	public String getLinkProUrl() {
+		return linkProUrl;
+	}
+
+	public void setLinkProUrl(String linkProUrl) {
+		this.linkProUrl = linkProUrl;
+	}
 }
 }

+ 89 - 100
mhotel/src/com/happy/action/AppBookingAction.java

@@ -342,60 +342,60 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
 
 
         // 取消订单,修改订单的支付状态
         // 取消订单,修改订单的支付状态
         Booking book = bookService.getById(Func.parseInt(bookingId));
         Booking book = bookService.getById(Func.parseInt(bookingId));
-        if (book == null )
-        {
+        if (book == null ) {
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.message, "未获取到订单信息,请重新查询");
             jsonObject.put(B.message, "未获取到订单信息,请重新查询");
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
             return null;
         }
         }
-
-        AdminManager adminManager = adminManagerService.getById(Func.parseInt(book.getHotelManagerId()));
-
+        // 查询用户信息
+        Users users = userService.queryByUserId(book.getCreateUserid());
+        if (users == null) {
+            jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
+            jsonObject.put(B.message, "未查询到当前用户数据users,请先授权");
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        //是否能取消订单(1是 2否)
+        if (Func.parseInt(book.getHotelIsCanorder()) == 2) {
+            jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
+            jsonObject.put(B.message, "商家设置不可取消订单,请联系商家");
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
         //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款,10退款中
         //1待支付,2已支付,3待入住,4已入住,5已消费,6支付超时,7已取消,8已退单,9已退款,10退款中
         int status = Func.parseInt(book.getOrderStatus());
         int status = Func.parseInt(book.getOrderStatus());
-        if (status == PayEnum.待入住.getNum())
-        {
+        if (status == PayEnum.待支付.getNum() || status == PayEnum.支付超时.getNum()) {
             book.setOrderStatus(Func.parseStr(PayEnum.已取消.getNum())); // 如果在1待支付情况,用户点击取消订单按钮,后台直接修改取消订单操作
             book.setOrderStatus(Func.parseStr(PayEnum.已取消.getNum())); // 如果在1待支付情况,用户点击取消订单按钮,后台直接修改取消订单操作
             book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
             book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
             book.setRemake(Func.parseStr(PayEnum.已取消.getPayStatus()));
             book.setRemake(Func.parseStr(PayEnum.已取消.getPayStatus()));
             bookService.updateBooking(book);
             bookService.updateBooking(book);
             jsonObject.put(B.code, ResultStatusCode.OK.getStatus());
             jsonObject.put(B.code, ResultStatusCode.OK.getStatus());
-            jsonObject.put(B.message, "已取消订单");
+            jsonObject.put(B.message, "已取消");
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
             return null;
-
-        }else if (status == PayEnum.已支付.getNum() || status == PayEnum.待入住.getNum())
-        {
-            // 如果在2已支付,3待入住 情况,用户点击取消订单按钮,后台先修改状态为退款中,然后走退款流程
-            book.setOrderStatus(Func.parseStr(PayEnum.退款中.getNum()));
-            book.setUpdateTime(DateUtil.getFormatPaternDate(new Date()));
-            book.setRemake(Func.parseStr(PayEnum.已取消.getPayStatus()));
-            if (book.getPayAccount() > 0)
-            {
-                // 注明如果支付金额大于0,则需要退款: (标识走退款操作)
-                book.setRefundWay(OrderEnum.微信退款.toString());
-            }
         }
         }
-
-        //是否能取消订单(1是 2否)
-        if (Func.parseInt(book.getHotelIsCanorder()) == 2)
-        {
+        if (status == PayEnum.已入住.getNum()) {
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
-            jsonObject.put(B.message, "商家设置不可取消订单,请联系商家");
+            jsonObject.put(B.message, "已入住,请前往前台办理退款");
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
             return null;
         }
         }
-
-        Users users = userService.queryByUserId(book.getCreateUserid()); // 用户信息
-        if (users == null) {
+        if (status == PayEnum.已消费.getNum() || status == PayEnum.已取消.getNum() || status == PayEnum.已退单.getNum() || status == PayEnum.已退款.getNum()) {
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
             jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
-            jsonObject.put(B.message, "未查询到当前用户数据users,请先授权");
+            jsonObject.put(B.message, "订单已完成,不可进行操作");
+            ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        if (status == PayEnum.退款中.getNum()) {
+            jsonObject.put(B.code, ResultStatusCode.BAD_REQUEST.getStatus());
+            jsonObject.put(B.message, "退款中,请勿重复操作");
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
             return null;
             return null;
         }
         }
-
         // 退款操作
         // 退款操作
+        book.setRemake(Func.parseStr(PayEnum.已取消.getPayStatus()));
+        book.setRefundWay(OrderEnum.微信退款.toString());
         jsonObject = refundMethod(book,users.getOpenid());
         jsonObject = refundMethod(book,users.getOpenid());
         jsonObject.put(B.data, book);
         jsonObject.put(B.data, book);
         ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
         ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
@@ -411,81 +411,70 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
      */
      */
     public JSONObject refundMethod(Booking book,String open_id) throws Exception {
     public JSONObject refundMethod(Booking book,String open_id) throws Exception {
         JSONObject  jsonObject  = new JSONObject();
         JSONObject  jsonObject  = new JSONObject();
-        if (book == null || Func.checkNull(open_id))
-        {
+        if (book == null || Func.checkNull(open_id)) {
             jsonObject.put("code", 400);
             jsonObject.put("code", 400);
             jsonObject.put("message", "未传入book和open_id数据---refundMethod");
             jsonObject.put("message", "未传入book和open_id数据---refundMethod");
             return jsonObject;
             return jsonObject;
         }
         }
-
         // 进行判断如果订单是退款中,并且标识字段微信退款,则进入退款流程
         // 进行判断如果订单是退款中,并且标识字段微信退款,则进入退款流程
-        if (Func.parseStr(PayEnum.退款中.getNum()).equals(book.getOrderStatus()) && OrderEnum.微信退款.toString().equals(book.getRefundWay())) {
-            String ip = WeiXinUtil.ip;
-            double money = book.getPayAccount();
-            int a = (int) (money * 100);
-            WechatUnifiedOrder w = new WechatUnifiedOrder();
-            w.setAppid(WeiXinUtil.appid_c);
-            w.setAttach("chuanghai");
-            w.setBody("chuanghai");
-            w.setMch_id(WeiXinUtil.account);
-            w.setNonce_str(PayWxUtil.getNonceStr());// 随机支付串
-            w.setNotify_url(WeiXinUtil.ip_h + "/abkquery_refund.action");// 支付结果回调地址
-            w.setOpenid(open_id);
-            w.setOut_trade_no(book.getOrderNum());
-            String refund_order = WxUtil.mchOrderNo();
-            w.setOut_refund_no(refund_order);   // 退款单号
-            w.setSpbill_create_ip(ip);
-            w.setTotal_fee(a);
-            w.setRefund_fee(a);   // 退款金额
-            w.setTrade_type("JSAPI");
-            SortedMap<String, String> params = new TreeMap<>();
-            params.put("appid", w.getAppid());
-            params.put("mch_id", w.getMch_id());
-            params.put("nonce_str", w.getNonce_str());
-            params.put("notify_url", w.getNotify_url());
-            params.put("out_refund_no", w.getOut_refund_no());   // 退款单号
-            params.put("out_trade_no", w.getOut_trade_no());
-            params.put("refund_fee",w.getRefund_fee()+"");  // 退款金额
-            params.put("total_fee", w.getTotal_fee() + "");
-
-            w.setSign(PayWxUtil.getSign(params, WeiXinUtil.key));
-            params.put("sign", w.getSign());
-            //String retXml = JaxbUtil.getRequestXml(params);
-            String xml = "<xml>" +
-                    "<appid>" + w.getAppid() + "</appid>" +
-                    "<mch_id>" + w.getMch_id() + "</mch_id>" +
-                    "<nonce_str>" + w.getNonce_str() + "</nonce_str>" +
-                    "<notify_url>" + w.getNotify_url() + "</notify_url>" +
-                    "<out_refund_no>" + w.getOut_refund_no() + "</out_refund_no>" +
-                    "<out_trade_no>" + w.getOut_trade_no() + "</out_trade_no>"	+
-                    "<refund_fee>" + w.getRefund_fee()+"" + "</refund_fee>" +
-                    "<total_fee>" + w.getTotal_fee() + "" + "</total_fee>" +
-                    "<sign>" + w.getSign() + "</sign>"	+
-                    "</xml>";
-            //String msg = HttpsClient.sendPost2("https://api.mch.weixin.qq.com/secapi/pay/refund", retXml);
-            String msg = HttpUtils.post2("https://api.mch.weixin.qq.com/secapi/pay/refund", xml);
-            if (msg.indexOf("FAIL") > -1) {
-                jsonObject.put("code", 507);
-                jsonObject.put("message", "退款失败");
-                ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
-                return null;
-            }
-
-            // 设置订单状态为退款中
-            book.setOrderStatus(Func.parseStr(PayEnum.退款中.getNum()));
-            book.setUpdateTime(DateUtil.parseDateToStr(new Date(),DateUtil.Time_Formatter_Second));
-            bookService.updateBooking(book);  // 退款中
-
-            // 用户在待支付状态下取消了订单时,写入数据操作
-            bookinglogService.addBooklog("用户在取消了订单,正进入退款流程",book);
-
-            jsonObject.put("code", 200);
-            jsonObject.put("message", "申请已提交,请稍候查询");
-            return jsonObject;
+        String ip = WeiXinUtil.ip;
+        double money = book.getPayAccount();
+        int a = (int) (money * 100);
+        WechatUnifiedOrder w = new WechatUnifiedOrder();
+        w.setAppid(WeiXinUtil.appid_c);
+        w.setAttach("chuanghai");
+        w.setBody("chuanghai");
+        w.setMch_id(WeiXinUtil.account);
+        w.setNonce_str(PayWxUtil.getNonceStr());// 随机支付串
+        w.setNotify_url(WeiXinUtil.ip_h + "/abkquery_refund.action");// 支付结果回调地址
+        w.setOpenid(open_id);
+        w.setOut_trade_no(book.getOrderNum());
+        String refund_order = WxUtil.mchOrderNo();
+        w.setOut_refund_no(refund_order);   // 退款单号
+        w.setSpbill_create_ip(ip);
+        w.setTotal_fee(a);
+        w.setRefund_fee(a);   // 退款金额
+        w.setTrade_type("JSAPI");
+        SortedMap<String, String> params = new TreeMap<>();
+        params.put("appid", w.getAppid());
+        params.put("mch_id", w.getMch_id());
+        params.put("nonce_str", w.getNonce_str());
+        params.put("notify_url", w.getNotify_url());
+        params.put("out_refund_no", w.getOut_refund_no());   // 退款单号
+        params.put("out_trade_no", w.getOut_trade_no());
+        params.put("refund_fee",w.getRefund_fee()+"");  // 退款金额
+        params.put("total_fee", w.getTotal_fee() + "");
+
+        w.setSign(PayWxUtil.getSign(params, WeiXinUtil.key));
+        params.put("sign", w.getSign());
+        //String retXml = JaxbUtil.getRequestXml(params);
+        String xml = "<xml>" +
+                "<appid>" + w.getAppid() + "</appid>" +
+                "<mch_id>" + w.getMch_id() + "</mch_id>" +
+                "<nonce_str>" + w.getNonce_str() + "</nonce_str>" +
+                "<notify_url>" + w.getNotify_url() + "</notify_url>" +
+                "<out_refund_no>" + w.getOut_refund_no() + "</out_refund_no>" +
+                "<out_trade_no>" + w.getOut_trade_no() + "</out_trade_no>"	+
+                "<refund_fee>" + w.getRefund_fee()+"" + "</refund_fee>" +
+                "<total_fee>" + w.getTotal_fee() + "" + "</total_fee>" +
+                "<sign>" + w.getSign() + "</sign>"	+
+                "</xml>";
+        //String msg = HttpsClient.sendPost2("https://api.mch.weixin.qq.com/secapi/pay/refund", retXml);
+        String msg = HttpUtils.post2("https://api.mch.weixin.qq.com/secapi/pay/refund", xml);
+        if (msg.indexOf("FAIL") > -1) {
+            jsonObject.put("code", 507);
+            jsonObject.put("message", "退款失败");
+            ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
         }
         }
-
-        jsonObject.put("code", 400);
-        jsonObject.put("message", "提交申请失败");
+        // 设置订单状态为退款中
+        book.setOrderStatus(Func.parseStr(PayEnum.退款中.getNum()));
+        book.setUpdateTime(DateUtil.parseDateToStr(new Date(),DateUtil.Time_Formatter_Second));
+        bookService.updateBooking(book);  // 退款中
+        // 用户在待支付状态下取消了订单时,写入数据操作
+        bookinglogService.addBooklog("用户在取消了订单,正进入退款流程",book);
+        jsonObject.put("code", 200);
+        jsonObject.put("message", "申请已提交,请稍候查询");
         return jsonObject;
         return jsonObject;
     }
     }
 
 
@@ -868,7 +857,7 @@ public class AppBookingAction extends ActionSupport implements ServletRequestAwa
                 {
                 {
                     hotelName = book.getHouseName();
                     hotelName = book.getHouseName();
                 }
                 }
-                Message2.send(adminManager.getOpenid(),order_num,book.getHotelType(),live_end,book.getUserName(),hotelName, Func.parseStr(book.getId()));
+                Message2.send(adminManager.getOpenid(),order_num,book.getHouseName(),live_end,book.getUserName(),hotelName, Func.parseStr(book.getId()));
 
 
                 int m = bookService.updateBooking(book);
                 int m = bookService.updateBooking(book);
                 //用户支付,写入数据操作
                 //用户支付,写入数据操作

+ 265 - 0
mhotel/src/com/happy/action/AppBookingCommentAction.java

@@ -0,0 +1,265 @@
+package com.happy.action;
+
+import com.happy.Model.BookingComment;
+import com.happy.Until.Func;
+import com.happy.Until.ResUtil;
+import com.happy.dto.OrderRateDto;
+import com.happy.service.BookingCommentService;
+import com.opensymphony.xwork2.ActionSupport;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.struts2.ServletActionContext;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.springframework.web.bind.annotation.RequestBody;
+
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+
+/**
+ * 评价
+ */
+
+public class AppBookingCommentAction extends ActionSupport implements ServletRequestAware {
+
+    private HttpServletRequest request;
+
+    public HttpServletResponse response;
+
+    public HttpServletRequest getRequest() {
+        return request;
+    }
+
+    public void setRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    @Override
+    public void setServletRequest(HttpServletRequest request) {
+        this.request = request;
+    }
+
+    public HttpServletResponse getResponse() {
+        return response;
+    }
+
+    public void setResponse(HttpServletResponse response) {
+        this.response = response;
+    }
+
+
+    @Resource
+    public BookingCommentService bookingCommentService;
+
+
+    //    评论订单id
+    public String bookingId;
+
+    //    评论民宿id
+    public String hotelId;
+
+    //    评论房型id
+    public String houseId;
+
+    //    内容
+    public String content;
+
+    //    总评分
+    public Double score;
+
+    //    卫生评分
+    public Double scoreWs;
+
+    //    服务评分
+    public Double scoreFw;
+
+    //    设施评分
+    public Double scoreSs;
+
+    //    位置评分
+    public Double scoreWz;
+
+    //    创建人
+    public Integer createId;
+
+    public String createUsername;
+
+    //    创建时间
+    public String createDate;
+
+    //    修改时间
+    public String modifyDate;
+
+    public List<String> pictureList;
+
+    public List<String> getPictureList() {
+        return pictureList;
+    }
+
+    public void setPictureList(List<String> pictureList) {
+        this.pictureList = pictureList;
+    }
+
+    public String getBookingId() {
+        return bookingId;
+    }
+
+    public void setBookingId(String bookingId) {
+        this.bookingId = bookingId;
+    }
+
+    public String getHotelId() {
+        return hotelId;
+    }
+
+    public void setHotelId(String hotelId) {
+        this.hotelId = hotelId;
+    }
+
+    public String getHouseId() {
+        return houseId;
+    }
+
+    public void setHouseId(String houseId) {
+        this.houseId = houseId;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public Double getScore() {
+        return score;
+    }
+
+    public void setScore(Double score) {
+        this.score = score;
+    }
+
+    public Double getScoreWs() {
+        return scoreWs;
+    }
+
+    public void setScoreWs(Double scoreWs) {
+        this.scoreWs = scoreWs;
+    }
+
+    public Double getScoreFw() {
+        return scoreFw;
+    }
+
+    public void setScoreFw(Double scoreFw) {
+        this.scoreFw = scoreFw;
+    }
+
+    public Double getScoreSs() {
+        return scoreSs;
+    }
+
+    public void setScoreSs(Double scoreSs) {
+        this.scoreSs = scoreSs;
+    }
+
+    public Double getScoreWz() {
+        return scoreWz;
+    }
+
+    public void setScoreWz(Double scoreWz) {
+        this.scoreWz = scoreWz;
+    }
+
+    public Integer getCreateId() {
+        return createId;
+    }
+
+    public void setCreateId(Integer createId) {
+        this.createId = createId;
+    }
+
+    public String getCreateUsername() {
+        return createUsername;
+    }
+
+    public void setCreateUsername(String createUsername) {
+        this.createUsername = createUsername;
+    }
+
+    public String getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(String createDate) {
+        this.createDate = createDate;
+    }
+
+    public String getModifyDate() {
+        return modifyDate;
+    }
+
+    public void setModifyDate(String modifyDate) {
+        this.modifyDate = modifyDate;
+    }
+
+    /**
+     * 添加评论
+     */
+    public JSONObject orderRate() {
+        JSONObject jsonObject = new JSONObject();
+        if (score == null || score < 0 || scoreFw == null || scoreFw < 0 || scoreSs == null || scoreSs < 0 || scoreWs == null || scoreWs < 0 || scoreWz == null || scoreWz < 0 || bookingId == null || hotelId == null || houseId == null) {
+            jsonObject.put("code", 400);
+            jsonObject.put("message", "未传入orderRateDto数据---orderRate");
+            ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+        BookingComment bookingComment = BookingComment.builder().bookingId(bookingId)
+                .hotelId(hotelId).houseId(houseId).content(content)
+                .score(score).scoreWs(scoreWs).scoreFw(scoreFw)
+                .scoreSs(scoreSs).scoreWz(scoreWz).createId(createId)
+                .createUsername(createUsername).createDate(createDate)
+                .modifyDate(modifyDate).build();
+
+
+        int a = bookingCommentService.orderRate(bookingComment,pictureList);
+
+
+        if (a>0) {
+            jsonObject.put("code", 200);
+            jsonObject.put("message", "添加成功");
+            ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+        jsonObject.put("message", "未知异常");
+        jsonObject.put("code", 205);
+        ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+        return null;
+    }
+
+
+    /**
+     * 评价列表
+     *
+     * @return
+     */
+    public JSONObject evaluateList() {
+        JSONObject jsonObject = new JSONObject();
+        if (Func.checkNull(hotelId)) {
+            jsonObject.put("code", 400);
+            jsonObject.put("message", "未传入hotel_id数据---evaluateList");
+            ResUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+            return null;
+        }
+
+
+        return null;
+
+    }
+
+
+}

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

@@ -3,19 +3,14 @@ package com.happy.action;
 import com.baidubce.model.User;
 import com.baidubce.model.User;
 import com.happy.Model.Hotel;
 import com.happy.Model.Hotel;
 import com.happy.Model.weixin.Users;
 import com.happy.Model.weixin.Users;
-import com.happy.Until.DateUtil;
+import com.happy.Until.*;
 import com.happy.Until.Enum.B;
 import com.happy.Until.Enum.B;
 import com.happy.Until.Enum.TempEnum;
 import com.happy.Until.Enum.TempEnum;
-import com.happy.Until.Func;
-import com.happy.Until.ResponseUtil;
-import com.happy.Until.ResultUtil;
 import com.happy.constant.ResultStatusCode;
 import com.happy.constant.ResultStatusCode;
 import com.happy.dao.UserVisitsDao;
 import com.happy.dao.UserVisitsDao;
 import com.happy.dto.IPage;
 import com.happy.dto.IPage;
-import com.happy.service.AppHomePageService;
-import com.happy.service.FileService;
-import com.happy.service.HotelService;
-import com.happy.service.UserService;
+import com.happy.dto.townshipCountDTO;
+import com.happy.service.*;
 import com.opensymphony.xwork2.ActionSupport;
 import com.opensymphony.xwork2.ActionSupport;
 import net.sf.json.JSONObject;
 import net.sf.json.JSONObject;
 import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.ServletActionContext;
@@ -24,6 +19,7 @@ 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.util.List;
 
 
 /**
 /**
  * 首页进去Action请求交互
  * 首页进去Action请求交互
@@ -43,6 +39,8 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
     public HotelService hotelService;
     public HotelService hotelService;
     @Resource
     @Resource
     public FileService fileService;
     public FileService fileService;
+    @Resource
+    public AdminManagerService adminManagerService;
 
 
     public int page; // 当前页
     public int page; // 当前页
     public int rows;// 每页显示的行数rows
     public int rows;// 每页显示的行数rows
@@ -57,6 +55,7 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
     public String queryValue; // 首页查寻搜索关键词
     public String queryValue; // 首页查寻搜索关键词
     private String hotel_township; // 所属乡镇
     private String hotel_township; // 所属乡镇
     public String userId; // 用户id
     public String userId; // 用户id
+    public int type;
 
 
     public HttpServletRequest getRequest() {
     public HttpServletRequest getRequest() {
         return request;
         return request;
@@ -121,8 +120,7 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
     public String homePage()
     public String homePage()
     {
     {
         // 获取民宿列表
         // 获取民宿列表
-        IPage iPage = appHomePageService.getHotelList(queryValue, hotel_township,page,rows);
-
+        IPage iPage = appHomePageService.getHotelList(queryValue, hotel_township,type,page,rows);
         // 用户访问量数据
         // 用户访问量数据
         userVisitsDao.add(userId);
         userVisitsDao.add(userId);
         ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),iPage);
         ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),iPage);
@@ -251,6 +249,47 @@ public class AppHomePageAction extends ActionSupport implements ServletRequestAw
 
 
 
 
 
 
+    /**
+     * 描述:获取各乡俗民宿级别数量
+     * @return
+     */
+    public String getTownshipCount(){
+        JSONObject resultjson = new JSONObject();
+        List<townshipCountDTO> list = adminManagerService.getTownshipCount();
+        if (list!=null){
+            resultjson.put("message", "返回成功");
+            resultjson.put("code", 200);
+            resultjson.put("data",list);
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+            return null;
+        }
+        resultjson.put("message", "数据为空");
+        resultjson.put("code", 205);
+        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+        return null;
+    }
+
+    /**
+     * 描述:获取各乡镇剩余房数
+     * @return
+     */
+    public String getResidueCount(){
+        JSONObject resultjson = new JSONObject();
+        List<townshipCountDTO> list = adminManagerService.getResidueCount();
+        if (list!=null){
+            resultjson.put("message", "返回成功");
+            resultjson.put("code", 200);
+            resultjson.put("data",list);
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+            return null;
+        }
+        resultjson.put("message", "数据为空");
+        resultjson.put("code", 205);
+        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
+        return null;
+    }
+
+
     public String getUserCode() {
     public String getUserCode() {
         return userCode;
         return userCode;
     }
     }

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

@@ -131,13 +131,15 @@ public class AppMePageAction extends ActionSupport implements ServletRequestAwar
 
 
         IPage<Booking> iPage = bookService.queryPage(querySql.toString(), page, rows);
         IPage<Booking> iPage = bookService.queryPage(querySql.toString(), page, rows);
         List<Booking> bookList =iPage.getPageList();
         List<Booking> bookList =iPage.getPageList();
-        for (Booking book: bookList) {
-            if (book == null || Func.checkNull(book.getHouseId()))
-                continue;
+        if(bookList!=null){
+            for (Booking book: bookList) {
+                if (book == null || Func.checkNull(book.getHouseId()))
+                    continue;
 
 
-            // 将房间图片,写入房型对象中
-            List<FileInfo> fileInfoList = fileService.queryListByLinkId(book.getHouseId());
-            book.setHouseFileInfoList(fileInfoList);
+                // 将房间图片,写入房型对象中
+                List<FileInfo> fileInfoList = fileService.queryListByLinkId(book.getHouseId());
+                book.setHouseFileInfoList(fileInfoList);
+            }
         }
         }
 
 
         ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),iPage);
         ResponseUtil.writeJsonIPage(ServletActionContext.getResponse(),iPage);

+ 5 - 45
mhotel/src/com/happy/action/adminManagerAction.java

@@ -176,7 +176,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
             if(fileInfoList!=null && fileInfoList.size()>0){
             if(fileInfoList!=null && fileInfoList.size()>0){
                 for(FileInfo file : fileInfoList){
                 for(FileInfo file : fileInfoList){
                     FileInfo fileInfo = fileService.getById(file.getId());
                     FileInfo fileInfo = fileService.getById(file.getId());
-                    file.setLinkId(admin.getId());
+                    file.setLinkId(String.valueOf(admin.getId()));
                     if(fileInfo==null){
                     if(fileInfo==null){
                         fileService.insertFile(file);
                         fileService.insertFile(file);
                     }else{
                     }else{
@@ -250,8 +250,8 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
                 }
                 }
             }
             }
             StringBuilder getOneSqlx = new StringBuilder("");
             StringBuilder getOneSqlx = new StringBuilder("");
-            getOneSqlx.append(" and admin_name = '").append(admin.getAdminName()).append("'");
-            getOneSqlx.append(" and id != '").append(admin.getId()).append("'");
+            getOneSqlx.append(" and a.admin_name = '").append(admin.getAdminName()).append("'");
+            getOneSqlx.append(" and a.id != '").append(admin.getId()).append("'");
             AdminManager listc = adminManagerService.getOen(getOneSqlx.toString());
             AdminManager listc = adminManagerService.getOen(getOneSqlx.toString());
             if (listc != null) {
             if (listc != null) {
                 resultJson.put("message", "该用户已存在");
                 resultJson.put("message", "该用户已存在");
@@ -263,11 +263,11 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
             List<FileInfo> fileInfoList = JSONArray.parseArray(fileListJson, FileInfo.class);
             List<FileInfo> fileInfoList = JSONArray.parseArray(fileListJson, FileInfo.class);
             if(fileInfoList!=null && fileInfoList.size()>0){
             if(fileInfoList!=null && fileInfoList.size()>0){
                 if(admin.getId()!= null){
                 if(admin.getId()!= null){
-                    fileService.delLinkFile(admin.getId());
+                    fileService.delLinkFile(String.valueOf(admin.getId()));
                 }
                 }
                 for(FileInfo file : fileInfoList){
                 for(FileInfo file : fileInfoList){
                     FileInfo fileInfo = fileService.getById(file.getId());
                     FileInfo fileInfo = fileService.getById(file.getId());
-                    file.setLinkId(admin.getId());
+                    file.setLinkId(String.valueOf(admin.getId()));
                     if(fileInfo==null){
                     if(fileInfo==null){
                         fileService.insertFile(file);
                         fileService.insertFile(file);
                     }else{
                     }else{
@@ -730,44 +730,4 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
         return null;
         return null;
     }
     }
 
 
-    /**
-     * 描述:获取各乡俗民宿级别数量
-     * @return
-     */
-    public String getTownshipCount(){
-        JSONObject resultjson = new JSONObject();
-        List<townshipCountDTO> list = adminManagerService.getTownshipCount();
-        if (list!=null){
-            resultjson.put("message", "返回成功");
-            resultjson.put("code", 200);
-            resultjson.put("data",list);
-            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-            return null;
-        }
-        resultjson.put("message", "数据为空");
-        resultjson.put("code", 205);
-        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-        return null;
-    }
-
-    /**
-     * 描述:获取各乡镇剩余房数
-     * @return
-     */
-    public String getResidueCount(){
-        JSONObject resultjson = new JSONObject();
-        List<townshipCountDTO> list = adminManagerService.getResidueCount();
-        if (list!=null){
-            resultjson.put("message", "返回成功");
-            resultjson.put("code", 200);
-            resultjson.put("data",list);
-            ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-            return null;
-        }
-        resultjson.put("message", "数据为空");
-        resultjson.put("code", 205);
-        ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
-        return null;
-    }
-
 }
 }

+ 2 - 2
mhotel/src/com/happy/action/hotelAction.java

@@ -111,11 +111,11 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
 
 
             if (m > 0) {
             if (m > 0) {
                 if(hotel.getId()!= null){
                 if(hotel.getId()!= null){
-                    fileService.delLinkFile(hotel.getId());
+                    fileService.delLinkFile(String.valueOf(hotel.getId()));
                 }
                 }
                 for(FileInfo file : fileList){
                 for(FileInfo file : fileList){
                     FileInfo fileInfo = fileService.getById(file.getId());
                     FileInfo fileInfo = fileService.getById(file.getId());
-                    file.setLinkId(hotelId);
+                    file.setLinkId(String.valueOf(hotelId));
                     if(fileInfo==null){
                     if(fileInfo==null){
                         fileService.insertFile(file);
                         fileService.insertFile(file);
                     }else{
                     }else{

+ 3 - 3
mhotel/src/com/happy/action/houseAction.java

@@ -139,7 +139,7 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
             if (m > 0) {
             if (m > 0) {
                 for(FileInfo file : fileList){
                 for(FileInfo file : fileList){
                     FileInfo fileInfo = fileService.getById(file.getId());
                     FileInfo fileInfo = fileService.getById(file.getId());
-                    file.setLinkId(house.getId());
+                    file.setLinkId(String.valueOf(house.getId()));
                     if(fileInfo==null){
                     if(fileInfo==null){
                         fileService.insertFile(file);
                         fileService.insertFile(file);
                     }else{
                     }else{
@@ -233,11 +233,11 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
             int m = houseService.updateHouse(house);
             int m = houseService.updateHouse(house);
             if (m > 0) {
             if (m > 0) {
                 if(house.getId()!= null){
                 if(house.getId()!= null){
-                    fileService.delLinkFile(house.getId());
+                    fileService.delLinkFile(String.valueOf(house.getId()));
                 }
                 }
                 for(FileInfo file : fileList){
                 for(FileInfo file : fileList){
                     FileInfo fileInfo = fileService.getById(file.getId());
                     FileInfo fileInfo = fileService.getById(file.getId());
-                    file.setLinkId(house.getId());
+                    file.setLinkId(String.valueOf(house.getId()));
                     if(fileInfo==null){
                     if(fileInfo==null){
                         fileService.insertFile(file);
                         fileService.insertFile(file);
                     }else{
                     }else{

+ 2 - 1
mhotel/src/com/happy/action/uploadAction.java

@@ -20,6 +20,7 @@ import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileInputStream;
 import java.util.List;
 import java.util.List;
+import java.util.UUID;
 
 
 public class uploadAction extends ActionSupport implements ServletRequestAware {
 public class uploadAction extends ActionSupport implements ServletRequestAware {
 
 
@@ -125,7 +126,7 @@ public class uploadAction extends ActionSupport implements ServletRequestAware {
             FileInfo fileInfo = new FileInfo();
             FileInfo fileInfo = new FileInfo();
             fileInfo.setName(myFileFileName);
             fileInfo.setName(myFileFileName);
             fileInfo.setUrl(fileurl);
             fileInfo.setUrl(fileurl);
-            fileInfo.setId(Math.toIntExact(UUIDUtil.generateID()));
+            fileInfo.setId(UUID.randomUUID().toString());
             /* 保存入库  */
             /* 保存入库  */
             int m = fileService.insertFile(fileInfo);
             int m = fileService.insertFile(fileInfo);
             if(m>0){
             if(m>0){

+ 8 - 0
mhotel/src/com/happy/dao/BookingCommentDao.java

@@ -0,0 +1,8 @@
+package com.happy.dao;
+
+import com.happy.Model.BookingComment;
+
+public interface BookingCommentDao {
+    String insertBookingComment(BookingComment bookingComment);
+
+}

+ 3 - 3
mhotel/src/com/happy/dao/FileInfoDao.java

@@ -25,21 +25,21 @@ public interface FileInfoDao {
      * @param id
      * @param id
      * @return
      * @return
      */
      */
-    int delFile(int id);
+    int delFile(String id);
 
 
     /**
     /**
      * 描述:根据linkId删除
      * 描述:根据linkId删除
      * @param linkId
      * @param linkId
      * @return
      * @return
      */
      */
-    int delLinkFile(int linkId);
+    int delLinkFile(String linkId);
 
 
     /**
     /**
      * 描述:根据Id查询详细
      * 描述:根据Id查询详细
      * @param id
      * @param id
      * @return
      * @return
      */
      */
-    FileInfo getById(int id);
+    FileInfo getById(String id);
 
 
     /**
     /**
      * 描述:分页查询
      * 描述:分页查询

+ 13 - 3
mhotel/src/com/happy/dao/impl/AdminManagerImplDao.java

@@ -32,7 +32,7 @@ public class AdminManagerImplDao implements AdminManagerDao {
 
 
     public String selectSql =
     public String selectSql =
         "select " +
         "select " +
-        "a.id, a.type, a.manager_id, a.admin_name, a.hotel_name, a.hotel_township, b.name hotel_township_name, a.corpn_name, a.corpn_phone, a.level, a.admin_power, a.bank_card, a.card_name, a.bank_name, a.create_id, DATE_FORMAT(a.create_date,'%Y-%m-%d %T') create_date,DATE_FORMAT(a.modify_date,'%Y-%m-%d %T') modify_date,a.status,a.remark,a.openid " +
+        "a.id, a.type, a.manager_id, a.link_pro_url, a.admin_name, a.hotel_name, a.hotel_township, b.name hotel_township_name, a.corpn_name, a.corpn_phone, a.level, a.admin_power, a.bank_card, a.card_name, a.bank_name, a.create_id, DATE_FORMAT(a.create_date,'%Y-%m-%d %T') create_date,DATE_FORMAT(a.modify_date,'%Y-%m-%d %T') modify_date,a.status,a.remark,a.openid " +
         "from `admin_manager` a " +
         "from `admin_manager` a " +
         "left join hotel_dict b on a.hotel_township = b.id";
         "left join hotel_dict b on a.hotel_township = b.id";
 
 
@@ -40,13 +40,14 @@ public class AdminManagerImplDao implements AdminManagerDao {
     @Override
     @Override
     public int insertAdmin(AdminManager adminManager) {
     public int insertAdmin(AdminManager adminManager) {
 
 
-        String sql = "INSERT INTO admin_manager (id, type, manager_id, admin_name, password, hotel_name, hotel_township, corpn_name, corpn_phone, level, admin_power, bank_card, card_name, bank_name, create_id, create_date, status, remark) VALUES (:id, :type, :manager_id ,:admin_name, :password, :hotel_name, :hotel_township, :corpn_name, :corpn_phone, :level, :admin_power, :bank_card, :card_name, :bank_name, :create_id, :create_date, :status, :remark)";
+        String sql = "INSERT INTO admin_manager (id, type, manager_id, admin_name, password, link_pro_url, hotel_name, hotel_township, corpn_name, corpn_phone, level, admin_power, bank_card, card_name, bank_name, create_id, create_date, status, remark) VALUES (:id, :type, :manager_id ,:admin_name, :password, :link_pro_url, :hotel_name, :hotel_township, :corpn_name, :corpn_phone, :level, :admin_power, :bank_card, :card_name, :bank_name, :create_id, :create_date, :status, :remark)";
 
 
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("type", adminManager.getType());
         sps.addValue("type", adminManager.getType());
         sps.addValue("manager_id", adminManager.getManagerId());
         sps.addValue("manager_id", adminManager.getManagerId());
         sps.addValue("admin_name", adminManager.getAdminName());
         sps.addValue("admin_name", adminManager.getAdminName());
         sps.addValue("password", adminManager.getPassword());
         sps.addValue("password", adminManager.getPassword());
+        sps.addValue("link_pro_url", adminManager.getLinkProUrl());
         sps.addValue("hotel_name", adminManager.getHotelName());
         sps.addValue("hotel_name", adminManager.getHotelName());
         sps.addValue("hotel_township", adminManager.getHotelTownship());
         sps.addValue("hotel_township", adminManager.getHotelTownship());
         sps.addValue("corpn_name", adminManager.getCorpnName());
         sps.addValue("corpn_name", adminManager.getCorpnName());
@@ -162,7 +163,7 @@ public class AdminManagerImplDao implements AdminManagerDao {
 
 
     @Override
     @Override
     public List<townshipCountDTO> getTownshipCount(){
     public List<townshipCountDTO> getTownshipCount(){
-        String sql = "select a.name,count(1) sumNumber,case when b.type=1 then 1 else 0 end aSum,case when b.type=2 then 1 else 0 end bSum,case when b.type=3 then 1 else 0 end cSum from \n" +
+        String sql = "select a.name,sum(case when b.id is not null then 1 else 0 end) sumNumber,sum(case when b.type=1 then 1 else 0 end) aSum,sum(case when b.type=2 then 1 else 0 end) bSum,sum(case when b.type=3 then 1 else 0 end) cSum from \n" +
                 "(select * from hotel_dict where code = 10 ) a\n" +
                 "(select * from hotel_dict where code = 10 ) a\n" +
                 "left join (select a.*,b.hstatus from admin_manager a\n" +
                 "left join (select a.*,b.hstatus from admin_manager a\n" +
                 "left join hotel b on a.id = b.manager_id\n" +
                 "left join hotel b on a.id = b.manager_id\n" +
@@ -201,6 +202,15 @@ public class AdminManagerImplDao implements AdminManagerDao {
     }
     }
 
 
     public void appendValue(AdminManager adminManager, StringBuffer stringBuffer, MapSqlParameterSource sps){
     public void appendValue(AdminManager adminManager, StringBuffer stringBuffer, MapSqlParameterSource sps){
+
+        if (!Func.checkNull(String.valueOf(adminManager.getType()))){
+            stringBuffer.append(" type=:type ,");
+            sps.addValue("type", adminManager.getType());
+        }
+        if (!Func.checkNull(adminManager.getLinkProUrl())){
+            stringBuffer.append(" link_pro_url=:link_pro_url ,");
+            sps.addValue("link_pro_url", adminManager.getLinkProUrl());
+        }
         if (!Func.checkNull(adminManager.getAdminName())){
         if (!Func.checkNull(adminManager.getAdminName())){
             stringBuffer.append(" admin_name=:admin_name ,");
             stringBuffer.append(" admin_name=:admin_name ,");
             sps.addValue("admin_name", adminManager.getAdminName());
             sps.addValue("admin_name", adminManager.getAdminName());

+ 2 - 2
mhotel/src/com/happy/dao/impl/BookImplDao.java

@@ -202,7 +202,7 @@ public class BookImplDao implements BookDao {
 
 
     @Override
     @Override
     public Booking getById(int id) {
     public Booking getById(int id) {
-        String sql = "SELECT "+selectCol+" FROM `booking` WHERE id = :id ";
+        String sql = "SELECT a.*,b.name hotel_township_name,c.hstatus hstatus,c.status hotelStatus FROM (select "+selectCol+" from booking) a left join hotel_dict b on a.hotel_township = b.id left join hotel c on a.hotel_id = c.id WHERE a.id = :id ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("id",id);
         sps.addValue("id",id);
         List<Booking> list = null;
         List<Booking> list = null;
@@ -221,7 +221,7 @@ public class BookImplDao implements BookDao {
         SqlUtil.filterKeyword(sqlx);
         SqlUtil.filterKeyword(sqlx);
 
 
         int start = (page - 1) * rows;// 每页的起始下标
         int start = (page - 1) * rows;// 每页的起始下标
-        String sql = "SELECT a.*,b.name hotel_township_name FROM (select "+selectCol+" from booking) a left join hotel_dict b on a.hotel_township = b.id WHERE 1=1 "+sqlx+" ORDER BY create_time DESC limit :start,:rows ";
+        String sql = "SELECT a.*,b.name hotel_township_name,c.hstatus hstatus,c.status hotelStatus FROM (select "+selectCol+" from booking) a left join hotel_dict b on a.hotel_township = b.id left join hotel c on a.hotel_id = c.id WHERE 1=1 "+sqlx+" ORDER BY create_time DESC limit :start,:rows ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("start", start);
         sps.addValue("start", start);
         sps.addValue("rows", rows);
         sps.addValue("rows", rows);

+ 76 - 0
mhotel/src/com/happy/dao/impl/BookingCommentDaoImpl.java

@@ -0,0 +1,76 @@
+package com.happy.dao.impl;
+
+import com.happy.Model.BookingComment;
+import com.happy.Until.UUIDUtil;
+import com.happy.dao.BookingCommentDao;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+@Repository("BookingCommentDao")
+public class BookingCommentDaoImpl implements BookingCommentDao {
+    @Autowired
+    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
+
+    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
+        return namedParameterJdbcTemplate;
+    }
+
+    public void setNamedParameterJdbcTemplate(
+            NamedParameterJdbcTemplate namedParameterJdbcTemplate) {
+        this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
+    }
+
+    /**
+     * Ìí¼ÓÆÀ¼Û£¬²¢·µ»ØÖ÷¼ü
+     * @param bookingComment
+     * @return
+     */
+    @Override
+    public String insertBookingComment(BookingComment bookingComment) {
+        String sql = "insert into `booking_comment`(id,comment_id,booking_id,hotel_id,house_id,content,comment_status,score, score_ws,score_fw,score_ss,score_wz,create_id,create_username,create_date,modify_date,status) values(:id,:comment_id,:booking_id,:hotel_id,:house_id,:content,:comment_status,:score,:score_ws,:score_fw,:score_ss,:score_wz,:create_id,:create_username,:create_date,:modify_date,:status) ";
+        MapSqlParameterSource sps = new MapSqlParameterSource();
+        sps.addValue("comment_id", bookingComment.getCommentId());
+        sps.addValue("booking_id",bookingComment.getBookingId());
+        sps.addValue("hotel_id", bookingComment.getHotelId());
+        sps.addValue("house_id", bookingComment.getHouseId());
+        sps.addValue("content", bookingComment.getContent());
+        sps.addValue("comment_status",bookingComment.getCommentStatus());
+        sps.addValue("score", bookingComment.getScore());
+        sps.addValue("score_ws", bookingComment.getScoreWs());
+        sps.addValue("score_fw", bookingComment.getScoreFw());
+        sps.addValue("score_ss", bookingComment.getScoreSs());
+        sps.addValue("score_wz", bookingComment.getScoreWz());
+        sps.addValue("create_id", bookingComment.getCreateId());
+        sps.addValue("create_username",bookingComment.getCreateUsername() );
+        sps.addValue("create_date",bookingComment.getCreateDate());
+        sps.addValue("modify_date",bookingComment.getModifyDate());
+        sps.addValue("status", 1);
+
+        String id ="";
+        if(bookingComment.getId()==null){
+            id = UUIDUtil.generateID()+"";
+            sps.addValue("id", id);
+        }else{
+            id=bookingComment.getId()+"";
+            sps.addValue("id", id);
+        }
+        int num = 0;
+        try{
+            num = namedParameterJdbcTemplate.update(sql, sps);
+        }
+        catch(Exception e){
+            e.printStackTrace();
+        }
+        if (num>0) {
+            return id;
+        }else {
+            id=num+"";
+        }
+        return id;
+    }
+
+
+
+}

+ 3 - 3
mhotel/src/com/happy/dao/impl/FileImplInfoDao.java

@@ -68,7 +68,7 @@ public class FileImplInfoDao implements FileInfoDao {
     }
     }
 
 
     @Override
     @Override
-    public int delFile(int id) {
+    public int delFile(String id) {
         String sql = "DELETE FROM `file_info` WHERE id = :id ";
         String sql = "DELETE FROM `file_info` WHERE id = :id ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("id",id);
         sps.addValue("id",id);
@@ -82,7 +82,7 @@ public class FileImplInfoDao implements FileInfoDao {
     }
     }
 
 
     @Override
     @Override
-    public int delLinkFile(int linkId) {
+    public int delLinkFile(String linkId) {
         String sql = "DELETE FROM `file_info` WHERE link_id = :link_id ";
         String sql = "DELETE FROM `file_info` WHERE link_id = :link_id ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("link_id",linkId);
         sps.addValue("link_id",linkId);
@@ -96,7 +96,7 @@ public class FileImplInfoDao implements FileInfoDao {
     }
     }
 
 
     @Override
     @Override
-    public FileInfo getById(int id) {
+    public FileInfo getById(String id) {
         String sql = "SELECT * FROM `file_info` WHERE id = :id ";
         String sql = "SELECT * FROM `file_info` WHERE id = :id ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("id",id);
         sps.addValue("id",id);

+ 13 - 12
mhotel/src/com/happy/dao/impl/HotelImplDao.java

@@ -109,9 +109,9 @@ public class HotelImplDao implements HotelDao {
     @Override
     @Override
     public Hotel getById(int id) {
     public Hotel getById(int id) {
 
 
-        String sql = " SELECT   a.*, c.manager_phone, b.hotel_township_name,c.hotel_name,d.hTypeName,f.room_number_calc  FROM `hotel` a  " +
+        String sql = " SELECT   a.*, c.manager_phone, b.hotel_township_name,c.hotel_name,d.hTypeName,f.room_number_calc,c.link_pro_url  FROM `hotel` a  " +
                 "left join (select manager_id,min(price) min_price ,sum(number) AS room_number_calc from house where status=1 group by manager_id) f on a.manager_id = f.manager_id " +
                 "left join (select manager_id,min(price) min_price ,sum(number) AS room_number_calc from house where status=1 group by manager_id) f on a.manager_id = f.manager_id " +
-                " LEFT JOIN (SELECT   id, corpn_phone manager_phone, hotel_township,hotel_name FROM  admin_manager ) c ON a.manager_id = c.id " +
+                " LEFT JOIN (SELECT   id, corpn_phone manager_phone, hotel_township,hotel_name,link_pro_url FROM  admin_manager ) c ON a.manager_id = c.id " +
                 " LEFT JOIN (  SELECT  id,name as hotel_township_name  FROM  hotel_dict GROUP BY  id) b ON b.id = c.hotel_township   "+
                 " LEFT JOIN (  SELECT  id,name as hotel_township_name  FROM  hotel_dict GROUP BY  id) b ON b.id = c.hotel_township   "+
                 " LEFT JOIN (  SELECT  id,name as hTypeName  FROM  hotel_dict GROUP BY  id) d ON d.id = a.htype   "+
                 " LEFT JOIN (  SELECT  id,name as hTypeName  FROM  hotel_dict GROUP BY  id) d ON d.id = a.htype   "+
                 " WHERE  a.STATUS = 1  AND a.id =  :id ";
                 " WHERE  a.STATUS = 1  AND a.id =  :id ";
@@ -132,8 +132,8 @@ public class HotelImplDao implements HotelDao {
     @Override
     @Override
     public Hotel getByManagerId(int id) {
     public Hotel getByManagerId(int id) {
 
 
-        String sql = " SELECT   a.*, c.manager_phone, b.hotel_township_name,c.hotel_name  FROM `hotel` a  " +
-                " LEFT JOIN (SELECT   id, corpn_phone manager_phone, hotel_township,hotel_name FROM  admin_manager ) c ON a.manager_id = c.id " +
+        String sql = " SELECT   a.*, c.manager_phone, b.hotel_township_name,c.hotel_name,c.link_pro_url  FROM `hotel` a  " +
+                " LEFT JOIN (SELECT   id, corpn_phone manager_phone, hotel_township,hotel_name,link_pro_url FROM  admin_manager ) c ON a.manager_id = c.id " +
                 " LEFT JOIN (  SELECT  id,name as hotel_township_name  FROM  hotel_dict GROUP BY  id) b ON b.id = c.hotel_township   "+
                 " 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 != 0  AND a.manager_id =  :manager_id ";
                 " WHERE  a.STATUS != 0  AND a.manager_id =  :manager_id ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
@@ -169,12 +169,12 @@ public class HotelImplDao implements HotelDao {
     public List<Hotel> queryPagePrice(String sqlx, int page, int rows) {
     public List<Hotel> queryPagePrice(String sqlx, int page, int rows) {
         SqlUtil.filterKeyword(sqlx);
         SqlUtil.filterKeyword(sqlx);
         int start = (page - 1) * rows;// 每页的起始下标
         int start = (page - 1) * rows;// 每页的起始下标
-        String sql = "SELECT a.*,b.min_price,c.hotel_township,d.hotel_township_name, e.h_type_name,c.hotel_name FROM `hotel` a " +
+        String sql = "SELECT a.*,b.min_price,c.hotel_township,d.hotel_township_name, e.h_type_name,c.hotel_name,c.link_pro_url FROM `hotel` a " +
                 "left join (select manager_id,min(price) min_price from house where status=1 group by manager_id) b on a.manager_id = b.manager_id " +
                 "left join (select manager_id,min(price) min_price from house where status=1 group by manager_id) b on a.manager_id = b.manager_id " +
-                "left join (select id,manager_id,hotel_township,hotel_name from admin_manager ) c on a.manager_id = c.id " +
-                "LEFT JOIN (  SELECT  id,name as hotel_township_name  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
+                "left join (select id,manager_id,hotel_township,hotel_name,type,status,link_pro_url from admin_manager ) c on a.manager_id = c.id " +
+                "LEFT JOIN (  SELECT  id,name as hotel_township_name,status  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
                 "LEFT JOIN (  SELECT  id,name as h_type_name  FROM  hotel_dict GROUP BY  id) e ON e.id = a.htype      " +
                 "LEFT JOIN (  SELECT  id,name as h_type_name  FROM  hotel_dict GROUP BY  id) e ON e.id = a.htype      " +
-                " WHERE status=1 "+sqlx+" ORDER BY id DESC limit :start,:rows ";
+                " WHERE hstatus = 1 and a.status=1 and c.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);
         sps.addValue("rows", rows);
         sps.addValue("rows", rows);
@@ -190,11 +190,12 @@ public class HotelImplDao implements HotelDao {
 //                "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;
 //                "where status=1 "+sqlx;
         SqlUtil.filterKeyword(sqlx);
         SqlUtil.filterKeyword(sqlx);
-        String sql = "SELECT count(*) FROM `hotel` a " +
+        String sql = "SELECT count(1) FROM `hotel` a " +
                 "left join (select manager_id,min(price) min_price from house where status=1 group by manager_id) b on a.manager_id = b.manager_id " +
                 "left join (select manager_id,min(price) min_price from house where status=1 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  id,name as hotel_township_name  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
-                " WHERE status=1 "+sqlx;
+                "left join (select id,manager_id,hotel_township,hotel_name,type,status,link_pro_url from admin_manager ) c on a.manager_id = c.id " +
+                "LEFT JOIN (  SELECT  id,name as hotel_township_name,status  FROM  hotel_dict GROUP BY  id) d ON d.id = c.hotel_township " +
+                "LEFT JOIN (  SELECT  id,name as h_type_name  FROM  hotel_dict GROUP BY  id) e ON e.id = a.htype      " +
+                " WHERE hstatus = 1 and a.status=1 and c.status = 1 "+sqlx;
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
         return namedParameterJdbcTemplate.queryForInt(sql, sps);
     }
     }

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

@@ -30,8 +30,8 @@ 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,collect_hotel,live_hotel)" +
-                " values(:card_number,:user_name,:user_phone,:user_zz,:openid,:create_time,:remark,:identity_type,:contact_id,:contact_name,:data_type,:head_photo,:collect_hotel,:live_hotel) ";
+        String sql = "insert into `users`(id,card_number,user_name,user_phone,user_zz,openid,create_time,remark,identity_type,contact_id,contact_name,data_type,head_photo,collect_hotel,live_hotel)" +
+                " values(:id,:card_number,:user_name,:user_phone,:user_zz,:openid,:create_time,:remark,:identity_type,:contact_id,:contact_name,:data_type,:head_photo,:collect_hotel,:live_hotel) ";
         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());
@@ -47,6 +47,11 @@ public class UserDaoImpl implements UserDao {
         sps.addValue("head_photo", users.getHeadPhoto());
         sps.addValue("head_photo", users.getHeadPhoto());
         sps.addValue("collect_hotel", users.getCollect_hotel());
         sps.addValue("collect_hotel", users.getCollect_hotel());
         sps.addValue("live_hotel", users.getLive_hotel());
         sps.addValue("live_hotel", users.getLive_hotel());
+        if(users.getId()==0){
+            sps.addValue("id", UUIDUtil.generateID());
+        }else{
+            sps.addValue("id", users.getId());
+        }
         int num = 0;
         int num = 0;
         try{
         try{
             num = namedParameterJdbcTemplate.update(sql, sps);
             num = namedParameterJdbcTemplate.update(sql, sps);

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

@@ -41,7 +41,11 @@ public class UserVisitsDaoImpl implements UserVisitsDao {
         String sql = "insert into `user_visits`(id,userid,create_time,type,remark) " +
         String sql = "insert into `user_visits`(id,userid,create_time,type,remark) " +
                 "values(:id,:userid,:create_time,:type,:remark) ";
                 "values(:id,:userid,:create_time,:type,:remark) ";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         MapSqlParameterSource sps = new MapSqlParameterSource();
-        sps.addValue("id", userVisits.getId());
+        if(userVisits.getId()==0){
+            sps.addValue("id", UUIDUtil.generateID());
+        }else{
+            sps.addValue("id", userVisits.getId());
+        }
         sps.addValue("userid", userVisits.getUserid());
         sps.addValue("userid", userVisits.getUserid());
         sps.addValue("create_time", UUIDUtil.getNewDate());
         sps.addValue("create_time", UUIDUtil.getNewDate());
         sps.addValue("type", userVisits.getType());
         sps.addValue("type", userVisits.getType());

+ 37 - 0
mhotel/src/com/happy/dto/OrderRateDto.java

@@ -0,0 +1,37 @@
+package com.happy.dto;
+
+import com.happy.Model.BookingComment;
+import com.happy.Model.FileInfo;
+
+import java.util.List;
+
+public class OrderRateDto {
+    //         ¸½¼þ
+    private List<FileInfo> fileInfoList;
+//  ÆÀ¼Û
+    private BookingComment bookingComment;
+
+    public List<FileInfo> getFileInfoList() {
+        return fileInfoList;
+    }
+
+    public void setFileInfoList(List<FileInfo> fileInfoList) {
+        this.fileInfoList = fileInfoList;
+    }
+
+    public BookingComment getBookingComment() {
+        return bookingComment;
+    }
+
+    public void setBookingComment(BookingComment bookingComment) {
+        this.bookingComment = bookingComment;
+    }
+
+    @Override
+    public String toString() {
+        return "OrderRateDto{" +
+                "fileInfoList=" + fileInfoList +
+                ", bookingComment=" + bookingComment +
+                '}';
+    }
+}

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

@@ -22,6 +22,15 @@ public interface AppHomePageService {
     public IPage getHotelList(String queryValue,String hotel_township, int page, int rows);
     public IPage getHotelList(String queryValue,String hotel_township, int page, int rows);
 
 
     /**
     /**
+     * APP端进入首页查询功能
+     * @param queryValue
+     * @param page
+     * @param rows
+     * @return
+     */
+    IPage getHotelList(String queryValue,String hotel_township,int type, int page, int rows);
+
+    /**
      * 通过id 查询酒店信息
      * 通过id 查询酒店信息
      * @param ids
      * @param ids
      * @param page
      * @param page

+ 12 - 0
mhotel/src/com/happy/service/BookingCommentService.java

@@ -0,0 +1,12 @@
+package com.happy.service;
+
+import com.happy.Model.BookingComment;
+import com.happy.Model.FileInfo;
+
+import java.util.List;
+
+public interface BookingCommentService {
+
+
+    int orderRate( BookingComment bookingComment,List<String> pictureList);
+}

+ 5 - 3
mhotel/src/com/happy/service/FileService.java

@@ -29,21 +29,21 @@ public interface FileService {
      * @param id
      * @param id
      * @return
      * @return
      */
      */
-    int delFile(int id);
+    int delFile(String id);
 
 
     /**
     /**
      * 描述:根据linkId删除
      * 描述:根据linkId删除
      * @param linkId
      * @param linkId
      * @return
      * @return
      */
      */
-    int delLinkFile(int linkId);
+    int delLinkFile(String linkId);
 
 
     /**
     /**
      * 描述:根据Id查询详细
      * 描述:根据Id查询详细
      * @param id
      * @param id
      * @return
      * @return
      */
      */
-    FileInfo getById(int id);
+    FileInfo getById(String id);
 
 
     /**
     /**
      * 描述:分页查询
      * 描述:分页查询
@@ -78,4 +78,6 @@ public interface FileService {
      * 描述:批量上传图片
      * 描述:批量上传图片
      */
      */
     void uploadImp(List<File> fileList, HttpServletRequest request);
     void uploadImp(List<File> fileList, HttpServletRequest request);
+
+    int batchInsertFile(List<FileInfo> fileInfoList);
 }
 }

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

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

+ 66 - 0
mhotel/src/com/happy/service/impl/BookingCommentImplService.java

@@ -0,0 +1,66 @@
+package com.happy.service.impl;
+
+import com.happy.Model.BookingComment;
+import com.happy.Model.FileInfo;
+import com.happy.dao.BookingCommentDao;
+import com.happy.service.BookingCommentService;
+import com.happy.service.FileService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service("BookingCommentService")
+
+public class BookingCommentImplService implements BookingCommentService {
+
+    @Resource
+    BookingCommentDao bookingCommentDao;
+
+    @Resource
+    FileService fileService;
+
+
+
+    /**
+     * 添加评论
+     *
+     * @param pictureList
+     * @param bookingComment
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int orderRate( BookingComment bookingComment,List<String> pictureList) {
+
+//        添加评论表并返回主键
+
+        String id = bookingCommentDao.insertBookingComment(bookingComment);
+        int i = 1;
+        if (pictureList.size() > 0) {
+            List<FileInfo> fileInfoList = new ArrayList<>();
+            for (String s : pictureList) {
+                String[] split = s.split("/");
+                String s1 = split[split.length-1];
+                FileInfo fileInfo = new FileInfo();
+                fileInfo.setLinkId(id);
+                fileInfo.setName(s1);
+                fileInfo.setUrl(s);
+
+                fileInfoList.add(fileInfo);
+            }
+
+            i = fileService.batchInsertFile(fileInfoList);
+        }
+        if (Long.valueOf(id) > 0 && i > 0) {
+            return i;
+        }else {
+            return 0;
+        }
+
+    }
+
+
+}

+ 12 - 3
mhotel/src/com/happy/service/impl/FileImplService.java

@@ -39,17 +39,17 @@ public class FileImplService implements FileService {
     }
     }
 
 
     @Override
     @Override
-    public int delFile(int id) {
+    public int delFile(String id) {
         return fileDao.delFile(id);
         return fileDao.delFile(id);
     }
     }
 
 
     @Override
     @Override
-    public int delLinkFile(int linkId) {
+    public int delLinkFile(String linkId) {
         return fileDao.delLinkFile(linkId);
         return fileDao.delLinkFile(linkId);
     }
     }
 
 
     @Override
     @Override
-    public FileInfo getById(int id) {
+    public FileInfo getById(String id) {
         return fileDao.getById(id);
         return fileDao.getById(id);
     }
     }
 
 
@@ -116,4 +116,13 @@ public class FileImplService implements FileService {
             }
             }
         }
         }
     }
     }
+
+    @Override
+    public int batchInsertFile(List<FileInfo> fileInfoList) {
+        int i=0;
+        for (FileInfo fileInfo : fileInfoList) {
+            i=fileDao.insertFile(fileInfo);
+        }
+        return i;
+    }
 }
 }

+ 1 - 0
mhotel/src/struts.xml

@@ -44,6 +44,7 @@
 		<action name="abk*" method = "{1}" class="com.happy.action.AppBookingAction"></action>
 		<action name="abk*" method = "{1}" class="com.happy.action.AppBookingAction"></action>
 		<action name="ahp*" method = "{1}" class="com.happy.action.AppHomePageAction"></action>
 		<action name="ahp*" method = "{1}" class="com.happy.action.AppHomePageAction"></action>
 		<action name="amp*" method = "{1}" class="com.happy.action.AppMePageAction"></action>
 		<action name="amp*" method = "{1}" class="com.happy.action.AppMePageAction"></action>
+		<action name="abca*" method = "{1}" class="com.happy.action.AppBookingCommentAction"></action>
 
 
 	</package>
 	</package>
 	<package name="interfaces" namespace="/interfaces" extends="struts-default">
 	<package name="interfaces" namespace="/interfaces" extends="struts-default">