|
|
@ -4,15 +4,18 @@ import com.engine.core.impl.Service;
|
|
|
|
import com.engine.thinktrans.entity.PersonnelSizeTop;
|
|
|
|
import com.engine.thinktrans.entity.PersonnelSizeTop;
|
|
|
|
import com.engine.thinktrans.entity.ReportChildrenData;
|
|
|
|
import com.engine.thinktrans.entity.ReportChildrenData;
|
|
|
|
import com.engine.thinktrans.entity.ReportColumns;
|
|
|
|
import com.engine.thinktrans.entity.ReportColumns;
|
|
|
|
|
|
|
|
import com.engine.thinktrans.entity.param.PersonnelSizeTopParam;
|
|
|
|
import com.engine.thinktrans.entity.param.TendencyReportParam;
|
|
|
|
import com.engine.thinktrans.entity.param.TendencyReportParam;
|
|
|
|
import com.engine.thinktrans.entity.vo.TendencyReportVO;
|
|
|
|
import com.engine.thinktrans.entity.vo.TendencyReportVO;
|
|
|
|
import com.engine.thinktrans.service.ReportCollectService;
|
|
|
|
import com.engine.thinktrans.service.ReportCollectService;
|
|
|
|
import com.engine.thinktrans.util.CommonDateUtil;
|
|
|
|
import com.engine.thinktrans.util.CommonDateUtil;
|
|
|
|
import com.weaver.general.Util;
|
|
|
|
import com.weaver.general.Util;
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
import weaver.hrm.company.DepartmentComInfo;
|
|
|
|
import weaver.hrm.company.DepartmentComInfo;
|
|
|
|
|
|
|
|
import weaver.hrm.company.SubCompanyComInfo;
|
|
|
|
|
|
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
import java.text.DecimalFormat;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.LocalDate;
|
|
|
@ -120,11 +123,11 @@ public class ReportCollectServiceImpl extends Service implements ReportCollectSe
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public TendencyReportVO getPersonnelSize(Integer year) {
|
|
|
|
public TendencyReportVO getPersonnelSize(PersonnelSizeTopParam param) {
|
|
|
|
List<ReportColumns> columns = getPSReportColumns();
|
|
|
|
List<ReportColumns> columns = getPSReportColumns();
|
|
|
|
List<String> addList = new ArrayList<>();
|
|
|
|
List<String> addList = new ArrayList<>();
|
|
|
|
List<String> addRate = new ArrayList<>();
|
|
|
|
List<String> addRate = new ArrayList<>();
|
|
|
|
List<ReportChildrenData> datas = getPersonnelSizeData(year,addList,addRate);
|
|
|
|
List<ReportChildrenData> datas = getPersonnelSizeData(param,addList,addRate);
|
|
|
|
return TendencyReportVO.builder()
|
|
|
|
return TendencyReportVO.builder()
|
|
|
|
.columns(columns)
|
|
|
|
.columns(columns)
|
|
|
|
.datas(datas)
|
|
|
|
.datas(datas)
|
|
|
@ -132,35 +135,31 @@ public class ReportCollectServiceImpl extends Service implements ReportCollectSe
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getTop(Integer year) {
|
|
|
|
public Map<String, Object> getTop(PersonnelSizeTopParam param) {
|
|
|
|
Map<String,Object> result = new HashMap<>(4);
|
|
|
|
Map<String,Object> result = new HashMap<>(4);
|
|
|
|
List<String> addList = new ArrayList<>();
|
|
|
|
List<String> addList = new ArrayList<>();
|
|
|
|
List<String> addRate = new ArrayList<>();
|
|
|
|
List<String> addRate = new ArrayList<>();
|
|
|
|
if (year == null) {
|
|
|
|
SubCompanyComInfo comInfo = new SubCompanyComInfo();
|
|
|
|
year = Year.now().getValue();
|
|
|
|
ArrayList compList = new ArrayList<>();
|
|
|
|
|
|
|
|
if (param.getCompany() != null) {
|
|
|
|
|
|
|
|
comInfo.getSubCompanyLists(String.valueOf(param.getCompany()),compList);
|
|
|
|
|
|
|
|
compList.add(param.getCompany());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
getPersonnelSizeData(year,addList,addRate);
|
|
|
|
|
|
|
|
|
|
|
|
if (param.getYear() == null) {
|
|
|
|
|
|
|
|
param.setYear(Year.now().getValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
getPersonnelSizeData(param,addList,addRate);
|
|
|
|
List<PersonnelSizeTop> pstList = new ArrayList<>();
|
|
|
|
List<PersonnelSizeTop> pstList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
String startYear = CommonDateUtil.getYearDayFirst(year);
|
|
|
|
String startYear = CommonDateUtil.getYearDayFirst(param.getYear());
|
|
|
|
String endYear = CommonDateUtil.getYearDayEnd(year);
|
|
|
|
String endYear = CommonDateUtil.getYearDayEnd(param.getYear());
|
|
|
|
int sumStart = 0;
|
|
|
|
int sumStart = sumsByFirstDate(startYear,compList);
|
|
|
|
int sumEnd = 0;
|
|
|
|
int sumEnd = sumsByFirstDate(endYear,compList);
|
|
|
|
int entrySum = 0;
|
|
|
|
int entrySum = sumsByTwoDate(startYear,endYear,compList);
|
|
|
|
int leaveSum = 0;
|
|
|
|
int leaveSum = 0;
|
|
|
|
rs.executeQuery("select count(1) as sumstart from hrmresource where status < 4 and companystartdate <= ?",startYear);
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
sumStart = Util.getIntValue(rs.getString("sumstart"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rs.executeQuery("select count(1) as sumend from hrmresource where status < 4 and companystartdate <= ?",endYear);
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
sumEnd = Util.getIntValue(rs.getString("sumend"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rs.executeQuery("select count(1) as entrysum from hrmresource where companystartdate >= ? and companystartdate <= ?",startYear,endYear);
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
entrySum = Util.getIntValue(rs.getString("entrysum"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rs.executeQuery("select count(1) as leavesum from hrmstatushistory where type_n = 5 and changedate >= ? and changedate <= ?",startYear,endYear);
|
|
|
|
rs.executeQuery("select count(1) as leavesum from hrmstatushistory where type_n = 5 and changedate >= ? and changedate <= ?",startYear,endYear);
|
|
|
|
if (rs.next()) {
|
|
|
|
if (rs.next()) {
|
|
|
|
leaveSum = Util.getIntValue(rs.getString("leavesum"));
|
|
|
|
leaveSum = Util.getIntValue(rs.getString("leavesum"));
|
|
|
@ -180,34 +179,29 @@ public class ReportCollectServiceImpl extends Service implements ReportCollectSe
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<ReportChildrenData> getPersonnelSizeData(Integer year, List<String> addList, List<String> addRate) {
|
|
|
|
private List<ReportChildrenData> getPersonnelSizeData(PersonnelSizeTopParam param, List<String> addList, List<String> addRate) {
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
List<ReportChildrenData> result = new ArrayList<>();
|
|
|
|
List<ReportChildrenData> result = new ArrayList<>();
|
|
|
|
if (year == null) {
|
|
|
|
if (param.getYear() == null) {
|
|
|
|
year = Year.now().getValue();
|
|
|
|
param.setYear(Year.now().getValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<YearMonth> yearMonths = CommonDateUtil.getYearMonths(year);
|
|
|
|
SubCompanyComInfo comInfo = new SubCompanyComInfo();
|
|
|
|
|
|
|
|
ArrayList compList = new ArrayList<>();
|
|
|
|
|
|
|
|
if (param.getCompany() != null) {
|
|
|
|
|
|
|
|
comInfo.getSubCompanyLists(String.valueOf(param.getCompany()),compList);
|
|
|
|
|
|
|
|
compList.add(param.getCompany());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<YearMonth> yearMonths = CommonDateUtil.getYearMonths(param.getYear());
|
|
|
|
for (int i = 0; i < yearMonths.size(); i++) {
|
|
|
|
for (int i = 0; i < yearMonths.size(); i++) {
|
|
|
|
List<String> data = new ArrayList<>();
|
|
|
|
List<String> data = new ArrayList<>();
|
|
|
|
String startMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateStartOfMonth(yearMonths.get(i)));
|
|
|
|
String startMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateStartOfMonth(yearMonths.get(i)));
|
|
|
|
String endMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateEndOfMonth(yearMonths.get(i)));
|
|
|
|
String endMonth = CommonDateUtil.getFormatYear(CommonDateUtil.toDateEndOfMonth(yearMonths.get(i)));
|
|
|
|
int sumStart = 0;
|
|
|
|
int sumStart = sumsByFirstDate(startMonth,compList);
|
|
|
|
int sumEnd = 0;
|
|
|
|
int sumEnd = sumsByFirstDate(endMonth,compList);
|
|
|
|
int entrySum = 0;
|
|
|
|
int entrySum = sumsByTwoDate(startMonth,endMonth,compList);
|
|
|
|
int leaveSum = 0;
|
|
|
|
int leaveSum = 0;
|
|
|
|
data.add(String.format("%d 月",i+1));
|
|
|
|
data.add(String.format("%d 月",i+1));
|
|
|
|
rs.executeQuery("select count(1) as sumstart from hrmresource where status < 4 and companystartdate <= ?",startMonth);
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
sumStart = Util.getIntValue(rs.getString("sumstart"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rs.executeQuery("select count(1) as sumend from hrmresource where status < 4 and companystartdate <= ?",endMonth);
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
sumEnd = Util.getIntValue(rs.getString("sumend"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rs.executeQuery("select count(1) as entrysum from hrmresource where companystartdate >= ? and companystartdate <= ?",startMonth,endMonth);
|
|
|
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
|
|
|
entrySum = Util.getIntValue(rs.getString("entrysum"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rs.executeQuery("select count(1) as leavesum from hrmstatushistory where type_n = 5 and changedate >= ? and changedate <= ?",startMonth,endMonth);
|
|
|
|
rs.executeQuery("select count(1) as leavesum from hrmstatushistory where type_n = 5 and changedate >= ? and changedate <= ?",startMonth,endMonth);
|
|
|
|
if (rs.next()) {
|
|
|
|
if (rs.next()) {
|
|
|
|
leaveSum = Util.getIntValue(rs.getString("leavesum"));
|
|
|
|
leaveSum = Util.getIntValue(rs.getString("leavesum"));
|
|
|
@ -309,10 +303,42 @@ public class ReportCollectServiceImpl extends Service implements ReportCollectSe
|
|
|
|
return ReportChildrenData.builder().data(data).build();
|
|
|
|
return ReportChildrenData.builder().data(data).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 单日期
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private int sumsByFirstDate(String firstDate,ArrayList compList) {
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
sb.append("select count(1) as sums from hrmresource where status < 4 and companystartdate <= ?");
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(compList)) {
|
|
|
|
|
|
|
|
sb.append(" and subcompanyid1 in(").append(StringUtils.join(compList,",")).append(")");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rs.executeQuery(sb.toString(),firstDate);
|
|
|
|
|
|
|
|
rs.next();
|
|
|
|
|
|
|
|
return Util.getIntValue(rs.getString("sums"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 双日期
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private int sumsByTwoDate(String firstDate,String twoDate,ArrayList compList) {
|
|
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
sb.append("select count(1) as sums from hrmresource where companystartdate >= ? and companystartdate <= ?");
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(compList)) {
|
|
|
|
|
|
|
|
sb.append(" and subcompanyid1 in(").append(StringUtils.join(compList,",")).append(")");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
rs.executeQuery(sb.toString(),firstDate,twoDate);
|
|
|
|
|
|
|
|
rs.next();
|
|
|
|
|
|
|
|
return Util.getIntValue(rs.getString("sums"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 月份1
|
|
|
|
* 月份1
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private List<ReportColumns> getPTReportColumns() {
|
|
|
|
private List<ReportColumns> getPTReportColumns() {
|
|
|
|
List<ReportColumns> columns = new ArrayList<>();
|
|
|
|
List<ReportColumns> columns = new ArrayList<>();
|
|
|
@ -334,7 +360,6 @@ public class ReportCollectServiceImpl extends Service implements ReportCollectSe
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 月份2
|
|
|
|
* 月份2
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private List<ReportColumns> getOJSReportColumns() {
|
|
|
|
private List<ReportColumns> getOJSReportColumns() {
|
|
|
|
List<ReportColumns> columns = new ArrayList<>();
|
|
|
|
List<ReportColumns> columns = new ArrayList<>();
|
|
|
@ -357,7 +382,6 @@ public class ReportCollectServiceImpl extends Service implements ReportCollectSe
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 求和
|
|
|
|
* 求和
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private List<Integer> summary(List<List<Integer>> countLists){
|
|
|
|
private List<Integer> summary(List<List<Integer>> countLists){
|
|
|
|
return countLists.stream()
|
|
|
|
return countLists.stream()
|
|
|
@ -373,7 +397,6 @@ public class ReportCollectServiceImpl extends Service implements ReportCollectSe
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 求比例
|
|
|
|
* 求比例
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private String calculateRate(List<String> addRate,int add,int sum) {
|
|
|
|
private String calculateRate(List<String> addRate,int add,int sum) {
|
|
|
|
String rate;
|
|
|
|
String rate;
|
|
|
|