Browse Source

优惠卷id批量失效接口修改,新增展示所有民宿信息接口

lijie 2 years ago
parent
commit
c02b6b73f4

+ 20 - 0
mhotel/src/com/happy/action/hotelAction.java

@@ -475,4 +475,24 @@ public class hotelAction extends ActionSupport implements ServletRequestAware {
         }
         }
     }
     }
 
 
+    /**
+     * 描述:查询所有民宿信息列表
+     *
+     */
+    public String queryAllHotel(){
+        JSONObject resultJson = new JSONObject();
+        List<Hotel> list = hotelService.queryList("");
+        if (list != null){
+            resultJson.put("message", "查询成功");
+            resultJson.put("code", 200);
+            resultJson.put("data", list);
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        }else {
+            resultJson.put("message", "数据为空!");
+            resultJson.put("code", 205);
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        }
+        return null;
+    }
+
 }
 }

+ 4 - 5
mhotel/src/com/happy/action/hotelCoupomAction.java

@@ -28,7 +28,7 @@ import java.util.List;
 public class hotelCoupomAction extends BaseController implements ServletRequestAware {
 public class hotelCoupomAction extends BaseController implements ServletRequestAware {
 
 
 
 
-    public List<String> ids; //优惠卷id
+    public String ids; //优惠卷id
     public String name; //优惠卷名称
     public String name; //优惠卷名称
     public String type; //类型
     public String type; //类型
     public String grantStartDate;//发放时间
     public String grantStartDate;//发放时间
@@ -208,16 +208,15 @@ public class hotelCoupomAction extends BaseController implements ServletRequestA
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             return null;
             return null;
         }
         }
-        HotelCoupon hotelCoupon = null;
         try {
         try {
-            hotelCoupon = gson.fromJson(json.toString(), new TypeToken<HotelCoupon>() {}.getType());
             if (ids == null){
             if (ids == null){
                 resultJson.put("message", "请传入优惠卷id");
                 resultJson.put("message", "请传入优惠卷id");
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 return null;
                 return null;
             }
             }
-            int m = hotelCoupomService.updateLapse(ids);
-            int n = hotelCoupomStatusService.updateLapse(ids);
+            List<String> hotelCoupom = Arrays.asList(ids.split(","));
+            int m = hotelCoupomService.updateLapse(hotelCoupom);
+            int n = hotelCoupomStatusService.updateLapse(hotelCoupom);
             resultJson.put("message", "修改成功");
             resultJson.put("message", "修改成功");
             resultJson.put("code", 200);
             resultJson.put("code", 200);
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
             ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());