From 21056c999d4aa0ed57b59192ddb9f5808d633bcd Mon Sep 17 00:00:00 2001 From: shilei <798989044@qq.com> Date: Mon, 29 Jan 2024 16:21:30 +0800 Subject: [PATCH] =?UTF-8?q?#matfron-2#=20=E7=BB=9F=E8=AE=A1=E9=97=A8?= =?UTF-8?q?=E6=88=B7=E7=9A=84=E5=85=83=E7=B4=A0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interface/mingfeng/getCompanyAnniversary.jsp | 25 ++++- interface/mingfeng/getCompanyAnniversary2.jsp | 36 +++++-- interface/mingfeng/getPortalDepartment.jsp | 101 ++++++++++++++++++ interface/mingfeng/getPortalDepartment2.jsp | 83 ++++++++++++++ interface/mingfeng/getPortalEducational.jsp | 92 ++++++++++++++++ interface/mingfeng/getPortalEthnic.jsp | 6 +- interface/mingfeng/getPortalSubCompany.jsp | 70 ++++++++++++ interface/mingfeng/getPortalTop.jsp | 92 ++++++++++++++++ interface/mingfeng/getPortalUserGender.jsp | 93 ++++++++++++++++ interface/mingfeng/getPortalUserJobType.jsp | 66 ++++++++++++ interface/mingfeng/getPortalWorkCompany.jsp | 72 +++++++++++++ interface/mingfeng/getUserBirthdayAjax.jsp | 25 ++++- interface/mingfeng/getUserBirthdayAjax2.jsp | 27 ++++- 13 files changed, 771 insertions(+), 17 deletions(-) create mode 100644 interface/mingfeng/getPortalDepartment.jsp create mode 100644 interface/mingfeng/getPortalDepartment2.jsp create mode 100644 interface/mingfeng/getPortalEducational.jsp create mode 100644 interface/mingfeng/getPortalSubCompany.jsp create mode 100644 interface/mingfeng/getPortalTop.jsp create mode 100644 interface/mingfeng/getPortalUserGender.jsp create mode 100644 interface/mingfeng/getPortalUserJobType.jsp create mode 100644 interface/mingfeng/getPortalWorkCompany.jsp diff --git a/interface/mingfeng/getCompanyAnniversary.jsp b/interface/mingfeng/getCompanyAnniversary.jsp index c8bdb66..515e8e4 100644 --- a/interface/mingfeng/getCompanyAnniversary.jsp +++ b/interface/mingfeng/getCompanyAnniversary.jsp @@ -17,6 +17,25 @@ SimpleDateFormat sdf = new SimpleDateFormat("MM-dd" ) ; SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; int days = 30 ; + String workflowid = "890"; + String formtable = "" ; + String sql = "select abs(formid) as formid from workflow_base where id = "+workflowid ; + rs.executeQuery(sql); + if(rs.next()){ + String formid = Util.null2String(rs.getString("formid")); + if(StringUtils.isNotBlank(formid)){ + formtable = "formtable_main_"+formid ; + } + } + + String where = "" ; + if(StringUtils.isNotBlank(formtable)){ + where = " and h.id not in(select k.lzyg \n" + + " from workflow_requestbase p\n" + + " inner join "+formtable+" k on k.requestid = p.requestid\n" + + " where workflowid = "+workflowid+"\n" + + " and p.currentnodetype = 3 ) "; + } for(int i=0;i"); + String formtable = "" ; + String sql = "select abs(formid) as formid from workflow_base where id = "+workflowid ; + rs.executeQuery(sql); + if(rs.next()){ + String formid = Util.null2String(rs.getString("formid")); + if(StringUtils.isNotBlank(formid)){ + formtable = "formtable_main_"+formid ; + } + } + out.println("formtable:"+formtable+"
"); + String where = "" ; + if(StringUtils.isNotBlank(formtable)){ + where = " and h.id not in(select k.lzyg \n" + + " from workflow_requestbase p\n" + + " inner join "+formtable+" k on k.requestid = p.requestid\n" + + " where workflowid = "+workflowid+"\n" + + " and p.currentnodetype = 3 ) "; + } + out.println("where:"+where+"
"); + for(int i=0;i"); - String sql =" select k.* from (select h.id,h.lastname,h.sex,h.departmentid,d.departmentname,s.subcompanyname,k.jobtitlename," + + sql = " select k.* from (select h.id,h.lastname,h.sex,h.departmentid,d.departmentname,s.subcompanyname,k.jobtitlename," + " h.companystartdate,convert(varchar(50), getdate(), 23) as enddate," + " (datediff(year,h.companystartdate,convert(varchar(50), getdate(), 23))-1) as zn" + " from hrmresource h\n" + @@ -36,7 +58,7 @@ " left join HrmJobTitles k on k.id = h.jobtitle\n" + " where right(h.companystartdate,5) = '"+currentDay+"'\n" + " and h.status in(0,1,2,3)" + - " and (h.belongto is null or h.belongto = -1 ) " + + " and (h.belongto is null or h.belongto = -1 ) " + where + " and h.companystartdate is not null " + " ) k " ; @@ -98,7 +120,7 @@ String currentYear = sdf2.format(calendar.getTime()) ; out.println("currentYear:"+currentYear+"
"); - String sql =" select k.* from (select h.id,h.lastname,h.sex,h.departmentid,d.departmentname,s.subcompanyname,k.jobtitlename," + + sql =" select k.* from (select h.id,h.lastname,h.sex,h.departmentid,d.departmentname,s.subcompanyname,k.jobtitlename," + " h.companystartdate,convert(varchar(50), getdate(), 23) as enddate," + " (datediff(year,h.companystartdate,convert(varchar(50), getdate(), 23))-1) as zn" + " from hrmresource h\n" + @@ -107,7 +129,7 @@ " left join HrmJobTitles k on k.id = h.jobtitle\n" + " where right(h.companystartdate,5) = '"+currentDay+"'\n" + " and h.status in(0,1,2,3)" + - " and (h.belongto is null or h.belongto = -1 ) " + + " and (h.belongto is null or h.belongto = -1 ) " + where + " and h.companystartdate is not null " + " ) k " ; @@ -163,9 +185,9 @@ String modeid = "" ; String formid = "" ; String uftable = "uf_rzznzfgly"; - String sql =" select k.id,k.formid from modeinfo k \n" + - " inner join workflow_bill l on formid = l.id\n" + - " where l.tablename = '"+uftable+"' " ; + sql =" select k.id,k.formid from modeinfo k \n" + + " inner join workflow_bill l on formid = l.id\n" + + " where l.tablename = '"+uftable+"' " ; rs.execute(sql); if(rs.next()){ modeid = Util.null2String(rs.getString("id")); diff --git a/interface/mingfeng/getPortalDepartment.jsp b/interface/mingfeng/getPortalDepartment.jsp new file mode 100644 index 0000000..987592c --- /dev/null +++ b/interface/mingfeng/getPortalDepartment.jsp @@ -0,0 +1,101 @@ +<%@ 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" %> +<%@ page import="com.fasterxml.jackson.databind.ObjectMapper" %> +<%@ page import="com.fasterxml.jackson.core.JsonProcessingException" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + JSONObject jsonObject = new JSONObject(); + OptionVO optionVO = getPortalDepartment(); + jsonObject.put("data",optionVO); + +%> +<%=jsonObject.toJSONString() %> + +<%! + + public OptionVO getPortalDepartment() { + RecordSet rs = new RecordSet(); + LinkedList xData = new LinkedList<>(); + LinkedList yData = new LinkedList<>(); + String where = " and (belongto is null or belongto = -1 ) "; + List 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){ + 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 " ; + rs.executeQuery(sql); + while (rs.next()){ + String depid = Util.null2String(rs.getString("department_id")); + deptids += StringUtils.isBlank(deptids) ? depid : ","+depid ; + } + + List 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")); + 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); + + return OptionVO.builder() + .titleText("一级部门人数统计") + .xData(xData) + .yMin(0) + .yMax(roundedMax) + .yInterval(ceil) + .yData(yData) + .build(); + } + + + + + private static String getJsonString(Object apidatas) { + ObjectMapper mapper = new ObjectMapper(); + try { + return mapper.writeValueAsString(apidatas); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return ""; + } + +%> + + + + + + diff --git a/interface/mingfeng/getPortalDepartment2.jsp b/interface/mingfeng/getPortalDepartment2.jsp new file mode 100644 index 0000000..a20a86b --- /dev/null +++ b/interface/mingfeng/getPortalDepartment2.jsp @@ -0,0 +1,83 @@ +<%@ 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" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + + RecordSet rs = new RecordSet(); + LinkedList xData = new LinkedList<>(); + LinkedList yData = new LinkedList<>(); + String where = " and (belongto is null or belongto = -1 ) "; + List 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+"
"); + 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+"
"); + + rs.executeQuery(sql); + while (rs.next()){ + String depid = Util.null2String(rs.getString("department_id")); + deptids += StringUtils.isBlank(deptids) ? depid : ","+depid ; + } + out.println("deptids:"+deptids+"
"); + List 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+"
"); + 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()); + + +%> + + + + + + + diff --git a/interface/mingfeng/getPortalEducational.jsp b/interface/mingfeng/getPortalEducational.jsp new file mode 100644 index 0000000..e59443c --- /dev/null +++ b/interface/mingfeng/getPortalEducational.jsp @@ -0,0 +1,92 @@ +<%@ page import="weaver.general.*" %> +<%@page import="weaver.conn.RecordSet"%> +<%@ page import="com.alibaba.fastjson.JSONObject" %> +<%@ page import="java.util.*" %> +<%@ page import="com.engine.matfron.entity.OptionVO" %> +<%@ page import="com.engine.matfron.entity.SeriesParam" %> +<%@ page import="java.util.stream.Collectors" %> +<%@ page import="java.text.DecimalFormat" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + JSONObject jsonObject = new JSONObject(); + OptionVO optionVO = getPortalEducational(); + jsonObject.put("data",optionVO); + +%> +<%=jsonObject.toString() %> + +<%! + + public OptionVO getPortalEducational() { + + DecimalFormat df = new DecimalFormat("#.0"); + RecordSet rs = new RecordSet(); + List colorList = Arrays.asList("#faf0e6","#7cfc00","#ee8164","#9933fa","#f19c45","#6fcecf","#507ef7","#ao20f0"); + LinkedList seriesData = new LinkedList<>(); + LinkedList nameSet = new LinkedList<>(); + + String sql =" select t.xl,d.name,count(1) as sum " + + " from uf_jypxjl t\n" + + " inner join hrmresource h on h.workcode = t.ygbh\n" + + " left join hrmeducationlevel d on t.xl = d.id \n" + + " where t.xl is not null \n" + + " and h.status in(0,1,2,3)\n" + + " and (h.belongto is null or h.belongto = -1 )\n" + + " group by t.xl,d.name " + + " order by t.xl desc " ; + + rs.executeQuery(sql); + int index = 0; + while (rs.next()) { + if (index > colorList.size()){ + index = 0; + } + index++; + String name = Util.formatMultiLang (Util.null2String(rs.getString("name"))); + + seriesData.add(SeriesParam.builder().value(Util.getDoubleValue(rs.getString("sum"))).name(name).color(colorList.get(index)).build()); + nameSet.add(name); + } + + double percentage = seriesData.stream().mapToDouble(SeriesParam::getValue).sum(); + seriesData.forEach(item -> item.setValue(Double.valueOf(df.format((item.getValue() * 100) / percentage)))); + +// LinkedList legendDataFirst = new LinkedList<>(); +// if (nameSet.size() > 2) { +// legendDataFirst = treeSetSplitExample(nameSet); +// } + + return OptionVO.builder() + .titleText("学历分析") + .legendDataFirst(nameSet) +// .legendDataTwo(nameSet) + .seriesData(seriesData) + .build(); + } + +%> + + +<%! + /** + * 平分legendData + * @param nameSet + */ + private LinkedList treeSetSplitExample(LinkedList nameSet) { + int splitSize = nameSet.size() / 2; + LinkedList legendDataFirst = nameSet.stream() + .collect(Collectors.partitioningBy(e -> nameSet.indexOf(e) < splitSize, + Collectors.toCollection(LinkedList::new))) + .get(false); + nameSet.removeAll(legendDataFirst); + return legendDataFirst; + } + + +%> + + + diff --git a/interface/mingfeng/getPortalEthnic.jsp b/interface/mingfeng/getPortalEthnic.jsp index 6b57d28..863f12b 100644 --- a/interface/mingfeng/getPortalEthnic.jsp +++ b/interface/mingfeng/getPortalEthnic.jsp @@ -35,8 +35,10 @@ " inner join hrmresource h on h.id = t.id\n" + " left join cus_selectitem k on k.selectvalue = t."+fieldname+"\n" + " where k.fieldid="+fieldid+" \n" + - " and t."+fieldname+" is not null\n" + - " and scope = 'HrmCustomFieldByInfoType' and scopeid='3'\n" + + " and t."+fieldname+" is not null \n" + + " and t.scope = 'HrmCustomFieldByInfoType' and t.scopeid='3' \n" + + " and h.status in(0,1,2,3)" + + " and (h.belongto is null or h.belongto = -1 ) " + " group by t."+fieldname+",k.selectname \n" + ""); while (rs.next()) { diff --git a/interface/mingfeng/getPortalSubCompany.jsp b/interface/mingfeng/getPortalSubCompany.jsp new file mode 100644 index 0000000..fc297fc --- /dev/null +++ b/interface/mingfeng/getPortalSubCompany.jsp @@ -0,0 +1,70 @@ +<%@ 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" %> + + +<%@ 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 yData = new LinkedList<>(); + String where = " and (belongto is null or belongto = -1 ) "; + + List 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(); + } + + + +%> + + + + + + diff --git a/interface/mingfeng/getPortalTop.jsp b/interface/mingfeng/getPortalTop.jsp new file mode 100644 index 0000000..e9d6af5 --- /dev/null +++ b/interface/mingfeng/getPortalTop.jsp @@ -0,0 +1,92 @@ +<%@ 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" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + JSONObject jsonObject = new JSONObject(); + LinkedList list = getPortalTop(); + jsonObject.put("data",list); + +%> +<%=jsonObject.toString() %> + +<%! + + public LinkedList getPortalTop() { + RecordSet rs = new RecordSet(); + DecimalFormat df = new DecimalFormat("#.00"); + String subcompanyid1 = "62" ; + + LinkedList portalTopVOList = new LinkedList(); + 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 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 treeSetSplitExample(LinkedList nameSet) { + int splitSize = nameSet.size() / 2; + LinkedList legendDataFirst = nameSet.stream() + .collect(Collectors.partitioningBy(e -> nameSet.indexOf(e) < splitSize, + Collectors.toCollection(LinkedList::new))) + .get(false); + nameSet.removeAll(legendDataFirst); + return legendDataFirst; + } + + +%> + + + diff --git a/interface/mingfeng/getPortalUserGender.jsp b/interface/mingfeng/getPortalUserGender.jsp new file mode 100644 index 0000000..9526e43 --- /dev/null +++ b/interface/mingfeng/getPortalUserGender.jsp @@ -0,0 +1,93 @@ +<%@ 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="com.engine.matfron.entity.OptionVO" %> +<%@ page import="java.time.LocalDate" %> +<%@ page import="java.time.Period" %> +<%@ page import="com.engine.matfron.util.CommonUtils" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + JSONObject jsonObject = new JSONObject(); + OptionVO OptionVO = getAgeAndSex(); + jsonObject.put("data",OptionVO); + +%> +<%=jsonObject.toString() %> + +<%! + + public OptionVO getAgeAndSex() { + RecordSet rs = new RecordSet(); + LinkedList barSeriesData = new LinkedList<>(); + LinkedList barSeriesDataTwo = new LinkedList<>(); + List ageArr = Arrays.asList("16~20","21~25","26~30","31~35","36~40","41~45","46~50","51~55","56~60","61~65","66~70"); + String where = " and (belongto is null or belongto = -1 ) "; + + List birthdayListMen = new ArrayList<>(); + rs.executeQuery("select birthday from hrmresource where status < 4 "+where+" and sex is not null and birthday is not null and birthday <> '' and sex = 0"); + while (rs.next()) { + birthdayListMen.add(Util.null2String(rs.getString("birthday"))); + } + List menAge = birthdayListMen.stream() + .map(birthday -> { + LocalDate birthdate = LocalDate.parse(birthday); + LocalDate now = LocalDate.now(); + return Period.between(birthdate, now).getYears(); + }) + .collect(Collectors.toList()); + for (int i = 0; i < ageArr.size(); i++) { + String[] split = ageArr.get(i).split("~"); + List collect = menAge.stream().filter(item -> item > Integer.parseInt(split[0]) && item <= Integer.parseInt(split[1])).collect(Collectors.toList()); + barSeriesData.add(collect.size()); + } + + int yMax = barSeriesData.stream().max(Integer::compare).orElse(0); + + List birthdayListWomen = new ArrayList<>(); + rs.executeQuery("select birthday from hrmresource where status < 4 "+where+" and sex is not null and birthday is not null and sex = 1"); + while (rs.next()) { + birthdayListWomen.add(Util.null2String(rs.getString("birthday"))); + } + List womenAge = birthdayListWomen.stream() + .map(birthday -> { + LocalDate birthdate = LocalDate.parse(birthday); + LocalDate now = LocalDate.now(); + return Period.between(birthdate, now).getYears(); + }) + .collect(Collectors.toList()); + + LinkedList list = new LinkedList<>(); + for (int i = 0; i < ageArr.size(); i++) { + String[] split = ageArr.get(i).split("~"); + List collect = womenAge.stream().filter(item -> item > Integer.parseInt(split[0]) && item <= Integer.parseInt(split[1])).collect(Collectors.toList()); + barSeriesDataTwo.add(-collect.size()); + list.add(collect.size()); + } + + int yMin = -(list.stream().max(Integer::compare).orElse(0)); + int sum = yMax > Math.abs(yMin) ? yMax : yMin ; + + int divisor = sum % 6; + sum = sum + (6 - divisor) + 12; + int ceil =(int) Math.ceil((double) sum / 3); + int roundedMax = CommonUtils.roundedMax(ceil, 6); + + return OptionVO.builder() + .titleText("年龄与性别分析") + .yMin(-roundedMax) + .yMax(roundedMax) + .yInterval(ceil) + .barSeriesData(barSeriesData) + .barSeriesDataTwo(barSeriesDataTwo) + .build(); + } + +%> + + + diff --git a/interface/mingfeng/getPortalUserJobType.jsp b/interface/mingfeng/getPortalUserJobType.jsp new file mode 100644 index 0000000..b30830d --- /dev/null +++ b/interface/mingfeng/getPortalUserJobType.jsp @@ -0,0 +1,66 @@ +<%@ page import="weaver.general.*" %> +<%@page import="weaver.conn.RecordSet"%> +<%@ page import="com.alibaba.fastjson.JSONObject" %> +<%@ page import="java.util.*" %> +<%@ page import="com.engine.matfron.entity.OptionVO" %> +<%@ page import="com.engine.matfron.util.CommonUtils" %> +<%@ page import="org.apache.commons.lang3.StringUtils" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + JSONObject jsonObject = new JSONObject(); + OptionVO OptionVO = getJobType(); + jsonObject.put("data",OptionVO); + +%> +<%=jsonObject.toString() %> + +<%! + + public OptionVO getJobType() { + RecordSet rs = new RecordSet(); + LinkedList xData = new LinkedList<>(); + LinkedList barSeriesData = new LinkedList<>(); + String where = " and (h.belongto is null or h.belongto = -1 ) "; + + rs.executeQuery(" select a.*,b.jobgroupname from ( " + + " select g.id as jobgroupid,count(1) as sum " + + " from hrmresource h \n" + + " left join hrmjobtitles j on h.jobtitle = j.id \n" + + " left join hrmjobactivities c on j.jobactivityid = c.id \n" + + " left join hrmjobgroups g on c.jobgroupid = g.id \n" + + " where h.status < 4 "+where+" " + + " and g.id is not null group by g.id" + + " ) as a " + + " left join hrmjobgroups b on a.jobgroupid = b.id "); + + while (rs.next()) { + String jobgroupname = Util.null2String(rs.getString("jobgroupname")) ; + int sum = Util.getIntValue(rs.getString("sum")); + if(StringUtils.isNotBlank(jobgroupname)){ + xData.add(jobgroupname); + barSeriesData.add(sum); + } + } + + int max = Collections.max(barSeriesData); + int ceil =(int) Math.ceil((double) max / 4); + ceil = CommonUtils.roundUpToNearestTen(ceil); + int roundedMax = CommonUtils.roundedMax(ceil, 4); + + return OptionVO.builder() + .titleText("职务类别统计") + .xData(xData) + .yMin(0) + .yMax(roundedMax) + .yInterval(ceil) + .barSeriesData(barSeriesData) + .build(); + } + +%> + + + diff --git a/interface/mingfeng/getPortalWorkCompany.jsp b/interface/mingfeng/getPortalWorkCompany.jsp new file mode 100644 index 0000000..646ce64 --- /dev/null +++ b/interface/mingfeng/getPortalWorkCompany.jsp @@ -0,0 +1,72 @@ +<%@ 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="com.engine.matfron.entity.OptionVO" %> +<%@ page import="com.engine.matfron.entity.SeriesParam" %> +<%@ page import="com.engine.matfron.entity.SurnameParam" %> +<%@ page import="java.text.DecimalFormat" %> + + +<%@ page language="java" contentType="text/html; charset=UTF-8" %> + +<% + JSONObject jsonObject = new JSONObject(); + OptionVO OptionVO = getSurname(); + jsonObject.put("data",OptionVO); + +%> +<%=jsonObject.toString() %> + +<%! + + public OptionVO getSurname() { + + DecimalFormat df = new DecimalFormat("#.00"); + + RecordSet rs = new RecordSet(); + LinkedList seriesData = new LinkedList<>(); + String where = " and (belongto is null or belongto = -1 ) "; + + List surnameList = new ArrayList<>(); + rs.executeQuery("select companyworkyear,count(1) as sum from hrmresource where status < 4 " + where + + " and companyworkyear is not null group by companyworkyear "); + while (rs.next()) { + surnameList.add(SurnameParam.builder().companyworkyear(Util.getDoubleValue(rs.getString("companyworkyear"))).count(Util.getIntValue(rs.getString("sum"))).build()); + } + + List statisticsArr = Arrays.asList(0,1,3,5,10,100); + List statisticsList = new ArrayList<>(); + for (int i = 0; i < 5; i++) { + double count = statisticsSurname(statisticsArr.get(i), statisticsArr.get(i+1), surnameList); + statisticsList.add(count); + } + + double percentage = statisticsList.stream().mapToDouble(Double::doubleValue).sum(); + List newList = statisticsList.stream() + .map(num -> Double.valueOf (df.format((num * 100 ) / percentage))) + .collect(Collectors.toList()); + + newList.forEach(count -> seriesData.add(SeriesParam.builder().value(count).build())); + + return OptionVO.builder() + .titleText("司龄统计") + .seriesData(seriesData) + .build(); + } + + + /** + * 根据范围统计司龄的个数 + * @return + */ + private Double statisticsSurname(Integer min,Integer max,List surnameList) { + return surnameList.stream().filter(item -> item.getCompanyworkyear() > min && item.getCompanyworkyear() <= max) + .mapToDouble(SurnameParam::getCount).sum(); + } + +%> + + + diff --git a/interface/mingfeng/getUserBirthdayAjax.jsp b/interface/mingfeng/getUserBirthdayAjax.jsp index f1dd17a..e283275 100644 --- a/interface/mingfeng/getUserBirthdayAjax.jsp +++ b/interface/mingfeng/getUserBirthdayAjax.jsp @@ -14,16 +14,37 @@ SimpleDateFormat sdf = new SimpleDateFormat("MM") ; SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + + String workflowid = "890"; + String formtable = "" ; + String sql = "select abs(formid) as formid from workflow_base where id = "+workflowid ; + rs.executeQuery(sql); + if(rs.next()){ + String formid = Util.null2String(rs.getString("formid")); + if(StringUtils.isNotBlank(formid)){ + formtable = "formtable_main_"+formid ; + } + } + + String where = "" ; + if(StringUtils.isNotBlank(formtable)){ + where = " and h.id not in(select k.lzyg \n" + + " from workflow_requestbase p\n" + + " inner join "+formtable+" k on k.requestid = p.requestid\n" + + " where workflowid = "+workflowid+"\n" + + " and p.currentnodetype = 3 ) "; + } + String currentMonth = sdf.format(new Date()); bb.writeLog("currentMonth:"+currentMonth); String currentYear = sdf2.format(new Date()); bb.writeLog("currentYear:"+currentYear); - String sql =" select h.id,h.lastname,h.sex,h.departmentid,d.departmentname,s.subcompanyname from hrmresource h\n" + + sql =" select h.id,h.lastname,h.sex,h.departmentid,d.departmentname,s.subcompanyname from hrmresource h\n" + " inner join HrmDepartment d on d.id = h.departmentid\n" + " inner join HrmSubCompany s on s.id = h.subcompanyid1\n" + " where right(left(h.birthday,7),2) ='"+currentMonth+"'\n" + - " and h.status in(0,1,2,3) and h.birthday is not null " + + " and h.status in(0,1,2,3) and h.birthday is not null " + where+ " and (h.belongto is null or h.belongto = -1 ) " ; bb.writeLog("sql:"+sql); rs.executeQuery(sql); diff --git a/interface/mingfeng/getUserBirthdayAjax2.jsp b/interface/mingfeng/getUserBirthdayAjax2.jsp index a598fd8..93ac304 100644 --- a/interface/mingfeng/getUserBirthdayAjax2.jsp +++ b/interface/mingfeng/getUserBirthdayAjax2.jsp @@ -13,6 +13,25 @@ BaseBean bb = new BaseBean(); SimpleDateFormat sdf = new SimpleDateFormat("MM") ; SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy" ) ; + String workflowid = "890"; + String formtable = "" ; + String sql = "select abs(formid) as formid from workflow_base where id = "+workflowid ; + rs.executeQuery(sql); + if(rs.next()){ + String formid = Util.null2String(rs.getString("formid")); + if(StringUtils.isNotBlank(formid)){ + formtable = "formtable_main_"+formid ; + } + } + + String where = "" ; + if(StringUtils.isNotBlank(formtable)){ + where = " and h.id not in(select k.lzyg \n" + + " from workflow_requestbase p\n" + + " inner join "+formtable+" k on k.requestid = p.requestid\n" + + " where workflowid = "+workflowid+"\n" + + " and p.currentnodetype = 3 ) "; + } String currentMonth = sdf.format(new Date()) ; @@ -20,12 +39,14 @@ String currentYear = sdf2.format(new Date()) ; out.println("currentYear:"+currentYear+"
"); - String sql =" select h.id,h.lastname,h.sex,h.departmentid,d.departmentname,s.subcompanyname from hrmresource h\n" + + sql =" select h.id,h.lastname,h.sex,h.departmentid,d.departmentname,s.subcompanyname from hrmresource h\n" + " inner join HrmDepartment d on d.id = h.departmentid\n" + " inner join HrmSubCompany s on s.id = h.subcompanyid1\n" + " where right(left(h.birthday,7),2) ='"+currentMonth+"'\n" + - " and h.status in(0,1,2,3) and h.birthday is not null " + + " and h.status in(0,1,2,3) and h.birthday is not null " + where + " and (h.belongto is null or h.belongto = -1 ) " ; + + out.println("sql:"+sql+"
"); bb.writeLog("sql:"+sql); rs.executeQuery(sql); while (rs.next()){ @@ -46,7 +67,7 @@ dataMap.put("nf",currentYear); dataList.add(dataMap); } - + out.println("dataList:"+dataList.size()+"
"); String modeid = "" ; String formid = "" ;