forked from chenwei/weaver-matfron
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
3.3 KiB
Plaintext
84 lines
3.3 KiB
Plaintext
1 year ago
|
<%@ page import="weaver.general.*" %>
|
||
|
<%@page import="weaver.conn.RecordSet"%>
|
||
|
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
||
|
<%@ page import="java.util.*" %>
|
||
|
<%@ page import="com.engine.matfron.util.CommonUtils" %>
|
||
|
<%@ page import="com.engine.matfron.entity.DepartmentParam" %>
|
||
|
<%@ page import="org.apache.commons.lang.StringUtils" %>
|
||
|
<%@ page import="com.engine.matfron.entity.OptionVO" %>
|
||
|
<jsp:useBean id="ResourceComInfo" class="weaver.hrm.resource.ResourceComInfo" scope="page"/>
|
||
|
<jsp:useBean id="bb" class="weaver.general.BaseBean" scope="page" />
|
||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
|
||
|
|
||
|
<%
|
||
|
|
||
|
RecordSet rs = new RecordSet();
|
||
|
LinkedList<String> xData = new LinkedList<>();
|
||
|
LinkedList<Integer> yData = new LinkedList<>();
|
||
|
String where = " and (belongto is null or belongto = -1 ) ";
|
||
|
List<Integer> ids = new ArrayList<>();
|
||
|
rs.executeQuery(" select id,departmentname from hrmdepartment where supdepid = 0 and (canceled = 0 or canceled is null) and subcompanyid1 = 62 ");
|
||
|
while (rs.next()) {
|
||
|
xData.add(Util.null2String(rs.getString("departmentname")));
|
||
|
ids.add(Util.getIntValue(rs.getString("id")));
|
||
|
}
|
||
|
|
||
|
|
||
|
for(int deptid : ids){
|
||
|
out.println("deptid:"+deptid+"</br>");
|
||
|
if(StringUtils.isNotBlank(deptid+"")){
|
||
|
String deptids = "" ;
|
||
|
String sql =" with tem_table(department_id,department_name,supdep_id,curlevel,canceled) as (\n" +
|
||
|
" select id,departmentname,supdepid, 1 as level,canceled\n" +
|
||
|
" from HrmDepartment where id = " + deptid +
|
||
|
" union all \n" +
|
||
|
" select a.id,a.departmentname,a.supdepid, b.curlevel+1 ,a.canceled\n" +
|
||
|
" from HrmDepartment a \n" +
|
||
|
" inner join tem_table b on ( b.department_id = a.supdepid )\n" +
|
||
|
" )\n" +
|
||
|
" select * from tem_table where isnull(canceled,0) !=1 " ;
|
||
|
|
||
|
out.println("sql:"+sql+"</br>");
|
||
|
|
||
|
rs.executeQuery(sql);
|
||
|
while (rs.next()){
|
||
|
String depid = Util.null2String(rs.getString("department_id"));
|
||
|
deptids += StringUtils.isBlank(deptids) ? depid : ","+depid ;
|
||
|
}
|
||
|
out.println("deptids:"+deptids+"</br>");
|
||
|
List<DepartmentParam> deptList = new ArrayList<>();
|
||
|
sql = " SELECT count(id) as num FROM hrmresource where status < 4 and departmentid in("+deptids+") "+where ;
|
||
|
rs.executeQuery(sql);
|
||
|
if (rs.next()) {
|
||
|
int num = Util.getIntValue(rs.getString("num"));
|
||
|
out.println("num:"+num+"</br>");
|
||
|
yData.add(num);
|
||
|
deptList.add(DepartmentParam.builder().departmentId(deptid).count(num).build());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int max = Collections.max(yData);
|
||
|
int ceil =(int) Math.ceil((double) max / 5);
|
||
|
ceil = CommonUtils.roundUpToNearestTen(ceil);
|
||
|
int roundedMax = CommonUtils.roundedMax(ceil, 5);
|
||
|
|
||
|
out.println(OptionVO.builder()
|
||
|
.titleText("一级部门人数统计")
|
||
|
.xData(xData)
|
||
|
.yMin(0)
|
||
|
.yMax(roundedMax)
|
||
|
.yInterval(ceil)
|
||
|
.yData(yData)
|
||
|
.build());
|
||
|
|
||
|
|
||
|
%>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|