|
@@ -109,7 +109,6 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
|
if (AuthMark.BOSS.equals(role)){ // 如果当前用户角色是领导,则查询全部部门的总成本
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
-// BigDecimal sumZcb = indexZcbMapper.getZcbByDate(String.valueOf(year), pcList);
|
|
|
BigDecimal sumZcb = indexZcbMapper.getZcbByYear(String.valueOf(year));
|
|
|
if (ObjectUtil.isEmpty(sumZcb)){
|
|
|
sumZcb = BigDecimal.valueOf(0);
|
|
@@ -383,6 +382,7 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
|
|
|
|
// 各个年、月的总成本之和的集合(结果集合)
|
|
|
ArrayList<BigDecimal> zcbSumValueList = new ArrayList<>();
|
|
|
+ ArrayList<ResuliEightCostvo> resuliEightCostvosList = new ArrayList<>();
|
|
|
IndexChartInfoVo indexChartInfoVo = new IndexChartInfoVo();
|
|
|
// 如果前端传递过来的标记是 按年统计 则获取日期范围内所有的年份,遍历集合 分别查询各个年份下的总成本的和
|
|
|
if ("year".equals(indexInfoParamDto.getTime())){
|
|
@@ -410,8 +410,6 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
|
if (AuthMark.DEPT_LEADER.equals(role)){ // 如果当前用户角色是部门领导,则查询当前部门的总成本
|
|
|
CompletableFuture<BigDecimal> zcbSumValueFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal sum = BigDecimal.valueOf(0);
|
|
|
-// BigDecimal b1 = indexZcbMapper.getZcbByXdDepartAndDate(deptList, year,pcList);
|
|
|
-// BigDecimal b2 = indexZcbMapper.getZcbByZrDepartAndDate(deptList, year,pcList);
|
|
|
BigDecimal b1 = indexZcbMapper.getZcbByXdDepartByYear(year, deptList);
|
|
|
BigDecimal b2 = indexZcbMapper.getZcbByZrDepartByYear(year, deptList);
|
|
|
if (!ObjectUtil.isEmpty(b1) && ObjectUtil.isEmpty(b2)){
|
|
@@ -457,45 +455,213 @@ public class IndexZcbServiceImpl implements IndexZcbService {
|
|
|
LocalDate endLocalDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
List<YearMonth> yearMonths = getYearMonths(beginLocalDate, endLocalDate);
|
|
|
ArrayList<String> yearMonthList = new ArrayList<>();
|
|
|
- for (YearMonth yearMonth : yearMonths) {
|
|
|
- String yearsMonthI = yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
- BigDecimal zcbSumValue = BigDecimal.valueOf(0); // 默认值为0
|
|
|
- if (AuthMark.BOSS.equals(role)){ // 如果当前用户角色是领导,则查询全部部门的总成本
|
|
|
-// zcbSumValue = indexZcbMapper.getZcbByDate(yearsMonthI,pcList);
|
|
|
- zcbSumValue = indexZcbMapper.getZcbByYearMonth(yearsMonthI);
|
|
|
- if (ObjectUtil.isEmpty(zcbSumValue)) {
|
|
|
- zcbSumValue = BigDecimal.valueOf(0);
|
|
|
+ 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);
|
|
|
+ int i = 0;
|
|
|
+ for (YearMonth yearMonth : yearMonths) {
|
|
|
+ String yearsMonthI = yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
+ if (yearMonthListSql.contains(yearsMonthI)){
|
|
|
+ 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));
|
|
|
}
|
|
|
+ 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)){ // 如果当前用户角色是部门领导,则查询当前部门的总成本
|
|
|
- CompletableFuture<BigDecimal> zcbSumValueFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal sum = BigDecimal.valueOf(0);
|
|
|
-// BigDecimal b1 = indexZcbMapper.getZcbByXdDepartAndDate(deptList, yearsMonthI,pcList);
|
|
|
-// BigDecimal b2 = indexZcbMapper.getZcbByZrDepartAndDate(deptList, yearsMonthI,pcList);
|
|
|
- BigDecimal b1 = indexZcbMapper.getZcbByXdDepartByYearMonth(yearsMonthI, deptList);
|
|
|
- BigDecimal b2 = indexZcbMapper.getZcbByZrDepartByYearMonth(yearsMonthI, deptList);
|
|
|
- if (!ObjectUtil.isEmpty(b1) && ObjectUtil.isEmpty(b2)){
|
|
|
- // 如果根据责任部门没有查出来值 但 根据下达部门查询有值
|
|
|
- sum = b1.add(BigDecimal.valueOf(0));
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)){ // 如果当前用户角色是部门领导,则查询当前部门的总成本
|
|
|
+ List<String> xdbmYearMonthListSql = indexZcbMapper.getXdbmYearMonth(beginDateStr, endDateStr, deptList);
|
|
|
+ List<String> zrbmYearMonthListSql = indexZcbMapper.getZrbmYearMonth(beginDateStr, endDateStr, deptList);
|
|
|
+ ArrayList<String> newZrbmYearMonthListSql = new ArrayList<>();
|
|
|
+ newZrbmYearMonthListSql.addAll(zrbmYearMonthListSql);
|
|
|
+ newZrbmYearMonthListSql.removeAll(xdbmYearMonthListSql);
|
|
|
+ ArrayList<String> yearMonthListSql = new ArrayList<>();
|
|
|
+ yearMonthListSql.addAll(xdbmYearMonthListSql);
|
|
|
+ yearMonthListSql.addAll(newZrbmYearMonthListSql);
|
|
|
+ Collections.sort(yearMonthListSql);
|
|
|
+ List<EightCosts> xdbmCostList = indexZcbMapper.getXdbmEightCostByYearMonth(beginDateStr, endDateStr, deptList);
|
|
|
+ List<EightCosts> zrbmCostList = indexZcbMapper.getZrbmEightCostByYearMonth(beginDateStr, endDateStr, deptList);
|
|
|
+ if (!ObjectUtil.isEmpty(xdbmCostList) && ObjectUtil.isEmpty(zrbmCostList)){
|
|
|
+ // 如果根据责任部门没有查出来值 但 根据下达部门查询有值
|
|
|
+ int i=0;
|
|
|
+ for (YearMonth yearMonth : yearMonths) {
|
|
|
+ String yearsMonthI = yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
+ if (yearMonthListSql.contains(yearsMonthI)){
|
|
|
+ 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));
|
|
|
+ yearMonthList.add(yearsMonthI);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isEmpty(xdbmCostList) && !ObjectUtil.isEmpty(zrbmCostList)){
|
|
|
+ // 如果根据责任部门查询有值,但根据下达部门没有值
|
|
|
+ int i=0;
|
|
|
+ for (YearMonth yearMonth : yearMonths) {
|
|
|
+ String yearsMonthI = yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
+ if (yearMonthListSql.contains(yearsMonthI)){
|
|
|
+ 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);
|
|
|
+ yearMonthList.add(yearsMonthI);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!ObjectUtil.isEmpty(xdbmCostList) && !ObjectUtil.isEmpty(xdbmCostList)){
|
|
|
+ // 如果下达部门跟责任部门都查询出值时,就进行累加(据沈工所说同一条任务的这两个字段的部门名称不会是相同的)
|
|
|
+ int i=0;
|
|
|
+ int j=0;
|
|
|
+ for (YearMonth yearMonth : yearMonths) {
|
|
|
+ String yearsMonthI = yearMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
+ if (xdbmYearMonthListSql.contains(yearsMonthI) && !zrbmYearMonthListSql.contains(yearsMonthI)){
|
|
|
+ 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 (!xdbmYearMonthListSql.contains(yearsMonthI) && zrbmYearMonthListSql.contains(yearsMonthI)){
|
|
|
+ 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 (zrbmYearMonthListSql.contains(yearsMonthI) && xdbmYearMonthListSql.contains(yearsMonthI)){
|
|
|
+ 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;
|
|
|
- });
|
|
|
-
|
|
|
+ yearMonthList.add(yearsMonthI);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- zcbSumValueList.add(zcbSumValue);
|
|
|
- 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(zcbSumValueList);
|
|
|
+
|
|
|
+ indexChartInfoVo.setSeriesData(resuliEightCostvosList);
|
|
|
indexChartInfoVo.setXAxisData(yearMonthList);
|
|
|
resultList.add(indexChartInfoVo);
|
|
|
}
|