|
@@ -1,6 +1,7 @@
|
|
package org.jeecg.modules.Index.service.impl;
|
|
package org.jeecg.modules.Index.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.subject.Subject;
|
|
import org.apache.shiro.subject.Subject;
|
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
|
@@ -384,6 +385,30 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
ArrayList<BigDecimal> zcbSumValueList = new ArrayList<>();
|
|
ArrayList<BigDecimal> zcbSumValueList = new ArrayList<>();
|
|
ArrayList<ResuliEightCostvo> resuliEightCostvosList = new ArrayList<>();
|
|
ArrayList<ResuliEightCostvo> resuliEightCostvosList = new ArrayList<>();
|
|
IndexChartInfoVo indexChartInfoVo = new IndexChartInfoVo();
|
|
IndexChartInfoVo indexChartInfoVo = new IndexChartInfoVo();
|
|
|
|
+ ArrayList<BigDecimal> clfList = new ArrayList<>();
|
|
|
|
+ ArrayList<BigDecimal> zyfList = new ArrayList<>();
|
|
|
|
+ ArrayList<BigDecimal> swfList = new ArrayList<>();
|
|
|
|
+ ArrayList<BigDecimal> wxfList = new ArrayList<>();
|
|
|
|
+ ArrayList<BigDecimal> rldlfList = new ArrayList<>();
|
|
|
|
+ ArrayList<BigDecimal> gdzczjList = new ArrayList<>();
|
|
|
|
+ ArrayList<BigDecimal> gzjlwfList = new ArrayList<>();
|
|
|
|
+ ArrayList<BigDecimal> glfList = new ArrayList<>();
|
|
|
|
+ ResuliEightCostvo r1 = new ResuliEightCostvo();
|
|
|
|
+ r1.setName("clf");
|
|
|
|
+ ResuliEightCostvo r2 = new ResuliEightCostvo();
|
|
|
|
+ r2.setName("zyf");
|
|
|
|
+ ResuliEightCostvo r3 = new ResuliEightCostvo();
|
|
|
|
+ r3.setName("swf");
|
|
|
|
+ ResuliEightCostvo r4 = new ResuliEightCostvo();
|
|
|
|
+ r4.setName("wxf");
|
|
|
|
+ ResuliEightCostvo r5 = new ResuliEightCostvo();
|
|
|
|
+ r5.setName("rldlf");
|
|
|
|
+ ResuliEightCostvo r6 = new ResuliEightCostvo();
|
|
|
|
+ r6.setName("gdzczj");
|
|
|
|
+ ResuliEightCostvo r7 = new ResuliEightCostvo();
|
|
|
|
+ r7.setName("gzjlwf");
|
|
|
|
+ ResuliEightCostvo r8 = new ResuliEightCostvo();
|
|
|
|
+ r8.setName("glf");
|
|
// 如果前端传递过来的标记是 按年统计 则获取日期范围内所有的年份,遍历集合 分别查询各个年份下的总成本的和
|
|
// 如果前端传递过来的标记是 按年统计 则获取日期范围内所有的年份,遍历集合 分别查询各个年份下的总成本的和
|
|
if ("year".equals(indexInfoParamDto.getTime())){
|
|
if ("year".equals(indexInfoParamDto.getTime())){
|
|
Date beginDate = null;
|
|
Date beginDate = null;
|
|
@@ -397,50 +422,204 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
// 将Date类型的数据转换成 LocalDate类型
|
|
// 将Date类型的数据转换成 LocalDate类型
|
|
LocalDate beginLocalDate = beginDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
LocalDate beginLocalDate = beginDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
LocalDate endLocalDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
LocalDate endLocalDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
- List<String> years = getYears(beginLocalDate, endLocalDate);
|
|
|
|
- for (String year:years) {
|
|
|
|
- BigDecimal zcbSumValue = BigDecimal.valueOf(0); // 默认值为0
|
|
|
|
- if (AuthMark.BOSS.equals(role)){ // 如果当前用户角色是领导,则查询全部部门的总成本
|
|
|
|
-// zcbSumValue = indexZcbMapper.get(year);
|
|
|
|
- zcbSumValue = indexZcbMapper.getZcbByYear(year);
|
|
|
|
- if (ObjectUtil.isEmpty(zcbSumValue)) {
|
|
|
|
- zcbSumValue = BigDecimal.valueOf(0);
|
|
|
|
|
|
+ List<String> yearList = getYears(beginLocalDate, endLocalDate);
|
|
|
|
+
|
|
|
|
+ if (AuthMark.BOSS.equals(role)){ // 如果当前用户角色是领导,则查询全部部门八项成本
|
|
|
|
+ CompletableFuture<List<String>> getYearListSqlFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
+ List<String> yearListSql = indexZcbMapper.getYear(beginDateStr, endDateStr);
|
|
|
|
+ return yearListSql;
|
|
|
|
+ });
|
|
|
|
+ CompletableFuture<List<EightCosts>> getCostListFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
+ List<EightCosts> costList = indexZcbMapper.getEightCostByYear(beginDateStr, endDateStr);
|
|
|
|
+ return costList;
|
|
|
|
+ });
|
|
|
|
+ //List<String> yearListSql = indexZcbMapper.getYear(beginDateStr, endDateStr);
|
|
|
|
+ //List<EightCosts> costList = indexZcbMapper.getEightCostByYear(beginDateStr, endDateStr);
|
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(getYearListSqlFuture,getCostListFuture);
|
|
|
|
+ future1.join();
|
|
|
|
+ List<String> yearListSql = getYearListSqlFuture.join();
|
|
|
|
+ List<EightCosts> costList = getCostListFuture.join();
|
|
|
|
+ int i = 0;
|
|
|
|
+ for (String year : yearList) {
|
|
|
|
+ if (yearListSql.contains(year)) {
|
|
|
|
+ clfList.add(costList.get(i).getClf());
|
|
|
|
+ zyfList.add(costList.get(i).getZyf());
|
|
|
|
+ swfList.add(costList.get(i).getSwf());
|
|
|
|
+ wxfList.add(costList.get(i).getWxf());
|
|
|
|
+ rldlfList.add(costList.get(i).getRldlf());
|
|
|
|
+ gdzczjList.add(costList.get(i).getGdzczj());
|
|
|
|
+ gzjlwfList.add(costList.get(i).getGzjlwf());
|
|
|
|
+ glfList.add(costList.get(i).getGlf());
|
|
|
|
+ i++;
|
|
|
|
+ } else {
|
|
|
|
+ clfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ zyfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ swfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ wxfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ rldlfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gdzczjList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gzjlwfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ glfList.add(BigDecimal.valueOf(0));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (AuthMark.DEPT_LEADER.equals(role)){ // 如果当前用户角色是部门领导,则查询当前部门的总成本
|
|
|
|
- CompletableFuture<BigDecimal> zcbSumValueFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
- BigDecimal sum = BigDecimal.valueOf(0);
|
|
|
|
- BigDecimal b1 = indexZcbMapper.getZcbByXdDepartByYear(year, deptList);
|
|
|
|
- BigDecimal b2 = indexZcbMapper.getZcbByZrDepartByYear(year, deptList);
|
|
|
|
- if (!ObjectUtil.isEmpty(b1) && ObjectUtil.isEmpty(b2)){
|
|
|
|
- // 如果根据责任部门没有查出来值 但 根据下达部门查询有值
|
|
|
|
- sum = b1.add(BigDecimal.valueOf(0));
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)){ // 如果当前用户角色是部门领导,则查询当前部门的八项成本
|
|
|
|
+ // 根据下达部门查询出日期集合
|
|
|
|
+ List<String> xdbmYearListSql = indexZcbMapper.getXdbmYear(beginDateStr, endDateStr, deptList);
|
|
|
|
+ // 根据责任部门查询出日期集合
|
|
|
|
+ List<String> zrbmYearListSql = indexZcbMapper.getZrbmYear(beginDateStr, endDateStr, deptList);
|
|
|
|
+ // 将根据责任部门和下达部门查询出的日期的集合合并,并且去掉重复的日期(保留一个),并进行排序
|
|
|
|
+ ArrayList<String> newZrbmYearListSql = new ArrayList<>();
|
|
|
|
+ newZrbmYearListSql.addAll(zrbmYearListSql);
|
|
|
|
+ newZrbmYearListSql.removeAll(xdbmYearListSql); //去除掉根据下达部门查询出的集合中已经存在的日期
|
|
|
|
+ ArrayList<String> yearListSql = new ArrayList<>(); // 最终的日期集合
|
|
|
|
+ yearListSql.addAll(xdbmYearListSql);
|
|
|
|
+ yearListSql.addAll(newZrbmYearListSql);
|
|
|
|
+ Collections.sort(yearListSql); // 进行排序
|
|
|
|
+ // 根据下达部门查询出八项成本
|
|
|
|
+ List<EightCosts> xdbmCostList = indexZcbMapper.getXdbmEightCostByYear(beginDateStr, endDateStr, deptList);
|
|
|
|
+ // 根据责任部门查询出八项成本
|
|
|
|
+ List<EightCosts> zrbmCostList = indexZcbMapper.getZrbmEightCostByYear(beginDateStr, endDateStr, deptList);
|
|
|
|
+ if (!ObjectUtil.isEmpty(xdbmCostList) && ObjectUtil.isEmpty(zrbmCostList)){
|
|
|
|
+ // 如果根据责任部门没有查出来值 但 根据下达部门查询有值
|
|
|
|
+ int i=0;
|
|
|
|
+ for (String year : yearList) {
|
|
|
|
+ if (yearListSql.contains(year)){
|
|
|
|
+ clfList.add(xdbmCostList.get(i).getClf());
|
|
|
|
+ zyfList.add(xdbmCostList.get(i).getZyf());
|
|
|
|
+ swfList.add(xdbmCostList.get(i).getSwf());
|
|
|
|
+ wxfList.add(xdbmCostList.get(i).getWxf());
|
|
|
|
+ rldlfList.add(xdbmCostList.get(i).getRldlf());
|
|
|
|
+ gdzczjList.add(xdbmCostList.get(i).getGdzczj());
|
|
|
|
+ gzjlwfList.add(xdbmCostList.get(i).getGzjlwf());
|
|
|
|
+ glfList.add(xdbmCostList.get(i).getGlf());
|
|
|
|
+ i++;
|
|
|
|
+ }else {
|
|
|
|
+ clfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ zyfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ swfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ wxfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ rldlfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gdzczjList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gzjlwfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ glfList.add(BigDecimal.valueOf(0));
|
|
}
|
|
}
|
|
- if (ObjectUtil.isEmpty(b1) && !ObjectUtil.isEmpty(b2)){
|
|
|
|
- // 如果根据责任部门查询有值,但根据下达部门没有值
|
|
|
|
- sum = b2.add(BigDecimal.valueOf(0));
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isEmpty(xdbmCostList) && !ObjectUtil.isEmpty(zrbmCostList)){
|
|
|
|
+ // 如果根据责任部门查询有值,但根据下达部门没有值
|
|
|
|
+ int i=0;
|
|
|
|
+ for (String year : yearList) {
|
|
|
|
+ if (yearListSql.contains(year)){
|
|
|
|
+ clfList.add(zrbmCostList.get(i).getClf());
|
|
|
|
+ zyfList.add(zrbmCostList.get(i).getZyf());
|
|
|
|
+ swfList.add(zrbmCostList.get(i).getSwf());
|
|
|
|
+ wxfList.add(zrbmCostList.get(i).getWxf());
|
|
|
|
+ rldlfList.add(zrbmCostList.get(i).getRldlf());
|
|
|
|
+ gdzczjList.add(zrbmCostList.get(i).getGdzczj());
|
|
|
|
+ gzjlwfList.add(zrbmCostList.get(i).getGzjlwf());
|
|
|
|
+ glfList.add(zrbmCostList.get(i).getGlf());
|
|
|
|
+ i++;
|
|
|
|
+ }else {
|
|
|
|
+ clfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ zyfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ swfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ wxfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ rldlfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gdzczjList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gzjlwfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ glfList.add(BigDecimal.valueOf(0));
|
|
}
|
|
}
|
|
- if (!ObjectUtil.isEmpty(b1) && !ObjectUtil.isEmpty(b2)){
|
|
|
|
- // 如果下达部门跟责任部门都查询出值时,就进行累加(据沈工所说同一条任务的这两个字段的部门名称不会是相同的)
|
|
|
|
- sum = b1.add(b2);
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!ObjectUtil.isEmpty(xdbmCostList) && !ObjectUtil.isEmpty(zrbmCostList)) {
|
|
|
|
+ // 如果下达部门跟责任部门都查询出值时,就进行累加(据沈工所说同一条任务的这两个字段的部门名称不会是相同的)
|
|
|
|
+ int i=0;
|
|
|
|
+ int j=0;
|
|
|
|
+ for (String year : yearList) {
|
|
|
|
+ if (xdbmYearListSql.contains(year) && !zrbmYearListSql.contains(year)){
|
|
|
|
+ clfList.add(xdbmCostList.get(i).getClf());
|
|
|
|
+ zyfList.add(xdbmCostList.get(i).getZyf());
|
|
|
|
+ swfList.add(xdbmCostList.get(i).getSwf());
|
|
|
|
+ wxfList.add(xdbmCostList.get(i).getWxf());
|
|
|
|
+ rldlfList.add(xdbmCostList.get(i).getRldlf());
|
|
|
|
+ gdzczjList.add(xdbmCostList.get(i).getGdzczj());
|
|
|
|
+ gzjlwfList.add(xdbmCostList.get(i).getGzjlwf());
|
|
|
|
+ glfList.add(xdbmCostList.get(i).getGlf());
|
|
|
|
+ i++;
|
|
|
|
+ }else if (!xdbmYearListSql.contains(year) && zrbmYearListSql.contains(year)){
|
|
|
|
+ clfList.add(xdbmCostList.get(j).getClf());
|
|
|
|
+ zyfList.add(xdbmCostList.get(j).getZyf());
|
|
|
|
+ swfList.add(xdbmCostList.get(j).getSwf());
|
|
|
|
+ wxfList.add(xdbmCostList.get(j).getWxf());
|
|
|
|
+ rldlfList.add(xdbmCostList.get(j).getRldlf());
|
|
|
|
+ gdzczjList.add(xdbmCostList.get(j).getGdzczj());
|
|
|
|
+ gzjlwfList.add(xdbmCostList.get(j).getGzjlwf());
|
|
|
|
+ glfList.add(xdbmCostList.get(j).getGlf());
|
|
|
|
+ j++;
|
|
|
|
+ }else if (zrbmYearListSql.contains(year) && xdbmYearListSql.contains(year)){
|
|
|
|
+ clfList.add(xdbmCostList.get(i).getClf().add(zrbmCostList.get(j).getClf()));
|
|
|
|
+ zyfList.add(xdbmCostList.get(i).getZyf().add(zrbmCostList.get(j).getZyf()));
|
|
|
|
+ swfList.add(xdbmCostList.get(i).getSwf().add(zrbmCostList.get(j).getSwf()));
|
|
|
|
+ wxfList.add(xdbmCostList.get(i).getWxf().add(zrbmCostList.get(j).getWxf()));
|
|
|
|
+ rldlfList.add(xdbmCostList.get(i).getRldlf().add(zrbmCostList.get(j).getRldlf()));
|
|
|
|
+ gdzczjList.add(xdbmCostList.get(i).getGdzczj().add(zrbmCostList.get(j).getGdzczj()));
|
|
|
|
+ gzjlwfList.add(xdbmCostList.get(i).getGzjlwf().add(zrbmCostList.get(j).getGzjlwf()));
|
|
|
|
+ glfList.add(xdbmCostList.get(i).getGlf().add(zrbmCostList.get(j).getGlf()));
|
|
|
|
+ i++;
|
|
|
|
+ j++;
|
|
|
|
+ }else {
|
|
|
|
+ clfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ zyfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ swfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ wxfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ rldlfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gdzczjList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gzjlwfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ glfList.add(BigDecimal.valueOf(0));
|
|
}
|
|
}
|
|
- return sum;
|
|
|
|
- });
|
|
|
|
- CompletableFuture<Void> future1 = CompletableFuture.allOf(zcbSumValueFuture);
|
|
|
|
- future1.join();
|
|
|
|
- BigDecimal sumZcb = zcbSumValueFuture.join();
|
|
|
|
- zcbSumValue = sumZcb;
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (role == null){ // 如果是空 就给0
|
|
|
|
+ for (String year : yearList) {
|
|
|
|
+ clfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ zyfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ swfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ wxfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ rldlfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gdzczjList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gzjlwfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ glfList.add(BigDecimal.valueOf(0));
|
|
}
|
|
}
|
|
- zcbSumValueList.add(zcbSumValue);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ r1.setValues(clfList);
|
|
|
|
+ r2.setValues(zyfList);
|
|
|
|
+ r3.setValues(swfList);
|
|
|
|
+ r4.setValues(wxfList);
|
|
|
|
+ r5.setValues(rldlfList);
|
|
|
|
+ r6.setValues(gdzczjList);
|
|
|
|
+ r7.setValues(gzjlwfList);
|
|
|
|
+ r8.setValues(glfList);
|
|
|
|
+ resuliEightCostvosList.add(r1);
|
|
|
|
+ resuliEightCostvosList.add(r2);
|
|
|
|
+ resuliEightCostvosList.add(r3);
|
|
|
|
+ resuliEightCostvosList.add(r4);
|
|
|
|
+ resuliEightCostvosList.add(r5);
|
|
|
|
+ resuliEightCostvosList.add(r6);
|
|
|
|
+ resuliEightCostvosList.add(r7);
|
|
|
|
+ resuliEightCostvosList.add(r8);
|
|
|
|
|
|
- indexChartInfoVo.setSeriesData(zcbSumValueList);
|
|
|
|
- indexChartInfoVo.setXAxisData(years);
|
|
|
|
|
|
+ indexChartInfoVo.setSeriesData(resuliEightCostvosList);
|
|
|
|
+ indexChartInfoVo.setXAxisData(yearList);
|
|
resultList.add(indexChartInfoVo);
|
|
resultList.add(indexChartInfoVo);
|
|
}
|
|
}
|
|
|
|
|
|
- // 如果前端传递过来的标记是 按月统计 则获取日期范围内所有的月份,遍历集合 分别查询各个月份下的总成本之和
|
|
|
|
|
|
+ // 如果前端传递过来的标记是 按月统计 则获取日期范围内所有的月份,遍历集合 分别查询各个月份下的八项成本
|
|
if ("month".equals(indexInfoParamDto.getTime())){
|
|
if ("month".equals(indexInfoParamDto.getTime())){
|
|
Date beginDate = null;
|
|
Date beginDate = null;
|
|
Date endDate = null;
|
|
Date endDate = null;
|
|
@@ -455,33 +634,21 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
LocalDate endLocalDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
LocalDate endLocalDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
List<YearMonth> yearMonths = getYearMonths(beginLocalDate, endLocalDate);
|
|
List<YearMonth> yearMonths = getYearMonths(beginLocalDate, endLocalDate);
|
|
ArrayList<String> yearMonthList = new ArrayList<>();
|
|
ArrayList<String> yearMonthList = new ArrayList<>();
|
|
- ArrayList<BigDecimal> clfList = new ArrayList<>();
|
|
|
|
- ArrayList<BigDecimal> zyfList = new ArrayList<>();
|
|
|
|
- ArrayList<BigDecimal> swfList = new ArrayList<>();
|
|
|
|
- ArrayList<BigDecimal> wxfList = new ArrayList<>();
|
|
|
|
- ArrayList<BigDecimal> rldlfList = new ArrayList<>();
|
|
|
|
- ArrayList<BigDecimal> gdzczjList = new ArrayList<>();
|
|
|
|
- ArrayList<BigDecimal> gzjlwfList = new ArrayList<>();
|
|
|
|
- ArrayList<BigDecimal> glfList = new ArrayList<>();
|
|
|
|
- ResuliEightCostvo r1 = new ResuliEightCostvo();
|
|
|
|
- r1.setName("clf");
|
|
|
|
- ResuliEightCostvo r2 = new ResuliEightCostvo();
|
|
|
|
- r2.setName("zyf");
|
|
|
|
- ResuliEightCostvo r3 = new ResuliEightCostvo();
|
|
|
|
- r3.setName("swf");
|
|
|
|
- ResuliEightCostvo r4 = new ResuliEightCostvo();
|
|
|
|
- r4.setName("wxf");
|
|
|
|
- ResuliEightCostvo r5 = new ResuliEightCostvo();
|
|
|
|
- r5.setName("rldlf");
|
|
|
|
- ResuliEightCostvo r6 = new ResuliEightCostvo();
|
|
|
|
- r6.setName("gdzczj");
|
|
|
|
- ResuliEightCostvo r7 = new ResuliEightCostvo();
|
|
|
|
- r7.setName("gzjlwf");
|
|
|
|
- ResuliEightCostvo r8 = new ResuliEightCostvo();
|
|
|
|
- r8.setName("glf");
|
|
|
|
- if (AuthMark.BOSS.equals(role)){ // 如果当前用户角色是领导,则查询全部部门的总成本
|
|
|
|
- List<String> yearMonthListSql = indexZcbMapper.getYearMonth(beginDateStr, endDateStr);
|
|
|
|
- List<EightCosts> costList = indexZcbMapper.getEightCostByYearMonth(beginDateStr, endDateStr);
|
|
|
|
|
|
+ if (AuthMark.BOSS.equals(role)){ // 如果当前用户角色是领导,则查询全部部门的八项成本
|
|
|
|
+ CompletableFuture<List<String>> getYearMonthListSqlFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
+ List<String> yearMonthListSql = indexZcbMapper.getYearMonth(beginDateStr, endDateStr);
|
|
|
|
+ return yearMonthListSql;
|
|
|
|
+ });
|
|
|
|
+ CompletableFuture<List<EightCosts>> getCostListFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
+ List<EightCosts> costList = indexZcbMapper.getEightCostByYearMonth(beginDateStr, endDateStr);
|
|
|
|
+ return costList;
|
|
|
|
+ });
|
|
|
|
+ //List<String> yearMonthListSql = indexZcbMapper.getYearMonth(beginDateStr, endDateStr);
|
|
|
|
+ //List<EightCosts> costList = indexZcbMapper.getEightCostByYearMonth(beginDateStr, endDateStr);
|
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(getYearMonthListSqlFuture,getCostListFuture);
|
|
|
|
+ future1.join();
|
|
|
|
+ List<String> yearMonthListSql = getYearMonthListSqlFuture.join();
|
|
|
|
+ List<EightCosts> costList = getCostListFuture.join();
|
|
int i = 0;
|
|
int i = 0;
|
|
for (YearMonth yearMonth : yearMonths) {
|
|
for (YearMonth yearMonth : yearMonths) {
|
|
String yearsMonthI = yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
String yearsMonthI = yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
@@ -507,25 +674,10 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
}
|
|
}
|
|
yearMonthList.add(yearsMonthI);
|
|
yearMonthList.add(yearsMonthI);
|
|
}
|
|
}
|
|
- r1.setValues(clfList);
|
|
|
|
- r2.setValues(zyfList);
|
|
|
|
- r3.setValues(swfList);
|
|
|
|
- r4.setValues(wxfList);
|
|
|
|
- r5.setValues(rldlfList);
|
|
|
|
- r6.setValues(gdzczjList);
|
|
|
|
- r7.setValues(gzjlwfList);
|
|
|
|
- r8.setValues(glfList);
|
|
|
|
- resuliEightCostvosList.add(r1);
|
|
|
|
- resuliEightCostvosList.add(r2);
|
|
|
|
- resuliEightCostvosList.add(r3);
|
|
|
|
- resuliEightCostvosList.add(r4);
|
|
|
|
- resuliEightCostvosList.add(r5);
|
|
|
|
- resuliEightCostvosList.add(r6);
|
|
|
|
- resuliEightCostvosList.add(r7);
|
|
|
|
- resuliEightCostvosList.add(r8);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)){ // 如果当前用户角色是部门领导,则查询当前部门的总成本
|
|
|
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)){ // 如果当前用户角色是部门领导,则查询当前部门的八项成本
|
|
List<String> xdbmYearMonthListSql = indexZcbMapper.getXdbmYearMonth(beginDateStr, endDateStr, deptList);
|
|
List<String> xdbmYearMonthListSql = indexZcbMapper.getXdbmYearMonth(beginDateStr, endDateStr, deptList);
|
|
List<String> zrbmYearMonthListSql = indexZcbMapper.getZrbmYearMonth(beginDateStr, endDateStr, deptList);
|
|
List<String> zrbmYearMonthListSql = indexZcbMapper.getZrbmYearMonth(beginDateStr, endDateStr, deptList);
|
|
ArrayList<String> newZrbmYearMonthListSql = new ArrayList<>();
|
|
ArrayList<String> newZrbmYearMonthListSql = new ArrayList<>();
|
|
@@ -593,7 +745,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
yearMonthList.add(yearsMonthI);
|
|
yearMonthList.add(yearsMonthI);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (!ObjectUtil.isEmpty(xdbmCostList) && !ObjectUtil.isEmpty(xdbmCostList)){
|
|
|
|
|
|
+ if (!ObjectUtil.isEmpty(xdbmCostList) && !ObjectUtil.isEmpty(zrbmCostList)){
|
|
// 如果下达部门跟责任部门都查询出值时,就进行累加(据沈工所说同一条任务的这两个字段的部门名称不会是相同的)
|
|
// 如果下达部门跟责任部门都查询出值时,就进行累加(据沈工所说同一条任务的这两个字段的部门名称不会是相同的)
|
|
int i=0;
|
|
int i=0;
|
|
int j=0;
|
|
int j=0;
|
|
@@ -643,24 +795,42 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
yearMonthList.add(yearsMonthI);
|
|
yearMonthList.add(yearsMonthI);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- r1.setValues(clfList);
|
|
|
|
- r2.setValues(zyfList);
|
|
|
|
- r3.setValues(swfList);
|
|
|
|
- r4.setValues(wxfList);
|
|
|
|
- r5.setValues(rldlfList);
|
|
|
|
- r6.setValues(gdzczjList);
|
|
|
|
- r7.setValues(gzjlwfList);
|
|
|
|
- r8.setValues(glfList);
|
|
|
|
- resuliEightCostvosList.add(r1);
|
|
|
|
- resuliEightCostvosList.add(r2);
|
|
|
|
- resuliEightCostvosList.add(r3);
|
|
|
|
- resuliEightCostvosList.add(r4);
|
|
|
|
- resuliEightCostvosList.add(r5);
|
|
|
|
- resuliEightCostvosList.add(r6);
|
|
|
|
- resuliEightCostvosList.add(r7);
|
|
|
|
- resuliEightCostvosList.add(r8);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (role == null){ // 如果是空 就给0
|
|
|
|
+ for (YearMonth yearMonth : yearMonths) {
|
|
|
|
+ String yearsMonthI = yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
|
+ clfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ zyfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ swfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ wxfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ rldlfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gdzczjList.add(BigDecimal.valueOf(0));
|
|
|
|
+ gzjlwfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ glfList.add(BigDecimal.valueOf(0));
|
|
|
|
+ yearMonthList.add(yearsMonthI);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ r1.setValues(clfList);
|
|
|
|
+ r2.setValues(zyfList);
|
|
|
|
+ r3.setValues(swfList);
|
|
|
|
+ r4.setValues(wxfList);
|
|
|
|
+ r5.setValues(rldlfList);
|
|
|
|
+ r6.setValues(gdzczjList);
|
|
|
|
+ r7.setValues(gzjlwfList);
|
|
|
|
+ r8.setValues(glfList);
|
|
|
|
+ resuliEightCostvosList.add(r1);
|
|
|
|
+ resuliEightCostvosList.add(r2);
|
|
|
|
+ resuliEightCostvosList.add(r3);
|
|
|
|
+ resuliEightCostvosList.add(r4);
|
|
|
|
+ resuliEightCostvosList.add(r5);
|
|
|
|
+ resuliEightCostvosList.add(r6);
|
|
|
|
+ resuliEightCostvosList.add(r7);
|
|
|
|
+ resuliEightCostvosList.add(r8);
|
|
|
|
+
|
|
|
|
+
|
|
indexChartInfoVo.setSeriesData(resuliEightCostvosList);
|
|
indexChartInfoVo.setSeriesData(resuliEightCostvosList);
|
|
indexChartInfoVo.setXAxisData(yearMonthList);
|
|
indexChartInfoVo.setXAxisData(yearMonthList);
|
|
resultList.add(indexChartInfoVo);
|
|
resultList.add(indexChartInfoVo);
|
|
@@ -782,7 +952,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
divide = BigDecimal.valueOf(0);
|
|
divide = BigDecimal.valueOf(0);
|
|
}else {
|
|
}else {
|
|
- divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ divide = entry.getValue().divide(sumZcb, 4, BigDecimal.ROUND_HALF_UP);
|
|
}
|
|
}
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
@@ -805,7 +975,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
ArrayList<ResultEightCost> resultL = new ArrayList<>();
|
|
ArrayList<ResultEightCost> resultL = new ArrayList<>();
|
|
List<EightCosts> e1 = indexZcbMapper.getEightCostXdDepartByDate(deptList, beginDate, endDate);
|
|
List<EightCosts> e1 = indexZcbMapper.getEightCostXdDepartByDate(deptList, beginDate, endDate);
|
|
List<EightCosts> e2 = indexZcbMapper.getEightCostZrDepartByDate(deptList, beginDate, endDate);
|
|
List<EightCosts> e2 = indexZcbMapper.getEightCostZrDepartByDate(deptList, beginDate, endDate);
|
|
- if (e1.size() > 0 && e2.size() == 0){
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(e1) && ObjectUtils.isEmpty(e2)){
|
|
HashMap<String, BigDecimal> m = new HashMap<>();
|
|
HashMap<String, BigDecimal> m = new HashMap<>();
|
|
BigDecimal sumZcb = BigDecimal.valueOf(0);
|
|
BigDecimal sumZcb = BigDecimal.valueOf(0);
|
|
for (EightCosts e:e1) {
|
|
for (EightCosts e:e1) {
|
|
@@ -888,7 +1058,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
divide = BigDecimal.valueOf(0);
|
|
divide = BigDecimal.valueOf(0);
|
|
}else {
|
|
}else {
|
|
- divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ divide = entry.getValue().divide(sumZcb, 4, BigDecimal.ROUND_HALF_UP);
|
|
}
|
|
}
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
@@ -898,7 +1068,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
resultL.add(resultEightCost);
|
|
resultL.add(resultEightCost);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (e1.size() == 0 && e2.size() > 0){
|
|
|
|
|
|
+ if (ObjectUtils.isEmpty(e1) && !ObjectUtils.isEmpty(e2)){
|
|
HashMap<String, BigDecimal> m = new HashMap<>();
|
|
HashMap<String, BigDecimal> m = new HashMap<>();
|
|
BigDecimal sumZcb = BigDecimal.valueOf(0);
|
|
BigDecimal sumZcb = BigDecimal.valueOf(0);
|
|
for (EightCosts e:e2) {
|
|
for (EightCosts e:e2) {
|
|
@@ -981,7 +1151,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
divide = BigDecimal.valueOf(0);
|
|
divide = BigDecimal.valueOf(0);
|
|
}else {
|
|
}else {
|
|
- divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ divide = entry.getValue().divide(sumZcb, 4, BigDecimal.ROUND_HALF_UP);
|
|
}
|
|
}
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
@@ -991,7 +1161,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
resultL.add(resultEightCost);
|
|
resultL.add(resultEightCost);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (e1.size() > 0 && e2.size() > 0){
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(e1) && !ObjectUtils.isEmpty(e2)){
|
|
ArrayList<EightCosts> eightCostsList = new ArrayList<>();
|
|
ArrayList<EightCosts> eightCostsList = new ArrayList<>();
|
|
EightCosts eightCosts = new EightCosts();
|
|
EightCosts eightCosts = new EightCosts();
|
|
for (int i = 0; i < e1.size(); i++) {
|
|
for (int i = 0; i < e1.size(); i++) {
|
|
@@ -1089,7 +1259,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
divide = BigDecimal.valueOf(0);
|
|
divide = BigDecimal.valueOf(0);
|
|
}else {
|
|
}else {
|
|
- divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ divide = entry.getValue().divide(sumZcb, 4, BigDecimal.ROUND_HALF_UP);
|
|
}
|
|
}
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
@@ -1223,7 +1393,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
divide = BigDecimal.valueOf(0);
|
|
divide = BigDecimal.valueOf(0);
|
|
}else {
|
|
}else {
|
|
- divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ divide = entry.getValue().divide(sumZcb, 4, BigDecimal.ROUND_HALF_UP);
|
|
}
|
|
}
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
@@ -1237,7 +1407,13 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
if (AuthMark.DEPT_LEADER.equals(role)){ // 如果当前用户角色是部门领导,则查询当前部门的总成本
|
|
if (AuthMark.DEPT_LEADER.equals(role)){ // 如果当前用户角色是部门领导,则查询当前部门的总成本
|
|
List<EightCosts> e1 = indexZcbMapper.getEightCostXdDepartByDate(deptList, beginDate, endDate);
|
|
List<EightCosts> e1 = indexZcbMapper.getEightCostXdDepartByDate(deptList, beginDate, endDate);
|
|
List<EightCosts> e2 = indexZcbMapper.getEightCostZrDepartByDate(deptList, beginDate, endDate);
|
|
List<EightCosts> e2 = indexZcbMapper.getEightCostZrDepartByDate(deptList, beginDate, endDate);
|
|
- if (e1.size() > 0 && e2.size() == 0){
|
|
|
|
|
|
+ if (e1.get(0) == null){
|
|
|
|
+ e1.clear();
|
|
|
|
+ }
|
|
|
|
+ if (e2.get(0) == null){
|
|
|
|
+ e2.clear();
|
|
|
|
+ }
|
|
|
|
+ if (!ObjectUtils.isEmpty(e1) && ObjectUtils.isEmpty(e2)){
|
|
HashMap<String, BigDecimal> m = new HashMap<>();
|
|
HashMap<String, BigDecimal> m = new HashMap<>();
|
|
BigDecimal sumZcb = BigDecimal.valueOf(0);
|
|
BigDecimal sumZcb = BigDecimal.valueOf(0);
|
|
for (EightCosts e:e1) {
|
|
for (EightCosts e:e1) {
|
|
@@ -1320,7 +1496,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
divide = BigDecimal.valueOf(0);
|
|
divide = BigDecimal.valueOf(0);
|
|
}else {
|
|
}else {
|
|
- divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ divide = entry.getValue().divide(sumZcb, 4, BigDecimal.ROUND_HALF_UP);
|
|
}
|
|
}
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
@@ -1330,7 +1506,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
resultList.add(resultEightCost);
|
|
resultList.add(resultEightCost);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (e1.size() == 0 && e2.size() > 0){
|
|
|
|
|
|
+ if (ObjectUtils.isEmpty(e1) && !ObjectUtils.isEmpty(e2)){
|
|
HashMap<String, BigDecimal> m = new HashMap<>();
|
|
HashMap<String, BigDecimal> m = new HashMap<>();
|
|
BigDecimal sumZcb = BigDecimal.valueOf(0);
|
|
BigDecimal sumZcb = BigDecimal.valueOf(0);
|
|
for (EightCosts e:e2) {
|
|
for (EightCosts e:e2) {
|
|
@@ -1413,7 +1589,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
divide = BigDecimal.valueOf(0);
|
|
divide = BigDecimal.valueOf(0);
|
|
}else {
|
|
}else {
|
|
- divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ divide = entry.getValue().divide(sumZcb, 4, BigDecimal.ROUND_HALF_UP);
|
|
}
|
|
}
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
@@ -1423,7 +1599,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
resultList.add(resultEightCost);
|
|
resultList.add(resultEightCost);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (e1.size() > 0 && e2.size() > 0){
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(e1) && !ObjectUtils.isEmpty(e2)){
|
|
ArrayList<EightCosts> eightCostsList = new ArrayList<>();
|
|
ArrayList<EightCosts> eightCostsList = new ArrayList<>();
|
|
EightCosts eightCosts = new EightCosts();
|
|
EightCosts eightCosts = new EightCosts();
|
|
for (int i = 0; i < e1.size(); i++) {
|
|
for (int i = 0; i < e1.size(); i++) {
|
|
@@ -1521,7 +1697,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
if (sumZcb.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
divide = BigDecimal.valueOf(0);
|
|
divide = BigDecimal.valueOf(0);
|
|
}else {
|
|
}else {
|
|
- divide = entry.getValue().divide(sumZcb, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
|
+ divide = entry.getValue().divide(sumZcb, 4, BigDecimal.ROUND_HALF_UP);
|
|
}
|
|
}
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
BigDecimal mul = divide.multiply(BigDecimal.valueOf(100));
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|
|
ResultEightCost resultEightCost = new ResultEightCost();
|