📄 newfaq_sb.jsp
字号:
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="com.doone.data.*" %>
<%@ page import="com.doone.uurm.*"%>
<%@ page import="com.doone.fj1w.fj1w.faq.*" %>
<%@ page import="com.doone.fj1w.fjmgr.sysmgr.Util"%>
<%@ page import="com.doone.util.*" %>
<%@ page import="java.util.*" %>
<%String sPurvICode="NGB009";%>
<%// 获取栏目列表,同时统计帖子数。
long faqCoteId = 0;
if ( request.getParameter("faqcoteid") != null )
faqCoteId = Long.parseLong(request.getParameter("faqcoteid"));
switch ( (int)faqCoteId ) {
case 1:
sPurvICode = "NGB009001";
break;
case 2:
sPurvICode = "NGB009002";
break;
case 3:
sPurvICode = "NGB009003";
break;
}
WebAuth auth = WebAuth.getInstance(request);
if ( ! auth.IsAuthed() ) {
out.write("<script language=\"javascript\">self.parent.location.replace(\"" + request.getContextPath() + "/view/login/login.jsp" + "\");</script>");
return;
}
else if ( ! auth.CheckPurv(sPurvICode) ) {
out.write("<script language=javascript src=\"../../common/script/RightForbidden.js\"></script>");
return;
}
DacClient db = null;
try{
db = new DacClient();
String sUpFaqId = request.getParameter("faqid");//本帖子
String sMainFaqId = request.getParameter("mainFaqId");
if ( sUpFaqId == null || sUpFaqId.equals("") ){
sUpFaqId = "0";
}
if ( sMainFaqId == null || sMainFaqId.equals("") ){
sMainFaqId = sUpFaqId;
}
// 读取Session。
String sStaffCode=auth.getUserCode();
String sStaffName = auth.getUserName();
String userID = sStaffCode;
String userName = sStaffName;
String title = request.getParameter("title");
String cityCode = request.getParameter("citycode");
String content = request.getParameter("content");
String userType = "";
String reviewState = "E";
String state = "E";
String lastUserId = userID;
String lastUserName = userName;
Date createTime = new Date();
Date lastDate = createTime;
db.beginTransaction(-1);
Tf_Faq newFaq = new Tf_Faq(db);
if ( ! sUpFaqId.equals("0") ){//主帖子的ID
Tf_Faq upfaq = new Tf_Faq(db, Long.parseLong(sUpFaqId));
newFaq.setUpFaqId(upfaq.getFaqId());//设置新的帖子
newFaq.setMainFaqId(upfaq.getMainFaqId());
newFaq.setFaqCoteId(upfaq.getFaqCoteId());
newFaq.setCityCode(upfaq.getCityCode());
if (title == null || title.equals("") ){
newFaq.setTitle("回复:" + upfaq.getTitle());
}
userType = "W";
upfaq.setLastUserId(lastUserId);
upfaq.setUserType(userType);
upfaq.setLastNickName(lastUserName);
int subCount=upfaq.getsubCount(upfaq.getFaqId())+1;
upfaq.setSubCount(subCount);
upfaq.setLastDate(lastDate);
upfaq.saveOther();
}
else{
newFaq.setFaqCoteId(faqCoteId);
newFaq.setUpFaqId(0);
newFaq.setMainFaqId(newFaq.getFaqId());
newFaq.setCityCode(cityCode);
newFaq.setTitle(title);
}
userType = "E";//员工回复的
newFaq.setLastUserId(lastUserId);
newFaq.setLastNickName(lastUserName);
newFaq.setLastDate(lastDate);
newFaq.setUserType(userType);
newFaq.setUserId(userID);
newFaq.setContent(content);
newFaq.setState(state);
newFaq.setReviewState(reviewState);
newFaq.setNickName(userName);
newFaq.setCreateTime(createTime);
newFaq.setSubCount(0);
newFaq.save();
/* if ( newFaq.getMainFaqId() != 0 && newFaq.getMainFaqId() != newFaq.getFaqId() ){
Tf_Faq mainFaq = new Tf_Faq(db,newFaq.getMainFaqId());
userType = "W";
mainFaq.setLastUserId(lastUserId);
mainFaq.setUserType(userType);
mainFaq.setLastNickName(lastUserName);
FileLogger.getLogger().debug("根帖的子帖数:" + String.valueOf(mainFaq.getSubCount()));
mainFaq.setSubCount(mainFaq.getsubCount(mainFaq.getFaqId()));
mainFaq.setLastDate(lastDate);
mainFaq.save();
}*/
db.endTransaction(true);
if ( sUpFaqId != null ) {
out.write("<script language=javascript>window.location.href='" + request.getHeader("referer") + "';</script>");
}
else {
out.write("<script language=javascript>window.location.href='"+request.getContextPath() + "/view/sysmgr/OperSuccess.jsp';</script>");
}
} catch(Exception ex){
try{
if ( db != null ) {
db.endTransaction(false);
}
}
catch(Exception e){
}
FileLogger.getLogger().warn(ex.getMessage(),ex);
out.write("<script language=javascript>window.location.href='"+request.getContextPath() + "/view/sysmgr/OperFailure.jsp?error="
+ Util.Replace(ex.getMessage()) + "';</script>");
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -