public String getProblemreasonNotByGroup(Long userId,
ArrayList problemreasons) throws EasyJException {
StringBuffer buffer = new StringBuffer();
ProblemreasonEvaluation pre = new ProblemreasonEvaluation();
Problemreason pr = new Problemreason();
SingleDataProxy sdp = SingleDataProxy.getInstance();
ProblemreasonSolution prs = new ProblemreasonSolution();
ProblemreasonSolution prs2 = new ProblemreasonSolution();
buffer.append("<div class=\"bc0\" style=\"padding:0px 0pt;\">");
String solution = "";
if (problemreasons.size() > 0) {
for (int i = 0; i < problemreasons.size(); i++) {
pr = (Problemreason) problemreasons.get(i);
prs.setProblemreasonId(pr.getProblemreasonId());
ArrayList prss = sdp.query(prs);
if (prss.size() > 0) {
for (int j = 0; j < prss.size(); j++) {
prs2 = (ProblemreasonSolution) prss.get(j);
solution = solution + ","
+ prs2.getProblemreasonSolutionId();
}
buffer
.append("<div class=\"f14 p90 pl10\" class=\"answer_content\">"
+ pr.getProblemreasonContent() + "</div>");
buffer.append("<p></p>共有" + sdp.getCount(prs)
+ "个解决方案,对应的解决方案为" + solution + "<p></p>");
solution = "";
} else {
buffer
.append("<div id=\"Lg\" ></div><div class=\"f14 p90 pl10\" class=\"answer_content\">"
+ pr.getProblemreasonContent()
+ "</div><p></p>目前无该原因的解决方案,<A class=brown12 href=\"javascript:Problemsolution.loadNewSolution("
+ pr.getProblemId()
+ ")\">添加一个?</A><p></p>");
}
boolean flag = true;
int j = 0;
ArrayList pres = pr.getProblemreasonEvaluations();
while (flag == true && j < pres.size()) {
pre = (ProblemreasonEvaluation) pres.get(j);
if (pre.getCreatorId().intValue() == userId.intValue()) {
flag = false;
}
j++;
}
if (userId.intValue() != pr.getCreatorId().intValue()
&& pr.getIsoverdue().equals("N") && flag) {
// 登陆者不是这个problemreason的作者,且没有评价过,且这个problemreason还没有过期
buffer
.append("<IMG src=\"/image/flower.gif\"> <A class=brown12 id=\"problemreason_flower"
+ pr.getProblemreasonId()
+ "\" href=\"javascript:Problem.problemreasonFlower("
+ pr.getProblemId()
+ ","
+ pr.getProblemreasonId()
+ ","
+ userId
+ ")\">送鲜花</A>(得<SPAN id=\"problemreason_flowernum"
+ pr.getProblemreasonId()
+ "\">"
+ pr.getGoodNum() + "</SPAN>支)");
buffer
.append("<IMG height=15 src=\"/image/badegg.gif\" width=16><A id=\"problemreason_badegg"
+ pr.getProblemreasonId()
+ "\"class=brown12 href=\"javascript:Problem.problemreasonBadegg("
+ pr.getProblemId()
+ ","
+ pr.getProblemreasonId()
+ ","
+ userId
+ ")\">扔鸡蛋</A>(得<SPAN class=orange12 id=\"problemreason_badeggnum"
+ pr.getProblemreasonId()
+ "\">"
+ pr.getBadNum() + "</SPAN>个)");
} else {
buffer.append("<IMG src=\"/image/flower.gif\"> (得<SPAN>"
+ pr.getGoodNum() + "</SPAN>支)");
buffer
.append("<IMG height=15 src=\"/image/badegg.gif\" width=16>(得<SPAN class=orange12>"
+ pr.getBadNum() + "</SPAN>个)");
}
if (pr.getIsoverdue().equals("N")
&& userId.intValue() == pr.getCreatorId().intValue()) {
// 只有是作者且还没有失效的时候才会出现实效按钮
buffer
.append("<br><IMG height=15 src=\"/image/assoc_delete.gif\" width=16><A id=\"problemreason_overdue"
+ pr.getProblemreasonId()
+ "\" class=brown12 href=\"javascript:Problem.problemreasonOverdue("
+ pr.getProblemId()
+ ","
+ pr.getProblemreasonId()
+ ","
+ userId
+ ")\">失效</A><div id=\"problemreason_overdue2"
+ pr.getProblemreasonId()
+ "\" style=\"display:none\">您已设置该回复失效</div>");
} else if (pr.getIsoverdue().equals("Y")
&& userId.intValue() == pr.getCreatorId().intValue()) {
buffer
.append("<br><IMG height=15 src=\"/image/assoc_delete.gif\" width=16>您已设置该回复失效");
} else if (pr.getIsoverdue().equals("Y")
&& userId.intValue() != pr.getCreatorId().intValue()) {
buffer
.append("<br><IMG height=15 src=\"/image/assoc_delete.gif\" width=16>该作者已设置该回复失效");
}
if (userId.intValue() == pr.getCreatorId().intValue()
&& pr.getProblemChange().equals("Y")) {
buffer
.append("<br><IMG height=15 src=\"/image/agree.gif\" width=16><A id=\"problemreason_confirm1"
+ pr.getProblemreasonId()
+ "\" class=brown12 href=\"javascript:Problem.problemreasonConfirm("
+ pr.getProblemId()
+ ","
+ pr.getProblemreasonId()
+ ","
+ userId
+ ")\">确认</A> <A id=\"problemreason_reject1"
+ pr.getProblemreasonId()
+ "\" class=brown12 href=\"javascript:Problem.problemreasonReject("
+ pr.getProblemId()
+ ","
+ pr.getProblemreasonId()
+ ","
+ userId
+ ")\">拒绝</A><div id=\"problemreason_confirm2"
+ pr.getProblemreasonId()
+ "\" style=\"display:none\">您已确认</div><div id=\"problemreason_reject2"
+ pr.getProblemreasonId()
+ "\" style=\"display:none\">您已拒绝</div>");
// 只有是作者
} else if (pr.getProblemChange().equals("C")
&& userId.intValue() == pr.getCreatorId().intValue()) {
buffer
.append("<br><IMG height=15 src=\"/image/agree.gif\" width=16>您已确认");
} else if (pr.getProblemChange().equals("C")
&& userId.intValue() != pr.getCreatorId().intValue()) {
buffer
.append("<br><IMG height=15 src=\"/image/agree.gif\" width=16>该文章作者已确认");
} else if (pr.getProblemChange().equals("D")
&& userId.intValue() == pr.getCreatorId().intValue()) {
buffer
.append("<br><IMG height=15 src=\"/image/agree.gif\" width=16>您已拒绝");
} else if (pr.getProblemChange().equals("D")
&& userId.intValue() != pr.getCreatorId().intValue()) {
buffer
.append("<br><IMG height=15 src=\"/image/agree.gif\" width=16>该文章作者已拒绝");
}
buffer
.append("<div align=\"right\" style=\"margin: 5px 5px 8px;\" id=\"comment_info\"><span class=\"gray\">评论者:"
+ pr.getUserName()
+ " 时间"
+ pr.getBuildTime()
+ "</span></div>");
/*
* if(i<problemreasons.size()-1){ buffer.append("<div
* id=\"Lg\" ></div>"); }
*/