RequestViewAjaxCount.jsp 44.4 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
<%@page import="weaver.systeminfo.SystemEnv"%>
<%@page import="weaver.hrm.User"%>
<%@page import="weaver.hrm.HrmUserVarify"%>
<%@ page import="weaver.conn.*" %>
<%@ page import="java.util.*" %>
<%@ page import="weaver.general.*"%>

<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="org.json.JSONArray"%>
<%@page import="org.json.JSONObject"%>
<%@page import="weaver.workflow.workflow.WorkflowVersion"%>
<%@ page import="weaver.systeminfo.menuconfig.LeftMenuInfoHandler" %>
<%@ page import="weaver.systeminfo.menuconfig.LeftMenuInfo" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
<jsp:useBean id="WorkTypeComInfo" class="weaver.workflow.workflow.WorkTypeComInfo" scope="page"/>
<jsp:useBean id="WorkflowComInfo" class="weaver.workflow.workflow.WorkflowComInfo" scope="page"/>
<jsp:useBean id="CustomerInfoComInfo" class="weaver.crm.Maint.CustomerInfoComInfo" scope="page" />
<jsp:useBean id="WrokflowOverTimeTimer" class="weaver.system.WrokflowOverTimeTimer" scope="page" />
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="sysInfo" class="weaver.system.SystemComInfo" scope="page"/>
<jsp:useBean id="AllManagers" class="weaver.hrm.resource.AllManagers" scope="page"/>
<jsp:useBean id="HrmListValidate" class="weaver.hrm.resource.HrmListValidate" scope="page" />
<jsp:useBean id="requestutil" class="weaver.workflow.request.todo.RequestUtil" scope="page" />

<%
String f_weaver_belongto_userid=request.getParameter("f_weaver_belongto_userid");//需要增加的代码
String f_weaver_belongto_usertype=request.getParameter("f_weaver_belongto_usertype");//需要增加的代码
User user = HrmUserVarify.getUser(request, response, f_weaver_belongto_userid, f_weaver_belongto_usertype) ;//需要增加的代码
if(user==null) {
    return;
}
	boolean isUseOldWfMode=sysInfo.isUseOldWfMode();
	String cursltwftypeid = Util.null2String(request.getParameter("wftype"));
	String cursltwfid = Util.null2String(request.getParameter("workflowid"));

	if(Util.getIntValue(cursltwftypeid)<0){
		cursltwftypeid = "" ;
	}
	if(Util.getIntValue(cursltwfid)<0){
		cursltwfid = "" ;
	}
	String curoptwfid = Util.null2String(request.getParameter("optkeys"));

	if(!"".equals(cursltwfid) && "".equals(cursltwftypeid)){
		cursltwftypeid = WorkflowComInfo.getWorkflowtype(cursltwfid);
    } else if (!"".equals(curoptwfid)) {
		String optwfid = "";
        String optkeysql = "select distinct workflowid from workflow_requestbase where requestid in (" + curoptwfid + ")";
        RecordSet rs9 = new RecordSet();
        rs9.executeSql(optkeysql);
        while (rs9.next()) {
            cursltwftypeid += "," + WorkflowComInfo.getWorkflowtype(WorkflowVersion.getActiveVersionWFID(rs9.getString(1)));
        }

		if (cursltwftypeid.length() > 1) {
		    cursltwftypeid = cursltwftypeid.substring(1, cursltwftypeid.length());
		}
    }

	String offical = Util.null2String(request.getParameter("offical"));
	int officalType = Util.getIntValue(request.getParameter("officalType"),-1);
	String loadtree = Util.null2String(request.getParameter("loadtree"));
    //System.out.println("loadtree:"+loadtree);
	boolean isfromtab =  Util.null2String(request.getParameter("isfromtab")).equals("true")?true:false;
	int requestid = Util.getIntValue((String)session.getAttribute("requestidForAllBill"),0);
	String topage_ForAllBill = Util.null2String((String)session.getAttribute("topage_ForAllBill"));

	if(!"".equals(topage_ForAllBill)){
	if(topage_ForAllBill.indexOf("/proj/process/ViewTask.jsp") == 0 || topage_ForAllBill.indexOf("/proj/plan/ViewTask.jsp") == 0){
		response.sendRedirect(topage_ForAllBill+"&requestid="+requestid);
		session.setAttribute("topage_ForAllBill","");
		return;
	}else if(topage_ForAllBill.indexOf("RequestOperation.jsp") > 0){
		int tempInt = topage_ForAllBill.lastIndexOf("3D");
		String tempString = topage_ForAllBill.substring(tempInt+2);
		response.sendRedirect("/proj/process/ViewTask.jsp?taskrecordid="+tempString+"&requestid="+requestid);
		session.setAttribute("topage_ForAllBill","");
		return;
	}
	}

    String resourceid= Util.null2String(request.getParameter("resourceid"));
    AllManagers.getAll(resourceid);
    if("".equals(resourceid)){
    	resourceid = ""+user.getUID();
    }
    boolean isSelf		=	false;
	boolean isManager	=	false;
	RecordSet.executeProc("HrmResource_SelectByID",resourceid);
	RecordSet.next();
	String departmentid = Util.toScreen(RecordSet.getString("departmentid"),user.getLanguage()) ;		/*所属部门*/
	if (resourceid.equals(""+user.getUID()) ){
			isSelf = true;
		}
	while(AllManagers.next()){
		String tempmanagerid = AllManagers.getManagerID();
		if (tempmanagerid.equals(""+user.getUID())) {
			isManager = true;
		}
	}
	if(!(((isSelf || isManager || HrmUserVarify.checkUserRight("HrmResource:Workflow",user,departmentid))))){
		//response.sendRedirect("/notice/noright.jsp") ;
	}

    String logintype = ""+user.getLogintype();
    int usertype = 0;
    if(logintype.equals("2")) usertype= 1;

    /* edited by wdl 2006-06-14 left menu advanced menu */
    int fromAdvancedMenu = Util.getIntValue(request.getParameter("fromadvancedmenu"),0);
    String selectedContent = Util.null2String(request.getParameter("selectedContent"));
    String menuType = Util.null2String(request.getParameter("menuType"));
    int infoId = Util.getIntValue(request.getParameter("infoId"),0);
	  if(selectedContent!=null && selectedContent.startsWith("key_")){
			String menuid = selectedContent.substring(4);
			RecordSet.executeSql("select * from menuResourceNode where contentindex = '"+menuid+"'");
			selectedContent = "";
			while(RecordSet.next()){
				String keyVal = RecordSet.getString(2);
				selectedContent += keyVal +"|";
			}
			if(selectedContent.indexOf("|")!=-1)
				selectedContent = selectedContent.substring(0,selectedContent.length()-1);
	}
	if(fromAdvancedMenu == 1){
		response.sendRedirect("/workflow/search/WFSearchCustom.jsp?fromadvancedmenu=1&infoId="+infoId+"&selectedContent="+selectedContent+"&menuType="+menuType);
		return;
	}
    String selectedworkflow = "";
    LeftMenuInfoHandler infoHandler = new LeftMenuInfoHandler();
    LeftMenuInfo info = infoHandler.getLeftMenuInfo(infoId);
    if(info!=null){
    	selectedworkflow = info.getSelectedContent();
    }
    if(!"".equals(selectedContent))
    {
    	selectedworkflow = selectedContent;
    }
    selectedworkflow+="|";
    /* edited end */
