|
|
@@ -1,18 +1,15 @@
|
|
|
package com.happy.action;
|
|
|
|
|
|
-import com.happy.Model.AdminManager;
|
|
|
+import com.baidubce.model.User;
|
|
|
import com.happy.Model.Booking;
|
|
|
-import com.happy.Model.House;
|
|
|
-import com.happy.Model.weixin.PayResult;
|
|
|
-import com.happy.Model.weixin.WechatUnifiedOrder;
|
|
|
-import com.happy.Model.weixin.WeiXinUtil;
|
|
|
+import com.happy.Model.weixin.Users;
|
|
|
import com.happy.Until.*;
|
|
|
import com.happy.Until.Excel.toExcel;
|
|
|
-import com.happy.Until.weixin.JaxbUtil;
|
|
|
-import com.happy.Until.weixin.PayWxUtil;
|
|
|
-import com.happy.common.wx.WxUtil;
|
|
|
+import com.happy.common.http.Message;
|
|
|
+import com.happy.dto.BookTypeEto;
|
|
|
import com.happy.dto.IPage;
|
|
|
import com.happy.service.BookService;
|
|
|
+import com.happy.service.UserService;
|
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.apache.struts2.ServletActionContext;
|
|
|
@@ -21,10 +18,7 @@ import org.apache.struts2.interceptor.ServletRequestAware;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-import java.text.ParseException;
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
import java.util.Vector;
|
|
|
|
|
|
public class bookAction extends ActionSupport implements ServletRequestAware {
|
|
|
@@ -34,12 +28,15 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
|
|
|
|
|
|
@Resource
|
|
|
public BookService bookService;
|
|
|
+ @Resource
|
|
|
+ public UserService userService;
|
|
|
|
|
|
public int page; // 当前页
|
|
|
public int rows;// 每页显示的行数rows
|
|
|
public Integer id;
|
|
|
- public String status;
|
|
|
- public String dom;
|
|
|
+ public Integer type;
|
|
|
+ public String orderStatus;//订单状态
|
|
|
+ public String manager_id;//商户Id
|
|
|
public String payStartTime;//支付开始时间
|
|
|
public String payEndTime;//支付结束时间
|
|
|
public String ledgerParam;//台账列表查询参数
|
|
|
@@ -64,355 +61,79 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
|
|
|
this.response = response;
|
|
|
}
|
|
|
|
|
|
- // 查看订单
|
|
|
-// public String list() {
|
|
|
-// JSONObject resultJson = new JSONObject();
|
|
|
-// StringBuilder s1 = new StringBuilder("");
|
|
|
-// if (status!=null){
|
|
|
-// s1.append(" and status = '").append(this.status).append("' ");
|
|
|
-// }
|
|
|
-// if (start_time!=null){
|
|
|
-// s1.append(" and create_time>'").append(this.start_time).append("' ");
|
|
|
-// }
|
|
|
-// if (end_time!=null){
|
|
|
-// s1.append(" and create_time<'").append(this.end_time).append("' ");
|
|
|
-// }
|
|
|
-// if (order_name_phone!=null){
|
|
|
-// s1.append(" and ( order_num like '%").append(this.order_name_phone)
|
|
|
-// .append("%' or user_name like '%").append(this.order_name_phone)
|
|
|
-// .append("%' or phone like '%").append(this.order_name_phone).append("%' ) ");
|
|
|
-// }
|
|
|
-// int total = bookService.queryBookTotal(s1.toString()); // 查询表中的总记录数
|
|
|
-// List<Booking> listPage = bookService.queryBookPage(s1.toString(), page, rows); // 查询分页
|
|
|
-//
|
|
|
-// if (listPage == null) {
|
|
|
-// resultJson.put("rows", "");
|
|
|
-// resultJson.put("total", 0);
|
|
|
-// } else {
|
|
|
-// resultJson.put("code", 200);
|
|
|
-// resultJson.put("rows", listPage);
|
|
|
-// // int total = listAll.size();
|
|
|
-// resultJson.put("total", total);// 总记录数
|
|
|
-// int totalPage = total % rows == 0 ? (total / rows)
|
|
|
-// : (total / rows) + 1;// 总页数
|
|
|
-// resultJson.put("totalPage", totalPage);
|
|
|
-// resultJson.put("currentPage", page);// 当前页
|
|
|
-// resultJson.put("numPerPage", rows);// 每页数
|
|
|
-// resultJson.put("nextPage", totalPage - page == 0 ? page : page + 1);// 下一页
|
|
|
-// resultJson.put("previousPage", page - 0 == 1 ? page : page - 1);// 上一页
|
|
|
-// resultJson.put("hasPreviousPage", true);// 有上一页
|
|
|
-// resultJson.put("hasNextPage", true);// 有下一页
|
|
|
-// resultJson.put("firstPage", true);// 首页
|
|
|
-// resultJson.put("lastPage", true);// 尾页
|
|
|
-// }
|
|
|
-// ResponseUtil.writeJson(ServletActionContext.getResponse(),
|
|
|
-// resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 导出列表
|
|
|
-// public String to_excel() {
|
|
|
-// JSONObject resultJson = new JSONObject();
|
|
|
-// StringBuilder s1 = new StringBuilder("");
|
|
|
-// if (status!=null){
|
|
|
-// s1.append(" and status = '").append(this.status).append("' ");
|
|
|
-// }
|
|
|
-// if (start_time!=null){
|
|
|
-// s1.append(" and create_time>'").append(this.start_time).append("' ");
|
|
|
-// }
|
|
|
-// if (end_time!=null){
|
|
|
-// s1.append(" and create_time<'").append(this.end_time).append("' ");
|
|
|
-// }
|
|
|
-// if (order_name_phone!=null){
|
|
|
-// s1.append(" and ( order_num like '%").append(this.order_name_phone)
|
|
|
-// .append("%' or user_name like '%").append(this.order_name_phone)
|
|
|
-// .append("%' or phone like '%").append(this.order_name_phone).append("%' ) ");
|
|
|
-// }
|
|
|
-// List<Booking> list = bookService.queryBooks(s1.toString()); // 查询分页
|
|
|
-// // 项目路径地址
|
|
|
-// String path = request.getSession().getServletContext()
|
|
|
-// .getRealPath("/download/");// File.separator
|
|
|
-//
|
|
|
-// try{
|
|
|
-// Vector columnName = new Vector();
|
|
|
-// columnName.add("order_num");
|
|
|
-// columnName.add("status");
|
|
|
-// columnName.add("dom");
|
|
|
-// columnName.add("user_name");
|
|
|
-// columnName.add("phone");
|
|
|
-// columnName.add("h_type");
|
|
|
-// columnName.add("price");
|
|
|
-// columnName.add("create_time");
|
|
|
-// columnName.add("pay_account");
|
|
|
-// // 导出文件
|
|
|
-// new toExcel().book(list, path + "订单信息" + "Report.xls",
|
|
|
-// "sheet1", columnName);
|
|
|
-// String url = request.getSession().getServletContext().getContextPath();
|
|
|
-// resultJson.put("downurl", url+"/download/订单信息" + "Report.xls");
|
|
|
-// resultJson.put("code", 200);
|
|
|
-// resultJson.put("message", "导出成功");
|
|
|
-// ResponseUtil.writeJson(ServletActionContext.getResponse(),
|
|
|
-// resultJson.toString());
|
|
|
-// } catch (Exception e){
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // pc处理核销-办理入住
|
|
|
-// public String operate_live() throws ParseException {
|
|
|
-// JSONObject resultJson = new JSONObject();
|
|
|
-// if (id==null){
|
|
|
-// resultJson.put("message", "请传id");
|
|
|
-// resultJson.put("code", 500);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// if (!status.equals("3")){
|
|
|
-// resultJson.put("message", "参数有误");
|
|
|
-// resultJson.put("code", 500);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// Booking booking = bookService.queryBookById(id);
|
|
|
-// if (booking==null){
|
|
|
-// resultJson.put("message", "订单已被删除");
|
|
|
-// resultJson.put("code", 500);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//// if (booking.getStatus().equals("1")){
|
|
|
-//// resultJson.put("message", "订单未支付不能进行其他操作");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-//// if (booking.getStatus().equals("3")){
|
|
|
-//// resultJson.put("message", "该订单已入住请勿重复办理");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-//// if (booking.getStatus().equals("4") || booking.getStatus().equals("5") || booking.getStatus().equals("6")){
|
|
|
-//// resultJson.put("message", "该订单已完成不能进行其他操作");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-//// if (!booking.getLive_time().equals(TimeExchange.getDate())){
|
|
|
-//// resultJson.put("message", "该订单未到入住时间或已过期,请重新下单");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-// int m = bookService.update(status,dom,id);
|
|
|
-// if(m>0){
|
|
|
-// resultJson.put("message", "操作成功");
|
|
|
-// resultJson.put("code", 200);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// resultJson.put("message", "操作失败");
|
|
|
-// resultJson.put("code", 205);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // pc处理核销-办理退款
|
|
|
-// public String refund_money() throws Exception {
|
|
|
-// JSONObject resultJson = new JSONObject();
|
|
|
-// if (id==null){
|
|
|
-// resultJson.put("message", "请传id");
|
|
|
-// resultJson.put("code", 500);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// if (!status.equals("5")){
|
|
|
-// resultJson.put("message", "参数有误");
|
|
|
-// resultJson.put("code", 500);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// Booking booking = bookService.queryBookById(id);
|
|
|
-// if (booking==null){
|
|
|
-// resultJson.put("message", "订单已被删除");
|
|
|
-// resultJson.put("code", 500);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//// if (booking.getStatus().equals("1")){
|
|
|
-//// resultJson.put("message", "订单未支付不能进行其他操作");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-//// if (booking.getStatus().equals("3")){
|
|
|
-//// resultJson.put("message", "该订单已入住,请办理退房");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-//// if (booking.getStatus().equals("4") || booking.getStatus().equals("5") || booking.getStatus().equals("6")){
|
|
|
-//// resultJson.put("message", "该订单已完成不能进行其他操作");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-// //String ip = request.getParameter("ip");
|
|
|
-// String ip = "171.34.223.11";
|
|
|
-//// double money = booking.getPay_account();
|
|
|
-//// int a = (int) (money * 100);
|
|
|
-//// WechatUnifiedOrder w = new WechatUnifiedOrder();
|
|
|
-//// w.setAppid(WeiXinUtil.appid_c);
|
|
|
-//// w.setAttach("chengxin");
|
|
|
-//// w.setBody("chengxin");
|
|
|
-//// w.setMch_id(WeiXinUtil.account);
|
|
|
-//// w.setNonce_str(PayWxUtil.getNonceStr());// 随机支付串
|
|
|
-//// w.setNotify_url(WeiXinUtil.ip_h + "/bookrefundResulet.action");// 支付结果回调地址
|
|
|
-//// w.setOpenid("");
|
|
|
-//// w.setOut_trade_no(booking.getOrder_num());
|
|
|
-//// 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");
|
|
|
-//// Map<String, String> params = new HashMap<String, String>();
|
|
|
-//// params.put("attach", w.getAttach());
|
|
|
-//// params.put("appid", w.getAppid());
|
|
|
-//// params.put("mch_id", w.getMch_id());
|
|
|
-//// params.put("nonce_str", w.getNonce_str());
|
|
|
-//// params.put("body", w.getBody());
|
|
|
-//// params.put("out_trade_no", w.getOut_trade_no());
|
|
|
-//// params.put("out_refund_no", w.getOut_refund_no()); // 退款单号
|
|
|
-//// params.put("total_fee", w.getTotal_fee() + "");
|
|
|
-//// params.put("refund_fee",w.getRefund_fee()+""); // 退款金额
|
|
|
-//// params.put("spbill_create_ip", w.getSpbill_create_ip());
|
|
|
-//// params.put("notify_url", w.getNotify_url());
|
|
|
-//// params.put("trade_type", w.getTrade_type());
|
|
|
-//// params.put("openid", w.getOpenid());
|
|
|
-//// w.setSign(PayWxUtil.getSign(params, WeiXinUtil.APIid));
|
|
|
-//// params.put("sign", w.getSign());
|
|
|
-//// String retXml = JaxbUtil.getRequestXml(params);
|
|
|
-//// String msg = HttpUtils.post("https://api.mch.weixin.qq.com/secapi/pay/refund", retXml);
|
|
|
-//// System.out.println(msg);
|
|
|
-//// if (msg.indexOf("FAIL") > -1) {
|
|
|
-//// resultJson.put("code", 507);
|
|
|
-//// resultJson.put("message", "退款失败");
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-//// resultJson.put("code", 200);
|
|
|
-//// resultJson.put("message", "退款申请已提交,请稍候查询");
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 退款回调
|
|
|
-// public String refundResulet(){
|
|
|
-// JSONObject resultjson = new JSONObject();
|
|
|
-// com.alibaba.fastjson.JSONObject json = GetHttpParam.getHttpParam(request);
|
|
|
-// try{
|
|
|
-// JaxbUtil requestBinder = new JaxbUtil(PayResult.class, PayResult.class);
|
|
|
-// PayResult result = requestBinder.fromXml(json.toString());// Xml到Java,用fromXML()方法
|
|
|
-// String order_num = result.getOut_trade_no();
|
|
|
-// System.out.println("退款成功回调,订单号:"+order_num);
|
|
|
-// // 支付成功
|
|
|
-// if (result.getResult_code().equals("SUCCESS")) {
|
|
|
-// bookService.update_pay("5", order_num);
|
|
|
-// resultjson.put("message", "退款成功");
|
|
|
-// resultjson.put("code", 200);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// } catch (Exception e){
|
|
|
-// resultjson.put("message", "退款失败");
|
|
|
-// resultjson.put("code", 205);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// resultjson.put("message", "退款失败");
|
|
|
-// resultjson.put("code", 205);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// // pc处理核销-办理退房
|
|
|
-// public String refund_room() throws ParseException {
|
|
|
-// JSONObject resultJson = new JSONObject();
|
|
|
-// if (id==null){
|
|
|
-// resultJson.put("message", "请传id");
|
|
|
-// resultJson.put("code", 500);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// if (!status.equals("6")){
|
|
|
-// resultJson.put("message", "参数有误");
|
|
|
-// resultJson.put("code", 500);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-// Booking booking = bookService.queryBookById(id);
|
|
|
-// if (booking==null){
|
|
|
-// resultJson.put("message", "订单已被删除");
|
|
|
-// resultJson.put("code", 500);
|
|
|
-// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//// if (booking.getStatus().equals("1")){
|
|
|
-//// resultJson.put("message", "订单未支付不能进行其他操作");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-//// if (booking.getStatus().equals("2")){
|
|
|
-//// resultJson.put("message", "该订单未入住,请办理退款");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-//// if (booking.getStatus().equals("4") || booking.getStatus().equals("5") || booking.getStatus().equals("6")){
|
|
|
-//// resultJson.put("message", "该订单已完成不能进行其他操作");
|
|
|
-//// resultJson.put("code", 500);
|
|
|
-//// ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
-//// return null;
|
|
|
-//// }
|
|
|
-// int m = bookService.update(status,dom,id);
|
|
|
-// if(m>0){
|
|
|
-// resultJson.put("message", "操作成功");
|
|
|
-// resultJson.put("code", 200);
|
|
|
-// 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 updateBookStatus(){
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
+ if (id == null) {
|
|
|
+ resultJson.put("message", "请传入订单id");
|
|
|
+ resultJson.put("code", 500);
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ //根据id获取当前订单信息
|
|
|
+ Booking book = bookService.getById(id);
|
|
|
+ //获取用户openId
|
|
|
+ Users user = userService.queryByUserId(book.getCreateUserid());
|
|
|
+ try{
|
|
|
+ switch (type){
|
|
|
+ case 1://接单
|
|
|
+ book.setOrderStatus("3");
|
|
|
+ //推送信息
|
|
|
+ Message.send(user.getOpenid(),book.getOrderNum(),book.getUserName(),"商家已接单",book.getCreateTime());
|
|
|
+ break;
|
|
|
+ case 2://入住
|
|
|
+ book.setOrderStatus("4");
|
|
|
+ break;
|
|
|
+ case 3://退房
|
|
|
+ book.setOrderStatus("5");
|
|
|
+ break;
|
|
|
+ case 4://退单
|
|
|
+ book.setOrderStatus("8");
|
|
|
+ break;
|
|
|
+ case 5://退款
|
|
|
+ book.setOrderStatus("9");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ bookService.updateBooking(book);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
- * 描述:分页查询台账(查询以消费订单数据)
|
|
|
+ * 描述:分页查询订单
|
|
|
* @return
|
|
|
*/
|
|
|
- public String quearyLedgerPage(){
|
|
|
+ public String quearyBookPage(){
|
|
|
JSONObject resultJson = new JSONObject();
|
|
|
StringBuilder s1 = new StringBuilder("");
|
|
|
- s1.append(" and status = 5");
|
|
|
- s1.append(" and order_num like '%").append(ledgerParam).append("'");
|
|
|
+ s1.append(" and hotel_manager_id like '%").append(manager_id).append("'");
|
|
|
if (ledgerParam!=null){
|
|
|
s1.append(" and (order_num like '%").append(ledgerParam).append("'")
|
|
|
- .append(" or user_name like '%").append(ledgerParam).append("'")
|
|
|
- .append(" or user_phone like '%").append(ledgerParam).append("')");
|
|
|
+ .append(" or user_name like '%").append(ledgerParam).append("'")
|
|
|
+ .append(" or user_phone like '%").append(ledgerParam).append("')");
|
|
|
+ }
|
|
|
+ if(orderStatus!=null){
|
|
|
+ s1.append(" and order_status = ").append(orderStatus);
|
|
|
}
|
|
|
if(payStartTime!=null && payEndTime!=null){
|
|
|
s1.append(" and pay_time >= '").append(payStartTime).append("'")
|
|
|
.append(" and pay_time <= '").append(payEndTime).append("'");
|
|
|
}
|
|
|
- IPage<Booking> houseIPage = bookService.queryPage(s1.toString(),page,rows);
|
|
|
- if(houseIPage!=null && !"".equals(houseIPage)){
|
|
|
+ IPage<Booking> bookIPage = bookService.queryPage(s1.toString(),page,rows);
|
|
|
+ //获取订单汇总信息
|
|
|
+ BookTypeEto bookTypeEto = bookService.getBookStatusSum(s1.toString());
|
|
|
+ bookTypeEto.setBookIPage(bookIPage);
|
|
|
+
|
|
|
+ if(bookTypeEto!=null && !"".equals(bookTypeEto)){
|
|
|
resultJson.put("message", "查询分页成功");
|
|
|
resultJson.put("code", 200);
|
|
|
- resultJson.put("date", houseIPage);
|
|
|
+ resultJson.put("date", bookTypeEto);
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
}else{
|
|
|
resultJson.put("message", "查询分页失败");
|
|
|
@@ -422,8 +143,85 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public String sumLedgerAccount(){
|
|
|
+ /**
|
|
|
+ * 描述:导出订单
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String toBookExcel() {
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
+ StringBuilder s1 = new StringBuilder("");
|
|
|
+ if (ledgerParam!=null){
|
|
|
+ s1.append(" and (order_num like '%").append(ledgerParam).append("'")
|
|
|
+ .append(" or user_name like '%").append(ledgerParam).append("'")
|
|
|
+ .append(" or user_phone like '%").append(ledgerParam).append("')");
|
|
|
+ }
|
|
|
+ if(orderStatus!=null){
|
|
|
+ s1.append(" and order_status = ").append(orderStatus);
|
|
|
+ }
|
|
|
+ if(payStartTime!=null && payEndTime!=null){
|
|
|
+ s1.append(" and pay_time >= '").append(payStartTime).append("'")
|
|
|
+ .append(" and pay_time <= '").append(payEndTime).append("'");
|
|
|
+ }
|
|
|
+ List<Booking> list = bookService.queryList(s1.toString()); // 查询分页
|
|
|
+ // 项目路径地址
|
|
|
+ String path = request.getSession().getServletContext()
|
|
|
+ .getRealPath("/download/");// File.separator
|
|
|
+ try{
|
|
|
+ Vector columnName = new Vector();
|
|
|
+ columnName.add("orderNum");
|
|
|
+ columnName.add("orderName");
|
|
|
+ columnName.add("userName");
|
|
|
+ columnName.add("userPhone");
|
|
|
+ columnName.add("houseName");
|
|
|
+ columnName.add("houseTotalPrice");
|
|
|
+ columnName.add("payTime");
|
|
|
+ // 导出文件
|
|
|
+ new toExcel().book(list, path + "订单信息" + "Report.xls",
|
|
|
+ "sheet1", columnName);
|
|
|
+ String url = request.getSession().getServletContext().getContextPath();
|
|
|
+ resultJson.put("downurl", url+"/download/订单信息" + "Report.xls");
|
|
|
+ resultJson.put("code", 200);
|
|
|
+ resultJson.put("message", "导出成功");
|
|
|
+ ResponseUtil.writeJson(ServletActionContext.getResponse(),
|
|
|
+ resultJson.toString());
|
|
|
+ } catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 描述:分页查询台账(查询以消费订单数据)
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String quearyLedgerPage(){
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
+ StringBuilder s1 = new StringBuilder("");
|
|
|
+ s1.append(" and order_status = 5");
|
|
|
+ s1.append(" and hotel_manager_id like '%").append(manager_id).append("'");
|
|
|
+ if (ledgerParam!=null){
|
|
|
+ s1.append(" and (order_num like '%").append(ledgerParam).append("'")
|
|
|
+ .append(" or user_name like '%").append(ledgerParam).append("'")
|
|
|
+ .append(" or user_phone like '%").append(ledgerParam).append("')");
|
|
|
+ }
|
|
|
+ if(payStartTime!=null && payEndTime!=null){
|
|
|
+ s1.append(" and pay_time >= '").append(payStartTime).append("'")
|
|
|
+ .append(" and pay_time <= '").append(payEndTime).append("'");
|
|
|
+ }
|
|
|
+ IPage<Booking> bookIPage = bookService.queryPage(s1.toString(),page,rows);
|
|
|
+ //获取订单汇总信息
|
|
|
+ BookTypeEto bookTypeEto = bookService.getBookStatusSum(s1.toString());
|
|
|
+ bookTypeEto.setBookIPage(bookIPage);
|
|
|
+ if(bookTypeEto!=null && !"".equals(bookTypeEto)){
|
|
|
+ resultJson.put("message", "查询分页成功");
|
|
|
+ resultJson.put("code", 200);
|
|
|
+ resultJson.put("date", bookTypeEto);
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
+ }else{
|
|
|
+ resultJson.put("message", "查询分页失败");
|
|
|
+ resultJson.put("code", 500);
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@@ -458,7 +256,7 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
|
|
|
* 描述:导出台账
|
|
|
* @return
|
|
|
*/
|
|
|
- public String toExcel() {
|
|
|
+ public String toLedgerExcel() {
|
|
|
JSONObject resultJson = new JSONObject();
|
|
|
StringBuilder s1 = new StringBuilder("");
|
|
|
s1.append(" and status = 5");
|
|
|
@@ -478,12 +276,12 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
|
|
|
|
|
|
try{
|
|
|
Vector columnName = new Vector();
|
|
|
- columnName.add("order_num");
|
|
|
- columnName.add("user_name");
|
|
|
- columnName.add("user_phone");
|
|
|
- columnName.add("house_order_number");
|
|
|
- columnName.add("pay_account");
|
|
|
- columnName.add("pay_time");
|
|
|
+ columnName.add("orderNum");
|
|
|
+ columnName.add("userName");
|
|
|
+ columnName.add("userPhone");
|
|
|
+ columnName.add("houseOrderNumber");
|
|
|
+ columnName.add("payAccount");
|
|
|
+ columnName.add("payTime");
|
|
|
// 导出文件
|
|
|
new toExcel().book(list, path + "台账信息" + "Report.xls",
|
|
|
"sheet1", columnName);
|