<%@ page import="weaver.general.*" %> <%@page import="weaver.conn.RecordSet"%> <%@ page import="weaver.hrm.User" %> <%@ page import="weaver.hrm.HrmUserVarify" %> <%@ page import="org.apache.commons.lang.StringUtils" %> <%@ page import="com.engine.portrait.util.PortraitUtil" %> <%@ page import="com.engine.portrait.util.CommonUtil" %> <%@ page import="com.alibaba.fastjson.JSONObject" %> <%@ page import="weaver.mobile.webservices.workflow.WorkflowServiceImpl" %> <%@ page language="java" contentType="text/html; charset=UTF-8" %> <% RecordSet rs = new RecordSet(); User user = HrmUserVarify.getUser(request , response) ; int userid = user.getUID(); String lastname = user.getLastname(); int rzts = 0; if(userid == 1){ String sql = " select isnull(datediff(day,hr.created,convert(varchar(100), getdate(), 23)),0) rzts from HrmResourcemanager hr where hr.id = ?"; rs.executeQuery(sql,new Object[]{userid}); if(rs.next()){ rzts = Util.getIntValue(Util.null2String(rs.getString("rzts")),0); } }else{ String sql = " select isnull(datediff(day,hr.createdate,convert(varchar(100), getdate(), 23)),0) rzts from HrmResource hr where hr.id = ?"; rs.executeQuery(sql,new Object[]{userid}); if(rs.next()){ rzts = Util.getIntValue(Util.null2String(rs.getString("rzts")),0); } } int doc_create = 0; String sql = "select isnull(count(1),0) as cou FROM DocDetail dd where doccreaterid = ?" ; rs.executeQuery(sql,new Object[]{userid}); if(rs.next()){ doc_create = Util.getIntValue(Util.null2String(rs.getString("cou")),0); } int wf_create = 0; sql = " select isnull(count(requestid),0) as amount from workflow_requestbase where creater=? "; rs.executeQuery(sql,new Object[]{userid}) ; if(rs.next()){ wf_create = Util.getIntValue(Util.null2String(rs.getString("amount")),0); } //已办是否包含办结 boolean isshowprocessed = true; boolean belongtoshowFlag = true; WorkflowServiceImpl ws = new WorkflowServiceImpl(); int wf_deal = ws.getHendledWorkflowRequestCount(user.getUID(), isshowprocessed, null,belongtoshowFlag); String mtgtrs = "0" ; String dateType = "3"; try{ sql = getQuerySql(userid+"","16"); if(StringUtils.isNotEmpty(sql)){ rs.executeQuery(sql,userid,dateType); if (rs.next()) { String itemData = Util.null2String(rs.getString("itemData")); if(StringUtils.isNotEmpty(itemData) && itemData.contains("amount")){ mtgtrs = itemData.substring(itemData.indexOf("=")+1); } } } }catch (Exception e){ } String cyqlsl = "0" ; try{ sql = getQuerySql(userid+"","17"); if(StringUtils.isNotEmpty(sql)){ rs.executeQuery(sql,userid,dateType); if (rs.next()) { String itemData = Util.null2String(rs.getString("itemData")); String itemname = Util.null2String(rs.getString("itemname")); String name = Util.null2String(rs.getString("name")); bb.writeLog("itemname:"+itemname+" itemname:"+itemname+" name:"+name); if(StringUtils.isNotEmpty(itemData) && itemData.contains("amount")){ cyqlsl = itemData.substring(itemData.indexOf("=")+1); } } } }catch (Exception e){ } JSONObject jsonObject = new JSONObject(); jsonObject.put("lastname",lastname); jsonObject.put("userurl","/spa/hrm/index_mobx.html#/main/hrm/card/cardInfo"); jsonObject.put("rzts",rzts); jsonObject.put("doc_create",doc_create); jsonObject.put("doc_create_url","/spa/document/static/index.html#/main/document/search"); jsonObject.put("wf_create",wf_create); jsonObject.put("wf_create_url","/spa/workflow/static/index.html#/main/workflow/listMine"); jsonObject.put("wf_deal",wf_deal); jsonObject.put("wf_deal_url","/spa/workflow/static/index.html#/main/workflow/listDone"); jsonObject.put("cyqlsl",cyqlsl); jsonObject.put("mtgtrs",mtgtrs); %> <%=jsonObject.toString() %> <%! /*** * * @param userid * @param itemid * @return */ private String getQuerySql(String userid,String itemid) { BaseBean bb = new BaseBean(); StringBuilder sqlSB = new StringBuilder(); if(StringUtils.isNotEmpty(itemid)) { sqlSB.append(" select e.id as itemdataid,e.userid,e.itemvalue,e.otherinfo as itemdata,d.* from (SELECT a.moduleid,a.name ,b.subname,b.subid ,b.iconname,b.iconcolor,b.iconbgcolor,c.id as itemid,c.iszeroshow,c.name as itemname,c.tipsinfo,c.isability,c.isnegative,c.overcolor,c.showorder") .append(" FROM wr_individualitem_module a join wr_individualitem_submodule b on a.moduleid = b.moduleid ") .append(" join wr_individualitem_info c on b.subid = c.subid ") .append(" where a.status = 1 and b.status = 1 and c.status = 1 "); if (!CommonUtil.hasSubordinate(userid)) { sqlSB.append(" and a.moduleid != 3 "); } String shareSql = ""; try { shareSql = PortraitUtil.getShareBizidSql("10",userid); } catch (Exception e) { bb.writeLog("获取shareSql失败,userid="+userid+",type=10,"+e); } if (StringUtils.isNotEmpty(shareSql)) { sqlSB.append(" and b.subid in (").append(shareSql).append(")"); } sqlSB.append(" ) d join wr_individualitem_detail e on e.itemid = d.itemid ").append(" WHERE e.userid = ? and e.type = ? "); sqlSB.append(" and d.itemid = "+itemid); sqlSB.append(" order by d.moduleid asc,d.showorder asc"); } return sqlSB.toString(); } %>