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.
83 lines
3.4 KiB
Plaintext
83 lines
3.4 KiB
Plaintext
<%@ page import="weaver.general.*" %>
|
|
<%@page import="weaver.conn.RecordSet"%>
|
|
<%@ page import="com.alibaba.fastjson.JSONObject" %>
|
|
<%@ page import="java.util.*" %>
|
|
<%@ page import="java.util.stream.Collectors" %>
|
|
<%@ page import="java.text.DecimalFormat" %>
|
|
<%@ page import="com.engine.matfron.entity.PortalTopVO" %>
|
|
<%@ page import="com.engine.matfron.util.CommonUtils" %>
|
|
<%@ page import="com.engine.matfron.util.CommonDateUtil" %>
|
|
<%@ page import="java.time.YearMonth" %>
|
|
<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" %>
|
|
|
|
<%
|
|
|
|
String subcompanyid1 = "62" ;
|
|
JSONObject jsonObject = new JSONObject();
|
|
LinkedList<PortalTopVO> list = getPortalTop(subcompanyid1);
|
|
jsonObject.put("data",list);
|
|
|
|
%>
|
|
<%=jsonObject.toString() %>
|
|
|
|
<%!
|
|
|
|
public LinkedList<PortalTopVO> getPortalTop(String subcompanyid1) {
|
|
RecordSet rs = new RecordSet();
|
|
DecimalFormat df = new DecimalFormat("#.00");
|
|
BaseBean bb = new BaseBean();
|
|
|
|
LinkedList<PortalTopVO> portalTopVOList = new LinkedList<PortalTopVO>();
|
|
String where = " and (belongto is null or belongto = -1 ) ";
|
|
|
|
rs.executeQuery("select count(1) as cou from hrmresource where status < 4 and subcompanyid1 ="+subcompanyid1 +where );
|
|
rs.next();
|
|
Integer count = Util.getIntValue(rs.getString("cou"), 0);
|
|
portalTopVOList.add(PortalTopVO.builder().title("在职人数总数").count(count).build());
|
|
|
|
int sb_count = 0 ;
|
|
String sql = " select count(1) as cou from hrsa_insurance_base_info where run_status in(2,3) and isnull(delete_type,0) !=1 " ;
|
|
rs.executeQuery(sql);
|
|
if(rs.next()){
|
|
sb_count = Util.getIntValue(rs.getString("cou"), 0);
|
|
}
|
|
portalTopVOList.add(PortalTopVO.builder().title("社保缴纳人数").count(sb_count).build());
|
|
|
|
List<String> birthdayList = new ArrayList<>();
|
|
rs.executeQuery("select birthday from hrmresource where status < 4 and birthday is not null and subcompanyid1 ="+subcompanyid1+" and birthday <> '' "+where);
|
|
while (rs.next()) {
|
|
birthdayList.add(Util.null2String(rs.getString("birthday")));
|
|
}
|
|
|
|
double averageAge = birthdayList.stream()
|
|
.map(CommonUtils::parseLocalDate)
|
|
.mapToInt(CommonUtils::calculateAge)
|
|
.average()
|
|
.orElse(0);
|
|
String avgAge = df.format(averageAge);
|
|
portalTopVOList.add(PortalTopVO.builder().title("平均年龄").count(avgAge).build());
|
|
|
|
int sum = 0;
|
|
String startMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateStartOfMonth(YearMonth.now()));
|
|
String endMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateEndOfMonth(YearMonth.now()));
|
|
sql = " select count(1) as sum from hrmresource where status < 4 and subcompanyid1 ="+subcompanyid1+" and companystartdate >= '"+startMonth+"' and companystartdate <= '"+endMonth+"'" + where ;
|
|
bb.writeLog("sql:"+sql);
|
|
rs.executeQuery(sql);
|
|
if(rs.next()){
|
|
sum = Util.getIntValue(Util.null2String(rs.getString("sum")),0);
|
|
}
|
|
|
|
bb.writeLog("sum:"+sum);
|
|
portalTopVOList.add(PortalTopVO.builder().title("本月新入职人员").count(sum).build());
|
|
|
|
return portalTopVOList;
|
|
}
|
|
|
|
%>
|
|
|
|
|
|
|
|
|