<%@ page import="java.util.Map" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page import="weaver.mobile.webservices.workflow.WorkflowServiceImpl" %>
<%@ page import="java.math.BigDecimal" %>
<%@ page import="java.math.RoundingMode" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%


    User user = HrmUserVarify.getUser(request, response);


    WorkflowServiceImpl workflowServiceImpl = new WorkflowServiceImpl();
    int createCount = 0;
    try{
        createCount = workflowServiceImpl.getMyWorkflowRequestCount(user.getUID(),null,true);
    }catch (Exception e){

    }
    int handleCount = 0 ;
    try{
        handleCount = workflowServiceImpl.getHendledWorkflowRequestCount(user.getUID(),true,null,true);
    }catch (Exception e){

    }
    int todoCount= 0;
    try{
        todoCount= workflowServiceImpl.getToDoWorkflowRequestCount(user.getUID(),true,null);
    }catch (Exception e){

    }

    Map<String,Object> dataMap = new HashMap<String,Object>();
    dataMap.put("hasDone",createCount);
    dataMap.put("qsgwlds",handleCount);
    dataMap.put("totalOverTime",todoCount);

    dataMap.put("overTimePercent",0);
    dataMap.put("totalWilloverTime",0);

    JSONObject dataJson = new JSONObject();
    double wcl = 0.0;
    if(todoCount+handleCount > 0){
        wcl = handleCount/((todoCount+handleCount)*1.0)*100;
    }
    BigDecimal bigDecimal = new BigDecimal(wcl);
    bigDecimal = bigDecimal.setScale(2, RoundingMode.HALF_UP);

    dataMap.put("bjl",bigDecimal.doubleValue()+"%");

    dataJson.put("data",dataMap);
    dataJson.put("code","200");

%>

<%=dataJson.toJSONString() %>

<%!


%>

