package action;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import bean.TransferOnlineUserBasicInfo;
import bean.TransferProblemInfo;
import bean.TransferQualificationtypeInfo;
import bean.TransferResultInfo;
import bean.TransferSolveInfo;
import bean.TransferUserInfo;
import cache.Configurations;
import cache.PlatformStatistics;
import cache.ResultCodeStorage;
import com.google.gson.Gson;
import exception.IllegalOperationException;
import exception.IllegalParameterException;
import exception.NoLoginException;
import exception.NoQualificationException;
import exception.PermissionDeniedException;
import service.CreditvaluelogService;
import service.ProblemService;
import service.QualificationtypeService;
import service.SolveService;
import service.UserService;
import util.DbUidGeneratorUtil;
import util.RecommandValueUtil;
import util.StringUtil;
import util.TimeUtil;
public class ProblemAction extends BaseAction implements ServletRequestAware, ServletResponseAware {
/**
*
*/
private static final long serialVersionUID = -5109006175908608284L;
private static final int save = 0;
private static final int accept = 1;
private static final int reject = 2;
private static final int cancel = 3;
private static final int finish = 4;
private static final int delete = 5;
private static final int get = 6;
private HttpServletRequest request;
private HttpServletResponse response;
private String uid;
private String createuseruid;
private String locationuid;
private String problemtypeuid;
private String title;
private List<String> preferday;
private String preferstart;
private String preferend;
private String description;
private String createip;
private String createtime;
private String status;
private String solveduid;
private String solvecreateuseruid;
private List<String> solveassistantuid;
private String solvedescription;
private String solvecreatetime;
private String solvecreateip;
private String type;
private String ui;
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getCreateuseruid() {
return createuseruid;
}
public void setCreateuseruid(String createuseruid) {
this.createuseruid = createuseruid;
}
public String getLocationuid() {
return locationuid;
}
public void setLocationuid(String locationuid) {
this.locationuid = locationuid;
}
public String getProblemtypeuid() {
return problemtypeuid;
}
public void setProblemtypeuid(String problemtypeuid) {
this.problemtypeuid = problemtypeuid;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<String> getPreferday() {
return preferday;
}
public void setPreferday(List<String> preferday) {
this.preferday = preferday;
}
public String getPreferstart() {
return preferstart;
}
public void setPreferstart(String preferstart) {
this.preferstart = preferstart;
}
public String getPreferend() {
return preferend;
}
public void setPreferend(String preferend) {
this.preferend = preferend;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCreateip() {
return createip;
}
public void setCreateip(String createip) {
this.createip = createip;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getSolveduid() {
return solveduid;
}
public void setSolveduid(String solveduid) {
this.solveduid = solveduid;
}
public String getSolvecreateuseruid() {
return solvecreateuseruid;
}
public void setSolvecreateuseruid(String solvecreateuseruid) {
this.solvecreateuseruid = solvecreateuseruid;
}
public List<String> getSolveassistantuid() {
return solveassistantuid;
}
public void setSolveassistantuid(List<String> solveassistantuid) {
this.solveassistantuid = solveassistantuid;
}
public String getSolvedescription() {
return solvedescription;
}
public void setSolvedescription(String solvedescription) {
this.solvedescription = solvedescription;
}
public String getSolvecreatetime() {
return solvecreatetime;
}
public void setSolvecreatetime(String solvecreatetime) {
this.solvecreatetime = solvecreatetime;
}
public String getSolvecreateip() {
return solvecreateip;
}
public void setSolvecreateip(String solvecreateip) {
this.solvecreateip = solvecreateip;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUi() {
return ui;
}
public void setUi(String ui) {
this.ui = ui;
}
public HttpServletRequest getRequest() {
return request;
}
public void setRequest(HttpServletRequest request) {
this.request = request;
}
public HttpServletResponse getResponse() {
return response;
}
public void setResponse(HttpServletResponse response) {
this.response = response;
}
@Override
public void setServletResponse(HttpServletResponse response) {
// TODO Auto-generated method stub
this.response = response;
}
@Override
public void setServletRequest(HttpServletRequest request) {
// TODO Auto-generated method stub
this.request = request;
}
public void save() {
operations(save);
}
public void accept() {
operations(accept);
}
public void reject() {
operations(reject);
}
public void cancel() {
operations(cancel);
}
public void finish() {
operations(finish);
}
public void delete() {
operations(delete);
}
public void get() {
operations(get);
}
private void operations(int op) {
try {
problemService.initParameters();
solveService.initParameters();
if (uid != null && !"".equals(uid)) {
problemService.setParameters(ProblemService.set_uid, uid);
solveService.setParameters(SolveService.set_problemUid, uid);
}
if (createuseruid != null && !"".equals(createuseruid))
problemService.setParameters(ProblemService.set_createUserUid, createuseruid);
if (locationuid != null && !"".equals(locationuid))
problemService.setParameters(ProblemService.set_locationUid, locationuid);
if (problemtypeuid != null && !"".equals(problemtypeuid))
problemService.setParameters(ProblemService.set_problemTypeUid, problemtypeuid);
if (title != null && !"".equals(title))
problemService.setParameters(ProblemService.set_title, title);
if (preferday != null && preferday.size() > 0)
problemService.setParameters(ProblemService.set_preferDay, StringUtil.stringsCombine(preferday));
if (preferstart != null && !"".equals(preferstart))
problemService.setParameters(ProblemService.set_preferStart, preferstart);
if (preferend != null && !"".equals(preferend))
problemService.setParameters(ProblemService.set_preferEnd, preferend);
if (description != null && !"".equals(description))
problemService.setParameters(ProblemService.set_description, description);
if (createip != null && !"".equals(createip))
problemService.setParameters(ProblemService.set_createIp, createip);
if (createtime != null && !"".equals(createtime))
problemService.setParameters(ProblemService.set_createTime, createtime);
if (status != null && !"".equals(status))
problemService.setParameters(ProblemService.set_status, status);
if (solveduid != null && !"".equals(solveduid)) {
problemService.setParameters(ProblemService.se