|
@@ -2540,12 +2540,24 @@ public class IndexServiceImpl implements IndexService {
|
|
|
IndexTotalVo lrIndexTotalVo = indexTotalVoInit();
|
|
|
|
|
|
//获取一层合同额
|
|
|
- IndexTotalVo hteindexTotalVo = getTotalIncome(request);
|
|
|
+ CompletableFuture<IndexTotalVo> getHteFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
+ return getTotalIncome(request);
|
|
|
+ });
|
|
|
+// IndexTotalVo hteindexTotalVo = getTotalIncome(request);
|
|
|
//获取一层支出成本额
|
|
|
- IndexTotalVo zceindexTotalVo = indexZcbService.getZhiChuTotalList().get(0);
|
|
|
+ CompletableFuture<IndexTotalVo> getZcbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
+ return indexZcbService.getZhiChuTotalList(request).get(0);
|
|
|
+ });
|
|
|
+// IndexTotalVo zceindexTotalVo = indexZcbService.getZhiChuTotalList(request).get(0);
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(getHteFuture,getZcbFuture);
|
|
|
+ future1.join();
|
|
|
+ IndexTotalVo hteindexTotalVo = getHteFuture.join();
|
|
|
+ IndexTotalVo zceindexTotalVo = getZcbFuture.join();
|
|
|
+ System.out.println("一层合同额、总成本:");
|
|
|
System.out.println(hteindexTotalVo);
|
|
|
System.out.println(zceindexTotalVo);
|
|
|
|
|
|
+
|
|
|
//当年利润额 合同额-成本额
|
|
|
if(hteindexTotalVo.getYearTotal() == null) hteindexTotalVo.setYearTotal(BigDecimal.valueOf(0));
|
|
|
if(zceindexTotalVo.getYearTotal() == null) zceindexTotalVo.setYearTotal(BigDecimal.valueOf(0));
|
|
@@ -2572,21 +2584,21 @@ public class IndexServiceImpl implements IndexService {
|
|
|
if(lreLastYearTotal.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
lrYearTb = BigDecimal.valueOf(1);
|
|
|
}else {
|
|
|
- lrYearTb = (lreYearTotal.subtract(lreLastYearTotal)).divide(lreLastYearTotal, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ lrYearTb = (lreYearTotal.subtract(lreLastYearTotal)).divide(lreLastYearTotal, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
//月同比 (当月利润-去年同期月份利润)/去年同期月份利润
|
|
|
BigDecimal lrMonthTb = BigDecimal.valueOf(0);
|
|
|
if(lreTqMonthTotal.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
lrMonthTb = BigDecimal.valueOf(1);
|
|
|
}else {
|
|
|
- lrMonthTb = (lreMonthTotal.subtract(lreTqMonthTotal)).divide(lreTqMonthTotal, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ lrMonthTb = (lreMonthTotal.subtract(lreTqMonthTotal)).divide(lreTqMonthTotal, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
//月环比 (当月利润-上个月利润)/上个月利润
|
|
|
BigDecimal lrMonthHb = BigDecimal.valueOf(0);
|
|
|
if(lreLastMonthTotal.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
lrMonthHb = BigDecimal.valueOf(1);
|
|
|
}else {
|
|
|
- lrMonthHb = (lreMonthTotal.subtract(lreLastMonthTotal)).divide(lreLastMonthTotal, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ lrMonthHb = (lreMonthTotal.subtract(lreLastMonthTotal)).divide(lreLastMonthTotal, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
|
|
|
lrIndexTotalVo.setYearTotal(lreYearTotal);//当年利润
|
|
@@ -2636,14 +2648,53 @@ public class IndexServiceImpl implements IndexService {
|
|
|
public IndexChartInfoVo<BigDecimal> getLreDetailByRole(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto) {
|
|
|
//初始化
|
|
|
IndexChartInfoVo<BigDecimal> indexChartInfoVo = indexChartInfoVoInit();
|
|
|
+ List<String> xAxisDataList = new ArrayList<>();
|
|
|
+ List<BigDecimal> seriesDataList = new ArrayList<>();
|
|
|
+ indexChartInfoVo.setXAxisData(xAxisDataList);
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
|
|
|
//获取二层合同额
|
|
|
- ContractChartInfoVo contractChartInfoVo = getContractAmountInfo(request, indexInfoParamDto);
|
|
|
- System.out.println(contractChartInfoVo);
|
|
|
+ CompletableFuture<ContractChartInfoVo> getHteFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
+ return getContractAmountInfo(request, indexInfoParamDto);
|
|
|
+ });
|
|
|
+// ContractChartInfoVo contractChartInfoVo = getContractAmountInfo(request, indexInfoParamDto);
|
|
|
+
|
|
|
//获取二层支出成本额 八项成本
|
|
|
- List<IndexChartInfoVo> resultList = indexZcbService.getEightCostsList(indexInfoParamDto);
|
|
|
+ CompletableFuture<List<EightCostChartInfoVo>> getZcbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
+ return indexZcbService.getEightCostsList(indexInfoParamDto, request);
|
|
|
+ });
|
|
|
+// List<EightCostChartInfoVo> resultList = indexZcbService.getEightCostsList(indexInfoParamDto, request);
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(getHteFuture,getZcbFuture);
|
|
|
+ future1.join();
|
|
|
+ ContractChartInfoVo contractChartInfoVo = getHteFuture.join();
|
|
|
+ List<EightCostChartInfoVo> resultList = getZcbFuture.join();
|
|
|
+ System.out.println("日期列表:");
|
|
|
+ System.out.println(xAxisDataList);
|
|
|
+ System.out.println("二层合同额、总成本:");
|
|
|
+ System.out.println(contractChartInfoVo);
|
|
|
System.out.println(resultList);
|
|
|
|
|
|
+ //日期列表
|
|
|
+ xAxisDataList.addAll(contractChartInfoVo.getXAxisData());
|
|
|
+ if(xAxisDataList.size() == 0) return indexChartInfoVo;//如果日期长度为0,返回空列表
|
|
|
+ //合同额列表
|
|
|
+ List<BigDecimal> contractAmountList = contractChartInfoVo.getContractAmount();
|
|
|
+ //总成本列表
|
|
|
+ List sumZcbDataList = resultList.get(0).getSumZcbData();
|
|
|
+ //利润额列表
|
|
|
+ List<BigDecimal> lreList = new ArrayList<>();
|
|
|
+ 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));
|
|
|
+ lreList.add(contractAmountList.get(i).subtract((BigDecimal) sumZcbDataList.get(i)));
|
|
|
+ }
|
|
|
+ System.out.println("二层利润额:");
|
|
|
+ System.out.println(lreList);
|
|
|
+
|
|
|
+ indexChartInfoVo.setXAxisData(xAxisDataList);
|
|
|
+ indexChartInfoVo.setSeriesData(lreList);
|
|
|
+
|
|
|
return indexChartInfoVo;
|
|
|
|
|
|
/*
|