|
|
@@ -0,0 +1,79 @@
|
|
|
+package com.happy.action;
|
|
|
+
|
|
|
+import com.happy.Model.BookingComplaint;
|
|
|
+import com.happy.Model.Hotel;
|
|
|
+import com.happy.Model.House;
|
|
|
+import com.happy.Until.ResUtil;
|
|
|
+import com.happy.common.controller.BaseController;
|
|
|
+import com.happy.dto.IPage;
|
|
|
+import com.happy.service.BookingComplaintService;
|
|
|
+import com.happy.service.HotelCoupomStatusService;
|
|
|
+import com.happy.service.HotelService;
|
|
|
+import com.happy.service.HouseService;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
+import org.apache.struts2.ServletActionContext;
|
|
|
+import org.apache.struts2.interceptor.ServletRequestAware;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+public class bookComplainAction extends BaseController implements ServletRequestAware {
|
|
|
+
|
|
|
+ public String keywords;//关键字搜索
|
|
|
+
|
|
|
+ public String complainStartTime;//起始时间
|
|
|
+
|
|
|
+ public String complainEndTime;//结束时间
|
|
|
+
|
|
|
+ @Resource(name = "BookingComplaintService")
|
|
|
+ private BookingComplaintService bookingComplaintService;
|
|
|
+ @Resource(name = "HotelService")
|
|
|
+ private HotelService hotelService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 列表查询
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String queryPage(){
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
+ StringBuilder s1 = new StringBuilder("");
|
|
|
+ if (keywords != null){
|
|
|
+ s1.append(" and id like '%").append(keywords).append("%'");
|
|
|
+ s1.append(" or title like '%").append(keywords).append("%'");
|
|
|
+ s1.append(" or content like '%").append(keywords).append("%'");
|
|
|
+ s1.append(" or booking_id = '").append(keywords).append("' ");
|
|
|
+ String sqlx = " and hname like '%" + keywords + "%' ";
|
|
|
+ List<Hotel> hotelList = hotelService.queryList(sqlx);
|
|
|
+ if (hotelList!=null){
|
|
|
+ StringBuilder ids = new StringBuilder();
|
|
|
+ hotelList.forEach(str->{
|
|
|
+ ids.append("'").append(str.getId()).append("',");
|
|
|
+ });
|
|
|
+ ids.deleteCharAt(ids.length()-1);
|
|
|
+ s1.append(" or hotel_id in (").append(ids).append(") ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (status != null){
|
|
|
+ s1.append(" and status = ").append(status).append(" ");
|
|
|
+ }
|
|
|
+ if (complainStartTime != null){
|
|
|
+ s1.append(" and DATE_FORMAT(create_date, '%Y-%m-%d') >= ").append(complainStartTime).append(" ");
|
|
|
+ }
|
|
|
+ if (complainStartTime != null){
|
|
|
+ s1.append(" and DATE_FORMAT(create_date, '%Y-%m-%d') <= ").append(complainEndTime).append(" ");
|
|
|
+ }
|
|
|
+ IPage<BookingComplaint> bookingComplaintIPage = bookingComplaintService.queryPage(s1.toString(), page, rows);
|
|
|
+ if(bookingComplaintIPage!=null && !"".equals(bookingComplaintIPage)){
|
|
|
+ resultJson.put("message", "查询分页成功");
|
|
|
+ resultJson.put("code", 200);
|
|
|
+ resultJson.put("data", bookingComplaintIPage);
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
+ }else{
|
|
|
+ resultJson.put("message", "查询分页失败");
|
|
|
+ resultJson.put("code", 500);
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|