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.

93 lines
3.7 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ 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" %>
<%
JSONObject jsonObject = new JSONObject();
LinkedList<PortalTopVO> list = getPortalTop();
jsonObject.put("data",list);
%>
<%=jsonObject.toString() %>
<%!
public LinkedList<PortalTopVO> getPortalTop() {
RecordSet rs = new RecordSet();
DecimalFormat df = new DecimalFormat("#.00");
String subcompanyid1 = "62" ;
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());
String startMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateStartOfMonth(YearMonth.now()));
String endMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateEndOfMonth(YearMonth.now()));
rs.executeQuery("select count(1) as sum from hrmresource where status < 4 and subcompanyid1 ="+subcompanyid1+" and companystartdate >= ? and companystartdate <= " + where,startMonth,endMonth);
rs.next();
Integer sum = Util.getIntValue(rs.getString("sum"),0);
portalTopVOList.add(PortalTopVO.builder().title("本月新入职人员").count(sum).build());
return portalTopVOList;
}
%>
<%!
/**
* 平分legendData
* @param nameSet
*/
private LinkedList<String> treeSetSplitExample(LinkedList<String> nameSet) {
int splitSize = nameSet.size() / 2;
LinkedList<String> legendDataFirst = nameSet.stream()
.collect(Collectors.partitioningBy(e -> nameSet.indexOf(e) < splitSize,
Collectors.toCollection(LinkedList::new)))
.get(false);
nameSet.removeAll(legendDataFirst);
return legendDataFirst;
}
%>