|
@@ -90,7 +90,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
private IndexZcbService indexZcbService;
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 科研任务信息表
|
|
|
*/
|
|
@@ -165,8 +164,10 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
-
|
|
|
- Date currentYearEndDate = instance.getTime();
|
|
|
+ setZeroMonth(instance);
|
|
|
+ instance.add(Calendar.MONTH,1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ Date currentYearEndDate = instance.getTime(); //加一天
|
|
|
setZeroYear(instance);
|
|
|
Date currentYearBeginDate = instance.getTime();
|
|
|
|
|
@@ -186,7 +187,11 @@ public class IndexServiceImpl implements IndexService {
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.YEAR, -1);
|
|
|
//去年的今日
|
|
|
+ setZeroMonth(instance);
|
|
|
+ instance.add(Calendar.MONTH,1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
Date LastTqEndDate = instance.getTime();
|
|
|
+
|
|
|
setZeroYear(instance);
|
|
|
Date LastYearBeginDate = instance.getTime();
|
|
|
|
|
@@ -202,10 +207,16 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return lastYearTqTotal;
|
|
|
});
|
|
|
|
|
|
- instance.setTime(new Date());
|
|
|
+/* instance.setTime(new Date());
|
|
|
Date currentMothEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
+ Date currentMothBginDate = instance.getTime();*/
|
|
|
+ instance.setTime(new Date());
|
|
|
+ setZeroMonth(instance);
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
+ instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.add(Calendar.DATE, 1);
|
|
|
+ Date currentMothEndDate = instance.getTime();
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal currentMonthTotal = null;
|
|
@@ -221,6 +232,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.MONTH, -1);
|
|
|
+ setZeroMonth(instance);
|
|
|
+ instance.add(Calendar.MONTH,1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
Date LastMothTqEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date LastMothTqBeginDate = instance.getTime();
|
|
@@ -240,6 +254,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.YEAR, -1);
|
|
|
+ setZeroMonth(instance);
|
|
|
+ instance.add(Calendar.MONTH,1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
Date lastYearMonthTqEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date lastYearMonthTqBeginDate = instance.getTime();
|
|
@@ -558,6 +575,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
+ setZeroMonth(instance);
|
|
|
+ instance.add(Calendar.MONTH,1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
Date currentYearEndDate = instance.getTime();
|
|
|
setZeroYear(instance);
|
|
|
Date currentYearBeginDate = instance.getTime();
|
|
@@ -577,6 +597,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.YEAR, -1);
|
|
|
+ setZeroMonth(instance);
|
|
|
+ instance.add(Calendar.MONTH,1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
//去年的今日
|
|
|
Date LastTqEndDate = instance.getTime();
|
|
|
setZeroYear(instance);
|
|
@@ -594,9 +617,11 @@ public class IndexServiceImpl implements IndexService {
|
|
|
});
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
- Date currentMothEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
+ instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.add(Calendar.DATE, 1);
|
|
|
+ Date currentMothEndDate = instance.getTime();
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal currentMonthTotal = null;
|
|
@@ -612,6 +637,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.MONTH, -1);
|
|
|
+ setZeroMonth(instance);
|
|
|
+ instance.add(Calendar.MONTH,1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
Date LastMothTqEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date LastMothTqBeginDate = instance.getTime();
|
|
@@ -631,6 +659,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.YEAR, -1);
|
|
|
+ setZeroMonth(instance);
|
|
|
+ instance.add(Calendar.MONTH,1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
Date lastYearMonthTqEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date lastYearMonthTqBeginDate = instance.getTime();
|
|
@@ -1750,24 +1781,19 @@ public class IndexServiceImpl implements IndexService {
|
|
|
//结束时间
|
|
|
String endString = indexInfoParamDto.getEndDate();
|
|
|
|
|
|
- if(timeType.equals("year")){
|
|
|
+ if (timeType.equals("year")) {
|
|
|
List<LreInfoByDate> lreDetail = indexMapper.getTasknoByGroupYear(startString, endString);
|
|
|
System.out.println(lreDetail);
|
|
|
- }else if(timeType.equals("month")){
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
List<LreInfoByDate> lreDetail = indexMapper.getTasknoByGroupMonth(startString, endString);
|
|
|
System.out.println(lreDetail);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
return tasknoList;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 首页一层利润额参数类 IndexTotalVo 初始化
|
|
|
*/
|
|
@@ -2296,7 +2322,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
//4.计算该时间列表中某年或某月对应的总收款
|
|
|
List<ReceivedByDate> receivedByDates = new ArrayList<>();
|
|
|
- if(timeType.equals("year")){
|
|
|
+ if (timeType.equals("year")) {
|
|
|
receivedByDates = exchangeMapper.getReceivedAllByYear(startString, endString);
|
|
|
// System.out.println("已收款二层按年查询结果:");
|
|
|
// for(ReceivedByDate receivedByDate:receivedByDates){
|
|
@@ -2305,7 +2331,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
// }
|
|
|
// System.out.println(receivedByDates);
|
|
|
|
|
|
- }else if(timeType.equals("month")){
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
receivedByDates = exchangeMapper.getReceivedAllByYMonth(startString, endString);
|
|
|
// System.out.println("已收款二层按月查询结果:");
|
|
|
// for(ReceivedByDate receivedByDate:receivedByDates){
|
|
@@ -2314,11 +2340,11 @@ public class IndexServiceImpl implements IndexService {
|
|
|
// }
|
|
|
// System.out.println(receivedByDates);
|
|
|
}
|
|
|
- if(receivedByDates.isEmpty()) return indexChartInfoVo;
|
|
|
+ if (receivedByDates.isEmpty()) return indexChartInfoVo;
|
|
|
|
|
|
- for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+ for (ReceivedByDate receivedByDate : receivedByDates) {
|
|
|
String date = receivedByDate.getDate();
|
|
|
- if(timeRangeList.contains(date)){
|
|
|
+ if (timeRangeList.contains(date)) {
|
|
|
seriesDataList.set(timeRangeList.indexOf(date), receivedByDate.getReceived());
|
|
|
}
|
|
|
}
|
|
@@ -2429,7 +2455,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
List<String> sysDepartNames = sysDepartMapper.getSysUserOfDepartNameList(userId);
|
|
|
System.out.println("查出的部门列表:");
|
|
|
System.out.println(sysDepartNames);
|
|
|
- if(sysDepartNames.isEmpty()) return indexChartInfoVo;
|
|
|
+ if (sysDepartNames.isEmpty()) return indexChartInfoVo;
|
|
|
|
|
|
// ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
// List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(sysDepartNames);
|
|
@@ -2445,29 +2471,29 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
//4.计算该时间列表中某年或某月对应的总收款
|
|
|
List<ReceivedByDate> receivedByDates = new ArrayList<>();
|
|
|
- if(timeType.equals("year")){
|
|
|
+ if (timeType.equals("year")) {
|
|
|
receivedByDates = exchangeMapper.getReceivedByYear2(sysDepartNames, startString, endString);
|
|
|
System.out.println("部门领导已收款二层按年查询结果:");
|
|
|
- for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+ for (ReceivedByDate receivedByDate : receivedByDates) {
|
|
|
System.out.println(receivedByDate.getDate());
|
|
|
System.out.println(receivedByDate.getReceived());
|
|
|
}
|
|
|
System.out.println(receivedByDates);
|
|
|
|
|
|
- }else if(timeType.equals("month")){
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
receivedByDates = exchangeMapper.getReceivedByYMonth2(sysDepartNames, startString, endString);
|
|
|
System.out.println("部门领导已收款二层按月查询结果:");
|
|
|
- for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+ for (ReceivedByDate receivedByDate : receivedByDates) {
|
|
|
System.out.println(receivedByDate.getDate());
|
|
|
System.out.println(receivedByDate.getReceived());
|
|
|
}
|
|
|
System.out.println(receivedByDates);
|
|
|
}
|
|
|
- if(receivedByDates.isEmpty()) return indexChartInfoVo;
|
|
|
+ if (receivedByDates.isEmpty()) return indexChartInfoVo;
|
|
|
|
|
|
- for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+ for (ReceivedByDate receivedByDate : receivedByDates) {
|
|
|
String date = receivedByDate.getDate();
|
|
|
- if(timeRangeList.contains(date)){
|
|
|
+ if (timeRangeList.contains(date)) {
|
|
|
seriesDataList.set(timeRangeList.indexOf(date), receivedByDate.getReceived());
|
|
|
}
|
|
|
}
|
|
@@ -2542,6 +2568,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
//获取一层已收款
|
|
|
CompletableFuture<IndexTotalVo> getYskFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
return getTotalReceived(request);
|
|
|
+// return getTotalIncome(request);
|
|
|
});
|
|
|
// IndexTotalVo hteindexTotalVo = getTotalIncome(request);
|
|
|
//获取一层支出成本额
|
|
@@ -2549,7 +2576,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return indexZcbService.getZhiChuTotalList(request).get(0);
|
|
|
});
|
|
|
// IndexTotalVo zceindexTotalVo = indexZcbService.getZhiChuTotalList(request).get(0);
|
|
|
- CompletableFuture<Void> future1 = CompletableFuture.allOf(getYskFuture,getZcbFuture);
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(getYskFuture, getZcbFuture);
|
|
|
future1.join();
|
|
|
IndexTotalVo yskindexTotalVo = getYskFuture.join();
|
|
|
IndexTotalVo zceindexTotalVo = getZcbFuture.join();
|
|
@@ -2559,45 +2586,45 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
|
|
|
//当年利润额 已收款-成本额
|
|
|
- if(yskindexTotalVo.getYearTotal() == null) yskindexTotalVo.setYearTotal(BigDecimal.valueOf(0));
|
|
|
- if(zceindexTotalVo.getYearTotal() == null) zceindexTotalVo.setYearTotal(BigDecimal.valueOf(0));
|
|
|
+ if (yskindexTotalVo.getYearTotal() == null) yskindexTotalVo.setYearTotal(BigDecimal.valueOf(0));
|
|
|
+ if (zceindexTotalVo.getYearTotal() == null) zceindexTotalVo.setYearTotal(BigDecimal.valueOf(0));
|
|
|
BigDecimal lreYearTotal = yskindexTotalVo.getYearTotal().subtract(zceindexTotalVo.getYearTotal());
|
|
|
//去年同期利润额 去年同期合同额-去年同期成本额
|
|
|
- if(yskindexTotalVo.getYearTq() == null) yskindexTotalVo.setYearTq(BigDecimal.valueOf(0));
|
|
|
- if(zceindexTotalVo.getYearTq() == null) zceindexTotalVo.setYearTq(BigDecimal.valueOf(0));
|
|
|
+ if (yskindexTotalVo.getYearTq() == null) yskindexTotalVo.setYearTq(BigDecimal.valueOf(0));
|
|
|
+ if (zceindexTotalVo.getYearTq() == null) zceindexTotalVo.setYearTq(BigDecimal.valueOf(0));
|
|
|
BigDecimal lreLastYearTotal = yskindexTotalVo.getYearTq().subtract(zceindexTotalVo.getYearTq());
|
|
|
//当月利润额 当月合同额-当月成本额
|
|
|
- if(yskindexTotalVo.getMonthTotal() == null) yskindexTotalVo.setMonthTotal(BigDecimal.valueOf(0));
|
|
|
- if(zceindexTotalVo.getMonthTotal() == null) zceindexTotalVo.setMonthTotal(BigDecimal.valueOf(0));
|
|
|
+ if (yskindexTotalVo.getMonthTotal() == null) yskindexTotalVo.setMonthTotal(BigDecimal.valueOf(0));
|
|
|
+ if (zceindexTotalVo.getMonthTotal() == null) zceindexTotalVo.setMonthTotal(BigDecimal.valueOf(0));
|
|
|
BigDecimal lreMonthTotal = yskindexTotalVo.getMonthTotal().subtract(zceindexTotalVo.getMonthTotal());
|
|
|
//去年同期月份利润额 去年同期月份合同额-去年同期月份成本额
|
|
|
- if(yskindexTotalVo.getMonthTq() == null) yskindexTotalVo.setMonthTq(BigDecimal.valueOf(0));
|
|
|
- if(zceindexTotalVo.getMonthTq() == null) zceindexTotalVo.setMonthTq(BigDecimal.valueOf(0));
|
|
|
+ if (yskindexTotalVo.getMonthTq() == null) yskindexTotalVo.setMonthTq(BigDecimal.valueOf(0));
|
|
|
+ if (zceindexTotalVo.getMonthTq() == null) zceindexTotalVo.setMonthTq(BigDecimal.valueOf(0));
|
|
|
BigDecimal lreTqMonthTotal = yskindexTotalVo.getMonthTq().subtract(zceindexTotalVo.getMonthTq());
|
|
|
//上个月利润额 上个月合同额-上个月成本额
|
|
|
- if(yskindexTotalVo.getMonthLast() == null) yskindexTotalVo.setMonthLast(BigDecimal.valueOf(0));
|
|
|
- if(zceindexTotalVo.getMonthLast() == null) zceindexTotalVo.setMonthLast(BigDecimal.valueOf(0));
|
|
|
+ if (yskindexTotalVo.getMonthLast() == null) yskindexTotalVo.setMonthLast(BigDecimal.valueOf(0));
|
|
|
+ if (zceindexTotalVo.getMonthLast() == null) zceindexTotalVo.setMonthLast(BigDecimal.valueOf(0));
|
|
|
BigDecimal lreLastMonthTotal = yskindexTotalVo.getMonthLast().subtract(zceindexTotalVo.getMonthLast());
|
|
|
|
|
|
//年同比 (当年利润-去年利润)/去年利润
|
|
|
BigDecimal lrYearTb = BigDecimal.valueOf(0);
|
|
|
- if(lreLastYearTotal.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
+ if (lreLastYearTotal.compareTo(BigDecimal.valueOf(0)) == 0) {
|
|
|
lrYearTb = BigDecimal.valueOf(1);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
lrYearTb = (lreYearTotal.subtract(lreLastYearTotal)).divide(lreLastYearTotal, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
//月同比 (当月利润-去年同期月份利润)/去年同期月份利润
|
|
|
BigDecimal lrMonthTb = BigDecimal.valueOf(0);
|
|
|
- if(lreTqMonthTotal.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
+ if (lreTqMonthTotal.compareTo(BigDecimal.valueOf(0)) == 0) {
|
|
|
lrMonthTb = BigDecimal.valueOf(1);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
lrMonthTb = (lreMonthTotal.subtract(lreTqMonthTotal)).divide(lreTqMonthTotal, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
//月环比 (当月利润-上个月利润)/上个月利润
|
|
|
BigDecimal lrMonthHb = BigDecimal.valueOf(0);
|
|
|
- if(lreLastMonthTotal.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
+ if (lreLastMonthTotal.compareTo(BigDecimal.valueOf(0)) == 0) {
|
|
|
lrMonthHb = BigDecimal.valueOf(1);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
lrMonthHb = (lreMonthTotal.subtract(lreLastMonthTotal)).divide(lreLastMonthTotal, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
|
|
@@ -2654,8 +2681,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
|
|
|
//获取二层合同额
|
|
|
- CompletableFuture<ContractChartInfoVo> getHteFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- return getContractAmountInfo(request, indexInfoParamDto);
|
|
|
+ CompletableFuture<IndexChartInfoVo> getHteFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
+// return getContractAmountInfo(request, indexInfoParamDto);
|
|
|
+ return getReceivedDetailByRoleDate(indexInfoParamDto);
|
|
|
});
|
|
|
// ContractChartInfoVo contractChartInfoVo = getContractAmountInfo(request, indexInfoParamDto);
|
|
|
|
|
@@ -2664,9 +2692,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return indexZcbService.getEightCostsList(indexInfoParamDto, request);
|
|
|
});
|
|
|
// List<EightCostChartInfoVo> resultList = indexZcbService.getEightCostsList(indexInfoParamDto, request);
|
|
|
- CompletableFuture<Void> future1 = CompletableFuture.allOf(getHteFuture,getZcbFuture);
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(getHteFuture, getZcbFuture);
|
|
|
future1.join();
|
|
|
- ContractChartInfoVo contractChartInfoVo = getHteFuture.join();
|
|
|
+ IndexChartInfoVo contractChartInfoVo = getHteFuture.join();
|
|
|
List<EightCostChartInfoVo> resultList = getZcbFuture.join();
|
|
|
System.out.println("日期列表:");
|
|
|
System.out.println(xAxisDataList);
|
|
@@ -2676,17 +2704,18 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
//日期列表
|
|
|
xAxisDataList.addAll(contractChartInfoVo.getXAxisData());
|
|
|
- if(xAxisDataList.size() == 0) return indexChartInfoVo;//如果日期长度为0,返回空列表
|
|
|
+ if (xAxisDataList.size() == 0) return indexChartInfoVo;//如果日期长度为0,返回空列表
|
|
|
//合同额列表
|
|
|
- List<BigDecimal> contractAmountList = contractChartInfoVo.getContractAmount();
|
|
|
+// List<BigDecimal> contractAmountList = contractChartInfoVo.getContractAmount();
|
|
|
+ List<BigDecimal> contractAmountList = contractChartInfoVo.getSeriesData();
|
|
|
//总成本列表
|
|
|
List sumZcbDataList = resultList.get(0).getSumZcbData();
|
|
|
//利润额列表
|
|
|
List<BigDecimal> lreList = new ArrayList<>();
|
|
|
- for(int i=0;i<contractAmountList.size();i++){
|
|
|
+ for (int i = 0; i < contractAmountList.size(); i++) {
|
|
|
//计算每个年或月的利润额 合同额-成本额
|
|
|
- if(contractAmountList.get(i) == null) contractAmountList.set(i, BigDecimal.valueOf(0));
|
|
|
- if(sumZcbDataList.get(i) == null) sumZcbDataList.set(i, BigDecimal.valueOf(0));
|
|
|
+ if (contractAmountList.get(i) == null) contractAmountList.set(i, BigDecimal.valueOf(0));
|
|
|
+ if (sumZcbDataList.get(i) == null) sumZcbDataList.set(i, BigDecimal.valueOf(0));
|
|
|
lreList.add(contractAmountList.get(i).subtract((BigDecimal) sumZcbDataList.get(i)));
|
|
|
}
|
|
|
System.out.println("二层利润额:");
|