|
@@ -1,17 +1,13 @@
|
|
|
package com.happy.action;
|
|
package com.happy.action;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
-import com.happy.Model.Admin;
|
|
|
|
|
-import com.happy.Model.AdminManager;
|
|
|
|
|
-import com.happy.Model.Booking;
|
|
|
|
|
-import com.happy.Model.House;
|
|
|
|
|
-import com.happy.Until.GetHttpParam;
|
|
|
|
|
-import com.happy.Until.PwdDefind;
|
|
|
|
|
-import com.happy.Until.ResUtil;
|
|
|
|
|
-import com.happy.Until.ResponseUtil;
|
|
|
|
|
|
|
+import com.happy.Model.*;
|
|
|
|
|
+import com.happy.Until.*;
|
|
|
import com.happy.dto.IPage;
|
|
import com.happy.dto.IPage;
|
|
|
import com.happy.service.BookService;
|
|
import com.happy.service.BookService;
|
|
|
|
|
+import com.happy.service.FileService;
|
|
|
import com.happy.service.HouseService;
|
|
import com.happy.service.HouseService;
|
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
@@ -33,12 +29,16 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
|
|
|
public HouseService houseService;
|
|
public HouseService houseService;
|
|
|
@Resource
|
|
@Resource
|
|
|
public BookService bookService;
|
|
public BookService bookService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ public FileService fileService;
|
|
|
|
|
|
|
|
public Integer id;
|
|
public Integer id;
|
|
|
public String hName;//房型名称
|
|
public String hName;//房型名称
|
|
|
public int page; // 当前页
|
|
public int page; // 当前页
|
|
|
public int rows;// 每页显示的行数rows
|
|
public int rows;// 每页显示的行数rows
|
|
|
|
|
|
|
|
|
|
+ public String fileListJson;
|
|
|
|
|
+
|
|
|
public HttpServletRequest getRequest() {
|
|
public HttpServletRequest getRequest() {
|
|
|
return request;
|
|
return request;
|
|
|
}
|
|
}
|
|
@@ -87,6 +87,13 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
+ //详细图附件
|
|
|
|
|
+ List<File> fileList = JSONArray.parseArray(fileListJson, File.class);
|
|
|
|
|
+ if(fileList==null){
|
|
|
|
|
+ resultJson.put("message", "请上传详细图");
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
StringBuilder getOneSqlx = new StringBuilder("");
|
|
StringBuilder getOneSqlx = new StringBuilder("");
|
|
|
getOneSqlx.append(" and h_name = '").append(house.gethName()).append("'");
|
|
getOneSqlx.append(" and h_name = '").append(house.gethName()).append("'");
|
|
|
House listc = houseService.getOen(getOneSqlx.toString());
|
|
House listc = houseService.getOen(getOneSqlx.toString());
|
|
@@ -96,8 +103,13 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
+ house.setId(Math.toIntExact(UUIDUtil.generateID()));
|
|
|
int m = houseService.insertHouse(house);
|
|
int m = houseService.insertHouse(house);
|
|
|
if (m > 0) {
|
|
if (m > 0) {
|
|
|
|
|
+ for(File file : fileList){
|
|
|
|
|
+ file.setLinkId(house.getId());
|
|
|
|
|
+ fileService.insertFile(file);
|
|
|
|
|
+ }
|
|
|
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());
|
|
@@ -151,6 +163,13 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
+ //详细图附件
|
|
|
|
|
+ List<File> fileList = JSONArray.parseArray(fileListJson, File.class);
|
|
|
|
|
+ if(fileList==null){
|
|
|
|
|
+ resultJson.put("message", "请上传详细图");
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
StringBuilder getOneSqlx = new StringBuilder("");
|
|
StringBuilder getOneSqlx = new StringBuilder("");
|
|
|
getOneSqlx.append(" and h_name = '").append(house.gethName()).append("'");
|
|
getOneSqlx.append(" and h_name = '").append(house.gethName()).append("'");
|
|
|
getOneSqlx.append(" and id != '").append(house.getId()).append("'");
|
|
getOneSqlx.append(" and id != '").append(house.getId()).append("'");
|
|
@@ -163,6 +182,13 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
|
|
|
}
|
|
}
|
|
|
int m = houseService.updateHouse(house);
|
|
int m = houseService.updateHouse(house);
|
|
|
if (m > 0) {
|
|
if (m > 0) {
|
|
|
|
|
+ if(house.getId()!= null){
|
|
|
|
|
+ fileService.delLinkFile(house.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ for(File file : fileList){
|
|
|
|
|
+ file.setLinkId(house.getId());
|
|
|
|
|
+ fileService.insertFile(file);
|
|
|
|
|
+ }
|
|
|
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());
|
|
@@ -220,6 +246,10 @@ public class houseAction extends ActionSupport implements ServletRequestAware {
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
House house = houseService.getById(id);
|
|
House house = houseService.getById(id);
|
|
|
|
|
+ StringBuilder fileSqlx = new StringBuilder("");
|
|
|
|
|
+ fileSqlx.append("and link_id = '").append(id).append("'");
|
|
|
|
|
+ List<File> fileList = fileService.queryList(fileSqlx.toString());
|
|
|
|
|
+ house.setFileList(fileList);
|
|
|
if (house != null) {
|
|
if (house != null) {
|
|
|
resultJson.put("message", "查询成功");
|
|
resultJson.put("message", "查询成功");
|
|
|
resultJson.put("code", 200);
|
|
resultJson.put("code", 200);
|