1
0
Fork 0
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.

71 lines
2.3 KiB
Plaintext

<%@ 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.OptionVO" %>
<%@ page import="java.time.YearMonth" %>
<%@ page import="com.engine.matfron.util.CommonDateUtil" %>
<%@ page import="java.time.LocalDate" %>
<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" %>
<%
JSONObject jsonObject = new JSONObject();
OptionVO optionVO = getPortalSubCompany();
jsonObject.put("data",optionVO);
jsonObject.put("status",true);
%>
<%=jsonObject.toJSONString() %>
<%!
public OptionVO getPortalSubCompany() {
RecordSet rs = new RecordSet();
LinkedList<Integer> yData = new LinkedList<>();
String where = " and (belongto is null or belongto = -1 ) ";
List<YearMonth> yearMonths = CommonDateUtil.getYearMonths(LocalDate.now());
yearMonths.forEach(yearMonth -> {
String startMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateStartOfMonth(yearMonth));
String endMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateEndOfMonth(yearMonth));
rs.executeQuery("select count(1) as sum from hrmresource where status < 4 and companystartdate <= ?" + where ,endMonth);
if (rs.next()) {
Integer sum = Util.getIntValue(rs.getString("sum"),0);
yData.add(sum);
}
});
int max = Collections.max(yData);
int ceil =(int) Math.ceil((double) max / 5);
ceil = CommonUtils.roundUpToNearestTen(ceil);
int roundedMax = CommonUtils.roundedMax(ceil, 5);
return OptionVO.builder()
.titleText("各月份分部总人数")
.yMin(0)
.yMax(roundedMax)
.yInterval(ceil)
.yData(yData)
.legendDataFirst(null)
.legendDataTwo(null)
.barSeriesData(null)
.barSeriesDataTwo(null)
.barSeriesDataThree(null)
.seriesData(null)
.build();
}
%>