Browse Source

房态管理-房价管理

liujunqiang 2 years ago
parent
commit
e3b0baf69d

+ 14 - 97
mhotel/src/com/happy/Model/HouseNumberStatus.java

@@ -1,103 +1,20 @@
 package com.happy.Model;
 package com.happy.Model;
 
 
-import java.util.Date;
+import com.happy.common.model.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
 /**
 /**
- * @Description  
- * @Author  raojiaolong
- * @Date 2023-08-23 
+ * 民宿房态表Model
  */
  */
-
-public class HouseNumberStatus {
-
-	private Integer id; // 主键
-	private Integer numberId; // 房间号id
-	private Integer closeType; // 关房类型(1.停用房 2.维修房 3.保留房)
-	private String remark; // 备注
-	private String setDate; // 设置日期
-	private Integer createId; // 创建人
-	private Date createDate; // 创建时间
-	private Date modifyDate; // 修改时间
-	private Integer status; // 状态(0删除 1.正常 2.关房 3.脏房 4.净房)
-
-
-	public Integer getId() {
-		return id;
-	}
-
-	public void setId(Integer id) {
-		this.id = id;
-	}
-
-
-	public Integer getNumberId() {
-		return numberId;
-	}
-
-	public void setNumberId(Integer numberId) {
-		this.numberId = numberId;
-	}
-
-
-	public Integer getCloseType() {
-		return closeType;
-	}
-
-	public void setCloseType(Integer closeType) {
-		this.closeType = closeType;
-	}
-
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-
-	public String getSetDate() {
-		return setDate;
-	}
-
-	public void setSetDate(String setDate) {
-		this.setDate = setDate;
-	}
-
-
-	public Integer getCreateId() {
-		return createId;
-	}
-
-	public void setCreateId(Integer createId) {
-		this.createId = createId;
-	}
-
-
-	public Date getCreateDate() {
-		return createDate;
-	}
-
-	public void setCreateDate(Date createDate) {
-		this.createDate = createDate;
-	}
-
-
-	public Date getModifyDate() {
-		return modifyDate;
-	}
-
-	public void setModifyDate(Date modifyDate) {
-		this.modifyDate = modifyDate;
-	}
-
-
-	public Integer getStatus() {
-		return status;
-	}
-
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class HouseNumberStatus extends BaseModel {
+
+    private Integer numberId; // 房间号id
+    private Integer closeType; // 关房类型(1.停用房 2.维修房 3.保留房)
+    private String remark; // 备注
+    private String setDate; // 设置日期
+    private Integer status; // 状态(0删除 1.正常 2.关房 3.脏房 4.净房)
 
 
 }
 }

+ 66 - 0
mhotel/src/com/happy/action/HouseNumberStatusAction.java

@@ -0,0 +1,66 @@
+package com.happy.action;
+
+import com.alibaba.fastjson.JSONObject;
+import com.happy.Model.HousePrice;
+import com.happy.Until.GetHttpParam;
+import com.happy.Until.ResUtil;
+import com.happy.common.controller.BaseController;
+import com.happy.dto.HousePriceDto;
+import com.happy.service.HousePriceService;
+import com.opensymphony.xwork2.ModelDriven;
+import lombok.SneakyThrows;
+import org.apache.struts2.ServletActionContext;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+public class HouseNumberStatusAction extends BaseController implements ModelDriven<HousePriceDto> {
+    private final HousePriceDto housePriceDto = new HousePriceDto();
+
+    @Override
+    public HousePriceDto getModel() {
+        return housePriceDto;
+    }
+
+    @Resource(name = "housePriceService")
+    private HousePriceService housePriceService;
+
+    /**
+     * 批量改价
+     * 约定body数据格式:{"dateList":["2023-08-11,2023-08-20"],"priceList":[{"managerId":"1586005529","houseId":"1379573861","price":"180"}]}
+     */
+    @SneakyThrows
+    public void modifyPriceBatch() {
+        String PostDataStr = GetHttpParam.getRequestPostData(request);
+        JSONObject PostDataJSONObject = JSONObject.parseObject(PostDataStr);
+        List<String> dateList = PostDataJSONObject.getJSONArray("dateList").toJavaList(String.class);
+        List<HousePrice> priceList = PostDataJSONObject.getJSONArray("priceList").toJavaList(HousePrice.class);
+        housePriceService.modifyPriceBatch(dateList, priceList);
+    }
+
+    public void modifyPrice() {
+        housePriceService.modifyPrice(housePriceDto);
+    }
+
+    /**
+     * 表格数据 房态管理-房价管理
+     */
+    public void queryPage() {
+        ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+            put("message", "查询成功");
+            put("code", 200);
+            put("data", housePriceService.queryPage(housePriceDto, page, rows));
+        }}.toString());
+    }
+
+    /**
+     * 表格数据 房态管理-房价管理-改价记录
+     */
+    public void queryPageHistory() {
+        ResUtil.writeJson(ServletActionContext.getResponse(), new JSONObject() {{
+            put("message", "查询成功");
+            put("code", 200);
+            put("data", housePriceService.queryPageHistory(housePriceDto, page, rows));
+        }}.toString());
+    }
+}

+ 29 - 0
mhotel/src/com/happy/dto/HouseNumberStatusDto.java

@@ -0,0 +1,29 @@
+package com.happy.dto;
+
+import com.happy.Model.HouseNumberStatus;
+import com.happy.Model.HousePrice;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class HouseNumberStatusDto extends HouseNumberStatus {
+    /**
+     * 房型名称
+     */
+    public String houseName;
+    /**
+     * 房型ID集合
+     */
+    public List<String> houseIdList;
+    /**
+     * 原价
+     */
+    private Double originalPrice;
+    /**
+     * 查询条件 房态管理-房价管理-改价记录-操作时间
+     */
+    public String operationTime;
+}