<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@page
import="java.text.SimpleDateFormat,com.gw.util.Constant,com.gw.util.StringHelper,com.gw.util.WorkflowHelper,com.gw.vo.workflow.*,com.gw.domain.workflow.*,com.gw.service.ServiceLocator,com.gw.service.FlowInstanceService"%>
<%@page import="com.gw.domain.form.Forminstances"%>
<%@page import="com.gw.service.FormInstanceService"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>乐清市发展和改革局公文处理单</title>
<SCRIPT LANGUAGE=javascript FOR=HWPostil EVENT=NotifyCtrlReady>
<!--
HWPostil_NotifyCtrlReady()
//-->
</SCRIPT>
</head>
<body>
<%
String userIds = "", newlingdaopishi = "";
String nibanyijian = "", lingdaopishi = "", chuliqingkuang = "", filedraft = "";
String formid = request.getParameter("formid");
FormInstanceService formInstanceService = (FormInstanceService) ServiceLocator
.getService(Constant.SERVICE_FORMINSTANCE);
Forminstances forminstances = formInstanceService.loadById(formid);
if (forminstances != null) {
filedraft = forminstances.getFiledraft() != null ? forminstances
.getFiledraft()
: "";
}
FlowTransmitBean flowTransmitBean = WorkflowHelper
.getFlowViewTransmit(request);
FlowInstanceService flowInstanceService = (FlowInstanceService) ServiceLocator
.getService(Constant.SERVICE_FLOWINSTANCE);
List list = new ArrayList();
String instanceID = flowTransmitBean.getInstanceID();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (!StringHelper.isNullOrEmpty(instanceID)) {
List doneTaskList = flowInstanceService
.getTaskListByStatusAndInstanceId(
Constant.FLOWTASK_DONE, instanceID);
int k = 0;
if (doneTaskList.size() > 0) {
Iterator diterator = doneTaskList.iterator();
Flowtasks task = null;
while (diterator.hasNext()) {
System.out.println(diterator.next());//错误就是这一行
task = (Flowtasks) diterator.next();
list.add(task);
}
}
}
for (int i = 0; i < list.size(); i++) {
Flowtasks ftask = (Flowtasks) list.get(i);
if (ftask.getTaskName().equals("主任拟办")) {
nibanyijian += (ftask.getMessage() != null ? ftask
.getMessage() : "")
+ " "
+ ftask.getPerformer()
+ " "
+ sdf.format(ftask.getFinishTime()) + "\n";
}
if (ftask.getTaskName().equals("领导阅处")
|| ftask.getTaskName().equals("局长批示")) {
lingdaopishi += (ftask.getMessage() != null ? ftask
.getMessage() : "")
+ " "
+ ftask.getPerformer()
+ " "
+ sdf.format(ftask.getFinishTime()) + "\n";
userIds += "'" + ftask.getPerformerId() + "',";
}
if (ftask.getTaskName().equals("落实专人")) {
chuliqingkuang += (ftask.getMessage() != null ? ftask
.getMessage() : "")
+ " "
+ ftask.getPerformer()
+ " "
+ sdf.format(ftask.getFinishTime()) + "\n";
}
}
System.out.println("instanceID:" + instanceID + " userIds:"
+ userIds);
if (!StringHelper.isNullOrEmpty(userIds)) {//如果userIds为空,表示没有局长批示或领导阅处,不需对此进行排序
userIds = userIds.substring(0, userIds.lastIndexOf(','));
List<Map> pslist = flowInstanceService.getPingshiLingdaoOrder(
instanceID, userIds);
String userIds2 = "";
if (pslist.size() > 0) {
for (Map map : pslist) {
String taskName = map.get("TASKNAME").toString();
String message = map.get("MESSAGE") != null ? map.get(
"MESSAGE").toString() : "";
String performer = map.get("PERFORMER").toString();
String finishTime = map.get("FINISHTIME").toString();
String performerId = map.get("PERFORMERID").toString();
if (taskName.equals("领导阅处") || taskName.equals("局长批示")) {
newlingdaopishi += (message != null ? message : "")
+ " " + performer + " " + finishTime
+ "\n";
}
}
}
System.out.println("newlingdaopishi:" + newlingdaopishi);
}
%>
<input type="hidden" name="nibanyijian" value="<%=nibanyijian%>">
<input type="hidden" name="lingdaopishi" value="<%=newlingdaopishi%>">
<input type="hidden" name="chuliqingkuang"
value="<%=chuliqingkuang%>">
<input type="hidden" name="filedraft" value="<%=filedraft%>">
<OBJECT id=HWPostil align='middle'
style='LEFT: 0px; WIDTH: 100%; TOP: 0px; HEIGHT: 700px'
classid=clsid:FF1FE7A0-0578-4FEE-A34E-FB21B277D561
codebase=resources/control/HWPostil.cab#Version=3,0,7,0>
</OBJECT>
<script type="text/javascript">
function HWPostil_NotifyCtrlReady() {
var regnum=window.top.opener.document.getElementById("regnum").value;
var getdocdate=window.top.opener.document.getElementById("getdocdate").value;
var senddep=window.top.opener.document.getElementById("senddep").value;
var issuecode=window.top.opener.document.getElementById("issuecode").value;
var issueyear=window.top.opener.document.getElementById("issueyear").value;
var issuenum=window.top.opener.document.getElementById("issuenum").value;
var title=window.top.opener.document.getElementById("title").value;
var filedraft=document.getElementById("filedraft").value;
if(filedraft==""||filedraft.indexOf("filedraft")>0){
HWPostil.LoadFile('http://127.0.0.1:8090'+'/yqoa/aip/ofzjgetdocfileview.aip');
HWPostil.Login("HWSEALDEMO**", 4, 65535, "DEMO", "");
}else{
HWPostil.LoadFileBase64(filedraft);
}
HWPostil.SetValue('Page1.filecode',regnum);
HWPostil.SetValue('Page1.filedate',getdocdate);
HWPostil.SetValue('Page1.getdocdept',senddep);
HWPostil.SetValue('Page1.getdocfilecode',issuecode+"〔"+issueyear+"〕"+issuenum+"号");
HWPostil.SetValue('Page1.title',title);
HWPostil.SetValue('Page1.nibanyijian',document.getElementById("nibanyijian").value);
HWPostil.SetValue('Page1.lingdaopishi',document.getElementById("lingdaopishi").value);
HWPostil.SetValue('Page1.chuliqingkuang',document.getElementById("chuliqingkuang").value);
}
function sendAIP(){
var filedraft=HWPostil.GetCurrFileBase64();
window.top.opener.document.getElementById("filedraft").value=filedraft;
window.close();
}
</script>
<div align="center">
<input type="button" value="提交" οnclick="sendAIP()">
</div>
</body>
</html>