public String getContent(Long userId, Problemsolution problemsolution,
ProblemsolutionReply psr, String useState) throws EasyJException {
StringBuffer buffer = new StringBuffer();
SingleDataProxy sdp = SingleDataProxy.getInstance();
ProblemsolutionEvaluation pse = new ProblemsolutionEvaluation();
ProblemsolutionReplyEvaluation psre = new ProblemsolutionReplyEvaluation();
if (problemsolution != null) {
boolean flag = true;
boolean stageflag1 = true;
boolean stageflag2 = true;
boolean stageflag3 = true;
int j = 0;
ArrayList pses = problemsolution.getProblemsolutionEvaluations();
while (flag == true && j < pses.size()) {
pse = (ProblemsolutionEvaluation) pses.get(j);
if (pse.getCreatorId().intValue() == userId.intValue()) {
flag = false;
}
j++;
}
ProblemsolutionEvaluation pse_stage = new ProblemsolutionEvaluation();
pse_stage.setProblemsolutionId(problemsolution
.getProblemsolutionId());
pse_stage.setStage(1);
ArrayList pses_stage1 = sdp.query(pse_stage);
pse_stage.setStage(2);
ArrayList pses_stage2 = sdp.query(pse_stage);
FinalsolutionEvaluation fse = new FinalsolutionEvaluation();
Finalsolution fs = new Finalsolution();
fs.setProblemsolutionId(problemsolution.getProblemsolutionId());
try {
fs = (Finalsolution) sdp.get(fs);
if (fs != null) {
fs = (Finalsolution) sdp.get(fs);
fse.setFinalsolutionId(fs.getFinalsolutionId());
ArrayList fses = sdp.query(fse);
while (stageflag3 == true && j < fses.size()) {
fs = (Finalsolution) fses.get(j);
if (pse.getCreatorId().intValue() == userId.intValue()) {
stageflag3 = false;
}
j++;
}
}
} catch (EasyJException e) {
}
while (stageflag1 == true && j < pses_stage1.size()) {
pse = (ProblemsolutionEvaluation) pses_stage1.get(j);
if (pse.getCreatorId().intValue() == userId.intValue()) {
stageflag1 = false;
}
j++;
}
while (stageflag2 == true && j < pses_stage2.size()) {
pse = (ProblemsolutionEvaluation) pses_stage2.get(j);
if (pse.getCreatorId().intValue() == userId.intValue()) {
stageflag2 = false;
}
j++;
}
if (useState.equals("C")) {
Finalsolution finalsolution = new Finalsolution();
finalsolution.setProblemsolutionId(problemsolution
.getProblemsolutionId());
finalsolution = (Finalsolution) sdp.get(finalsolution);
buffer.append("把该解决方案作为最佳解决方案您是否满意?:<br>");
if (userId.intValue() != problemsolution.getCreatorId()
.intValue()
&& problemsolution.getIsoverdue().equals("N")
&& stageflag3) {
// 登陆者不是这个problemsolution的作者,且没有评价过,且这个problemsolution还没有过期
buffer
.append("<IMG src=\"/image/flower.gif\"> <A class=brown12 id=\"problemsolution_flower"
+ problemsolution.getProblemsolutionId()
+ "\" href=\"javascript:Problemsolution.problemsolutionFlower("
+ problemsolution.getProblemId()
+ ","
+ problemsolution.getProblemsolutionId()
+ ","
+ userId
+ ",'"
+ useState
+ "')\">送鲜花</A>(得<SPAN id=\"problemsolution_flowernum"
+ problemsolution.getProblemsolutionId()
+ "\">"
+ finalsolution.getFinalgoodNum()
+ "</SPAN>支)");
buffer
.append("<IMG height=15 src=\"/image/badegg.gif\" width=16><A id=\"problemsolution_badegg"
+ problemsolution.getProblemsolutionId()
+ "\"class=brown12 href=\"javascript:Problemsolution.problemsolutionBadegg("
+ problemsolution.getProblemId()
+ ","
+ problemsolution.getProblemsolutionId()
+ ","
+ userId
+ ",'"
+ useState
+ "')\">扔鸡蛋</A>(得<SPAN class=orange12 id=\"problemsolution_badeggnum"
+ problemsolution.getProblemsolutionId()
+ "\">"
+ finalsolution.getFinalbadNum()
+ "</SPAN>个)");
} else {
buffer.append("<IMG src=\"/image/flower.gif\"> (得<SPAN>"
+ finalsolution.getFinalgoodNum() + "</SPAN>支)");
buffer
.append("<IMG height=15 src=\"/image/badegg.gif\" width=16>(得<SPAN class=orange12>"
+ finalsolution.getFinalbadNum()
+ "</SPAN>个)");
}
} else if (useState.equals("Y")) {
buffer.append("作为备选方案正在投票中:<br>");
if (userId.intValue() != problemsolution.getCreatorId()
.intValue()
&& problemsolution.getIsoverdue().equals("N")
&& stageflag1) {
// 登陆者不是这个problemsolution的作者,且没有评价过,且这个problemsolution还没有过期
buffer
.append("<IMG src=\"/image/flower.gif\"> <A class=brown12 id=\"problemsolution_flower"
+ problemsolution.getProblemsolutionId()
+ "\" href=\"javascript:Problemsolution.problemsolutionFlower("
+ problemsolution.getProblemId()
+ ","
+ problemsolution.getProblemsolutionId()
+ ","
+ userId
+ ",'"
+ useState
+ "')\">送鲜花</A>(得<SPAN id=\"problemsolution_flowernum"
+ problemsolution.getProblemsolutionId()
+ "\">"
+ problemsolution.getVotingGoodNum()
+ "</SPAN>支)");
buffer
.append("<IMG height=15 src=\"/image/badegg.gif\" width=16><A id=\"problemsolution_badegg"
+ problemsolution.getProblemsolutionId()
+ "\"class=brown12 href=\"javascript:Problemsolution.problemsolutionBadegg("
+ problemsolution.getProblemId()
+ ","
+ problemsolution.getProblemsolutionId()
+ ","
+ userId
+ ",'"
+ useState
+ "')\">扔鸡蛋</A>(得<SPAN class=orange12 id=\"problemsolution_badeggnum"
+ problemsolution.getProblemsolutionId()
+ "\">"
+ problemsolution.getVotingBadNum()
+ "</SPAN>个)");
} else {
buffer.append("<IMG src=\"/image/flower.gif\"> (得<SPAN>"
+ problemsolution.getVotingGoodNum() + "</SPAN>支)");
buffer
.append("<IMG height=15 src=\"/image/badegg.gif\" width=16>(得<SPAN class=orange12>"
+ problemsolution.getVotingBadNum()
+ "</SPAN>个)");
}
} else if (useState.equals("N")) {
buffer.append("第一阶段投票数:<p></p>");
if (userId.intValue() != problemsolution.getCreatorId()
.intValue()
&& problemsolution.getIsoverdue().equals("N")
&& stageflag2) {
// 登陆者不是这个problemsolution的作者,且没有评价过,且这个problemsolution还没有过期
buffer
.append("<IMG src=\"/image/flower.gif\"> <A class=brown12 id=\"problemsolution_flower"
+ problemsolution.getProblemsolutionId()
+ "\" href=\"javascript:Problemsolution.problemsolutionFlower("
+ problemsolution.getProblemId()
+ ","
+ problemsolution.getProblemsolutionId()
+ ","
+ userId
+ ",'"
+ useState
+ "')\">送鲜花</A>(得<SPAN id=\"problemsolution_flowernum"
+ problemsolution.getProblemsolutionId()
+ "\">"
+ problemsolution.getGoodNum()
+ "</SPAN>支)");
buffer
.append("<IMG height=15 src=\"/image/badegg.gif\" width=16><A id=\"problemsolution_badegg"
+ problemsolution.getProblemsolutionId()
+ "\"class=brown12 href=\"javascript:Problemsolution.problemsolutionBadegg("
+ problemsolution.getProblemId()
+ ","
+ problemsolution.getProblemsolutionId()
+ ","
+ userId
+ ",'"
+ useState
+ "')\">扔鸡蛋</A>(得<SPAN class=orange12 id=\"problemsolution_badeggnum"
+ problemsolution.getProblemsolutionId()
+ "\">"
+ problemsolution.getBadNum()
+ "</SPAN>个)");
} else {
buffer.append("<IMG src=\"/image/flower.gif\"> (得<SPAN>"
+ problemsolution.getGoodNum() + "</SPAN>支)");
buffer
.append("<IMG height=15 src=\"/image/badegg.gif\" width=16>(得<SPAN class=orange12>"
+ problemsolution.getBadNum() + "</SPAN>个)");
}
}
if (problemsolution.getIsoverdue().equals("N")
&& userId.intValue() == problemsolution.getCreatorId()
.intValue()) {
// 只有是作者且还没有失效的时候才会出现失效按钮
buffer
.append("<br><IMG height=15 src=\"/image/assoc_delete.gif\" width=16><A id=\"problemsolution_overdue"
+ problemsolution.getProblemsolutionId()
+ "\" class=brown12 href=\"javascript:Problemsolution.problemsolutionOverdue("
+ problemsolution.getProblemId()
+ ","
+ problemsolution.getProblemsolutionId()
+ ","
+ userId
+ ")\">失效</A><div id=\"problemsolution_overdue2"
+ problemsolution.getProblemsolutionId()
+ "\" style=\"display:none\">您已设置该主贴失效</div>");
} else if (problemsolution.getIsoverdue().equals("Y")
&& userId.intValue() == problemsolution.getCreatorId()
.intValue()) {
buffer
.append("<br><IMG height=15 src=\"/image/assoc_delete.gif\" width=16>您已设置该主贴失效<br>");
} else if (problemsolution.getIsoverdue().equals("Y")
&& userId.intValue() != problemsolution.getCreatorId()
.intValue()) {
buffer
.append("<br><IMG height=15 src=\"/image/assoc_delete.gif\" width=16>该作者已设置该主贴失效<br>");
}
// main代表回复了主贴,这时候00没有意义,可去除
buffer
.append(" <A class=brown12 href=\"javascript:ProblemsolutionReply.createReply("
+ problemsolution.getProblemsolutionId()
+ ","
+ "000" + ",'" + "main" + "')\">回复</A>");
}
// 解决方案回复
else if (psr != null) {
boolean flag = true;
int j = 0;
ArrayList psres = psr.getProblemsolutionReplyEvaluations();
while (flag == true && j < psres.size()) {
psre = (ProblemsolutionReplyEvaluation) psres.get(j);
if (psre.getCreatorId().intValue() == userId.intValue()) {
flag = false;
}
j++;
}