RemarkOperate.jsp 53 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040

<%@page import="weaver.workflow.request.RequestOperationLogManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.GCONST" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.file.FileUpload" %>
<%@ page import="weaver.general.TimeUtil"%>
<%@ page import="weaver.workflow.request.RequestAnnexUpload,weaver.share.ShareinnerInfo" %>
<%@page import="weaver.workflow.request.RequestSignRelevanceWithMe"%>
<%@page import="weaver.workflow.request.RequestManager"%>
<%@page import="weaver.formmode.log.LogType"%>
<%@page import="weaver.workflow.request.WFPathUtil"%>
<%@page import="weaver.mobile.webservices.workflow.soa.RequestPreProcessing"%>
<%@ page import="weaver.conn.BatchRecordSet" %>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%--td3641 xwj 20060214--%>
 <%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="WorkflowAllComInfo" class="weaver.workflow.workflow.WorkflowAllComInfo" scope="page" />
<jsp:useBean id="RequestAddShareInfo" class="weaver.workflow.request.RequestAddShareInfo" scope="page" />
<%--  added by xwj on 22005-08-01 for td2104  --%>
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" /><%--xwj for td3641 on 20060214 --%>
<jsp:useBean id="PoppupRemindInfoUtil" class="weaver.workflow.msg.PoppupRemindInfoUtil" scope="page"/><!--xwj for td3641 on 20060214-->
<jsp:useBean id="sendMail" class="weaver.workflow.request.MailAndMessage" scope="page"/><!--xwj for td3641 on 20060214-->
<jsp:useBean id="WFLinkInfo" class="weaver.workflow.request.WFLinkInfo" scope="page"/>
<jsp:useBean id="RemarkOperaterManager" class="weaver.workflow.request.RemarkOperaterManager" scope="page" />
<jsp:useBean id="RequestAddOpinionShareInfo" class="weaver.workflow.request.RequestAddOpinionShareInfo" scope="page" />
<jsp:useBean id="basebean" class="weaver.general.BaseBean" scope="page" />
<jsp:useBean id="WFForwardManager" class="weaver.workflow.request.WFForwardManager" scope="page" />
<jsp:useBean id="WFManager" class="weaver.workflow.workflow.WFManager" scope="page" />
<jsp:useBean id="wfAgentCondition" class="weaver.workflow.request.wfAgentCondition" scope="page" />
<jsp:useBean id="remarkRight" class="weaver.workflow.request.RequestRemarkRight" scope="page" />

<%

//Date d1 = new Date();

//    System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>转发开始...");
FileUpload fu = new FileUpload(request);
String operate=Util.null2String(fu.getParameter("operate"));
String needwfback=Util.null2String(fu.getParameter("needwfback"));
String requestid=Util.null2String(fu.getParameter("requestid"));
RecordSet.executeSql("select * from workflow_requestbase where requestid ="+requestid);
int workflowid= -1;
String currnodetype0 = "";
int currnodeid0 = 0;
if(RecordSet.next()){
workflowid = Util.getIntValue(RecordSet.getString("workflowid")) ;
currnodetype0 = RecordSet.getString("currentnodetype");
currnodeid0 = RecordSet.getInt("currentnodeid");
}
String f_weaver_belongto_userid=fu.getParameter("f_weaver_belongto_userid");//需要增加的代码
String f_weaver_belongto_usertype=fu.getParameter("f_weaver_belongto_usertype");//需要增加的代码
user = HrmUserVarify.getUser(request, response, f_weaver_belongto_userid, f_weaver_belongto_usertype) ;//需要增加的代码
String userid=user.getUID()+"";
//int workflowid=Util.getIntValue(fu.getParameter("workflowid"));
//int workflowid=Util.getIntValue((String)session.getAttribute(userid+"_"+requestid+"workflowid"),0);
String ifchangstatus=Util.null2String(basebean.getPropValue(GCONST.getConfigFile() , "ecology.changestatus"));
String forwardrightsql = "select * from workflow_base where id = "+ workflowid ;
String isforwardrights="";
RecordSet.executeSql(forwardrightsql);
if(RecordSet.next()){
isforwardrights = Util.null2String(RecordSet.getString("isforwardrights")) ;
}
char flag=Util.getSeparator() ;
String para="";
String usertype="0";//被转发人肯定为人力资源,因此类型默认为“0”TD9836
String remark = Util.null2String(fu.getParameter("remark"));
int forwardflag = Util.getIntValue(fu.getParameter("forwardflag"));
if(forwardflag!=2 && forwardflag!=3){
forwardflag = 1;  // 2 征求意见;3 转办 ;1 转发
}
String signdocids = Util.null2String(fu.getParameter("signdocids"));
String signworkflowids = Util.null2String(fu.getParameter("signworkflowids"));
String clientip=fu.getRemoteAddr();
int requestLogId = Util.getIntValue(fu.getParameter("workflowRequestLogId"),0);
String remarkLocation = Util.null2String(fu.getParameter("remarkLocation"));
String logintype = user.getLogintype();
//if(logintype.equals("2")){
//   usertype="1";
//}
String operatortype = "";

if(logintype.equals("1"))  operatortype = "0";
if(logintype.equals("2"))  operatortype = "1";

Calendar today = Calendar.getInstance();
String CurrentDate = "";
String CurrentTime = "";
try{
	rs.executeProc("GetDBDateAndTime", "");
	if(rs.next()){
		CurrentDate = rs.getString("dbdate");
		CurrentTime = rs.getString("dbtime");
	}
}catch(Exception e){
	CurrentDate = Util.add0(today.get(Calendar.YEAR), 4) + "-" +
		Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" +
		Util.add0(today.get(Calendar.DAY_OF_MONTH), 2) ;

	CurrentTime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" +
		Util.add0(today.get(Calendar.MINUTE), 2) + ":" +
		Util.add0(today.get(Calendar.SECOND), 2) ;
}
int currentnodeid=Util.getIntValue((String)session.getAttribute(userid+"_"+requestid+"nodeid"),0);
//加强性修改转发。

if(currentnodeid<1){
	rs.execute("select nodeid from workflow_currentoperator where usertype=0 and requestid="+requestid+" and userid = "+ userid + " order by id desc");
	if(rs.next()){
		currentnodeid = Util.getIntValue(rs.getString("nodeid"),0);
	}
}
//int workflowid=Util.getIntValue((String)session.getAttribute(userid+"_"+requestid+"workflowid"),0);
String requestname = Util.null2String((String)session.getAttribute(userid+"_"+requestid+"requestname"));
String currentnodetype_temp = "";
if (workflowid == 0) {
    int nodeid = WFLinkInfo.getCurrentNodeid(Util.getIntValue(requestid), Util.getIntValue(userid), Util.getIntValue(logintype,1));               //节点id
    String nodetype = WFLinkInfo.getNodeType(nodeid);

	RecordSet.executeProc("workflow_Requestbase_SByID",requestid+"");
	if(RecordSet.next()){
	    requestname = Util.null2String(RecordSet.getString("requestname")) ;
		workflowid = Util.getIntValue(RecordSet.getString("workflowid"),0);
		int currentnodeid_temp = Util.getIntValue(RecordSet.getString("currentnodeid"),0);
	    if(currentnodeid<1) currentnodeid = currentnodeid_temp;
		String nodetype_1 = Util.null2String(RecordSet.getString("currentnodetype"));
	    if(nodetype.equals("")) currentnodetype_temp = nodetype_1;
	}
}

