You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
4.3 KiB
96 lines
4.3 KiB
/************************************************************************************************* |
|
* 프로그램명 : HttpDocEnd.java 프로그램설명 : 집계취소 파라미터 작성자 : 작성일 : 변경일 : |
|
**************************************************************************************************/ |
|
|
|
package kr.co.kihyun.beans.totsys.totper; |
|
|
|
import java.io.IOException; |
|
import java.io.PrintWriter; |
|
import java.util.Date; |
|
|
|
import javax.jdo.PersistenceManager; |
|
import javax.jdo.Transaction; |
|
import javax.servlet.ServletException; |
|
import javax.servlet.annotation.WebServlet; |
|
import javax.servlet.http.HttpServlet; |
|
import javax.servlet.http.HttpServletRequest; |
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import kr.co.kihyun.beans.entity.TotDoc; |
|
import kr.co.kihyun.beans.entity.TotDocProcess; |
|
import kr.co.kihyun.beans.entity.util.*; |
|
import kr.co.kihyun.beans.user.HttpSSOLogin; |
|
import kr.co.kihyun.lang.Encoder; |
|
import kr.co.kihyun.lang.MLong; |
|
import kr.co.kihyun.lang.MString; |
|
import kr.co.kihyun.moumi.MoumiConfig; |
|
import kr.co.kihyun.text.html.ServletUtil; |
|
import org.slf4j.Logger; |
|
import org.slf4j.LoggerFactory; |
|
@WebServlet("/servlet/kr.co.kihyun.beans.totsys.totper.HttpDocEnd") |
|
public class HttpDocEnd extends HttpServlet { |
|
private static final long serialVersionUID = 2036606476684168227L; |
|
private static final Logger LOG = LoggerFactory.getLogger(HttpDocEnd.class); |
|
|
|
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { |
|
res.setContentType("text/html;charset=UTF-8"); |
|
PrintWriter out = res.getWriter(); |
|
|
|
Long docID = MLong.parseLong(Encoder.toJava(req.getParameter("docID"))); |
|
String docType = MString.checkNull(req.getParameter("docType")); |
|
String usID = HttpSSOLogin.getLoginID(req); |
|
int sysAuth = HttpSSOLogin.getSysAuth(req); |
|
|
|
if (!HttpSSOLogin.isLogin(req)) { |
|
String connURL = "location='/totsys/login/login.jsp';"; |
|
out.println(ServletUtil.getJavaScript(connURL)); |
|
return; |
|
} |
|
|
|
PersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager()); |
|
Transaction tx = pm.currentTransaction(); |
|
try { |
|
tx.begin(); |
|
|
|
TotDoc totDoc = pm.getObjectById(TotDoc.class, docID); |
|
if (sysAuth == MoumiConfig.TOTPER && !usID.equals(totDoc.getUser(pm).getId())) { |
|
pm.close(); |
|
out.println(ServletUtil.alert(MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc") |
|
+ MoumiConfig.getMessageBundle().getString("moumi.message.popup.endFail") + MoumiConfig.getMessageBundle().getString("moumi.message.popup.normalHandle"))); |
|
out.println(ServletUtil |
|
.getJavaScript("document.location='/totsys/totper/mydocbox/prssbox/doc_modify.jsp?docType=" |
|
+ docType + "&docID=" + docID + "';")); |
|
return; |
|
} |
|
|
|
totDoc.setEndDate(new Date(System.currentTimeMillis())); |
|
totDoc.setProcess(TotDocProcess.END); |
|
pm.makePersistent(totDoc); |
|
|
|
tx.commit(); |
|
|
|
out.println(ServletUtil.alert(TotDocProcess.END + MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.success") +"!")); |
|
out.println(ServletUtil |
|
.getJavaScript("document.location='/totsys/totper/mydocbox/prssbox/doc_list.jsp?docType=END';")); |
|
} catch (Exception e) { |
|
e.printStackTrace(); |
|
out.println(ServletUtil.alert(TotDocProcess.END + MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.fail") +"!")); |
|
//v2. 9.크로스사이트 스크립트 (PrintWrier) : Update by KWON,HAN |
|
// out.println(ServletUtil |
|
// .getJavaScript("document.location='/totsys/totper/mydocbox/prssbox/doc_list.jsp?docType=" |
|
// + docType + "';")); |
|
|
|
// 수정 : 외부 입력값 필터링 |
|
String callbackFunc = "document.location='/totsys/totper/mydocbox/prssbox/doc_list.jsp?docType=" + docType + "';"; |
|
String filtered_callbackFunc = callbackFunc.replaceAll("<","").replaceAll(">","").replaceAll("&","").replaceAll(",",""); |
|
LOG.debug("v2 9.크로스사이트 스크립트 (PrintWrier) : HttpDocEnd.doPost() filtered_callbackFunc={}, Not Test", filtered_callbackFunc); |
|
out.println(ServletUtil.getJavaScript(filtered_callbackFunc)); |
|
//======================================== |
|
|
|
} finally { |
|
if (tx.isActive()) |
|
tx.rollback(); |
|
pm.close(); |
|
} |
|
} |
|
}
|
|
|