menuCount.jsp
4.79 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
<%@page import="weaver.cpt.util.CommonShareManager"%>
<%@page import="weaver.proj.Maint.ProjectTask"%>
<%@ page import="weaver.conn.*" %>
<%@ page import="weaver.general.*" %>
<%@page import="org.json.JSONArray"%>
<%@page import="org.json.JSONObject"%>
<%@ page import="weaver.hrm.HrmUserVarify"%>
<%@ page import="weaver.hrm.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="CustomerStatusCount" class="weaver.crm.CustomerStatusCount" scope="page" />
<jsp:useBean id="PrjSettingsComInfo" class="weaver.proj.util.PrjSettingsComInfo" scope="page" />
<%
User user = HrmUserVarify.getUser (request , response) ;
String userid=user.getUID()+"";
String usertype=(user.getLogintype().equals("2")?1:0) + "";
//String userid = Util.null2String(request.getParameter("userid"));
//String usertype = Util.null2String(request.getParameter("usertype"));
//String parentid = Util.null2String(request.getParameter("parentid"));
String levelid = Util.null2String(request.getParameter("levelid"));
JSONObject jsonObj = new JSONObject();
if(levelid.equals("")){
out.print("");
return;
}
String[] tmpIds = levelid.split(",");
for(int i=0;i<tmpIds.length;i++){
String lid = tmpIds[i];
//待办事宜
if(lid.equals("13")){
rs.executeSql("select count(distinct a.requestid) allcount from workflow_currentoperator a where "+
"userid="+userid+" and isremark in ('0','1','5','7','8','9') and usertype="+usertype+" and islasttimes=1 "+
"and exists (select 1 from workflow_requestbase c where c.requestid=a.requestid "+
"and (c.deleted<>1 or c.deleted is null or c.deleted='')) and viewtype='0'");
//待办事宜不需要这些数字
if(rs.next()){
//jsonObj.put("num_"+lid,rs.getString("allcount"));
}else{
//jsonObj.put("num_"+lid,0);
}
}
//客户模块--》我的客户
if(lid.equals("25")){
int count = CustomerStatusCount.getNewCustomerNumber(userid);
jsonObj.put("num_"+lid,count);
}
//客户模块--》客户联系
if(lid.equals("26")){
int count = CustomerStatusCount.getContactNumber(userid);
jsonObj.put("num_"+lid,count);
}
//客户模块--》销售机会
if(lid.equals("27")){
int count = CustomerStatusCount.getSellChanceNumber(userid);
jsonObj.put("num_"+lid,count);
}
//客户模块--》合同管理
if(lid.equals("28")){
int count = CustomerStatusCount.getContractNumber("expire",userid)+
CustomerStatusCount.getContractNumber("pay",userid)+
CustomerStatusCount.getContractNumber("delivery",userid);
jsonObj.put("num_"+lid,count);
}
if("38".equals(lid)){//项目>审批任务
String sqlWhere = " where t1.prjid=t2.id and t1.isdelete =0 and t1.status <>"+ProjectTask.APPROVED +" ";
if("2".equals( PrjSettingsComInfo.getTsk_approval_type())){
if("oracle".equalsIgnoreCase(rs.getDBType())){
sqlWhere+=" and ( exists(select 1 from Prj_TaskProcess t3 where t3.id=t1.parentid and ','||t3.hrmid||',' like '%,"+userid+",%' ) or ( t2.manager='"+userid+"' and t1.level_n=1) ) ";
}else if(rs.getDBType().equals("mysql")){
sqlWhere+=" and ( exists(select 1 from Prj_TaskProcess t3 where t3.id=t1.parentid and concat(',',t3.hrmid,',') like '%,"+userid+",%' ) or ( t2.manager='"+userid+"' and t1.level_n=1) ) ";
}else{
sqlWhere+=" and ( exists(select 1 from Prj_TaskProcess t3 where t3.id=t1.parentid and ','+convert(varchar, t3.hrmid)+',' like '%,"+userid+",%' ) or ( t2.manager='"+userid+"' and t1.level_n=1) ) ";
}
}else{
sqlWhere+=" and t2.manager='"+userid+"' ";
}
String fromSql = " Prj_TaskProcess t1,Prj_ProjectInfo t2 ";
rs.executeSql("select count(t1.id) from "+fromSql+" "+sqlWhere);
int count=0;
if(rs.next()&&(count=rs.getInt(1))>0){
jsonObj.put("num_"+lid,count);
}else{
jsonObj.put("num_"+lid,"");
}
}
if("594".equals(lid)){//资产>入库验收
String sqlWhere = " where d.cptstockinid=m.id and m.ischecked = 0 and m.checkerid in(" +new CommonShareManager().getContainsSubuserids(""+ userid)+") ";
String fromSql = " CptStockInMain m ,CptStockInDetail d ";
rs.executeSql("select count(distinct m.id) from "+fromSql+" "+sqlWhere);
int count=0;
if(rs.next()&&(count=rs.getInt(1))>0){
jsonObj.put("num_"+lid,count);
}else{
jsonObj.put("num_"+lid,"");
}
}
if("638".equals(lid)){//协作>协作申请
String sqlWhere = " where t1.principal = "+userid+" and t2.status = -1 and t2.id <>0";
String fromSql = " cowork_items t1 JOIN cowork_apply_info t2 ON t1.id = t2.coworkid ";
rs.executeSql("select count(t1.id) from "+fromSql+" "+sqlWhere);
int count=0;
if(rs.next()&&(count=rs.getInt(1))>0){
jsonObj.put("num_"+lid,count);
}else{
jsonObj.put("num_"+lid,"");
}
}
}
out.print(jsonObj.toString());
%>