String workflowtype=WorkflowAllComInfo.getWorkflowtype(workflowid+"");
//all remark resource
int detailnum=Util.getIntValue(fu.getParameter("totaldetail"),0);
Set resourceids = new LinkedHashSet();
ArrayList agenterids=new ArrayList();
String resourceid="";
int i=0;


String tmpid=Util.fromScreen(fu.getParameter("field5"),user.getLanguage());
if(!tmpid.equals("")){
    String[] tmpids=Util.TokenizerString2(tmpid,",");
    for(int m=0 ;m<tmpids.length;m++){
        resourceids.add(tmpids[m]);
    }
}
Set rightResourceidList = new HashSet();
rs.execute("select distinct userid from workflow_currentoperator where usertype=0 and requestid="+requestid);
while(rs.next()){
	int userid_tmp = Util.getIntValue(rs.getString("userid"), 0);
	if(resourceids.contains(""+userid_tmp) == false){
		rightResourceidList.add(""+userid_tmp);
	}
}

int wfcurrrid=Util.getIntValue((String)session.getAttribute(userid+"_"+requestid+"wfcurrrid"), 0);

if (wfcurrrid == 0) {
    RecordSet.executeSql("select isremark,isreminded,preisremark,id,groupdetailid,nodeid from workflow_currentoperator where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" order by isremark,id");
    boolean istoManagePage=false;   //add by xhheng @20041217 for TD 1438
    while(RecordSet.next())	{
        String isremark = Util.null2String(RecordSet.getString("isremark")) ;
        wfcurrrid=Util.getIntValue(RecordSet.getString("id"));
        int tmpnodeid=Util.getIntValue(RecordSet.getString("nodeid"));
        //modify by mackjoe at 2005-09-29 td1772 转发特殊处理,转发信息本人未处理一直需要处理即使流程已归档
        if( isremark.equals("1")||isremark.equals("5") || isremark.equals("7")|| isremark.equals("9") ||(isremark.equals("0")  && !currentnodetype_temp.equals("3")) ) {
          //modify by xhheng @20041217 for TD 1438
          break;
        }
        if(isremark.equals("8")){
            break;
        }
    }
}

String messageid="";
/* ---- xwj for td2104 on 20050802 begin-----  */


//forwardflag : 2 征求意见;3 转办 ;1 转发
int rolmIsRemark = 2;
String src = "forward";
if(forwardflag == 2 || forwardflag == 3){
    rolmIsRemark = 0;
    if (forwardflag == 2) {
        src = "take";
    } else {
        src = "trans";
    }
}
RequestOperationLogManager rolm = new RequestOperationLogManager(Util.getIntValue(requestid)
        , currentnodeid
        , rolmIsRemark
        , user.getUID()
        , user.getType()
        , CurrentDate
        , CurrentTime
        , src);
//开始记录日志
rolm.flowTransStartBefore();

if(operate.equals("save")&&wfcurrrid>0){
 List poppuplist=new ArrayList();

   /* --------------add by xwj for td3641 begin -----*/
       String tempHrmIds = "";//xwj td2302
       String receivedPersonids = "";
    String agentSQL = "";//xwj td2302
    boolean isbeAgent=false;
    String agenterId="";
    String beginDate="";
    String beginTime="";
   String endDate="";
   String endTime="";
   String currentDate="";
   String currentTime="";
   String agenttype = "";
   /* --------------add by xwj for td3641 end -----*/

    WFForwardManager.setForwardRight(fu,Util.getIntValue(requestid),workflowid,currentnodeid,Util.getIntValue(userid));
    int showorder = 1;

    //是否运行优化的逻辑
    boolean isPfx = (forwardflag == 1 && !isforwardrights.equals("1"));
    List<String> insertUesrids = new ArrayList<String>();
    List<Integer> insertShowOrderids = new ArrayList<Integer>();
    //获取当前请求操作者的代理情况
    //在插入操作者迭代过程中在单独查询
    Map<String, String> operatorAgentInfo = wfAgentCondition.getAgentInfoByResouce(
            String.valueOf(workflowid)
            , tmpid
            , String.valueOf(requestid));
    //end by mackjoe

    RecordSet.executeSql("select max(showorder) as maxshow from workflow_currentoperator where nodeid = " + currentnodeid + " and isremark in ('0','1','4') and requestid = " + requestid);
    if (RecordSet.next()) {
        showorder = RecordSet.getInt("maxshow") + 1;
    }

    //统一查询出已存在的用户id
    List<String> existstOperators = new ArrayList<String>();
    if (forwardflag == 1) {
        String selectsql = "select userid, isremark,id from workflow_currentoperator where requestid=" + requestid + " and isremark in('0','1','5','7') and (" + Util.getSubINClause(tmpid, "userid", "IN") + ") and usertype=0 order by isremark";

        RecordSet.executeSql(selectsql);

        while (RecordSet.next()) {
            String exiUserid = Util.null2String(RecordSet.getString("userid"));
            if (existstOperators.indexOf(exiUserid) == -1) {
                existstOperators.add(exiUserid);
            }
        }
    }
    //需要批量插入的参数列表
    List<List<Object>> insertOperatorParamsList = new ArrayList<List<Object>>();
    //保存要插入的人员, 用于更新islasttimes
    List<String> insertOperatorIds = new ArrayList<String>();

    String forwardresourceids = "";
	for (Object resourceidObj : resourceids) {
       int BeForwardid=0;
	   isbeAgent=false;
      //modify by mackjoe at 2005-09-28 td2865
      resourceid=(String)resourceidObj;
	  boolean isexist=false;
	  if(forwardflag == 1){
	      /*
      String selectsql="select isremark,id from workflow_currentoperator where requestid="+requestid+" and isremark in('0','1','5','7') and userid="+resourceid+" and usertype=0 order by isremark";
      RecordSet.executeSql(selectsql);

      if(RecordSet.next()){
          isexist=true;
      }
      */
          if (existstOperators.indexOf(resourceid) != -1) {
              isexist = true;
          }
	  }
        if (forwardflag != 1 || !isPfx) {
            //end by mackjoe
            RecordSet.executeSql("select max(showorder) as maxshow from workflow_currentoperator where nodeid = " + currentnodeid + " and isremark in ('0','1','4') and requestid = " + requestid);
            if (RecordSet.next()) {
                showorder = RecordSet.getInt("maxshow") + 1;
            }
        } else {
            //每次自增即可
            showorder++;
        }
			/* -----------   xwj for td3641 begin -----------*/
			/*
                            agentSQL = " select * from workflow_agentConditionSet where workflowId="+ workflowid +" and bagentuid=" + resourceid +
                     " and agenttype = '1' and isproxydeal='1' " +
                     " and ( ( (endDate = '" + CurrentDate + "' and (endTime='' or endTime is null))" +
                     " or (endDate = '" + CurrentDate + "' and endTime > '" + CurrentTime + "' ) ) " +
                     " or endDate > '" + CurrentDate + "' or endDate = '' or endDate is null)" +
                     " and ( ( (beginDate = '" + CurrentDate + "' and (beginTime='' or beginTime is null))" +
	             " or (beginDate = '" + CurrentDate + "' and beginTime < '" + CurrentTime + "' ) ) " +
	             " or beginDate < '" + CurrentDate + "' or beginDate = '' or beginDate is null) order by agentbatch asc  ,id asc "; //agentSQL is added by xwj for td2302

                         rs.execute(agentSQL);

                         while(rs.next()){
                         	String agentid = rs.getString("agentid");
 							String conditionkeyid = rs.getString("conditionkeyid");
 							boolean isagentcond = wfAgentCondition.isagentcondite(""+ requestid, "" + workflowid, "" + resourceid,"" + agentid, "" + conditionkeyid);
 							 if(isagentcond){
 	                       		isbeAgent=true;
 	                       	 	agenterId=rs.getString("agentuid");
 	                       	 	beginDate=rs.getString("beginDate");
 	              			 	beginTime=rs.getString("beginTime");
 	                      	 	endDate=rs.getString("endDate");
 	                      	 	endTime=rs.getString("endTime");
 	                      	 	currentDate=TimeUtil.getCurrentDateString();
 	                       	 	currentTime=(TimeUtil.getCurrentTimeString()).substring(11,19);
 	                       	 	agenttype = rs.getString("agenttype");
 	                          	agenterids.add(agenterId);
                         		break;
 							 }
 						}
 						*/
        agenterId = operatorAgentInfo.get(resourceid);
        if(agenterId != null && !agenterId.equals("")){
            agenterids.add(agenterId);
            isbeAgent = true;
        }

        if(!isexist){
            //仅对转发做处理,意见征询、转办,暂时不回涉及到大量的人员。
            if (isPfx) {
                if(isbeAgent){
                    List<Object> insertSqlParamList = new ArrayList();
                    insertSqlParamList.add(resourceid);
                    insertSqlParamList.add("2"); //isremark
                    insertSqlParamList.add(agenterId);
                    insertSqlParamList.add("1"); //agenttype
                    insertSqlParamList.add(showorder);
                    insertSqlParamList.add(CurrentDate);
                    insertSqlParamList.add(CurrentTime);
                    insertSqlParamList.add("1");
                    insertOperatorParamsList.add(insertSqlParamList);

                    showorder++;

                    insertSqlParamList = new ArrayList();
                    insertSqlParamList.add(agenterId);
                    insertSqlParamList.add("1");
                    insertSqlParamList.add(resourceid);
                    insertSqlParamList.add("2");
                    insertSqlParamList.add(showorder);
                    insertSqlParamList.add(CurrentDate);
                    insertSqlParamList.add(CurrentTime);
                    insertSqlParamList.add("1");
                    insertOperatorParamsList.add(insertSqlParamList);

                    insertUesrids.add(agenterId);
                    insertShowOrderids.add(showorder);

                    //记录要插入的人员, 用于更新islasttimes
                    insertOperatorIds.add(resourceid);
                    insertOperatorIds.add(agenterId);
                }else{
                    List<Object> insertSqlParamList = new ArrayList();
                    insertSqlParamList.add(resourceid);
                    insertSqlParamList.add("1"); //isremark
                    insertSqlParamList.add(-1);
                    insertSqlParamList.add("0"); //agenttype
                    insertSqlParamList.add(showorder);
                    insertSqlParamList.add(CurrentDate);
                    insertSqlParamList.add(CurrentTime);
                    insertSqlParamList.add("1");
                    insertOperatorParamsList.add(insertSqlParamList);

                    insertUesrids.add(resourceid);
                    insertShowOrderids.add(showorder);

                    //记录要插入的人员, 用于更新islasttimes
                    insertOperatorIds.add(resourceid);
                }
            }

		if(isbeAgent) {
            //代理人
            if (forwardflag != 1 || !isPfx) {
                para = requestid + flag + resourceid + flag + "0" + flag + workflowid + "" + flag + workflowtype + flag + usertype + flag + "2" +
                        flag + currentnodeid + flag + agenterId + flag + "1" + flag + showorder + flag + "-1";
                RecordSet.executeProc("workflow_CurrentOperator_I", para);
            }
			if(forwardflag==3){
				//被代理人
				/*para=requestid+ flag +agenterId+ flag +"0"+ flag +workflowid+""+ flag +workflowtype+ flag+usertype+flag + "1" +
		flag + currentnodeid + flag + resourceid + flag + "2" + flag + showorder+flag+"-1";
		RecordSet.executeProc("workflow_CurrentOperator_I",para);*/
				 // para=requestid+ flag +agenterId+ flag +"0"+ flag +workflowid+""+ flag +workflowtype+ flag+usertype+flag + "0" +
		//flag + currentnodeid + flag + "-1" + flag + "2" + flag + showorder+flag+"-1";
				   para=requestid+ flag +agenterId+ flag +"0"+ flag +workflowid+""+ flag +workflowtype+ flag+usertype+flag + "0" +
		flag + currentnodeid + flag + resourceid + flag + "2" + flag + showorder+flag+"-1";
		RecordSet.executeProc("workflow_CurrentOperator_I",para);
           //agentSQL="select id from workflow_CurrentOperator where requestid="+requestid+" and userid="+agenterId+" and usertype="+usertype+" and isremark='1' and nodeid="+currentnodeid+" and showorder="+showorder+" order by id desc";
		      if(needwfback.equals("0")){
		 String needsql = "update workflow_currentoperator set needwfback = '0' where requestid="+requestid+" and userid="+agenterId+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
		   RecordSet.execute(needsql);
		  }
		   String ForwardHsql = "";
		  if(agenterId.equals(userid)){  //转办给自己时特殊处理
				 ForwardHsql = "update workflow_currentoperator set isremark = 2 where requestid="+requestid+" and userid="+userid+"and showorder<>"+showorder+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
		  }else{
				 ForwardHsql = "update workflow_currentoperator set isremark = 2 where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" and isremark='0' and agentorbyagentid = '-1' and nodeid="+currentnodeid;
		  }
		   RecordSet.execute(ForwardHsql);
			   String IDsql = "select * from workflow_currentoperator where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" and isremark='2' and nodeid="+currentnodeid+" order by id desc";
			 RecordSet.execute(IDsql);
			 if(RecordSet.next()){
					 int id = RecordSet.getInt("id");
				// RecordSet.execute("update workflow_currentoperator set handleforwardid = "+ id +" where requestid="+requestid+" and userid="+resourceid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid);
				int groupdetailid = RecordSet.getInt("groupdetailid");
				 int groupid = RecordSet.getInt("groupid");
				 RecordSet.execute("update workflow_currentoperator set handleforwardid = "+ id +" ,groupdetailid = "+ groupdetailid +" ,groupid = "+ groupid +" where requestid="+requestid+" and userid="+resourceid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid);
			 }
			}else if(forwardflag==2){  //意见征询,设置标识位takisremark的值为 "2"
			String checkoperatorsql = "select 1 from workflow_currentoperator where requestid="+requestid+" and userid="+agenterId+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
		    RecordSet.execute(checkoperatorsql);
		    if(!RecordSet.next()){
			    para=requestid+ flag +agenterId+ flag +"0"+ flag +workflowid+""+ flag +workflowtype+ flag+usertype+flag + "1" +
			    flag + currentnodeid + flag + resourceid + flag + "2" + flag + showorder+flag+"-1";
		        RecordSet.executeProc("workflow_CurrentOperator_I",para);
		 String IDsql = "select * from workflow_currentoperator where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
			 RecordSet.execute(IDsql);
			 if(RecordSet.next()){
					// int id = RecordSet.getInt("id");
				// RecordSet.execute("update workflow_currentoperator set handleforwardid = "+ id +" where requestid="+requestid+" and userid="+resourceid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid);
				int groupdetailid = RecordSet.getInt("groupdetailid");
				 int groupid = RecordSet.getInt("groupid");
		String Taksql = "update workflow_CurrentOperator set takisremark = 2 ,groupdetailid = "+ groupdetailid +" ,groupid = "+ groupid +" where requestid="+requestid+" and userid="+agenterId+" and  usertype="+usertype+" and showorder="+showorder+" and isremark='1' and nodeid="+currentnodeid;
			 RecordSet.execute(Taksql);
			 //代理人、被代理人都要加被意见征询标识
			 RecordSet.execute("update workflow_CurrentOperator set takisremark = 2 where requestid="+requestid+" and  agentorbyagentid ="+agenterId+" and  usertype="+usertype+" and showorder="+showorder+" and isremark='2' and nodeid="+currentnodeid);
			 }
			 String Taksql2 = "update workflow_CurrentOperator set takisremark = -2 where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
			 RecordSet.execute(Taksql2);
			 }
            agentSQL="select id from workflow_CurrentOperator where requestid="+requestid+" and userid="+agenterId+" and usertype="+usertype+" and isremark='1' and nodeid="+currentnodeid+" and showorder="+showorder+" order by id desc";
			}else if (!isPfx){
			//被代理人   agenttype 的问题?
			para=requestid+ flag +agenterId+ flag +"0"+ flag +workflowid+""+ flag +workflowtype+ flag+usertype+flag + "1" +
		flag + currentnodeid + flag + resourceid + flag + "2" + flag + showorder+flag+"-1";
		RecordSet.executeProc("workflow_CurrentOperator_I",para);
            agentSQL="select id from workflow_CurrentOperator where requestid="+requestid+" and userid="+agenterId+" and usertype="+usertype+" and isremark='1' and nodeid="+currentnodeid+" and showorder="+showorder+" order by id desc";
			}
		}
		else{
			if(forwardflag==3){  //handleforwardid
			para=requestid+ flag +resourceid+ flag +"0"+ flag +workflowid+""+ flag +workflowtype+ flag+usertype+flag + "0" +
		  flag + currentnodeid + flag + -1 + flag + "0" + flag + showorder+flag+"-1";
		  RecordSet.executeProc("workflow_CurrentOperator_I",para);
		  if(needwfback.equals("0")){
		 String needsql = "update workflow_currentoperator set needwfback = '0' where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
		   RecordSet.execute(needsql);
		  }
		  String ForwardHsql = "";
		  if(resourceid.equals(userid)){  //转办给自己时特殊处理
				ForwardHsql = "update workflow_currentoperator set isremark = 2 where requestid="+requestid+" and userid="+userid+"and showorder<>"+showorder+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
		  }else{
				ForwardHsql = "update workflow_currentoperator set isremark = 2 where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
		  }
		   RecordSet.execute(ForwardHsql);
		    String IDsql = "select * from workflow_currentoperator where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" and isremark='2' and nodeid="+currentnodeid+" order by id desc";
			 RecordSet.execute(IDsql);
			 if(RecordSet.next()){
				 int id = RecordSet.getInt("id");
				 int groupdetailid = RecordSet.getInt("groupdetailid");
				 int groupid = RecordSet.getInt("groupid");
				 RecordSet.execute("update workflow_currentoperator set handleforwardid = "+ id +" ,groupdetailid = "+ groupdetailid +" ,groupid = "+ groupid +" where requestid="+requestid+" and userid="+resourceid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid);
			 }
			}else if(forwardflag==2){   //意见征询,设置标识位takisremark的值为 "2"
			    String checkoperatorsql = "select 1 from workflow_currentoperator where requestid="+requestid+" and userid="+resourceid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
			    RecordSet.execute(checkoperatorsql);
			    if(!RecordSet.next()){
				    para=requestid+ flag +resourceid+ flag +"0"+ flag +workflowid+""+ flag +workflowtype+ flag+usertype+flag + "1" +
			        flag + currentnodeid + flag + -1 + flag + "0" + flag + showorder+flag+"-1";
			        RecordSet.executeProc("workflow_CurrentOperator_I",para);
				    String IDsql = "select * from workflow_currentoperator where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
				    RecordSet.execute(IDsql);
				    if(RecordSet.next()){
					    //int id = RecordSet.getInt("id");
					    int groupdetailid = RecordSet.getInt("groupdetailid");
					    int groupid = RecordSet.getInt("groupid");
				        String Taksql = "update workflow_CurrentOperator set takisremark = 2, groupdetailid = "+ groupdetailid +" ,groupid = "+ groupid +" where requestid="+requestid+" and userid="+resourceid+" and usertype="+usertype+" and showorder="+showorder+" and isremark='1' and nodeid="+currentnodeid;
				        RecordSet.execute(Taksql);
				    }
				    String Taksql2 = "update workflow_CurrentOperator set takisremark = -2 where requestid="+requestid+" and userid="+userid+" and usertype="+usertype+" and isremark='0' and nodeid="+currentnodeid;
				    RecordSet.execute(Taksql2);
			    }
                agentSQL="select id from workflow_CurrentOperator where requestid="+requestid+" and userid="+resourceid+" and usertype="+usertype+" and isremark='1' and nodeid="+currentnodeid+" and showorder="+showorder+" order by id desc";
			}else if (!isPfx){
			para=requestid+ flag +resourceid+ flag +"0"+ flag +workflowid+""+ flag +workflowtype+ flag+usertype+flag + "1" +
		  flag + currentnodeid + flag + -1 + flag + "0" + flag + showorder+flag+"-1";
		  RecordSet.executeProc("workflow_CurrentOperator_I",para);
            agentSQL="select id from workflow_CurrentOperator where requestid="+requestid+" and userid="+resourceid+" and usertype="+usertype+" and isremark='1' and nodeid="+currentnodeid+" and showorder="+showorder+" order by id desc";
			}
		}
            if (forwardflag != 1 || !isPfx) {
                RecordSet.execute(agentSQL);
                if (RecordSet.next()) {
                    BeForwardid = RecordSet.getInt("id");
                }
            }
        }

    if(!isbeAgent){
    tempHrmIds += Util.toScreen(ResourceComInfo.getResourcename(resourceid),user.getLanguage()) + ",";
    receivedPersonids += Util.null2String(resourceid) + ",";
	  }
	  else{
	  tempHrmIds += Util.toScreen(ResourceComInfo.getResourcename(resourceid),user.getLanguage()) + "->"+ Util.toScreen(ResourceComInfo.getResourcename(agenterId),user.getLanguage())+ ",";
	  receivedPersonids += Util.null2String(resourceid) + ",";
	  }

	/* -----------   xwj for td3641 end -----------*/

	//流程测试状态下转发,不提醒被转发人 START
	int istest = 0;
	try{
		rs.execute("select isvalid from workflow_base where id="+workflowid);
		if(rs.next()){
			int isvalid_t = Util.getIntValue(rs.getString("isvalid"), 0);
			if(isvalid_t == 2){
				istest = 1;
			}
		}
	}catch(Exception e){
		e.printStackTrace();
	}

	if (istest != 1) {
        // 2004-05-19 刘煜修改, 在转发的时候加入对被转发人的工作流提醒(有新的工作流), 被转发人肯定为人力资源,因此类型默认为“0”


       if(isbeAgent){
           forwardresourceids += "," + agenterId;
        // PoppupRemindInfoUtil.insertPoppupRemindInfo(Integer.parseInt(agenterId),0,"0",Integer.parseInt(requestid),requestname);//xwj for td3450 20060111
            Map map=new HashMap();
		    map.put("userid",""+Integer.parseInt(agenterId));
		    map.put("type","0");
		    map.put("logintype","0");
		    map.put("requestid",""+Integer.parseInt(requestid));
		    map.put("requestname",""+requestname);
		    map.put("workflowid","-1");
		    map.put("creater","");
		    poppuplist.add(map);
       }
       else{
           forwardresourceids += "," + resourceid;

    	    Map map=new HashMap();
  		    map.put("userid",""+Integer.parseInt(resourceid));
  		    map.put("type","0");
  		    map.put("logintype","0");
  		    map.put("requestid",""+Integer.parseInt(requestid));
  		    map.put("requestname",""+requestname);
  		    map.put("workflowid","-1");
  		    map.put("creater","");
  		    poppuplist.add(map);
           //PoppupRemindInfoUtil.insertPoppupRemindInfo(Integer.parseInt(resourceid),0,"0",Integer.parseInt(requestid),requestname);//xwj for td3450 20060111
       }
	}
PoppupRemindInfoUtil.setPoppuplist(poppuplist);
int IsSubmitedOpinion=0;     //待办提交后被转发人是否可提交意见
int IsBeForwardTodo=0;    //待办可转发


int IsBeForwardSubmitAlready =0;    //允许已办被转发人可提交意见


int IsBeForwardAlready =0;		//已办被转发人可转发


int IsBeForwardSubmitNotaries =0;    //允许办结被转发人可提交意见


int IsBeForward=0;            //办结被转发人是否可转发


int IsFromWFRemark = -1;	 //被转发状态


	//流程测试状态下转发,不提醒被转发人 END
		//WFForwardManager.SaveForward(Util.getIntValue(requestid),wfcurrrid,BeForwardid);
if(isforwardrights.equals("1")){
IsSubmitedOpinion=Util.getIntValue(fu.getParameter("IsSubmitedOpinion"),0);     //待办提交后被转发人是否可提交意见
IsBeForwardTodo=Util.getIntValue(fu.getParameter("IsBeForwardTodo"),0);    //待办可转发


IsBeForwardSubmitAlready =Util.getIntValue(fu.getParameter("IsBeForwardSubmitAlready"),0);    //允许已办被转发人可提交意见


IsBeForwardAlready =Util.getIntValue(fu.getParameter("IsBeForwardAlready"),0);		//已办被转发人可转发


IsBeForwardSubmitNotaries =Util.getIntValue(fu.getParameter("IsBeForwardSubmitNotaries"),0);    //允许办结被转发人可提交意见


IsBeForward=Util.getIntValue(fu.getParameter("IsBeForward"),0);            //办结被转发人是否可转发


IsFromWFRemark = Util.getIntValue(fu.getParameter("IsFromWFRemark"),-1);
}
        //走优化的逻辑的话, 最后处理
        if (forwardflag != 1 || !isPfx) {
            WFForwardManager.SaveForward(Util.getIntValue(requestid), wfcurrrid, BeForwardid, forwardflag);
        }
		if(isforwardrights.equals("1")){
//int IsSubmitedOpinion=Util.getIntValue(fu.getParameter("IsSubmitedOpinion"),0);     //待办提交后被转发人是否可提交意见
//int IsBeForwardTodo=Util.getIntValue(fu.getParameter("IsBeForwardTodo"),0);    //待办可转发


//int IsBeForwardSubmitAlready =Util.getIntValue(fu.getParameter("IsBeForwardSubmitAlready"),0);    //允许已办被转发人可提交意见


//int IsBeForwardAlready =Util.getIntValue(fu.getParameter("IsBeForwardAlready"),0);		//已办被转发人可转发


//int IsBeForwardSubmitNotaries =Util.getIntValue(fu.getParameter("IsBeForwardSubmitNotaries"),0);    //允许办结被转发人可提交意见


//int IsBeForward=Util.getIntValue(fu.getParameter("IsBeForward"),0);            //办结被转发人是否可转发


		/*WFForwardManager.setIsSubmitedOpinion(IsSubmitedOpinion);
		WFForwardManager.setIsBeForwardTodo(IsBeForwardTodo);
		WFForwardManager.setIsBeForwardSubmitAlready(IsBeForwardSubmitAlready);
		WFForwardManager.setIsBeForwardAlready(IsBeForwardAlready);
		WFForwardManager.setIsBeForwardSubmitNotaries(IsBeForwardSubmitNotaries);
		WFForwardManager.setIsBeForward(IsBeForward);*/
		String wfSQL="select requestid from workflow_Forward where requestid="+requestid+" and Forwardid="+wfcurrrid+" and BeForwardid="+BeForwardid;
		RecordSet.execute(wfSQL);
if(RecordSet.next()){
		RecordSet.execute("update workflow_Forward set IsSubmitedOpinion="+IsSubmitedOpinion+",IsBeForwardTodo="+IsBeForwardTodo+",IsBeForwardSubmitAlready="+IsBeForwardSubmitAlready+",IsBeForward="+IsBeForward+",IsBeForwardAlready="+IsBeForwardAlready+",IsBeForwardSubmitNotaries="+IsBeForwardSubmitNotaries+",IsFromWFRemark="+IsFromWFRemark+" where requestid="+requestid+" and Forwardid="+wfcurrrid+" and BeForwardid="+BeForwardid);
	}
String sql_h="select currentnodetype from workflow_requestbase a where  a.requestid="+requestid;
String currentnodetype = "";
RecordSet.execute(sql_h);
if(RecordSet.next()){
  currentnodetype =RecordSet.getString("currentnodetype");
}
if(currentnodetype.equals("3")){
String  sql_u ="update workflow_currentoperator  set iscomplete=1 where  requestid= "+requestid;
RecordSet.execute(sql_u);
}
}

	}

    //批量插入处理
    if (insertOperatorParamsList != null && !insertOperatorParamsList.isEmpty()) {
        //处理islasttimes
        rs.executeUpdate("update workflow_currentoperator set islasttimes=0 where requestid=" + requestid +
                " and (" + Util.getSubINClause(StringUtils.join(insertOperatorIds, ","), "userid", "IN") + ") and usertype = 0");

        //防止workflowtype的值为空
        String forwardSql = "insert into workflow_currentoperator " +
                "(requestid, userid, groupid, workflowid, workflowtype, usertype, isremark, nodeid, agentorbyagentid, agenttype, showorder, receivedate, receivetime, viewtype, iscomplete, islasttimes, groupdetailid, preisremark, needwfback)" +
                "values(" + requestid + ", ?, 0, " + workflowid + ", " + workflowtype + ", 0, ?, " + currentnodeid + ", ?, ?, ?, ?, ?, 0, 0, 1, -1, ?, '1')";
        BatchRecordSet rst = new BatchRecordSet();

        rst.executeBatchSql(forwardSql, insertOperatorParamsList);

        String sltCurrtIdSql = "select id, userid, usertype, showorder " +
                "from workflow_CurrentOperator " +
                "where requestid=" + requestid + " and isremark='1' and nodeid=" + currentnodeid + " and receivedate='" + CurrentDate + "' and receivetime='" + CurrentTime + "' order by id desc";
        rs.executeSql(sltCurrtIdSql);

        List<List<Object>> insertForwardParamsList = new ArrayList<List<Object>>();
        while (rs.next()) {
            int currtId = Util.getIntValue(rs.getString("id"));
            int currtUserId = Util.getIntValue(rs.getString("userid"));
            int currtShoworder = Util.getIntValue(rs.getString("showorder"));
            int insertUserIndex = insertUesrids.indexOf(currtUserId + "");
            int insertShowOrderIndex = insertShowOrderids.indexOf(currtShoworder);
            if (insertUserIndex != -1 && insertUserIndex == insertShowOrderIndex) {
                List<Object> forwardSqlParamList = new ArrayList();
                forwardSqlParamList.add(currtId);
                insertForwardParamsList.add(forwardSqlParamList);
                //防止一个人有多次记录的情况
                insertUesrids.remove(insertUserIndex);
                insertShowOrderids.remove(insertUserIndex);
            }
        }

        if (insertForwardParamsList != null && !insertForwardParamsList.isEmpty()) {
            WFForwardManager.insertForwardInfo(Util.getIntValue(requestid), wfcurrrid, insertForwardParamsList);
        }
    }
    //推送处理start
    WFPathUtil wfutil = new WFPathUtil();
    //有需要提醒的信息,才抛出处理
    if (PoppupRemindInfoUtil.getPoppuplist() != null && !PoppupRemindInfoUtil.getPoppuplist().isEmpty()) {
        wfutil.getFixedThreadPool().execute(PoppupRemindInfoUtil);
    }
//        PoppupRemindInfoUtil.insertPoppupRemindInfo(poppuplist);

    //将代理人加入人员列表,用于发送邮件通知和设置共享


    for(i=0;i<agenterids.size();i++){
        resourceids.add(agenterids.get(i));
    }

	String isfeedback="";
    String isnullnotfeedback="";
	RecordSet.executeSql("select isfeedback,isnullnotfeedback from workflow_flownode where workflowid="+workflowid+" and nodeid="+currentnodeid);
	if(RecordSet.next()){
		isfeedback=Util.null2String(RecordSet.getString("isfeedback"));
        isnullnotfeedback=Util.null2String(RecordSet.getString("isnullnotfeedback"));
	}
	/*
	if (!ifchangstatus.equals("")&&isfeedback.equals("1")&&((isnullnotfeedback.equals("1")&&!Util.replace(remark, "\\<script\\>initFlashVideo\\(\\)\\;\\<\\/script\\>", "", 0, false).equals(""))||!isnullnotfeedback.equals("1")))
		{
		RecordSet.executeSql("update workflow_currentoperator set viewtype =-1  where needwfback='1' and requestid=" + requestid + " and userid<>" + userid + " and viewtype=-2");
		}*/

   //发送邮件


       sendMail.setForwardflag(forwardflag);
       sendMail.setRequest(fu);
       sendMail.sendMailAndMessage(Integer.parseInt(requestid),new ArrayList(resourceids),user);
	//加入LOG表信息


	  RecordSet.executeSql("select * from workflow_currentoperator where userid = " + userid + " and nodeid = " + currentnodeid + " and isremark in ('0','1','4') and requestid = "+ requestid+" order by showorder,receivedate,receivetime");
    int tempagentorbyagentid = -1;
    int tempagenttype = 0;
    if(RecordSet.next()){
    showorder =  RecordSet.getInt("showorder");
    tempagentorbyagentid = RecordSet.getInt("agentorbyagentid");
    tempagenttype = RecordSet.getInt("agenttype");
    if(tempagenttype<0) tempagenttype = 0;
    }
	String currentnodetype = "";
	RecordSet.executeSql("select currentnodetype from workflow_requestbase where requestid= "+requestid);
	if(RecordSet.next()){
		currentnodetype = RecordSet.getString("currentnodetype");
		if(currentnodetype.equals("3")){
			tempagentorbyagentid = -1;
			tempagenttype = 0;
		}
	}
    RequestAnnexUpload rau=new RequestAnnexUpload();
    rau.setRequest(fu);
    rau.setUser(user);
    String annexdocids=rau.AnnexUpload();
    String Procpara="";
	if(forwardflag==2){
       Procpara=requestid+"" + flag + workflowid+"" + flag + currentnodeid+"" + flag + "a" + flag
    	+ CurrentDate + flag + CurrentTime + flag + userid+"" + flag
    	//+ CurrentDate + flag + CurrentTime + flag + userid+"" + flag + remark + flag
    	+ clientip+flag+operatortype+flag+"0"+flag+tempHrmIds.trim() + flag + tempagentorbyagentid + flag + tempagenttype + flag + showorder+flag+annexdocids+flag+requestLogId+ flag + signdocids+flag+signworkflowids+flag+"0"+flag+"0"+flag+"0"+flag+receivedPersonids.trim()+flag+remarkLocation; //xwj for td1837 on 2005-05-12
    }
	if(forwardflag==3){
       Procpara=requestid+"" + flag + workflowid+"" + flag + currentnodeid+"" + flag + "h" + flag
    	+ CurrentDate + flag + CurrentTime + flag + userid+"" + flag
    	//+ CurrentDate + flag + CurrentTime + flag + userid+"" + flag + remark + flag
    	+ clientip+flag+operatortype+flag+"0"+flag+tempHrmIds.trim() + flag + tempagentorbyagentid + flag + tempagenttype + flag + showorder+flag+annexdocids+flag+requestLogId+ flag + signdocids+flag+signworkflowids+flag+"0"+flag+"0"+flag+"0"+flag+receivedPersonids.trim()+flag+remarkLocation; //xwj for td1837 on 2005-05-12
    }
	if(forwardflag==1){
       Procpara=requestid+"" + flag + workflowid+"" + flag + currentnodeid+"" + flag + "7" + flag
    	+ CurrentDate + flag + CurrentTime + flag + userid+"" + flag
    	//+ CurrentDate + flag + CurrentTime + flag + userid+"" + flag + remark + flag
    	+ clientip+flag+operatortype+flag+"0"+flag+tempHrmIds.trim() + flag + tempagentorbyagentid + flag + tempagenttype + flag + showorder+flag+annexdocids+flag+requestLogId+ flag + signdocids+flag+signworkflowids+flag+"0"+flag+"0"+flag+"0"+flag+receivedPersonids.trim()+flag+remarkLocation; //xwj for td1837 on 2005-05-12
    }
    String currentString = new RequestManager().execRequestlog(Procpara,rs,flag,remark);
	
	//代理转办,更新签字意见之后再更新。
	for(int j=0;j<agenterids.size();j++){
        String agentResourceid = (String)agenterids.get(j);
		if(forwardflag==3 && !agentResourceid.equals(userid) ){
			String ForwardHsqldc = "update workflow_currentoperator set isremark = 2 where requestid="+requestid+" and userid="+userid+" and usertype="+operatortype+" and isremark='0' and agenttype='2' and nodeid="+currentnodeid;
			RecordSet.execute(ForwardHsqldc);
		}
    }
	
    String configsql = "select notseeeachother from workflow_flownode where workflowid = " + workflowid + " and nodeid = " + currentnodeid;
    rs.executeSql(configsql);
    int notseeeachother = 0;
    if(rs.next()){
        notseeeachother = rs.getInt(1);
    }
  	if(!"".equals(currentString) && currentString.indexOf("~~current~~") > -1 && notseeeachother == 1){
  		String [] arraycurrent = Util.TokenizerString2(currentString, "~~current~~");
  		String currentdate = arraycurrent[0];
  		String currenttime = arraycurrent[1];
  		RequestSignRelevanceWithMe reqsignwm = new RequestSignRelevanceWithMe();
        reqsignwm.inertRelevanceInfo(workflowid+"", requestid, currentnodeid+"", "7", currentdate, currenttime, userid, remark, (("" != forwardresourceids) ? forwardresourceids.substring(1) : forwardresourceids));

        int nodeattr = WFLinkInfo.getNodeAttribute(currentnodeid);
        Set<String> branchNodeSet = new HashSet<String>();
        if(nodeattr == 2){   //分支中间节点
        	String branchnodes = "";
        	branchnodes = WFLinkInfo.getNowNodeids(Util.getIntValue(requestid,-1));
        	if(!"".equals(branchnodes)){
        		String [] strs = branchnodes.split(",");
        		for(int k = 0; k < strs.length; k++){
        			String nodestr = strs[k];
        			if(!"-1".equals(nodestr)){
        				branchNodeSet.add(nodestr);
        			}
        		}
        	}
        }
        /**日志的权限处理,start*/
        if(!"3".equals(currnodetype0) && (currentnodeid == currnodeid0 || branchNodeSet.contains(currentnodeid+""))){   //非归档节点,且是在当前节点上的转发操作
	        remarkRight.setRequestid(Util.getIntValue(requestid,-1));
	        remarkRight.setNodeid(currentnodeid);
	        remarkRight.setWorkflow_currentid(wfcurrrid);
	        String logtype = "7";
	        if(forwardflag == 2){   //征询
	        	logtype = "a";
	        }else if(forwardflag == 3){  //转办
	        	logtype = "h";
	        }else{  //转发
	        	logtype = "7";
	        }
	        String rightSql = " select logid from workflow_requestlog where workflowid = " + workflowid
	        		        + " and nodeid = " + currentnodeid + " and logtype = '" + logtype + "' and requestid = " + requestid
	        		        + " and operatedate = '" + currentdate + "' and operatetime = '" + currenttime + "' and operator = " + userid;
	        RecordSet.executeSql(rightSql);
	        int logid = -1;
	        if(RecordSet.next()){
	        	logid = RecordSet.getInt("logid");
	        }
	        String receiversids = "";  //授予权限的人员
	        //这里将转发的接收人,以及接收人的代理人都授权,避免代理人收回代理权限时,还需要处理签字意见的权限问题
	        for(Object myuserid : resourceids){
	        	receiversids += "," + myuserid;
	        }
	        if(receiversids.length() > 0){
	        	receiversids = receiversids.substring(1);
	        }
	        remarkRight.saveRemarkRight(logid,receiversids);
        }
        /**日志的权限处理,end*/
  	}

  	int nodeattr = WFLinkInfo.getNodeAttribute(currentnodeid);
	if(forwardflag == 3&&nodeattr==2){
		new RequestManager().CheckUserIsLasttimes(Util.getIntValue(requestid), currentnodeid, user);
	}

    /*RecordSet.executeProc("workflow_RequestLog_Insert",Procpara);
    if (RecordSet.next()) {
        String currentdate = RecordSet.getString(1);
        String currenttime = RecordSet.getString(2);

        RequestSignRelevanceWithMe reqsignwm = new RequestSignRelevanceWithMe();
        reqsignwm.inertRelevanceInfo(workflowid+"", requestid, currentnodeid+"", "7", currentdate, currenttime, userid, remark, forwardresourceids.substring(1));
    }*/

    if(requestLogId>0){//表单签章
    	RecordSet.executeSql("select imagefileid from workflow_formsignremark where requestlogid="+requestLogId);
    	RecordSet.next();
    	int imagefileid = Util.getIntValue(RecordSet.getString("imagefileid"),0);
    	if(imagefileid>0) remark=""+requestLogId;
    }
    if (!ifchangstatus.equals("")&&isfeedback.equals("1")&&((isnullnotfeedback.equals("1")&&!Util.replace(remark, "\\<script\\>initFlashVideo\\(\\)\\;\\<\\/script\\>", "", 0, false).equals(""))||!isnullnotfeedback.equals("1")))
    {
    	RecordSet.executeSql("update workflow_currentoperator set viewtype =-1  where needwfback='1' and requestid=" + requestid + " and userid<>" + userid + " and viewtype=-2");
    }

	//处理之前节点操作人对附件的权限 TD10577 Start
	String[] docids = Util.TokenizerString2(annexdocids, ",");
	for(int cx=0; i<docids.length; i++){
		int docid_tmp = Util.getIntValue(docids[cx]);
		for (Object rightResourceid_tmpObj : rightResourceidList) {
			int rightResourceid_tmp = Util.getIntValue((String)rightResourceid_tmpObj, 0);
			try{
				ShareinnerInfo shareInfo=new ShareinnerInfo();
				shareInfo.AddShare(docid_tmp, 1, rightResourceid_tmp, 10, 1, 1, rightResourceid_tmp, "ShareinnerDoc", 1);
			}catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
	//处理之前节点操作人对附件的权限 TD10577 End

    //保存签字意见提交人当前部门


    //String departmentid = Util.null2String(ResourceComInfo.getDepartmentID(""+userid));
    //if(!departmentid.equals("")) rs.executeSql("update workflow_requestlog set operatorDept="+departmentid+" where requestid="+requestid+" and nodeid="+currentnodeid+" and logtype='7' and operator="+userid+" and operatortype="+operatortype);

    if(!signdocids.equals("")){
        RecordSet.executeSql("select docids from workflow_requestbase where requestid="+requestid);
        RecordSet.next();
        String newdocids = Util.null2String(RecordSet.getString("docids"));
        if(!newdocids.equals("")) newdocids = newdocids+","+signdocids;
        else newdocids = signdocids;
        RecordSet.executeSql("update workflow_requestbase set docids='"+newdocids+"' where requestid="+requestid);
    }
    RequestAddShareInfo.SetNextNodeID(currentnodeid);
	//处理模板为只读,转办后附件可以编辑
	String result = "";
	String isEdit = "";
	String sql1 = "select * from workflow_nodeform  where nodeid = "+currentnodeid+" and exists (select 1 from workflow_billfield where workflow_nodeform.fieldid = workflow_billfield.id and workflow_billfield.fieldhtmltype='6' and type in(1,2))";
	RecordSet.executeSql(sql1);
	while(RecordSet.next()){
		isEdit = Util.null2String(RecordSet.getString("isedit"));
	}
	if("0".equals(isEdit) || "".equals(isEdit)){
		result = "false";
	}else{
		result = "true";
	}

    if(forwardflag == 1){
        RequestAddShareInfo.addShareInfo(requestid,new ArrayList(resourceids),"false", forwardflag == 2, "1".equals(WFForwardManager.getIsBeForwardModify())) ;
	}else{
		RequestAddShareInfo.addShareInfo(requestid,new ArrayList(resourceids), result, forwardflag == 2, "1".equals(WFForwardManager.getIsBeForwardModify())) ;
	}

    //added by pony on 2006-05-31 for Td4442
    RemarkOperaterManager.processRemark(workflowid,requestid,currentnodeid,user,fu);
    RequestAddOpinionShareInfo.processOpinionRemarkResourcesShare(workflowid,requestid,new ArrayList(resourceids),user,currentnodeid);
    //added end.
    //RecordSet.executeSql("update workflow_requestbase set lastoperator="+userid+",lastoperatortype="+usertype+",lastoperatedate='"+CurrentDate+"',lastoperatetime='"+CurrentTime+"' where requestid="+requestid);
  	if(currentnodetype.equals("3"))//如果流程已归档,不修改lastoperatedate和lastoperatetime的值


   	    RecordSet.executeSql("update workflow_requestbase set lastoperator="+userid+",lastoperatortype="+usertype+" where requestid="+requestid);
   	//else
   	    //RecordSet.executeSql("update workflow_requestbase set lastoperator="+userid+",lastoperatortype="+usertype+",lastoperatedate='"+CurrentDate+"',lastoperatetime='"+CurrentTime+"' where requestid="+requestid);

	//TD9144 弹出转发窗口,提交转发请求后,关闭该窗口,并刷新原页面

	// 查询当前请求的一些基本信息
	if(forwardflag == 1){

	    try{
		    RecordSet.executeQuery("select isbill,formid from workflow_base where id = ? ", workflowid);
		    if(RecordSet.next()){
		        int isbill = RecordSet.getInt("isbill");
		        int formid = RecordSet.getInt("formid");
	            RecordSet.executeProc("workflow_Requestbase_SByID", requestid + "");
	            if (RecordSet.next()) {
	                String oldformsignaturemd5 = Util.null2String(RecordSet.getString("formsignaturemd5"));

	                //推送处理start
//	                WFPathUtil wfutil = new WFPathUtil();

	                if(tmpid.length() > 0){
	                    String[] tmpids = Util.TokenizerString2(tmpid, ",");
	                    for (Object tmpidObj : tmpids) {
	                        int tmpuserid = Util.getIntValue((String)tmpidObj, 0);
	                        if(tmpuserid > 0){
	                            User userTemp = User.getUser(tmpuserid,Integer.valueOf(usertype));
	                            wfutil.getFixedThreadPool().execute(new RequestPreProcessing("0", workflowid, isbill, formid, Integer.valueOf(requestid), requestname, oldformsignaturemd5, currentnodeid, currentnodeid, false, "0", userTemp, true));
	                        }
	                    }
	                }
	                //推送处理end
	            }
		    }
	    }catch(Exception e){}
	}

    //response.sendRedirect("/workflow/request/ViewRequest.jsp?requestid="+requestid);

}else{
    messageid="6";
}

//记录日志
rolm.flowTransSubmitAfter();

//    System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>转发结束,共耗时:" + (new Date().getTime() - d1.getTime()));
%>
<script language=javascript>
//关闭处理对话框


var forwardflag = <%=forwardflag%>
if($("#bodyiframe",window.parent.parent.document).length>0){		//流程处理界面转发
	var pwindow=window.parent.parent.document.getElementById("bodyiframe").contentWindow;
if(forwardflag==1){
	//alert("流程已转发成功");
	try {
		var pdialog = parent.parent.getDialog(window.parent);
		//var _document = $("#bodyiframe",window.parent.parent.document)[0].contentWindow.document;
		//jQuery("#lastOperateDate", _document).val("<%=CurrentDate %>");
		//jQuery("#lastOperateTime", _document).val("<%=CurrentTime %>");
		//jQuery("#lastOperator", _document).val("<%=user.getUID()%>");
		pdialog.close();
	} catch (e) {}
	//pwindow.parent.location.href="/workflow/request/ViewRequest.jsp?requestid=<%=requestid%>&message=<%=messageid%>";
	//刷新流转意见
	//pwindow.flipOver(-1);
	try {
		pwindow.jQuery("#oTDtype_0").children("a")[0].click();
		//pwindow.toggertab(0)
	} catch (e) {}
}else if(forwardflag==2){
	alert("<%=SystemEnv.getHtmlLabelName(84512,user.getLanguage())%>");
pwindow.parent.location.href="/workflow/request/ViewRequest.jsp?f_weaver_belongto_userid=<%=userid%>&f_weaver_belongto_usertype=<%=f_weaver_belongto_usertype%>&requestid=<%=requestid%>&message=<%=messageid%>";
//刷新门户流程待办
	if(jQuery('#btnWfCenterReload',pwindow.parent.opener.document)[0]){
		pwindow.parent.opener.btnWfCenterReload.onclick();
	}
	//刷新流转意见
pwindow.flipOver(-1);
pwindow.parent.close();
pwindow.parent.opener._table.reLoad();
}else{
	alert("<%=SystemEnv.getHtmlLabelName(84513,user.getLanguage())%>");
pwindow.parent.location.href="/workflow/request/ViewRequest.jsp?f_weaver_belongto_userid=<%=userid%>&f_weaver_belongto_usertype=<%=f_weaver_belongto_usertype%>&requestid=<%=requestid%>&message=<%=messageid%>";
	//刷新门户流程待办
	if(jQuery('#btnWfCenterReload',pwindow.parent.opener.document)[0]){
		pwindow.parent.opener.btnWfCenterReload.onclick();
	}
	//刷新流转意见

pwindow.flipOver(-1);
pwindow.parent.close();
pwindow.parent.opener._table.reLoad();
}
}else{		//流程列表行按钮转发


	try {
		var pdialog = parent.parent.getDialog(window.parent);
		pdialog.close();
	} catch (e) {}

	try {
		window.parent.parent.opener.parent.location.href = "/workflow/request/ViewRequest.jsp?f_weaver_belongto_userid=<%=userid%>&f_weaver_belongto_usertype=<%=f_weaver_belongto_usertype%>&requestid=<%=requestid%>&message=<%=messageid%>";
		window.parent.parent.close();
	} catch (e) {}
}
</script>