|
|
@ -3,6 +3,7 @@ package com.app.action; |
|
|
|
import com.app.bean.*; |
|
|
|
import com.app.bean.*; |
|
|
|
import com.app.service.*; |
|
|
|
import com.app.service.*; |
|
|
|
import com.app.utils.Constants; |
|
|
|
import com.app.utils.Constants; |
|
|
|
|
|
|
|
import com.app.utils.StateType; |
|
|
|
import com.opensymphony.xwork2.ActionContext; |
|
|
|
import com.opensymphony.xwork2.ActionContext; |
|
|
|
import org.apache.struts2.ServletActionContext; |
|
|
|
import org.apache.struts2.ServletActionContext; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -25,15 +26,48 @@ public class ApplyAction { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private MaterialService materialService; |
|
|
|
private MaterialService materialService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String action; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private RefuseApplyService refuseApplyService; |
|
|
|
private RefuseApplyService refuseApplyService; |
|
|
|
|
|
|
|
|
|
|
|
public int id; |
|
|
|
public int id; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public StateType state; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String message; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String content; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getAction() { |
|
|
|
|
|
|
|
return action; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setAction(String action) { |
|
|
|
|
|
|
|
this.action = action; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public StateType getState() { |
|
|
|
|
|
|
|
return state; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setState(StateType state) { |
|
|
|
|
|
|
|
this.state = state; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setId(int id) { |
|
|
|
public void setId(int id) { |
|
|
|
this.id = id; |
|
|
|
this.id = id; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getContent() { |
|
|
|
|
|
|
|
return content; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setContent(String content) { |
|
|
|
|
|
|
|
this.content = content; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getId() { |
|
|
|
public int getId() { |
|
|
|
|
|
|
|
|
|
|
|
return id; |
|
|
|
return id; |
|
|
@ -148,25 +182,15 @@ public class ApplyAction { |
|
|
|
|
|
|
|
|
|
|
|
public String updateApply() { |
|
|
|
public String updateApply() { |
|
|
|
ActionContext act = ActionContext.getContext(); |
|
|
|
ActionContext act = ActionContext.getContext(); |
|
|
|
|
|
|
|
HttpServletRequest request=ServletActionContext.getRequest(); |
|
|
|
Apply model = applyService.findById(id); |
|
|
|
Apply model = applyService.findById(id); |
|
|
|
|
|
|
|
model.setMessage(content); |
|
|
|
model.setPid(pid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.setUserid(userid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.setState(statex); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.setType(type); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.setCreated(created); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.setAttachfile(attachfile); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.setStateid(stateid); |
|
|
|
model.setStateid(stateid); |
|
|
|
applyService.update(model); |
|
|
|
applyService.update(model); |
|
|
|
act.put("message", "Update Data Success!"); |
|
|
|
|
|
|
|
act.put("url", "admin/apply/edit?id=" + id); |
|
|
|
this.setMessage("更新成功"); |
|
|
|
act.put("state", "success"); |
|
|
|
this.setState(StateType.success); |
|
|
|
|
|
|
|
|
|
|
|
return "success"; |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -235,17 +259,21 @@ public class ApplyAction { |
|
|
|
|
|
|
|
|
|
|
|
public String applyList() { |
|
|
|
public String applyList() { |
|
|
|
ActionContext act = ActionContext.getContext(); |
|
|
|
ActionContext act = ActionContext.getContext(); |
|
|
|
|
|
|
|
HttpServletRequest request=ServletActionContext.getRequest(); |
|
|
|
Users u = (Users) act.getSession().get("users"); |
|
|
|
Users u = (Users) act.getSession().get("users"); |
|
|
|
List<Apply> list = applyService.transformList("select a.id as id,a.userid as userid,h.cate " + |
|
|
|
List<Apply> list = applyService.transformList("select a.id as id,a.userid as userid,h.cate " + |
|
|
|
"as cate,c.name as name,a.state as state,a.message as message " + |
|
|
|
"as cate,c.name as name,a.state as state,a.message as message " + |
|
|
|
"FROM Apply a,House h,Community c,Users u where a.userid="+ u.getId()+"and a.hid=h.id and h.communityId=c.id and a.userid=u.id "); |
|
|
|
"FROM Apply a,House h,Community c,Users u where a.userid="+ u.getId()+"and a.hid=h.id and h.communityId=c.id and a.userid=u.id "); |
|
|
|
act.put("list", list); |
|
|
|
act.put("list", list); |
|
|
|
act.put(Constants.USERS_MAP,ConstantsService.usersMap); |
|
|
|
act.put(Constants.USERS_MAP,ConstantsService.usersMap); |
|
|
|
|
|
|
|
this.setState(request.getParameter(Constants.STATE) == null ? null : StateType.valueOf(request.getParameter(Constants.STATE))); |
|
|
|
|
|
|
|
this.setMessage(request.getParameter(Constants.MESSAGE)); |
|
|
|
return "success"; |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String applyList1() { |
|
|
|
public String applyList1() { |
|
|
|
ActionContext act = ActionContext.getContext(); |
|
|
|
ActionContext act = ActionContext.getContext(); |
|
|
|
|
|
|
|
HttpServletRequest request=ServletActionContext.getRequest(); |
|
|
|
Users u = (Users) act.getSession().get("users"); |
|
|
|
Users u = (Users) act.getSession().get("users"); |
|
|
|
String wh = " a.pid=" + u.getPid() + " AND a.cid=" + u.getCid() |
|
|
|
String wh = " a.pid=" + u.getPid() + " AND a.cid=" + u.getCid() |
|
|
|
+ " AND a.aid=" + u.getAid(); |
|
|
|
+ " AND a.aid=" + u.getAid(); |
|
|
@ -254,6 +282,8 @@ public class ApplyAction { |
|
|
|
|
|
|
|
|
|
|
|
act.put("list", list); |
|
|
|
act.put("list", list); |
|
|
|
act.put(Constants.USERS_MAP,ConstantsService.usersMap); |
|
|
|
act.put(Constants.USERS_MAP,ConstantsService.usersMap); |
|
|
|
|
|
|
|
this.setState(request.getParameter(Constants.STATE) == null ? null : StateType.valueOf(request.getParameter(Constants.STATE))); |
|
|
|
|
|
|
|
this.setMessage(request.getParameter(Constants.MESSAGE)); |
|
|
|
return "success"; |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -273,17 +303,36 @@ public class ApplyAction { |
|
|
|
"a.state as state FROM Apply a,House h,Community c,Users u where a.hid=h.id and h.communityId=c.id and a.userid=u.id "+whereSql); |
|
|
|
"a.state as state FROM Apply a,House h,Community c,Users u where a.hid=h.id and h.communityId=c.id and a.userid=u.id "+whereSql); |
|
|
|
act.put("list", list); |
|
|
|
act.put("list", list); |
|
|
|
act.put(Constants.USERS_MAP,ConstantsService.usersMap); |
|
|
|
act.put(Constants.USERS_MAP,ConstantsService.usersMap); |
|
|
|
|
|
|
|
this.setState(request.getParameter(Constants.STATE) == null ? null : StateType.valueOf(request.getParameter(Constants.STATE))); |
|
|
|
|
|
|
|
this.setMessage(request.getParameter(Constants.MESSAGE)); |
|
|
|
return "success"; |
|
|
|
return "success"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String delete() { |
|
|
|
public String delete() { |
|
|
|
ActionContext act = ActionContext.getContext(); |
|
|
|
ActionContext act = ActionContext.getContext(); |
|
|
|
Users u = (Users) act.getSession().get("users"); |
|
|
|
Users u = (Users) act.getSession().get("users"); |
|
|
|
applyService.delete(this.id); |
|
|
|
Apply apply=applyService.findById(this.id); |
|
|
|
materialService.deleteUserMaterial(u.getId()); |
|
|
|
if(apply!=null) { |
|
|
|
act.put("message", "ɾ³ý³É¹¦!"); |
|
|
|
applyService.delete(this.id); |
|
|
|
act.put("state", "success"); |
|
|
|
materialService.deleteUserMaterial(u.getId()); |
|
|
|
act.put("url", "admin/apply/"+ret+".do"); |
|
|
|
House house=houseService.findById(apply.getHid()); |
|
|
|
return "success"; |
|
|
|
house.setState(1); |
|
|
|
|
|
|
|
houseService.update(house); |
|
|
|
|
|
|
|
this.setMessage("删除成功!"); |
|
|
|
|
|
|
|
this.setState(StateType.success); |
|
|
|
|
|
|
|
return Constants.SUCCESS; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.setMessage("删除失败!"); |
|
|
|
|
|
|
|
this.setState(StateType.error); |
|
|
|
|
|
|
|
return Constants.ERROR; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getMessage() { |
|
|
|
|
|
|
|
return message; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setMessage(String message) { |
|
|
|
|
|
|
|
this.message = message; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |