|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.kms.statistics.service; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
@ -59,10 +60,9 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
if (ObjectUtil.isNotEmpty(bsSgcJsjdBuiRealName.getAdmissionTime())){ |
|
|
|
LocalDate localDate = bsSgcJsjdBuiRealName.getAdmissionTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); |
|
|
|
String year= String.valueOf(localDate.getYear()); |
|
|
|
String yearMonth=localDate.getYear()+"-"+localDate.getMonth(); |
|
|
|
String yearMonth=localDate.getYear()+"-"+localDate.getMonthValue(); |
|
|
|
String month= String.valueOf(localDate.getMonthValue()); |
|
|
|
BsSgcJsjdNmgStatisticVo bsSgcJsjdNmgStatisticVo1=new BsSgcJsjdNmgStatisticVo(); |
|
|
|
BsSgcJsjdNmgStatisticVo bsSgcJsjdNmgStatisticVo2=new BsSgcJsjdNmgStatisticVo(); |
|
|
|
//年统计
|
|
|
|
if (map.containsKey(year)){ |
|
|
|
BsSgcJsjdNmgStatisticVo o = (BsSgcJsjdNmgStatisticVo) map.get(year); |
|
|
@ -91,7 +91,7 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
map.put(year,bsSgcJsjdNmgStatisticVo1); |
|
|
|
|
|
|
|
//月统计
|
|
|
|
if (map.containsKey(yearMonth)){ |
|
|
|
if (childrenMap.containsKey(yearMonth)){ |
|
|
|
BsSgcJsjdNmgStatisticVo o = (BsSgcJsjdNmgStatisticVo) map.get(yearMonth); |
|
|
|
o.setTotalNum(String.valueOf(Integer.parseInt(o.getTotalNum())+1)); |
|
|
|
if (ObjectUtil.isNotEmpty(bsSgcJsjdBuiRealName.getExitTime())){ |
|
|
@ -100,8 +100,9 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
if (ObjectUtil.isNotEmpty(bsSgcJsjdBuiRealName.getAdmissionTime())){ |
|
|
|
o.setPresentNum(String.valueOf(Integer.parseInt(o.getPresentNum()+1))); |
|
|
|
} |
|
|
|
map.put(yearMonth,o); |
|
|
|
childrenMap.put(yearMonth,o); |
|
|
|
}else { |
|
|
|
BsSgcJsjdNmgStatisticVo bsSgcJsjdNmgStatisticVo2=new BsSgcJsjdNmgStatisticVo(); |
|
|
|
bsSgcJsjdNmgStatisticVo2.setProjectName(bs.getProjectName()); |
|
|
|
bsSgcJsjdNmgStatisticVo2.setTotalNum("1"); |
|
|
|
bsSgcJsjdNmgStatisticVo2.setCurrentTime(yearMonth); |
|
|
@ -164,10 +165,11 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
monthValue=monthValue+1; |
|
|
|
if (monthValue>12){ |
|
|
|
yearValue=yearValue+1; |
|
|
|
monthValue=1; |
|
|
|
} |
|
|
|
yearMonth=yearValue+"-"+monthValue; |
|
|
|
if (map.containsKey(yearMonth)){ |
|
|
|
BsSgcJsjdNmgStatisticVo o = (BsSgcJsjdNmgStatisticVo) map.get(yearMonth); |
|
|
|
if (childrenMap.containsKey(yearMonth)){ |
|
|
|
BsSgcJsjdNmgStatisticVo o = (BsSgcJsjdNmgStatisticVo) childrenMap.get(yearMonth); |
|
|
|
o.setTotalNum(String.valueOf(Integer.parseInt(o.getTotalNum())+1)); |
|
|
|
if (ObjectUtil.isNotEmpty(bsSgcJsjdBuiRealName.getExitTime())){ |
|
|
|
o.setExitNum(String.valueOf(Integer.parseInt(o.getExitNum())+1)); |
|
|
@ -177,6 +179,7 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
} |
|
|
|
childrenMap.put(yearMonth,o); |
|
|
|
}else { |
|
|
|
BsSgcJsjdNmgStatisticVo bsSgcJsjdNmgStatisticVo2=new BsSgcJsjdNmgStatisticVo(); |
|
|
|
bsSgcJsjdNmgStatisticVo2.setProjectName(bs.getProjectName()); |
|
|
|
bsSgcJsjdNmgStatisticVo2.setTotalNum("1"); |
|
|
|
bsSgcJsjdNmgStatisticVo2.setCurrentTime(yearMonth); |
|
|
@ -190,7 +193,7 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
}else { |
|
|
|
bsSgcJsjdNmgStatisticVo2.setPresentNum("0"); |
|
|
|
} |
|
|
|
childrenMap.put(year,bsSgcJsjdNmgStatisticVo2); |
|
|
|
childrenMap.put(yearMonth,bsSgcJsjdNmgStatisticVo2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -203,8 +206,8 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
String year= String.valueOf(localDate.getYear()); |
|
|
|
String month = String.valueOf(localDate.getMonthValue()); |
|
|
|
String yearMonth=year+"-"+month; |
|
|
|
if (map.containsKey(yearMonth)){ |
|
|
|
BsSgcJsjdNmgStatisticVo o = (BsSgcJsjdNmgStatisticVo) map.get(yearMonth); |
|
|
|
if (map.containsKey(year)){ |
|
|
|
BsSgcJsjdNmgStatisticVo o = (BsSgcJsjdNmgStatisticVo) map.get(year); |
|
|
|
if (ObjectUtil.isNotEmpty(o.getTotalSalary())){ |
|
|
|
o.setTotalSalary(String.valueOf(Integer.parseInt(bsSgcJsjdBuiSalaryPayable.getMonthlySalaryCurrent())+Integer.parseInt(o.getTotalSalary()))); |
|
|
|
}else { |
|
|
@ -220,10 +223,11 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
}else { |
|
|
|
o.setUnpaidWages("1"); |
|
|
|
} |
|
|
|
map.put(year,o); |
|
|
|
}else { |
|
|
|
BsSgcJsjdNmgStatisticVo bsSgcJsjdNmgStatisticVo1=new BsSgcJsjdNmgStatisticVo(); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setProjectName(bs.getProjectName()); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setCurrentTime(yearMonth); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setCurrentTime(year); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setTotalSalary(bsSgcJsjdBuiSalaryPayable.getMonthlySalaryCurrent()); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setUnpaidWagesAmount(bsSgcJsjdBuiSalaryPayable.getMonthlySalaryDeduct()); |
|
|
|
if (!bsSgcJsjdNmgStatisticVo1.getUnpaidWagesAmount().equals("0")){ |
|
|
@ -233,17 +237,62 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
} |
|
|
|
map.put(bsSgcJsjdNmgStatisticVo1.getCurrentTime(),bsSgcJsjdNmgStatisticVo1); |
|
|
|
} |
|
|
|
|
|
|
|
if (childrenMap.containsKey(yearMonth)){ |
|
|
|
BsSgcJsjdNmgStatisticVo o = (BsSgcJsjdNmgStatisticVo) childrenMap.get(yearMonth); |
|
|
|
if (ObjectUtil.isNotEmpty(o.getTotalSalary())){ |
|
|
|
o.setTotalSalary(String.valueOf(Integer.parseInt(bsSgcJsjdBuiSalaryPayable.getMonthlySalaryCurrent())+Integer.parseInt(o.getTotalSalary()))); |
|
|
|
}else { |
|
|
|
o.setTotalSalary(bsSgcJsjdBuiSalaryPayable.getMonthlySalaryCurrent()); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(o.getUnpaidWagesAmount())){ |
|
|
|
o.setUnpaidWagesAmount(String.valueOf(Integer.parseInt(bsSgcJsjdBuiSalaryPayable.getMonthlySalaryDeduct())+Integer.parseInt(o.getUnpaidWagesAmount()))); |
|
|
|
}else { |
|
|
|
o.setUnpaidWagesAmount(bsSgcJsjdBuiSalaryPayable.getMonthlySalaryDeduct()); |
|
|
|
} |
|
|
|
if (!o.getUnpaidWagesAmount().equals("0")){ |
|
|
|
o.setUnpaidWages("0"); |
|
|
|
}else { |
|
|
|
o.setUnpaidWages("1"); |
|
|
|
} |
|
|
|
childrenMap.put(yearMonth,o); |
|
|
|
}else { |
|
|
|
BsSgcJsjdNmgStatisticVo bsSgcJsjdNmgStatisticVo1=new BsSgcJsjdNmgStatisticVo(); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setProjectName(bs.getProjectName()); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setCurrentTime(yearMonth); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setTotalSalary(bsSgcJsjdBuiSalaryPayable.getMonthlySalaryCurrent()); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setUnpaidWagesAmount(bsSgcJsjdBuiSalaryPayable.getMonthlySalaryDeduct()); |
|
|
|
if (!bsSgcJsjdNmgStatisticVo1.getUnpaidWagesAmount().equals("0")){ |
|
|
|
bsSgcJsjdNmgStatisticVo1.setUnpaidWages("0"); |
|
|
|
}else { |
|
|
|
bsSgcJsjdNmgStatisticVo1.setUnpaidWages("1"); |
|
|
|
} |
|
|
|
childrenMap.put(bsSgcJsjdNmgStatisticVo1.getCurrentTime(),bsSgcJsjdNmgStatisticVo1); |
|
|
|
} |
|
|
|
} |
|
|
|
List<BsSgcJsjdNmgStatisticVo>list1=new ArrayList<>(); |
|
|
|
List<BsSgcJsjdNmgStatisticVo>list2=new ArrayList<>(); |
|
|
|
map.forEach((key,value)->{ |
|
|
|
list1.add((BsSgcJsjdNmgStatisticVo) value); |
|
|
|
List<BsSgcJsjdNmgStatisticVo> finalList1 = list1; |
|
|
|
map.forEach((key, value)->{ |
|
|
|
finalList1.add((BsSgcJsjdNmgStatisticVo) value); |
|
|
|
}); |
|
|
|
childrenMap.forEach((key,value)->{ |
|
|
|
list2.add((BsSgcJsjdNmgStatisticVo) value); |
|
|
|
List<BsSgcJsjdNmgStatisticVo>bsSgcJsjdNmgStatisticVos=new ArrayList<>(); |
|
|
|
childrenMap.forEach((key, value)->{ |
|
|
|
for (BsSgcJsjdNmgStatisticVo bsSgcJsjdNmgStatisticVo1: finalList1){ |
|
|
|
if (bsSgcJsjdNmgStatisticVo1.getCurrentTime().equals(key.split("-")[0])){ |
|
|
|
if (CollectionUtil.isEmpty(bsSgcJsjdNmgStatisticVo1.getChildren())){ |
|
|
|
List<BsSgcJsjdNmgStatisticVo>list3=new ArrayList<>(); |
|
|
|
list3.add((BsSgcJsjdNmgStatisticVo) value); |
|
|
|
bsSgcJsjdNmgStatisticVo1.setChildren(list3); |
|
|
|
}else { |
|
|
|
bsSgcJsjdNmgStatisticVo1.getChildren().add((BsSgcJsjdNmgStatisticVo) value); |
|
|
|
} |
|
|
|
bsSgcJsjdNmgStatisticVos.add(bsSgcJsjdNmgStatisticVo1); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
bsSgcJsjdNmgStatisticVo.setChildrenYear(list1); |
|
|
|
bsSgcJsjdNmgStatisticVo.setChildrenMonth(list2); |
|
|
|
list1=bsSgcJsjdNmgStatisticVos; |
|
|
|
bsSgcJsjdNmgStatisticVo.setChildren(list1); |
|
|
|
list.add(bsSgcJsjdNmgStatisticVo); |
|
|
|
} |
|
|
|
Page<BsSgcJsjdNmgStatisticVo> page1=new Page<>(); |
|
|
@ -251,4 +300,6 @@ public class BsSgcJsjdBuiNmgStatisticsService { |
|
|
|
page1.setTotal(list.size()); |
|
|
|
return page1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|