diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/common/service/impl/CommonServiceImpl.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/common/service/impl/CommonServiceImpl.java index 1a507da..92c4c58 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/common/service/impl/CommonServiceImpl.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/common/service/impl/CommonServiceImpl.java @@ -126,7 +126,7 @@ public class CommonServiceImpl implements CommonService { Map resultMap = dsSetService.getListDatas(SourceType.getSourceTypeByValue(sourceType),queryDto); resultList = (List>)resultMap.get("list"); } - + log.error("getListDatasBySourceName:[{}]",resultList); return resultList; } } diff --git a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/AuthorizedStrengthServiceImpl.java b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/AuthorizedStrengthServiceImpl.java index 70cb875..79e557e 100644 --- a/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/AuthorizedStrengthServiceImpl.java +++ b/jcl-hrmorganization/secondev-jcl-hrmorganization/src/main/java/com/weaver/seconddev/jcl/organization/service/impl/AuthorizedStrengthServiceImpl.java @@ -38,15 +38,15 @@ public class AuthorizedStrengthServiceImpl implements AuthorizedStrengthService String currentDate = DateUtil.getCurrentMonth(); //人员编制统计数据 数据源 List> datasBySourceList = commonService.getListDatasBySourceName("人员编制统计数据","LOGIC","weaver-hr-service"); - datasBySourceList = datasBySourceList.stream().filter(e->e.get("year").equals(params.get("adjustYear")) && - ((List>)e.get("orgId")).get(0).get("id").equals(params.get("adjustDepartment")) && - ((List>)e.get("planId")).get(0).get("id").equals(params.get("developPlan"))).collect(Collectors.toList()); + datasBySourceList = datasBySourceList.stream().filter(e->CommonUtils.null2String(e.get("year")).equals(params.get("adjustYear")) && + CommonUtils.null2String(((List>)e.get("orgId")).get(0).get("id")).equals(params.get("adjustDepartment")) && + CommonUtils.null2String(((List>)e.get("planId")).get(0).get("id")).equals(params.get("developPlan"))).collect(Collectors.toList()); //人员编制控编维度统计数据(月度周期) List> personYdzqMonthList = commonService.getListDatasBySourceName("人员编制控编维度统计数据","LOGIC","weaver-hr-service"); personYdzqMonthList = personYdzqMonthList.stream().filter(e->e.get("year").equals(params.get("adjustYear")) && - ((List>)e.get("orgId")).get(0).get("id").equals(params.get("adjustDepartment")) && - ((List>)e.get("position")).get(0).get("id").equals(params.get("position")) && - ((List>)e.get("grade")).get(0).get("id").equals(params.get("grade"))).collect(Collectors.toList()); + CommonUtils.null2String(((List>)e.get("orgId")).get(0).get("id")).equals(params.get("adjustDepartment")) && + CommonUtils.null2String(((List>)e.get("position")).get(0).get("id")).equals(params.get("position")) && + CommonUtils.null2String(((List>)e.get("grade")).get(0).get("id")).equals(params.get("grade"))).collect(Collectors.toList()); sql = "select * from e10_other_business.hr_est_history where org_id=? and cfg_id in ("+String.join(",",cfgIds)+")"; @@ -54,42 +54,66 @@ public class AuthorizedStrengthServiceImpl implements AuthorizedStrengthService String startDate = params.get("adjustYear")+"-01"; List> deparmentAdjust = Lists.newArrayList(); List> jobAdjust = Lists.newArrayList(); - + log.error("datasBySourceList:[{}]",datasBySourceList); + log.error("personYdzqMonthList:[{}]",personYdzqMonthList); for (int i=0;i<=11;i++){ Map dataMap = Maps.newHashMap(); Map dataMap2 = Maps.newHashMap(); String date = DateUtil.nextMonth(startDate,i, DateUtil.yyyyMM); int monthValue = DateUtil.getTime(date).getMonthValue(); - List> hrestCfg = dataList.stream().filter(e->e.get("cfg_month").equals(String.valueOf(monthValue))).collect(Collectors.toList()); + List> hrestCfg = dataList.stream().filter(e->CommonUtils.null2String(e.get("cfg_month")).equals(String.valueOf(monthValue))).collect(Collectors.toList()); if (hrestCfg.size() == 0){ continue; } + log.error("hrestCfg: [{}]",hrestCfg); + dataMap.put("monthvalue",monthValue); dataMap.put("bz",hrestCfg.get(0).get("est_count")); dataMap2.put("bz",hrestCfg.get(0).get("est_count")); + dataMap2.put("monthvalue",monthValue); List> hresthistory = historyList.stream().filter(e->e.get("cfg_id").equals(hrestCfg.get(0).get("id")) && e.get("history_month").equals(date)).collect(Collectors.toList()); List> personYdzqMonth = personYdzqMonthList.stream().filter(e->e.get("month").equals(String.valueOf(monthValue)) && e.get("cfgId").equals(hrestCfg.get(0).get("id"))).collect(Collectors.toList()); + if (personYdzqMonth.size() > 0){ + dataMap2.put("zz",personYdzqMonth.get(0).get("numberingCount")); + dataMap2.put("zy",personYdzqMonth.get(0).get("NumberComponent")); + dataMap2.put("ysf",personYdzqMonth.get(0).get("preSubEmpCount")); + dataMap2.put("kybz",personYdzqMonth.get(0).get("estLackCount")); + }else { + dataMap2.put("zz",""); + dataMap2.put("zy",""); + dataMap2.put("ysf",""); + dataMap2.put("kybz",""); + } - dataMap2.put("zz",personYdzqMonth.get(0).get("numberingCount")); - dataMap2.put("zy",personYdzqMonth.get(0).get("NumberComponent")); - dataMap2.put("ysf",personYdzqMonth.get(0).get("preSubEmpCount")); - dataMap2.put("kybz",personYdzqMonth.get(0).get("estLackCount")); if (DateUtil.getTime(date).compareTo(DateUtil.getTime(currentDate))<0){ //取历史 - - dataMap.put("zz",hresthistory.get(0).get("est_count")); - dataMap.put("zy",hresthistory.get(0).get("pre_add_count")); - dataMap.put("ysf",hresthistory.get(0).get("pre_sub_count")); - int kybz = Integer.valueOf(dataMap.get("bz").toString())-Integer.valueOf(dataMap.get("zz").toString())-Integer.valueOf(dataMap.get("zy").toString()); - dataMap.put("kybz",kybz); + if (hresthistory.size() > 0){ + dataMap.put("zz",hresthistory.get(0).get("est_count")); + dataMap.put("zy",hresthistory.get(0).get("pre_add_count")); + dataMap.put("ysf",hresthistory.get(0).get("pre_sub_count")); + int kybz = Integer.valueOf(dataMap.get("bz").toString())-Integer.valueOf(dataMap.get("zz").toString())-Integer.valueOf(dataMap.get("zy").toString()); + dataMap.put("kybz",kybz); + }else { + dataMap.put("zz",""); + dataMap.put("zy",""); + dataMap.put("ysf",""); + dataMap.put("kybz",""); + } }else { //取数据源 - dataMap.put("zz",datasBySourceList.get(0).get("numberingCount")); - dataMap.put("zy",datasBySourceList.get(0).get("preAddEmpCount")); - dataMap.put("ysf",datasBySourceList.get(0).get("preSubEmpCount")); - dataMap.put("kybz",datasBySourceList.get(0).get("estLackCount")); + if (datasBySourceList.size() > 0){ + dataMap.put("zz",datasBySourceList.get(0).get("numberingCount")); + dataMap.put("zy",datasBySourceList.get(0).get("preAddEmpCount")); + dataMap.put("ysf",datasBySourceList.get(0).get("preSubEmpCount")); + dataMap.put("kybz",datasBySourceList.get(0).get("estLackCount")); + }else { + dataMap.put("zz",""); + dataMap.put("zy",""); + dataMap.put("ysf",""); + dataMap.put("kybz",""); + } } deparmentAdjust.add(dataMap); jobAdjust.add(dataMap2); @@ -98,6 +122,6 @@ public class AuthorizedStrengthServiceImpl implements AuthorizedStrengthService resultMap.put("deparmentAdjust",deparmentAdjust); resultMap.put("jobAdjust",jobAdjust); - return null; + return resultMap; } }