Browse Source

修改bug

raojiaolong@163.com 2 years ago
parent
commit
503dae3525

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

@@ -286,7 +286,7 @@ public class adminAction extends ActionSupport implements ServletRequestAware {
         if(adminIPage!=null && !"".equals(adminIPage)){
             resultJson.put("message", "查询分页成功");
             resultJson.put("code", 200);
-            resultJson.put("date", adminIPage);
+            resultJson.put("data", adminIPage);
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         }else{
             resultJson.put("message", "查询分页失败");
@@ -312,7 +312,7 @@ public class adminAction extends ActionSupport implements ServletRequestAware {
         if (admin != null) {
             resultJson.put("message", "查询成功");
             resultJson.put("code", 200);
-            resultJson.put("date", admin);
+            resultJson.put("data", admin);
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
         }else{

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

@@ -554,7 +554,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
         if(adminIPage!=null && !"".equals(adminIPage)){
             resultJson.put("message", "查询分页成功");
             resultJson.put("code", 200);
-            resultJson.put("date", adminIPage);
+            resultJson.put("data", adminIPage);
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         }else{
             resultJson.put("message", "查询分页失败");
@@ -582,7 +582,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
         if (admin != null) {
             resultJson.put("message", "查询成功");
             resultJson.put("code", 200);
-            resultJson.put("date", admin);
+            resultJson.put("data", admin);
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
         }else{

+ 28 - 5
mhotel/src/com/happy/action/bookAction.java

@@ -36,10 +36,13 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
     public Integer id;
     public Integer type;
     public String orderStatus;//订单状态
-    public String manager_id;//商户Id
+    public String managerId;//商户Id
     public String payStartTime;//支付开始时间
     public String payEndTime;//支付结束时间
     public String ledgerParam;//台账列表查询参数
+    public String hotelTownship;//所属乡镇
+    public String minTotalPrice;//最小订单总价
+    public String maxTotalPrice;//最大订单总价
 
     public HttpServletRequest getRequest() {
         return request;
@@ -112,7 +115,7 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
     public String quearyBookPage(){
         JSONObject resultJson = new JSONObject();
         StringBuilder s1 = new StringBuilder("");
-        s1.append(" and hotel_manager_id like '%").append(manager_id).append("'");
+        s1.append(" and hotel_manager_id = '").append(managerId).append("'");
         if (ledgerParam!=null){
             s1.append(" and (order_num like '%").append(ledgerParam).append("'")
                     .append(" or user_name like '%").append(ledgerParam).append("'")
@@ -198,7 +201,7 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
         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("'");
+        s1.append(" and hotel_manager_id like '%").append(managerId).append("'");
         if (ledgerParam!=null){
             s1.append(" and (order_num like '%").append(ledgerParam).append("'")
                 .append(" or user_name like '%").append(ledgerParam).append("'")
@@ -208,6 +211,15 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
             s1.append(" and pay_time >= '").append(payStartTime).append("'")
                     .append(" and pay_time <= '").append(payEndTime).append("'");
         }
+        if(hotelTownship!=null){
+            s1.append(" and hotel_township = '").append(payStartTime).append("'");
+        }
+        if(minTotalPrice!=null){
+            s1.append(" and house_total_price >= '").append(minTotalPrice).append("'");
+        }
+        if(maxTotalPrice!=null){
+            s1.append(" and house_total_price <= '").append(maxTotalPrice).append("'");
+        }
         IPage<Booking> bookIPage = bookService.queryPage(s1.toString(),page,rows);
         //获取订单汇总信息
         BookTypeEto bookTypeEto = bookService.getBookStatusSum(s1.toString());
@@ -259,7 +271,8 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
     public String toLedgerExcel() {
         JSONObject resultJson = new JSONObject();
         StringBuilder s1 = new StringBuilder("");
-        s1.append(" and status = 5");
+        s1.append(" and order_status = 5");
+        s1.append(" and hotel_manager_id like '%").append(managerId).append("'");
         if (ledgerParam!=null){
             s1.append(" and (order_num like '%").append(ledgerParam).append("'")
                     .append(" or user_name like '%").append(ledgerParam).append("'")
@@ -269,7 +282,17 @@ public class bookAction extends ActionSupport implements ServletRequestAware {
             s1.append(" and pay_time >= '").append(payStartTime).append("'")
                     .append(" and pay_time <= '").append(payEndTime).append("'");
         }
-        List<Booking> list = bookService.queryList(s1.toString()); // 查询分页
+        if(hotelTownship!=null){
+            s1.append(" and hotel_township = '").append(payStartTime).append("'");
+        }
+        if(minTotalPrice!=null){
+            s1.append(" and house_total_price >= '").append(minTotalPrice).append("'");
+        }
+        if(maxTotalPrice!=null){
+            s1.append(" and house_total_price <= '").append(maxTotalPrice).append("'");
+        }
+
+        List<Booking> list = bookService.queryList(s1.toString()); // 查询列表
         // 项目路径地址
         String path = request.getSession().getServletContext()
                 .getRealPath("/download/");// File.separator

+ 23 - 18
mhotel/src/com/happy/action/hotelAction.java

@@ -84,13 +84,6 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
             BeanUtils.copyProperties(hotelEto,hotel);
             int hotelId = hotel.getId()!= null ? hotel.getId():Math.toIntExact(UUIDUtil.generateID());
             int m = 0;
-            //保存基本信息
-            if(hotel.getId()!= null){
-                m = hotelService.updateHotel(hotel);
-            }else{
-                hotel.setId(hotelId);
-                m = hotelService.insertHotel(hotel);
-            }
             //保存详细图附件
             if(hotelEto.getFileList()!=null && hotelEto.getFileList().size()>0){
                 if(hotel.getId()!= null){
@@ -105,6 +98,13 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 return null;
             }
+            //保存基本信息
+            if(hotel.getId()!= null){
+                m = hotelService.updateHotel(hotel);
+            }else{
+                hotel.setId(hotelId);
+                m = hotelService.insertHotel(hotel);
+            }
             if (m > 0) {
                 resultJson.put("message", "维护成功");
                 resultJson.put("code", 200);
@@ -144,15 +144,19 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
         //查询民宿信息
         Hotel hotel = hotelService.getOen(s1.toString());
         HotelEto hotelEto = new HotelEto();
-        BeanUtils.copyProperties(adminManager,hotelEto);
-        BeanUtils.copyProperties(hotel,hotelEto);
+        if(adminManager!=null){
+            BeanUtils.copyProperties(adminManager,hotelEto);
+        }
+        if(hotel!=null){
+            BeanUtils.copyProperties(hotel,hotelEto);
+        }
         StringBuilder fileSqlx = new StringBuilder("");
         fileSqlx.append("and link_id = '").append(id).append("'");
         List<File> fileList = fileService.queryList(fileSqlx.toString());
         hotelEto.setFileList(fileList);
         resultJson.put("message", "查询成功");
         resultJson.put("code", 200);
-        resultJson.put("date", hotelEto);
+        resultJson.put("data", hotelEto);
         ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         return null;
     }
@@ -253,7 +257,7 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 return null;
             }
-            if(hotelDict.getName()==null || hotelDict.getCode()==null){
+            if(hotelDict.getName()==null){
                 resultJson.put("message", "各参数不能为空");
                 resultJson.put("code", 500);
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
@@ -276,7 +280,7 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 return null;
             }
-            int m = hotelDictService.insertHotelDict(hotelDict);
+            int m = hotelDictService.updateHotelDict(hotelDict);
             if (m > 0) {
                 resultJson.put("message", "修改成功");
                 resultJson.put("code", 200);
@@ -336,13 +340,13 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
         StringBuilder s3 = new StringBuilder("");
         StringBuilder s4 = new StringBuilder("");
         if(code==null){//查询全部
-            s1.append("and code = '1'");
+            s1.append("and code = 1");
             List<HotelDict> list1 = hotelDictService.queryList(s1.toString());
-            s2.append("and code = '2'");
+            s2.append("and code = 2");
             List<HotelDict> list2 = hotelDictService.queryList(s2.toString());
-            s1.append("and code = '3'");
+            s3.append("and code = 3");
             List<HotelDict> list3 = hotelDictService.queryList(s3.toString());
-            s1.append("and code = '4'");
+            s4.append("and code = 4");
             List<HotelDict> list4 = hotelDictService.queryList(s4.toString());
             resultJson.put("message", "查询成功");
             resultJson.put("code", 200);
@@ -353,11 +357,12 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
         }else{
-            s1.append("and code = '").append(code).append("'");
+            s1.append("and code = ").append(code);
             List<HotelDict> list1 = hotelDictService.queryList(s1.toString());
             resultJson.put("message", "查询成功");
             resultJson.put("code", 200);
-            resultJson.put("date1", list1);
+            resultJson.put("data"+code, list1);
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
         }
     }

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

@@ -223,7 +223,7 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
         if (house != null) {
             resultJson.put("message", "查询成功");
             resultJson.put("code", 200);
-            resultJson.put("date", house);
+            resultJson.put("data", house);
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
         }else{
@@ -248,7 +248,7 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
         if(houseIPage!=null && !"".equals(houseIPage)){
             resultJson.put("message", "查询分页成功");
             resultJson.put("code", 200);
-            resultJson.put("date", houseIPage);
+            resultJson.put("data", houseIPage);
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         }else{
             resultJson.put("message", "查询分页失败");

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

@@ -110,7 +110,7 @@ public class uploadAction extends ActionSupport implements ServletRequestAware {
             /* 保存入库  */
             resultJson.put("code", 500);
             resultJson.put("message", "上传成功");
-            resultJson.put("date", url);
+            resultJson.put("data", url);
             ResponseUtil.writeJson(ServletActionContext.getResponse(),resultJson.toString());
         }catch (Exception e){
             resultJson.put("code", 502);

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

@@ -213,19 +213,21 @@ public class BookImplDao implements BookDao {
         }catch (Exception e){
             e.printStackTrace();
         }
-        return list.get(0).getPayAccount();
+        if(list != null && list.size()>0) return list.get(0).getPayAccount();
+        return null;
     }
 
     @Override
     public BookTypeEto getBookStatusSum(String sqlx){
-        String sql = "select sum(case when  order_status = 2 then 1 else 0 end) pendingOrderSum,count(1) orderSum,sum(case when  order_status = 5 then 1 else 0 end) consumerOrderSum,sum(case when  order_status = 5 then pay_account else 0 end) sumAccount from booking where 1=1"+sqlx;
+        String sql = "select ifnull(sum(case when order_status = 2 then 1 else 0 end),0) pendingOrderSum,count(1) orderSum,ifnull(sum(case when  order_status = 5 then 1 else 0 end),0) consumerOrderSum,ifnull(sum(case when  order_status = 5 then pay_account else 0 end),0) sumAccount from booking where 1=1"+sqlx;
         List<BookTypeEto> list = null;
         try{
             list = namedParameterJdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BookTypeEto.class));
         }catch (Exception e){
             e.printStackTrace();
         }
-        return list.get(0);
+        if(list != null && list.size()>0) return list.get(0);
+        return null;
     }
 
 

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

@@ -55,14 +55,13 @@ public class HotelDictImplDao implements HotelDictDao {
 
     @Override
     public int updateHotelDict(HotelDict hotelDict) {
-        String sql = "UPDATE hotel_dict SET code=:code, name=:name, file_url=:file_url, create_id=:create_id, modify_date=:modify_date, status=:status WHERE id = :id";
+        String sql = "UPDATE hotel_dict SET code=:code, name=:name, file_url=:file_url, create_id=:create_id, modify_date=:modify_date WHERE id = :id";
         MapSqlParameterSource sps = new MapSqlParameterSource();
         sps.addValue("code",hotelDict.getCode());
         sps.addValue("name",hotelDict.getName());
         sps.addValue("file_url",hotelDict.getFileUrl());
         sps.addValue("create_id",hotelDict.getCreateId());
         sps.addValue("modify_date",UUIDUtil.getNewDate());
-        sps.addValue("status",hotelDict.getStatus());
         sps.addValue("id", hotelDict.getId());
         int num = 0;
         try{