String userID = String.valueOf(user.getUID());
String userIDAll = String.valueOf(user.getUID());
int userid=user.getUID();
String belongtoshow = "";
		RecordSet.executeSql("select * from HrmUserSetting where resourceId = "+userID);
		if(RecordSet.next()){
			belongtoshow = RecordSet.getString("belongtoshow");
		}
//QC235172,如果不是查看自己的代办,主从账号统一显示不需要判断
if(!isSelf) belongtoshow = "";
String Belongtoids =user.getBelongtoids();
int Belongtoid=0;
String[] arr2 = null;
ArrayList<String> userlist = new ArrayList();
userlist.add(userid + "");
if(!"".equals(Belongtoids)){
userIDAll = userID+","+Belongtoids;
arr2 = Belongtoids.split(",");
for(int i=0;i<arr2.length;i++){
Belongtoid = Util.getIntValue(arr2[i]);
userlist.add(Belongtoid + "");
}
}


    if(resourceid.equals("")) {
        session.removeAttribute("RequestViewResource") ;
    }
    else {
        session.setAttribute("RequestViewResource",resourceid) ;
    }
    boolean superior = false;  //是否为被查看者上级或者本身

	if("".equals(resourceid) || userID.equals(resourceid))
	{
        resourceid = userID;
		superior = true;
	}
	else
	{
		rs.executeSql("SELECT * FROM HrmResource WHERE ID = " + resourceid + " AND managerStr LIKE '%," + userID + ",%'");

		if(rs.next())
		{
			superior = true;
		}
	}

    char flag = Util.getSeparator();

    String username = Util.toScreen(ResourceComInfo.getResourcename(resourceid),user.getLanguage());

    if(logintype.equals("2")) username = Util.toScreen(CustomerInfoComInfo.getCustomerInfoname(""+user.getUID()),user.getLanguage()) ;

    String imagefilename = "/images/hdReport_wev8.gif";
    String titlename =  SystemEnv.getHtmlLabelName(1207,user.getLanguage()) + ": "+SystemEnv.getHtmlLabelName(367,user.getLanguage());
    String needfav ="1";
    String needhelp ="";
	String tworkflowNodeIDs = "";


	String typeid="";
	String typecount="";
	String typename="";
	String workflowid="";
	String workflowcount="";
    String newremarkwfcount0="";
    String newremarkwfcount1="";
    String wfsupedcount="";
	String workflowname="";

    ArrayList wftypeList=new ArrayList();
	ArrayList wftypecountList=new ArrayList();
	ArrayList workflowList=new ArrayList();
	ArrayList workflowcountList=new ArrayList();
    ArrayList newremarkwfcount0List=new ArrayList();//待办数量
    ArrayList newremarkwfcount1List=new ArrayList();//反馈数量
    ArrayList wftypeworkflowList=new ArrayList();
    ArrayList wfovertimecountList=new ArrayList();//超时数量
    ArrayList wfsupedcountList = new ArrayList();	//被督办数量

	Hashtable wfNodeHahstable = new Hashtable();


	Map newremarkwfcount0Map=new Hashtable();//待办数量
	Map newremarkwfcount1Map=new Hashtable();//反馈数量
	Map wftypeworkflowMap=new Hashtable();
	Map wfovertimecountMap=new Hashtable();//超时数量
	Map wfsupedcountMap = new Hashtable();	//被督办数量


    int totalcount=0;
    String wftypes = "";
    String demoLeftMenus = "";
    //String SQL = "";
    //SQL = "select workflowtype, workflowid from workflow_currentoperator where (isremark='0' or isremark='1' or isremark='5' or isremark='8' or isremark='9' or isremark='7')  and islasttimes=1 and userid=" +  resourceid  + " and usertype= " + usertype +"  and exists (select 1 from workflow_requestbase c where c.workflowid=workflow_currentoperator.workflowid and c.requestid=workflow_currentoperator.requestid)";

    StringBuffer sqlsb = new StringBuffer();
    sqlsb.append("select workflowtype, workflowid ");
    sqlsb.append("  from workflow_currentoperator ");
    sqlsb.append("	  where ( (isremark = '0' and (takisremark is null or takisremark=0)) or ");
    sqlsb.append("        isremark = '1' or isremark = '5' or isremark = '8' or isremark = '9' or isremark = '7') ");
    sqlsb.append("   and islasttimes = 1 ");
    if(!"".equals(cursltwftypeid)){
	    sqlsb.append("   and workflowtype in ( ").append(cursltwftypeid).append(")");
    }
    //if(!"".equals(cursltwfid)){
	//    sqlsb.append("   and workflowid = ").append(cursltwfid);
    //}
    	if("1".equals(belongtoshow)){
		sqlsb.append("	    and userid in (").append(userIDAll);
		}else{
		sqlsb.append("	    and userid in (").append(resourceid);
		}
    sqlsb.append("  ) and usertype = ").append(usertype);
	sqlsb.append(" and  workflowid in (select id from workflow_base where (isvalid=1 or isvalid=3) )  ");
    sqlsb.append("   and exists (select 1 ");
    sqlsb.append("          from workflow_requestbase c ");
    sqlsb.append("         where (c.deleted <> 1 or c.deleted is null or c.deleted='') and c.workflowid = workflow_currentoperator.workflowid ");
    if(RecordSet.getDBType().equals("oracle"))
	{
		sqlsb.append(" and (nvl(c.currentstatus,-1) = -1 or (nvl(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}else if(RecordSet.getDBType().equals("mysql")){
		sqlsb.append(" and (ifnull(c.currentstatus,-1) = -1 or (ifnull(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}
	else
	{
		sqlsb.append(" and (isnull(c.currentstatus,-1) = -1 or (isnull(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}
    sqlsb.append("           and c.requestid = workflow_currentoperator.requestid)");

	//RecordSet.executeSql("select workflowtype, workflowid, viewtype, count(distinct requestid) workflowcount from workflow_currentoperator where (isremark='0' or isremark='1' or isremark='5') and islasttimes=1 and (isprocessed is null or (isprocessed<>'2' and isprocessed<>'3')) and userid=" +  resourceid  + " and usertype= " + usertype +" group by workflowtype, workflowid, viewtype order by workflowtype, workflowid " ) ;
    //System.out.print("select workflowtype, workflowid from workflow_currentoperator where (isremark='0' or isremark='1' or isremark='5')  and islasttimes=1 and userid=" +  resourceid  + " and usertype= " + usertype +"  and exists (select 1 from workflow_requestbase c where c.requestid=workflow_currentoperator.requestid) group by workflowtype, workflowid order by workflowtype, workflowid "  ) ;
    //RecordSet.executeSql("select distinct a.workflowtype, a.workflowid from workflow_currentoperator a ,workflow_requestbase b  where a.requestid=b.requestid and (b.currentnodetype <> '3' or  (a.isremark ='1' and b.currentnodetype = '3')) and (a.isremark='0' or a.isremark='1' or a.isremark='5')  and a.userid=" +  resourceid  + " and a.usertype= " + usertype +" group by a.workflowtype, a.workflowid order by a.workflowtype, a.workflowid " ) ;
	if(!superior)
	{
		//SQL += " AND EXISTS (SELECT NULL FROM workFlow_CurrentOperator b WHERE workflow_currentoperator.workflowid = b.workflowid AND workflow_currentoperator.requestid = b.requestid AND b.userid=" + user.getUID() + " and b.usertype= " + usertype +") ";
			if("1".equals(belongtoshow)){
		sqlsb.append(" AND EXISTS (SELECT NULL FROM workFlow_CurrentOperator b WHERE workflow_currentoperator.workflowid = b.workflowid AND workflow_currentoperator.requestid = b.requestid AND b.userid in (" + userIDAll + ") and b.usertype= " + usertype +") ");
			}else{
			sqlsb.append(" AND EXISTS (SELECT NULL FROM workFlow_CurrentOperator b WHERE workflow_currentoperator.workflowid = b.workflowid AND workflow_currentoperator.requestid = b.requestid AND b.userid in (" + user.getUID() + ") and b.usertype= " + usertype +") ");
			}
	}
	if(offical.equals("1")){//发文/收文/签报
		if(officalType==1){
			sqlsb.append(" and workflowid in (select id from workflow_base where isWorkflowDoc=1 and officalType in (1,3) and (isvalid=1 or isvalid=3))");
		}else if(officalType==2){
			sqlsb.append(" and workflowid in (select id from workflow_base where isWorkflowDoc=1 and officalType=2 and (isvalid=1 or isvalid=3))");
		}
	}
	//SQL += " group by workflowtype, workflowid order by workflowtype, workflowid";
	sqlsb.append(" group by workflowtype, workflowid order by workflowtype, workflowid ");
    RecordSet.executeSql(sqlsb.toString());
    while(RecordSet.next()){
        String theworkflowid = Util.null2String(RecordSet.getString("workflowid")) ;
        String theworkflowtype = Util.null2String(RecordSet.getString("workflowtype")) ;

        theworkflowid = WorkflowVersion.getActiveVersionWFID(theworkflowid);
        if(WorkflowComInfo.getIsValid(theworkflowid).equals("1"))
        {

            /* added by wdl 2006-06-14 left menu advanced menu */
    	 	if(selectedworkflow.indexOf("T"+theworkflowtype+"|")==-1 && fromAdvancedMenu==1) continue;
    	 	if(selectedworkflow.indexOf("W"+theworkflowid+"|")==-1 && fromAdvancedMenu==1) continue;
    	 	/* added end */

    	 	if(wftypeworkflowList.indexOf(theworkflowtype+","+theworkflowid)<0){
        	 	wftypeworkflowList.add(theworkflowtype+","+theworkflowid);
            }
            int wftindex = wftypeList.indexOf(theworkflowtype) ;
            if(wftindex == -1) {
                wftypeList.add(theworkflowtype) ;
                wftypecountList.add("0") ;
            }
            wftindex = workflowList.indexOf(theworkflowid) ;
            if(wftindex == -1) {
                workflowList.add(theworkflowid) ;
                workflowcountList.add("0") ;
            }
			if(selectedworkflow.indexOf("PW"+theworkflowid+"N")!=-1 && fromAdvancedMenu==1){
				int bx = selectedworkflow.indexOf("PW"+theworkflowid+"N");
				String tmp = selectedworkflow.substring(bx+("PW"+theworkflowid+"N").length());
				bx = tmp.indexOf("SP^AN");
				tmp = tmp.substring(0, bx);
				//System.out.println("theworkflowid = " + theworkflowid + " tmp = " + tmp);
				wfNodeHahstable.put(theworkflowid, tmp);
			}
        }
    }


   	 StringBuffer wftypesb = new StringBuffer();
   	 StringBuffer wfsb = new StringBuffer();
   	 StringBuffer wfnodesb = new StringBuffer();

   	 for(int i=0;i<wftypeworkflowList.size();i++){
         ArrayList templist=Util.TokenizerString((String)wftypeworkflowList.get(i),",");
         String tworkflowtype=(String)templist.get(0);
         String tworkflowid=(String)templist.get(1);
         int newcount=0;
         int newcount1=0;
	     tworkflowNodeIDs = Util.null2String((String)wfNodeHahstable.get(tworkflowid));

		 wftypesb.append(",").append(tworkflowtype);
		 wfsb.append(",").append(WorkflowVersion.getAllVersionStringByWFIDs(tworkflowid));
		 String tempnodeid = WorkflowVersion.getAllRelationNodeStringByNodeIDs(tworkflowNodeIDs);
		 if (tempnodeid != null && !"".equals(tempnodeid)) {
		 	wfnodesb.append(",").append(tempnodeid);
		 }

   	 }

   	 if (wftypesb.length() > 0) {
   	  	wftypesb = wftypesb.delete(0, 1);
   		wfsb = wfsb.delete(0, 1);
   	 }
   	 if (wfnodesb.indexOf(",") == 0) {
   		wfnodesb = wfnodesb.delete(0, 1);
   	 }

    int newcount=0;
    int newcount1=0;

	//System.out.println("tworkflowNodeIDs = " + tworkflowNodeIDs);
	sqlsb = new StringBuffer();
	if("1".equals(belongtoshow)){
	sqlsb.append("select a.workflowtype, a.workflowid, a.viewtype, count(a.requestid) workflowcount ");
	}else{
	sqlsb.append("select a.workflowtype, a.workflowid, a.viewtype, count(distinct a.requestid) workflowcount ");
	}
	sqlsb.append("	  from workflow_currentoperator a ");
	sqlsb.append("	  where (((isremark='0' and (takisremark is null or takisremark=0 )) and isprocessed is null) ");
	sqlsb.append("	         or isremark = '1' or ");
	sqlsb.append("	        isremark = '8' or isremark = '9' or isremark = '7') ");
	sqlsb.append("	    and islasttimes = 1 ");
    if(!"".equals(cursltwftypeid)){
	    sqlsb.append("   and workflowtype in (").append(cursltwftypeid).append(")");
    }
    //if(!"".equals(cursltwfid)){
	//    sqlsb.append("   and workflowid = ").append(cursltwfid);
    //}
		if("1".equals(belongtoshow)){
		sqlsb.append("	    and userid in (").append(userIDAll);
		}else{
		sqlsb.append("	    and userid in (").append(resourceid);
		}
	sqlsb.append("	)    and usertype = ").append(usertype);
	if(!"".equals(wftypesb.toString())){
		sqlsb.append("	    and a.workflowtype in ( ").append(wftypesb).append(") ");
	}
	if(!"".equals(wfsb.toString())){
		sqlsb.append("	    and a.workflowid in (").append(wfsb).append(")");
	}
	sqlsb.append("	    and exists (select c.requestid ");
	sqlsb.append("	           from workflow_requestbase c ");
	sqlsb.append("	          where (c.deleted <> 1 or c.deleted is null or c.deleted='') and c.requestid = a.requestid");
	if(RecordSet.getDBType().equals("oracle"))
	{
		sqlsb.append(" and (nvl(c.currentstatus,-1) = -1 or (nvl(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}else if(RecordSet.getDBType().equals("mysql")){
		sqlsb.append(" and (ifnull(c.currentstatus,-1) = -1 or (ifnull(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}
	else
	{
		sqlsb.append(" and (isnull(c.currentstatus,-1) = -1 or (isnull(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}
	sqlsb.append(")");
    //SQL = "select a.viewtype, count(distinct a.requestid) workflowcount from workflow_currentoperator a  where   ((isremark='0' and (isprocessed is null or (isprocessed<>'2' and isprocessed<>'3'))) or isremark='1' or isremark='8' or isremark='9' or isremark='7') and islasttimes=1 and userid=" +  resourceid  + " and usertype= " + usertype +" and a.workflowtype="+tworkflowtype+" and a.workflowid="+tworkflowid+" and exists (select c.requestid from workflow_requestbase c where c.requestid=a.requestid) ";
	if(!"".equals(tworkflowNodeIDs)){
		sqlsb.append(" and a.nodeid in (" + WorkflowVersion.getAllRelationNodeStringByNodeIDs(tworkflowNodeIDs) + ") ");
	}
    if(!superior)
	{
		if("1".equals(belongtoshow)){
    	sqlsb.append(" AND EXISTS (SELECT NULL FROM workFlow_CurrentOperator b WHERE a.workflowid = b.workflowid AND a.requestid = b.requestid AND b.userid in (" + userIDAll + ") and b.usertype= " + usertype +") ");
		}else{
		sqlsb.append(" AND EXISTS (SELECT NULL FROM workFlow_CurrentOperator b WHERE a.workflowid = b.workflowid AND a.requestid = b.requestid AND b.userid in (" + user.getUID() + ") and b.usertype= " + usertype +") ");
		}
	}

	if(offical.equals("1")){//发文/收文/签报
		if(officalType==1){
			sqlsb.append(" and workflowid in (select id from workflow_base where isWorkflowDoc=1 and officalType in (1,3) and (isvalid=1 or isvalid=3))");
		}else if(officalType==2){
			sqlsb.append(" and workflowid in (select id from workflow_base where isWorkflowDoc=1 and officalType=2 and (isvalid=1 or isvalid=3))");
		}
	}

    sqlsb.append(" group by a.viewtype, a.workflowtype, a.workflowid");
	//System.out.println("************" + sqlsb.toString());
    rs.executeSql(sqlsb.toString()) ;
    while(rs.next()){
        String tworkflowtype = Util.null2String(rs.getString("workflowtype"));
        String tworkflowid = WorkflowVersion.getActiveVersionWFID(Util.null2String(rs.getString("workflowid")));

        int theworkflowcount = Util.getIntValue(rs.getString("workflowcount"),0) ;

        int viewtype = Util.getIntValue(rs.getString("viewtype"),2) ;
        int wfindex = workflowList.indexOf(tworkflowid) ;
        if(wfindex != -1) {
            workflowcountList.set(wfindex,""+(Util.getIntValue((String)workflowcountList.get(wfindex),0)+theworkflowcount)) ;
            if(viewtype==0){
            	newcount=theworkflowcount;
                //newremarkwfcount0Map.put(tworkflowid, newcount);
                Object tempobj = newremarkwfcount0Map.get(tworkflowid);
                if (tempobj != null) {
                	int wf0countindex = (Integer)tempobj ;
                	newremarkwfcount0Map.put(tworkflowid, wf0countindex + newcount);
                } else {
                    newremarkwfcount0Map.put(tworkflowid, newcount);
                }

                //newremarkwfcount0List.add(""+newcount);
            }
            if(viewtype==-1){
            	newcount1=theworkflowcount;
            	Object tempobj = newremarkwfcount1Map.get(tworkflowid);
                if (tempobj != null) {
                	int wf0countindex = (Integer)tempobj ;
                	newremarkwfcount1Map.put(tworkflowid, wf0countindex + newcount1);
                } else {
                    newremarkwfcount1Map.put(tworkflowid, newcount1);
                }
                 //newremarkwfcount1List.add(""+newcount1);

            }
        }

            int wftindex = wftypeList.indexOf(tworkflowtype) ;
            if(wftindex != -1) {
                wftypecountList.set(wftindex,""+(Util.getIntValue((String)wftypecountList.get(wftindex), 0)+theworkflowcount)) ;
            }
            totalcount += theworkflowcount;
    }
//    newremarkwfcount0List.add(""+newcount);
    //newremarkwfcount1List.add(""+newcount1);

    int overtimecount=0;
//    if(templist.size()==2){

	sqlsb = new StringBuffer();
	if("1".equals(belongtoshow)){
	sqlsb.append("select a.workflowtype,a.workflowid, count(distinct a.requestid) overcount ");
	}else{
	sqlsb.append("select a.workflowtype,a.workflowid, count(a.requestid) overcount ");
	}
	sqlsb.append("  from workflow_currentoperator a ");
	sqlsb.append("  where (((isremark='0' and (takisremark is null or takisremark=0 )) and (isprocessed = '2' or isprocessed = '3')) or ");
	sqlsb.append("        isremark = '5') ");
	sqlsb.append("    and islasttimes = 1 ");
    if(!"".equals(cursltwftypeid)){
	    sqlsb.append("   and workflowtype in (").append(cursltwftypeid).append(")");
    }
    //if(!"".equals(cursltwfid)){
	//    sqlsb.append("   and workflowid = ").append(cursltwfid);
    //}
		if("1".equals(belongtoshow)){
		sqlsb.append("	    and userid in (").append(userIDAll);
		}else{
		sqlsb.append("	    and userid in (").append(resourceid);
		}
	sqlsb.append("   ) and usertype = ").append(usertype);
	if(!"".equals(wftypesb.toString())){
		sqlsb.append("    and a.workflowtype in (").append(wftypesb).append(")");
	}
	if(!"".equals(wfsb.toString())){
		sqlsb.append("    and a.workflowid in (").append(wfsb).append(")");
	}
	sqlsb.append("    and exists (select 1 ");
	sqlsb.append("          from workflow_requestbase c ");
	sqlsb.append("         where (c.deleted <> 1 or c.deleted is null or c.deleted='') and c.workflowid = a.workflowid ");
	if(RecordSet.getDBType().equals("oracle"))
	{
		sqlsb.append(" and (nvl(c.currentstatus,-1) = -1 or (nvl(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}else if(RecordSet.getDBType().equals("mysql")){
		sqlsb.append(" and (ifnull(c.currentstatus,-1) = -1 or (ifnull(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}
	else
	{
		sqlsb.append(" and (isnull(c.currentstatus,-1) = -1 or (isnull(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}
	sqlsb.append("           and c.requestid = a.requestid)");
   	//SQL = "select count(distinct a.requestid) overcount from workflow_currentoperator a  where   ((isremark='0' and (isprocessed='2' or isprocessed='3'))  or isremark='5') and islasttimes=1 and userid=" +  resourceid  + " and usertype= " + usertype +" and a.workflowtype="+tworkflowtype+" and  a.workflowid ="+tworkflowid+" and exists (select 1 from workflow_requestbase c where c.workflowid=a.workflowid and c.requestid=a.requestid)" ;

	if(!"".equals(tworkflowNodeIDs)){
		sqlsb.append(" and a.nodeid in (" + WorkflowVersion.getAllRelationNodeStringByNodeIDs(tworkflowNodeIDs) + ") ");
	}
   	if(!superior)
   	{
//   		sqlsb.append(" AND EXISTS (SELECT 1 FROM workFlow_CurrentOperator b WHERE b.islasttimes='1' AND b.userid=" + user.getUID() + " and b.usertype= " + usertype + ") ");
   		sqlsb.append(" AND EXISTS (SELECT NULL FROM workFlow_CurrentOperator b WHERE a.workflowid = b.workflowid AND a.requestid = b.requestid AND b.userid=" + user.getUID() + " and b.usertype= " + usertype +") ");
   	}

   	if(offical.equals("1")){//发文/收文/签报
		if(officalType==1){
			sqlsb.append(" and workflowid in (select id from workflow_base where isWorkflowDoc=1 and officalType in (1,3) and (isvalid=1 or isvalid=3))");
		}else if(officalType==2){
			sqlsb.append(" and workflowid in (select id from workflow_base where isWorkflowDoc=1 and officalType=2 and (isvalid=1 or isvalid=3))");
		}
	}
   	sqlsb.append(" GROUP BY a.workflowtype, a.workflowid ");
    RecordSet.executeSql(sqlsb.toString()) ;
    //System.out.println("3 = "+sqlsb.toString());
    while (RecordSet.next()) {
       String tworkflowtype = Util.null2String(RecordSet.getString("workflowtype"));
       String tworkflowid = WorkflowVersion.getActiveVersionWFID(Util.null2String(RecordSet.getString("workflowid")));

       overtimecount=RecordSet.getInt("overcount");

       int wfindex = workflowList.indexOf(tworkflowid) ;
       if(wfindex != -1) {
           workflowcountList.set(wfindex,""+(Util.getIntValue((String)workflowcountList.get(wfindex),0) + overtimecount)) ;
       }
       int wftindex = wftypeList.indexOf(tworkflowtype) ;
       if(wftindex != -1) {
           wftypecountList.set(wftindex,""+(Util.getIntValue((String)wftypecountList.get(wftindex),0)+overtimecount)) ;
       }
       Object tempobj = wfovertimecountMap.get(tworkflowid);
       if (tempobj != null) {
       	int wf0countindex = (Integer)tempobj ;
       	wfovertimecountMap.put(tworkflowid, wf0countindex + overtimecount);
       } else {
           wfovertimecountMap.put(tworkflowid, overtimecount);
       }
       totalcount += overtimecount;
    }

    //求被督办的流程,和其他查询不冲突
    sqlsb = new StringBuffer();
    sqlsb.append("select a.workflowtype, a.workflowid, count(0) workflowcount ");
	sqlsb.append("	  from workflow_currentoperator a ");
	sqlsb.append("	  where ((isremark = '0' and (isprocessed is null or ");
	sqlsb.append("	        (isprocessed <> '2' and isprocessed <> '3'))) or isremark = '1' or ");
	sqlsb.append("	        isremark = '8' or isremark = '9' or isremark = '7') ");
	sqlsb.append("	    and islasttimes = 1 ");
    if(!"".equals(cursltwftypeid)){
	    sqlsb.append("   and workflowtype in (").append(cursltwftypeid).append(")");
    }

		if("1".equals(belongtoshow)){
		sqlsb.append("	    and userid in (").append(userIDAll);
		}else{
		sqlsb.append("	    and userid in (").append(resourceid);
		}
	sqlsb.append("	)    and usertype = ").append(usertype);
	if(!"".equals(wftypesb.toString())){
		sqlsb.append("	    and a.workflowtype in (").append(wftypesb).append(")");
	}
	if(!"".equals(wfsb.toString())){
		sqlsb.append("	    and a.workflowid in (").append(wfsb).append(")");
	}
	sqlsb.append("	    and exists (select c.requestid ");
	sqlsb.append("	           from workflow_requestbase c ");
	sqlsb.append("	          where (c.deleted <> 1 or c.deleted is null or c.deleted='') and c.requestid = a.requestid");
	sqlsb.append("		and ( select count(0) from workflow_requestlog where requestid = a.requestid and logtype='s') > 0");
	if(RecordSet.getDBType().equals("oracle"))
	{
		sqlsb.append(" and (nvl(c.currentstatus,-1) = -1 or (nvl(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}else if(RecordSet.getDBType().equals("mysql")){
		sqlsb.append(" and (ifnull(c.currentstatus,-1) = -1 or (ifnull(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}
	else
	{
		sqlsb.append(" and (isnull(c.currentstatus,-1) = -1 or (isnull(c.currentstatus,-1)=0 and c.creater="+user.getUID()+")) ");
	}
	sqlsb.append(")");
    //SQL = "select a.viewtype, count(distinct a.requestid) workflowcount from workflow_currentoperator a  where   ((isremark='0' and (isprocessed is null or (isprocessed<>'2' and isprocessed<>'3'))) or isremark='1' or isremark='8' or isremark='9' or isremark='7') and islasttimes=1 and userid=" +  resourceid  + " and usertype= " + usertype +" and a.workflowtype="+tworkflowtype+" and a.workflowid="+tworkflowid+" and exists (select c.requestid from workflow_requestbase c where c.requestid=a.requestid) ";
	if(!"".equals(tworkflowNodeIDs)){
		sqlsb.append(" and a.nodeid in (" + WorkflowVersion.getAllRelationNodeStringByNodeIDs(tworkflowNodeIDs) + ") ");
	}
    if(!superior)
	{
//    	sqlsb.append(" AND EXISTS (SELECT 1 FROM workFlow_CurrentOperator b WHERE b.islasttimes='1' AND b.userid=" + user.getUID() + " and b.usertype= " + usertype +") ");
    	sqlsb.append(" AND EXISTS (SELECT NULL FROM workFlow_CurrentOperator b WHERE a.workflowid = b.workflowid AND a.requestid = b.requestid AND b.userid=" + user.getUID() + " and b.usertype= " + usertype + ") ");
	}

	if(offical.equals("1")){//发文/收文/签报
		if(officalType==1){
			sqlsb.append(" and workflowid in (select id from workflow_base where isWorkflowDoc=1 and officalType in (1,3) and (isvalid=1 or isvalid=3))");
		}else if(officalType==2){
			sqlsb.append(" and workflowid in (select id from workflow_base where isWorkflowDoc=1 and officalType=2 and (isvalid=1 or isvalid=3))");
		}
	}
	sqlsb.append(" GROUP BY a.workflowtype, a.workflowid");

    RecordSet.executeSql(sqlsb.toString());
    //System.out.println("4 = "+sqlsb.toString());
    while (RecordSet.next()) {
        String tworkflowtype = Util.null2String(RecordSet.getString("workflowtype"));
        String tworkflowid = WorkflowVersion.getActiveVersionWFID(Util.null2String(RecordSet.getString("workflowid")));
        overtimecount=RecordSet.getInt(3);
        Object tempobj = wfsupedcountMap.get(tworkflowid);
        if (tempobj != null) {
        	int wf0countindex = (Integer)tempobj ;
        	wfsupedcountMap.put(tworkflowid, wf0countindex + overtimecount);
        } else {
            wfsupedcountMap.put(tworkflowid, overtimecount);
        }
    }

	for(int i=0; i<wftypecountList.size(); i++){
		String t_wftypecount = (String)wftypecountList.get(i);
		if("0".equals(t_wftypecount)){
			wftypeList.remove(i);
			wftypecountList.remove(i);
			i--;
		}
	}


	for(int i=0; i<workflowcountList.size(); i++){
		String t_workflowcount = (String)workflowcountList.get(i);
		if("0".equals(t_workflowcount)){

		    String tempworkflowid = (String)workflowList.get(i);

			workflowcountList.remove(i);
			//System.out.println((String)(workflowList.get(i)));
			workflowList.remove(i);
			newremarkwfcount0Map.remove(tempworkflowid);
			newremarkwfcount1Map.remove(tempworkflowid);

			//newremarkwfcount0List.remove(i);
			//newremarkwfcount1List.remove(i);
			wftypeworkflowList.remove(i);
			i--;
		}
	}

		/*******************************/

    if (!"".equals(cursltwftypeid)) {

    	if (wftypeList.size() == 0) {

    	    String[] curoptwfarrary = cursltwftypeid.split(",");
    		for (int i=0; i<curoptwfarrary.length; i++) {
    		    wftypeList.add(curoptwfarrary[i]);
            	wftypecountList.add("0");
    		}
    	}

    	String _tempwfsql = "SELECT id FROM workflow_base WHERE workflowtype in (" + cursltwftypeid + ")";
    	RecordSet _temprs = new RecordSet();
    	_temprs.executeSql(_tempwfsql);
    	while (_temprs.next()) {

    		String _tempwfid = Util.null2String(_temprs.getString("id"));
    	    if (!workflowList.contains(_tempwfid)) {
    	        workflowList.add(_tempwfid);
    	        workflowcountList.add("0");
    	    }
    	}
    }
		//左侧树拼接 json
	demoLeftMenus = "[";

	for (int i = 0; i < wftypeList.size(); i++) {
		typeid = (String) wftypeList.get(i);
		typecount = (String) wftypecountList.get(i);
		typename = WorkTypeComInfo.getWorkTypename(typeid);
		String workFlowIDsRequest = "";
		String workFlowNodeIDsRequest = "";
		for (int j = 0; j < workflowList.size(); j++) {
			workflowid = (String) workflowList.get(j);
			String curtypeid = WorkflowComInfo.getWorkflowtype(workflowid);
			if (!curtypeid.equals(typeid)) {
				continue;
			}
			workFlowIDsRequest += workflowid + ",";
			String t_workFlowNodeIDRequest = Util.null2String((String) wfNodeHahstable.get(workflowid));
			if (!"".equals(t_workFlowNodeIDRequest)) {
				workFlowNodeIDsRequest += t_workFlowNodeIDRequest + ",";
			}
		}
		if (!"".equals(workFlowIDsRequest)) {
			workFlowIDsRequest = workFlowIDsRequest.substring(0, workFlowIDsRequest.length());
		}
		if (!"".equals(workFlowNodeIDsRequest)) {
			workFlowNodeIDsRequest = workFlowNodeIDsRequest.substring(0, workFlowNodeIDsRequest.length());
		}

		demoLeftMenus +="{";
		demoLeftMenus+="\"__domid__\":\"__type_"+typeid+"\",";

		int flowNew=0;
		int flowResponse=0;
		int flowOut=0;
		int flowAll=0;
		int flowSup=0;

		List<Map> maps=new ArrayList(0);
		for (int j = 0; j < workflowList.size(); j++) {
			workflowid = (String) workflowList.get(j);
			String curtypeid = WorkflowComInfo.getWorkflowtype(workflowid);
			if (!curtypeid.equals(typeid))
				continue;

			workflowcount = (String) workflowcountList.get(j);
			workflowname = WorkflowComInfo.getWorkflowname(workflowid);
			workflowname = Util.processBody(workflowname,user.getLanguage()+"");
			int tempind = wftypeworkflowList.indexOf(typeid + "," + workflowid);
			int ovtimenum = 0;
			newremarkwfcount1 = "0";
			newremarkwfcount0 = "0";
			wfsupedcount = "0";

			if (tempind > -1) {
				Object tempovtimenumObj = wfovertimecountMap.get(workflowid);
				if (tempovtimenumObj != null) {
				    ovtimenum = (Integer)tempovtimenumObj;
				} else {
				    ovtimenum = 0;
				}

				Object tempnewremarkwfcount0Obj = newremarkwfcount0Map.get(workflowid);
				if (tempnewremarkwfcount0Obj != null) {
				    newremarkwfcount0 = (Integer)tempnewremarkwfcount0Obj + "";
				} else {
					newremarkwfcount0 = "0";
				}

				Object tempnewremarkwfcount1Obj = newremarkwfcount1Map.get(workflowid);
				if (tempnewremarkwfcount1Obj != null) {
				    newremarkwfcount1 = (Integer)tempnewremarkwfcount1Obj + "";
				} else {
					newremarkwfcount1 = "0";
				}

				Object tempwfsupedcountObj = wfsupedcountMap.get(workflowid);
				if (tempwfsupedcountObj != null) {
				    wfsupedcount = (Integer)tempwfsupedcountObj + "";
				} else {
				    wfsupedcount = "0";
				}
			}
			String t_nodeids = Util.null2String((String) wfNodeHahstable.get(workflowid));
			Map map=new HashMap();
			map.put("name",Util.toScreen(workflowname, user.getLanguage()));
			map.put("workflowid",workflowid);
			map.put("nodeids",t_nodeids);
			map.put("flowNew",Util.toScreen(newremarkwfcount0, user.getLanguage()));
			map.put("flowResponse",Util.toScreen(newremarkwfcount1, user.getLanguage()));
			map.put("flowOut",ovtimenum);
			map.put("flowAll",Util.toScreen(workflowcount,user.getLanguage()));
			map.put("flowSup",Util.toScreen(wfsupedcount, user.getLanguage()));
			flowNew+=Integer.valueOf(map.get("flowNew")+"");
			flowResponse+=Integer.valueOf(map.get("flowResponse")+"");
			flowOut+=Integer.valueOf(map.get("flowOut")+"");
			flowAll+=Integer.valueOf(map.get("flowAll")+"");
			flowSup+=Integer.valueOf(map.get("flowSup")+"");
			maps.add(map);
		}

				demoLeftMenus += "\"numbers\":{";
				demoLeftMenus += "\"flowNew\":"+flowNew+",";
				demoLeftMenus += "\"flowResponse\":"+flowResponse+",";
				demoLeftMenus += "\"flowOut\":"+flowOut+",";
				demoLeftMenus += "\"flowAll\":"+flowAll+",";
				demoLeftMenus += "\"flowSup\":"+flowSup;
				demoLeftMenus += "},";

				demoLeftMenus += "\"attr\":{";
				demoLeftMenus += "\"typeid\":"+typeid+",";
				demoLeftMenus += "\"flowNew\":"+flowNew+",";
				demoLeftMenus += "\"flowResponse\":"+flowResponse+",";
				demoLeftMenus += "\"flowOut\":"+flowOut+",";
				demoLeftMenus += "\"flowAll\":"+flowAll+",";
				demoLeftMenus += "\"flowSup\":"+flowSup;
				demoLeftMenus += "}";
				demoLeftMenus += "}";

			if (maps.size() > 0) {
				demoLeftMenus += ",";
			}

				for(int x=0;x<maps.size();x++){
					Map map=maps.get(x);

					demoLeftMenus += "{";
					demoLeftMenus+="\"__domid__\":\"__wf_"+map.get("workflowid")+"\",";
						demoLeftMenus += "\"numbers\":{";
							demoLeftMenus += "\"flowNew\":"+map.get("flowNew")+",";
							demoLeftMenus += "\"flowResponse\":"+map.get("flowResponse")+",";
							demoLeftMenus += "\"flowOut\":"+map.get("flowOut")+",";
						 	demoLeftMenus += "\"flowAll\":"+map.get("flowAll")+",";
							demoLeftMenus += "\"flowSup\":"+map.get("flowSup");
							demoLeftMenus += "},";

							demoLeftMenus += "\"attr\":{";
							demoLeftMenus += "\"workflowid\":"+map.get("workflowid")+",";
							demoLeftMenus += "\"flowNew\":"+map.get("flowNew")+",";
							demoLeftMenus += "\"flowResponse\":"+map.get("flowResponse")+",";
							demoLeftMenus += "\"flowOut\":"+map.get("flowOut")+",";
							demoLeftMenus += "\"flowAll\":"+map.get("flowAll")+",";
							demoLeftMenus += "\"flowSup\":"+map.get("flowSup");
							demoLeftMenus += "}";

							demoLeftMenus += "}";
							demoLeftMenus += (x==maps.size()-1)?"":",";
				}
				if (i < wftypeList.size() - 1) {
					demoLeftMenus += ",";
				}

		}

        if(requestutil.getOfsSetting().getIsuse()==1) {
            RecordSet rs1 = new RecordSet();
            int wftype_count = 0;
            //rs.executeSql("select sysid,sysshortname from ofs_sysinfo order by sysid desc");
            //wftype_count = rs.getCounts();
            //while (rs.next()) {
			//记录当前异构系统流程id, 用于查询类型信息
			StringBuilder sb = new StringBuilder();
			//流程请求数量信息,结构说明:Map<流程id, Map<流程id,全部数量,未读数量>>
			Map<String, Map<String, String>> ofsReqInfos = new HashMap<String, Map<String, String>>();
			int ofsWfAllReqCount = 0;
			int ofsWfNewReqCount = 0;
			//查询指定人员所有的待办流程数量
			rs.executeQuery("select workflowid, viewtype, COUNT(requestid) count from ofs_todo_data where userid=? and isremark='0' and islasttimes=1 group by workflowid, viewtype", user.getUID());
			boolean hasOfsReq = rs.getCounts() > 0;
			while (rs.next()) {
				String ofsWfid = Util.null2String(rs.getString("workflowid"));
				int ofsViewType = Util.getIntValue(rs.getString("viewtype"), 0);
				int ofsReqCount = Util.getIntValue(rs.getString("count"), 0);
				ofsWfAllReqCount += ofsReqCount;

				Map<String, String> ofsReqInfoBean = ofsReqInfos.get(ofsWfid);
				if (ofsReqInfoBean == null) {
					ofsReqInfoBean = new HashMap<String, String>();
					ofsReqInfos.put(ofsWfid, ofsReqInfoBean);
					ofsReqInfoBean.put("ofswfid", ofsWfid);
				}
				if (ofsViewType == 0) {
					ofsReqInfoBean.put("newcount", ofsReqCount + "");
				} else {
				    //viewtype不为0 全部统计到全部中。
					int tempOfsReqCount = Util.getIntValue(ofsReqInfoBean.get("count"), 0);
					ofsReqInfoBean.put("count", (ofsReqCount + tempOfsReqCount) + "");
				}
				sb.append(ofsWfid).append(",");
			}

			if (hasOfsReq) {
				Map<String, List<Map<String, String>>> ofsWfTypeInfos = new HashMap<String, List<Map<String, String>>>();
				rs.executeSql("select a.workflowid, a.workflowname, b.sysid, b.sysshortname from ofs_workflow a, ofs_sysinfo b where a.workflowid in (" + sb.toString() + " 0) and a.sysid=b.sysid and a.Cancel=0 order by a.workflowid desc");
				while (rs.next()) {
					String ofsWfid = Util.null2String(rs.getString("workflowid"));
					String ofsWfName = Util.null2String(rs.getString("workflowname"));
					String ofsWfTypeId = Util.null2String(rs.getString("sysid"));
					String ofsWfTypeName = Util.null2String(rs.getString("sysshortname"));
					List<Map<String, String>> ofsWfList = ofsWfTypeInfos.get(ofsWfTypeId);
					if (ofsWfList == null) {
						ofsWfList = new ArrayList<Map<String, String>>();
						ofsWfTypeInfos.put(ofsWfTypeId, ofsWfList);
					}
					Map<String, String> ofswfBean = new HashMap<String, String>();
					ofswfBean.put("ofswfid", ofsWfid);
					ofswfBean.put("ofswfname", ofsWfName);
					ofswfBean.put("ofswftypeid", ofsWfTypeId);
					ofswfBean.put("ofswftypename", ofsWfTypeName);
					ofsWfList.add(ofswfBean);
				}

				StringBuilder demoLeftMenusSb = new StringBuilder();

				int zflg = 0;
				Set<Map.Entry<String, List<Map<String, String>>>> ofsTypeInfoSet = ofsWfTypeInfos.entrySet();
				for (Iterator<Map.Entry<String, List<Map<String, String>>>> it = ofsTypeInfoSet.iterator(); it.hasNext(); ) {
					Map.Entry<String, List<Map<String, String>>> ofsWfTypeInfo = it.next();
					String wfTypeid = ofsWfTypeInfo.getKey();
					List<Map<String, String>> ofsWfInfos = ofsWfTypeInfo.getValue();

					int ofsWfTypeReqCount = 0;
					int ofsWfTypeNewReqCount = 0;

					StringBuilder ofsReqInfoSb = new StringBuilder();
					for (int i = 0; i < ofsWfInfos.size(); i++) {
						Map<String, String> ofswfInfo = ofsWfInfos.get(i);

						String ofswfid = ofswfInfo.get("ofswfid");
						String ofswfname = ofswfInfo.get("ofswfname");
						String ofswftypeid = ofswfInfo.get("ofswftypeid");
						String ofswftypename = ofswfInfo.get("ofswftypename");
						Map<String, String> ofsReqInfo = ofsReqInfos.get(ofswfid);
						int ofsNewReqCount = Util.getIntValue(ofsReqInfo.get("newcount"), 0);
						int ofsReqCount = Util.getIntValue(ofsReqInfo.get("count"), 0);
						ofsReqCount += ofsNewReqCount;
						ofsWfTypeReqCount += ofsReqCount;
						ofsWfTypeNewReqCount += ofsNewReqCount;

						ofsReqInfoSb.append(",{");
						ofsReqInfoSb.append("\"__domid__\":\"__wf_").append(ofswfid).append("\",");
						ofsReqInfoSb.append("\"attr\":{");
						ofsReqInfoSb.append("\"flowNew\":").append(ofsNewReqCount).append(",");
						ofsReqInfoSb.append("\"flowResponse\":0,");
						ofsReqInfoSb.append("\"flowOut\":0,");
						ofsReqInfoSb.append("\"flowAll\":").append(ofsReqCount).append(",");
						ofsReqInfoSb.append("\"flowSup\":0");
						ofsReqInfoSb.append("},");
						ofsReqInfoSb.append("\"numbers\":{");
						ofsReqInfoSb.append("\"flowNew\":").append(ofsNewReqCount).append(",");
						ofsReqInfoSb.append("\"flowResponse\":0,");
						ofsReqInfoSb.append("\"flowOut\":0,");
						ofsReqInfoSb.append("\"flowAll\":").append(ofsReqCount).append(",");
						ofsReqInfoSb.append("\"flowSup\":0");
						ofsReqInfoSb.append("}");
						ofsReqInfoSb.append("}");
					}
					if (zflg++ > 0) {
						demoLeftMenusSb.append(",");
					}
					demoLeftMenusSb.append("{");
					demoLeftMenusSb.append(" \"__domid__\":\"__type_").append(wfTypeid).append("\",");
					demoLeftMenusSb.append("\"attr\":{");
					demoLeftMenusSb.append("\"flowNew\":" + ofsWfTypeNewReqCount + ",");
					demoLeftMenusSb.append("\"flowResponse\":0,");
					demoLeftMenusSb.append("\"flowOut\":0,");
					demoLeftMenusSb.append("\"flowAll\":").append(ofsWfTypeReqCount).append(",");
					demoLeftMenusSb.append("\"flowSup\":0");
					demoLeftMenusSb.append("},");
					demoLeftMenusSb.append("\"numbers\":{");
					demoLeftMenusSb.append("\"flowNew\":" + ofsWfTypeNewReqCount + ",");
					demoLeftMenusSb.append("\"flowResponse\":0,");
					demoLeftMenusSb.append("\"flowOut\":0,");
					demoLeftMenusSb.append("\"flowAll\":").append(ofsWfTypeReqCount).append(",");
					demoLeftMenusSb.append("\"flowSup\":0");
					demoLeftMenusSb.append("}");
					demoLeftMenusSb.append("}");
					//添加类型下流程数据
					demoLeftMenusSb.append(ofsReqInfoSb);
				}

				if (demoLeftMenus.length() > 10 && demoLeftMenusSb.length() > 10) {
					demoLeftMenus += ",";
				}
				demoLeftMenus += demoLeftMenusSb.toString();
			}
        }
		demoLeftMenus += "]";
		out.print(demoLeftMenus);
//		System.out.print(demoLeftMenus);
	%>