Browse Source

提交房间数比较

夏文涛 2 years ago
parent
commit
ab8e242e8b

+ 1 - 0
mhotel/src/com/happy/Until/HttpUtils.java

@@ -213,6 +213,7 @@ public class HttpUtils {
 		} catch (ClientProtocolException e) {
 			e.printStackTrace();
 		} catch (IOException e) {
+			System.out.println("退款异常;"+e.getMessage());
 			e.printStackTrace();
 		} finally {
 			try {

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

@@ -307,7 +307,7 @@ public class AppHotelCouponAction extends ActionSupport implements ServletReques
     public JSONObject usefulCoupon() {
         JSONObject jsonObject = new JSONObject();
 
-        if (Func.checkNull(hotelId) && Func.checkNull(userId)&&totalPrice==null) {
+        if (Func.checkNull(hotelId) && Func.checkNull(userId) && totalPrice==null) {
             jsonObject.put("code", 400);
             jsonObject.put("success", false);
             jsonObject.put("message", "缺少数据hotelId,userId,totalPrice---usefulCoupon");

+ 10 - 1
mhotel/src/com/happy/action/houseAction.java

@@ -187,6 +187,16 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 return null;
             }
+
+            //2023-09-19 A-jax 房型数量必须和房间数量一致
+            List<String> houseNumberList = Arrays.asList(houseNumber.split(","));
+            if(house.getNumber().intValue() != houseNumberList.size()){
+                resultJson.put("message", "房型数量与房间数量不一致");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+
             if (house.getId() == null) {
                 resultJson.put("message", "房型Id为空");
                 resultJson.put("code", 500);
@@ -220,7 +230,6 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
                 return null;
             }
             //验证成功修改房号表
-            List<String> houseNumberList = Arrays.asList(houseNumber.split(","));
             List<HouseNumber> houseNumbers = new ArrayList<HouseNumber>();
             for (String s : houseNumberList){
                 HouseNumber h1 = new HouseNumber();