|
@@ -136,15 +136,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroYear(instance);
|
|
|
Date currentYearBeginDate = instance.getTime();
|
|
|
|
|
|
- List<BigDecimal> currentYearIncomeList = new ArrayList<>();
|
|
|
- IndexTotalVo finalIncomeDataInfoVo = incomeDataInfoVO;
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+
|
|
|
+ CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//根据年份和当前部门对应的任务号查询,部门当前年的年收入
|
|
|
BigDecimal currentYearTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
if (ObjectUtils.isEmpty(currentYearTotal)) currentYearTotal = BigDecimal.valueOf(0);
|
|
|
- finalIncomeDataInfoVo.setYearTotal(currentYearTotal);
|
|
|
- currentYearIncomeList.add(currentYearTotal);
|
|
|
- }).join();
|
|
|
+ return currentYearTotal;
|
|
|
+ });
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.YEAR, -1);
|
|
@@ -153,29 +151,23 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroYear(instance);
|
|
|
Date LastYearBeginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> lastYearTqIncomeList = new ArrayList<>();
|
|
|
//根据年份和当前部门对应的任务号查询,部门去年同期年收入
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+ CompletableFuture<BigDecimal> lastYearTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastYearTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
if (ObjectUtils.isEmpty(lastYearTqTotal)) lastYearTqTotal = BigDecimal.valueOf(0);
|
|
|
- finalIncomeDataInfoVo.setYearTq(lastYearTqTotal);
|
|
|
- lastYearTqIncomeList.add(lastYearTqTotal);
|
|
|
- }).join();
|
|
|
-
|
|
|
+ return lastYearTqTotal;
|
|
|
+ });
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
Date currentMothEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> currentMonthTotalList = new ArrayList<>();
|
|
|
-
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+ CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal currentMonthTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
if (ObjectUtils.isEmpty(currentMonthTotal)) currentMonthTotal = BigDecimal.valueOf(0);
|
|
|
- finalIncomeDataInfoVo.setMonthTotal(currentMonthTotal);
|
|
|
- currentMonthTotalList.add(currentMonthTotal);
|
|
|
- }).join();
|
|
|
+ return currentMonthTotal;
|
|
|
+ });
|
|
|
|
|
|
|
|
|
instance.setTime(new Date());
|
|
@@ -184,12 +176,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroMonth(instance);
|
|
|
Date LastMothTqBeginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> lastMothTqTotalList = new ArrayList<>();
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+
|
|
|
+ CompletableFuture<BigDecimal> lastMothTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastMothTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
if (ObjectUtils.isEmpty(lastMothTqTotal)) lastMothTqTotal = BigDecimal.valueOf(0);
|
|
|
- lastMothTqTotalList.add(lastMothTqTotal);
|
|
|
- }).join();
|
|
|
+ return lastMothTqTotal;
|
|
|
+ });
|
|
|
|
|
|
|
|
|
instance.setTime(new Date());
|
|
@@ -198,69 +190,84 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroMonth(instance);
|
|
|
Date lastYearMonthTqBeginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> lastYearMonthTqTotalList = new ArrayList<>();
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+ CompletableFuture<BigDecimal> lastYearMonthTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastYearMonthTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
if (ObjectUtils.isEmpty(lastYearMonthTqTotal)) lastYearMonthTqTotal = BigDecimal.valueOf(0);
|
|
|
- lastYearMonthTqTotalList.add(lastYearMonthTqTotal);
|
|
|
- }).join();
|
|
|
+ return lastYearMonthTqTotal;
|
|
|
+ });
|
|
|
+
|
|
|
+ CompletableFuture<Void> future = CompletableFuture.allOf(currentYearTotalFuture,lastYearTqTotalFuture, currentMonthTotalFuture, lastMothTqTotalFuture, lastYearMonthTqTotalFuture);
|
|
|
+ future.join();
|
|
|
+ BigDecimal currentYearTotal = currentYearTotalFuture.join();
|
|
|
+ BigDecimal lastYearTqTotal = lastYearTqTotalFuture.join();
|
|
|
+ BigDecimal currentMonthTotal = currentMonthTotalFuture.join();
|
|
|
+ BigDecimal lastMothTqTotal = lastMothTqTotalFuture.join();
|
|
|
+ BigDecimal lastYearMonthTqTotal = lastYearMonthTqTotalFuture.join();
|
|
|
+
|
|
|
+ incomeDataInfoVO.setYearTotal(currentYearTotal);
|
|
|
+ incomeDataInfoVO.setYearTq(lastYearTqTotal);
|
|
|
+ incomeDataInfoVO.setMonthTotal(currentMonthTotal);
|
|
|
+
|
|
|
|
|
|
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- BigDecimal currentYearTotal = currentYearIncomeList.get(0);
|
|
|
- BigDecimal lastYearTqTotal = lastYearTqIncomeList.get(0);
|
|
|
+ CompletableFuture<BigDecimal> incomeYearTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//去年同比
|
|
|
BigDecimal YearDifference = currentYearTotal.subtract(lastYearTqTotal);
|
|
|
BigDecimal incomeYearTb = BigDecimal.valueOf(1);
|
|
|
if (lastYearTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
incomeYearTb = YearDifference.divide(lastYearTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
- finalIncomeDataInfoVo.setYearTb(incomeYearTb);
|
|
|
- }).join();
|
|
|
+ return incomeYearTb;
|
|
|
+ });
|
|
|
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- BigDecimal currentMonthTotal = currentMonthTotalList.get(0);
|
|
|
- BigDecimal lastMothTqTotal = lastMothTqTotalList.get(0);
|
|
|
+ CompletableFuture<BigDecimal> incomeMothHbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal MothDifference = currentMonthTotal.subtract(lastMothTqTotal);
|
|
|
BigDecimal incomeMothHb = BigDecimal.valueOf(1);
|
|
|
if (lastMothTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
incomeMothHb = MothDifference.divide(lastMothTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
- finalIncomeDataInfoVo.setMonthHb(incomeMothHb);
|
|
|
- }).join();
|
|
|
+ return incomeMothHb;
|
|
|
+ });
|
|
|
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- BigDecimal currentMonthTotal = currentMonthTotalList.get(0);
|
|
|
- BigDecimal lastYearMonthTqTotal = lastYearMonthTqTotalList.get(0);
|
|
|
+ CompletableFuture<BigDecimal> incomeYearMothTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal yearMothDifference = currentMonthTotal.subtract(lastYearMonthTqTotal);
|
|
|
BigDecimal incomeYearMothTb = BigDecimal.valueOf(1);
|
|
|
if (lastYearMonthTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
incomeYearMothTb = yearMothDifference.divide(lastYearMonthTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
- finalIncomeDataInfoVo.setMonthTb(incomeYearMothTb);
|
|
|
- }).join();
|
|
|
+ return incomeYearMothTb;
|
|
|
+ });
|
|
|
|
|
|
- redisUtil.set(INCOME_DATA_REDIS_KEY + depart, finalIncomeDataInfoVo, 1000L * 60 * 60 * 2);
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(incomeYearTbFuture, incomeMothHbFuture, incomeYearMothTbFuture);
|
|
|
+ future1.join();
|
|
|
+ BigDecimal incomeYearTb = incomeYearTbFuture.join();
|
|
|
+ BigDecimal incomeMothHb = incomeMothHbFuture.join();
|
|
|
+ BigDecimal incomeYearMothTb = incomeYearMothTbFuture.join();
|
|
|
+ incomeDataInfoVO.setYearTb(incomeYearTb);
|
|
|
+ incomeDataInfoVO.setMonthTb(incomeYearMothTb);
|
|
|
+ incomeDataInfoVO.setMonthHb(incomeMothHb);
|
|
|
|
|
|
- return finalIncomeDataInfoVo;
|
|
|
+ redisUtil.set(INCOME_DATA_REDIS_KEY + depart, incomeDataInfoVO, 1000L * 60 * 60 * 2);
|
|
|
+
|
|
|
+ return incomeDataInfoVO;
|
|
|
}
|
|
|
|
|
|
|
|
|
/*合同数量一层*/
|
|
|
@Override
|
|
|
- public IndexTotalVo getTotalContract(HttpServletRequest request) {
|
|
|
- //首页合同渲染对象
|
|
|
+ public IndexTotalVo getTotalContractNum(HttpServletRequest request) {
|
|
|
+ //首页收入渲染对象
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0);
|
|
|
- IndexTotalVo contractDataInfoVo = new IndexTotalVo();
|
|
|
- contractDataInfoVo.setYearTotal(initValue);
|
|
|
- contractDataInfoVo.setYearTq(initValue);
|
|
|
- contractDataInfoVo.setYearTb(initValue);
|
|
|
- contractDataInfoVo.setMonthTotal(initValue);
|
|
|
- contractDataInfoVo.setMonthHb(initValue);
|
|
|
- contractDataInfoVo.setMonthTb(initValue);
|
|
|
+ IndexTotalVo totalContractNumInfoVO = new IndexTotalVo();
|
|
|
+ totalContractNumInfoVO.setYearTotal(initValue);
|
|
|
+ totalContractNumInfoVO.setYearTq(initValue);
|
|
|
+ totalContractNumInfoVO.setYearTb(initValue);
|
|
|
+ totalContractNumInfoVO.setMonthTotal(initValue);
|
|
|
+ totalContractNumInfoVO.setMonthHb(initValue);
|
|
|
+ totalContractNumInfoVO.setMonthTb(initValue);
|
|
|
|
|
|
String userNameByToken = JwtUtil.getUserNameByToken(request);
|
|
|
LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
|
|
|
List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
- if (departNames.isEmpty()) return contractDataInfoVo;
|
|
|
+ if (departNames.isEmpty()) return totalContractNumInfoVO;
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
for (String departName : departNames) {
|
|
@@ -269,8 +276,8 @@ public class IndexServiceImpl implements IndexService {
|
|
|
String depart = stringBuilder.toString();
|
|
|
IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CONTRACT_DATA_REDIS_KEY + depart);
|
|
|
if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
- contractDataInfoVo = cacheObject;
|
|
|
- return contractDataInfoVo;
|
|
|
+ totalContractNumInfoVO = cacheObject;
|
|
|
+ return totalContractNumInfoVO;
|
|
|
}
|
|
|
|
|
|
ArrayList<String> tasknoList = new ArrayList<>();
|
|
@@ -278,7 +285,8 @@ public class IndexServiceImpl implements IndexService {
|
|
|
List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
|
|
|
tasknoList.addAll(ZrbmTasknoList);
|
|
|
tasknoList.addAll(XdbmTasknoList);
|
|
|
- if (tasknoList.isEmpty()) return contractDataInfoVo;
|
|
|
+ if (tasknoList.isEmpty()) return totalContractNumInfoVO;
|
|
|
+
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
|
|
@@ -286,15 +294,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroYear(instance);
|
|
|
Date currentYearBeginDate = instance.getTime();
|
|
|
|
|
|
- List<BigDecimal> currentYearIncomeList = new ArrayList<>();
|
|
|
- IndexTotalVo finalContractDataInfoVo = contractDataInfoVo;
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+
|
|
|
+ CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//根据年份和当前部门对应的任务号查询,部门当前年的年收入
|
|
|
BigDecimal currentYearTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
if (ObjectUtils.isEmpty(currentYearTotal)) currentYearTotal = BigDecimal.valueOf(0);
|
|
|
- finalContractDataInfoVo.setYearTotal(currentYearTotal);
|
|
|
- currentYearIncomeList.add(currentYearTotal);
|
|
|
- }).join();
|
|
|
+ return currentYearTotal;
|
|
|
+ });
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.YEAR, -1);
|
|
@@ -303,28 +309,23 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroYear(instance);
|
|
|
Date LastYearBeginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> lastYearTqIncomeList = new ArrayList<>();
|
|
|
//根据年份和当前部门对应的任务号查询,部门去年同期年收入
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+ CompletableFuture<BigDecimal> lastYearTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastYearTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
if (ObjectUtils.isEmpty(lastYearTqTotal)) lastYearTqTotal = BigDecimal.valueOf(0);
|
|
|
- finalContractDataInfoVo.setYearTq(lastYearTqTotal);
|
|
|
- lastYearTqIncomeList.add(lastYearTqTotal);
|
|
|
- }).join();
|
|
|
+ return lastYearTqTotal;
|
|
|
+ });
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
Date currentMothEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> currentMonthTotalList = new ArrayList<>();
|
|
|
-
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+ CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal currentMonthTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
if (ObjectUtils.isEmpty(currentMonthTotal)) currentMonthTotal = BigDecimal.valueOf(0);
|
|
|
- finalContractDataInfoVo.setMonthTotal(currentMonthTotal);
|
|
|
- currentMonthTotalList.add(currentMonthTotal);
|
|
|
- }).join();
|
|
|
+ return currentMonthTotal;
|
|
|
+ });
|
|
|
|
|
|
|
|
|
instance.setTime(new Date());
|
|
@@ -333,12 +334,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroMonth(instance);
|
|
|
Date LastMothTqBeginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> lastMothTqTotalList = new ArrayList<>();
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+
|
|
|
+ CompletableFuture<BigDecimal> lastMothTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastMothTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
if (ObjectUtils.isEmpty(lastMothTqTotal)) lastMothTqTotal = BigDecimal.valueOf(0);
|
|
|
- lastMothTqTotalList.add(lastMothTqTotal);
|
|
|
- }).join();
|
|
|
+ return lastMothTqTotal;
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.YEAR, -1);
|
|
@@ -346,69 +348,84 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroMonth(instance);
|
|
|
Date lastYearMonthTqBeginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> lastYearMonthTqTotalList = new ArrayList<>();
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+ CompletableFuture<BigDecimal> lastYearMonthTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastYearMonthTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
if (ObjectUtils.isEmpty(lastYearMonthTqTotal)) lastYearMonthTqTotal = BigDecimal.valueOf(0);
|
|
|
- lastYearMonthTqTotalList.add(lastYearMonthTqTotal);
|
|
|
- }).join();
|
|
|
+ return lastYearMonthTqTotal;
|
|
|
+ });
|
|
|
+
|
|
|
+ CompletableFuture<Void> future = CompletableFuture.allOf(currentYearTotalFuture,lastYearTqTotalFuture, currentMonthTotalFuture, lastMothTqTotalFuture, lastYearMonthTqTotalFuture);
|
|
|
+ future.join();
|
|
|
+ BigDecimal currentYearTotal = currentYearTotalFuture.join();
|
|
|
+ BigDecimal lastYearTqTotal = lastYearTqTotalFuture.join();
|
|
|
+ BigDecimal currentMonthTotal = currentMonthTotalFuture.join();
|
|
|
+ BigDecimal lastMothTqTotal = lastMothTqTotalFuture.join();
|
|
|
+ BigDecimal lastYearMonthTqTotal = lastYearMonthTqTotalFuture.join();
|
|
|
+
|
|
|
+ totalContractNumInfoVO.setYearTotal(currentYearTotal);
|
|
|
+ totalContractNumInfoVO.setYearTq(lastYearTqTotal);
|
|
|
+ totalContractNumInfoVO.setMonthTotal(currentMonthTotal);
|
|
|
+
|
|
|
|
|
|
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- BigDecimal currentYearTotal = currentYearIncomeList.get(0);
|
|
|
- BigDecimal lastYearTqTotal = lastYearTqIncomeList.get(0);
|
|
|
+ CompletableFuture<BigDecimal> yearTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//去年同比
|
|
|
BigDecimal YearDifference = currentYearTotal.subtract(lastYearTqTotal);
|
|
|
- BigDecimal contractYearTb = BigDecimal.valueOf(1);
|
|
|
+ BigDecimal incomeYearTb = BigDecimal.valueOf(1);
|
|
|
if (lastYearTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
- contractYearTb = YearDifference.divide(lastYearTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
- finalContractDataInfoVo.setYearTb(contractYearTb);
|
|
|
- }).join();
|
|
|
+ incomeYearTb = YearDifference.divide(lastYearTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
+ return incomeYearTb;
|
|
|
+ });
|
|
|
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- BigDecimal currentMonthTotal = currentMonthTotalList.get(0);
|
|
|
- BigDecimal lastMothTqTotal = lastMothTqTotalList.get(0);
|
|
|
+ CompletableFuture<BigDecimal> mothHbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal MothDifference = currentMonthTotal.subtract(lastMothTqTotal);
|
|
|
- BigDecimal contractMothHb = BigDecimal.valueOf(1);
|
|
|
+ BigDecimal incomeMothHb = BigDecimal.valueOf(1);
|
|
|
if (lastMothTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
- contractMothHb = MothDifference.divide(lastMothTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
- finalContractDataInfoVo.setMonthHb(contractMothHb);
|
|
|
- }).join();
|
|
|
+ incomeMothHb = MothDifference.divide(lastMothTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
+ return incomeMothHb;
|
|
|
+ });
|
|
|
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- BigDecimal currentMonthTotal = currentMonthTotalList.get(0);
|
|
|
- BigDecimal lastYearMonthTqTotal = lastYearMonthTqTotalList.get(0);
|
|
|
+ CompletableFuture<BigDecimal> yearMothTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal yearMothDifference = currentMonthTotal.subtract(lastYearMonthTqTotal);
|
|
|
- BigDecimal contractYearMothTb = BigDecimal.valueOf(1);
|
|
|
+ BigDecimal incomeYearMothTb = BigDecimal.valueOf(1);
|
|
|
if (lastYearMonthTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
- contractYearMothTb = yearMothDifference.divide(lastYearMonthTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
- finalContractDataInfoVo.setMonthTb(contractYearMothTb);
|
|
|
- }).join();
|
|
|
+ incomeYearMothTb = yearMothDifference.divide(lastYearMonthTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
+ return incomeYearMothTb;
|
|
|
+ });
|
|
|
|
|
|
- redisUtil.set(CONTRACT_DATA_REDIS_KEY + depart, finalContractDataInfoVo, 1000L * 60 * 60 * 2);
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(yearTbFuture, mothHbFuture, yearMothTbFuture);
|
|
|
+ future1.join();
|
|
|
+ BigDecimal yearTb = yearTbFuture.join();
|
|
|
+ BigDecimal mothHb = mothHbFuture.join();
|
|
|
+ BigDecimal yearMothTb = yearMothTbFuture.join();
|
|
|
+ totalContractNumInfoVO.setYearTb(yearTb);
|
|
|
+ totalContractNumInfoVO.setMonthTb(yearMothTb);
|
|
|
+ totalContractNumInfoVO.setMonthHb(mothHb);
|
|
|
|
|
|
+ redisUtil.set(CONTRACT_DATA_REDIS_KEY + depart, totalContractNumInfoVO, 1000L * 60 * 60 * 2);
|
|
|
|
|
|
- return finalContractDataInfoVo;
|
|
|
+ return totalContractNumInfoVO;
|
|
|
}
|
|
|
|
|
|
|
|
|
/*已收款一层*/
|
|
|
@Override
|
|
|
public IndexTotalVo getTotalReceived(HttpServletRequest request) {
|
|
|
+ //首页收入渲染对象
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0);
|
|
|
- IndexTotalVo receivedDataInfoVo = new IndexTotalVo();
|
|
|
- receivedDataInfoVo.setYearTotal(initValue);
|
|
|
- receivedDataInfoVo.setYearTq(initValue);
|
|
|
- receivedDataInfoVo.setYearTb(initValue);
|
|
|
- receivedDataInfoVo.setMonthTotal(initValue);
|
|
|
- receivedDataInfoVo.setMonthHb(initValue);
|
|
|
- receivedDataInfoVo.setMonthTb(initValue);
|
|
|
+ IndexTotalVo indexTotalVo = new IndexTotalVo();
|
|
|
+ indexTotalVo.setYearTotal(initValue);
|
|
|
+ indexTotalVo.setYearTq(initValue);
|
|
|
+ indexTotalVo.setYearTb(initValue);
|
|
|
+ indexTotalVo.setMonthTotal(initValue);
|
|
|
+ indexTotalVo.setMonthHb(initValue);
|
|
|
+ indexTotalVo.setMonthTb(initValue);
|
|
|
|
|
|
String userNameByToken = JwtUtil.getUserNameByToken(request);
|
|
|
LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
|
|
|
List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
- if (departNames.isEmpty()) return receivedDataInfoVo;
|
|
|
+ if (departNames.isEmpty()) return indexTotalVo;
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
for (String departName : departNames) {
|
|
@@ -417,8 +434,8 @@ public class IndexServiceImpl implements IndexService {
|
|
|
String depart = stringBuilder.toString();
|
|
|
IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(RECEIVED_DATA_REDIS_KEY + depart);
|
|
|
if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
- receivedDataInfoVo = cacheObject;
|
|
|
- return receivedDataInfoVo;
|
|
|
+ indexTotalVo = cacheObject;
|
|
|
+ return indexTotalVo;
|
|
|
}
|
|
|
|
|
|
ArrayList<String> tasknoList = new ArrayList<>();
|
|
@@ -426,7 +443,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
|
|
|
tasknoList.addAll(ZrbmTasknoList);
|
|
|
tasknoList.addAll(XdbmTasknoList);
|
|
|
- if (tasknoList.isEmpty()) return receivedDataInfoVo;
|
|
|
+ if (tasknoList.isEmpty()) return indexTotalVo;
|
|
|
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
@@ -435,15 +452,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroYear(instance);
|
|
|
Date currentYearBeginDate = instance.getTime();
|
|
|
|
|
|
- List<BigDecimal> currentYearIncomeList = new ArrayList<>();
|
|
|
- IndexTotalVo finalIncomeDataInfoVo = receivedDataInfoVo;
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- //根据年份和当前部门对应的任务号查询,部门当前年的年收入
|
|
|
+
|
|
|
+ CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal currentYearTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
if (ObjectUtils.isEmpty(currentYearTotal)) currentYearTotal = BigDecimal.valueOf(0);
|
|
|
- finalIncomeDataInfoVo.setYearTotal(currentYearTotal);
|
|
|
- currentYearIncomeList.add(currentYearTotal);
|
|
|
- }).join();
|
|
|
+ return currentYearTotal;
|
|
|
+ });
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
instance.add(Calendar.YEAR, -1);
|
|
@@ -452,29 +466,22 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroYear(instance);
|
|
|
Date LastYearBeginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> lastYearTqIncomeList = new ArrayList<>();
|
|
|
- //根据年份和当前部门对应的任务号查询,部门去年同期年收入
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+ CompletableFuture<BigDecimal> lastYearTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastYearTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
if (ObjectUtils.isEmpty(lastYearTqTotal)) lastYearTqTotal = BigDecimal.valueOf(0);
|
|
|
- finalIncomeDataInfoVo.setYearTq(lastYearTqTotal);
|
|
|
- lastYearTqIncomeList.add(lastYearTqTotal);
|
|
|
- }).join();
|
|
|
-
|
|
|
+ return lastYearTqTotal;
|
|
|
+ });
|
|
|
|
|
|
instance.setTime(new Date());
|
|
|
Date currentMothEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> currentMonthTotalList = new ArrayList<>();
|
|
|
-
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+ CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal currentMonthTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
if (ObjectUtils.isEmpty(currentMonthTotal)) currentMonthTotal = BigDecimal.valueOf(0);
|
|
|
- finalIncomeDataInfoVo.setMonthTotal(currentMonthTotal);
|
|
|
- currentMonthTotalList.add(currentMonthTotal);
|
|
|
- }).join();
|
|
|
+ return currentMonthTotal;
|
|
|
+ });
|
|
|
|
|
|
|
|
|
instance.setTime(new Date());
|
|
@@ -483,12 +490,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroMonth(instance);
|
|
|
Date LastMothTqBeginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> lastMothTqTotalList = new ArrayList<>();
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+
|
|
|
+ CompletableFuture<BigDecimal> lastMothTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastMothTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
if (ObjectUtils.isEmpty(lastMothTqTotal)) lastMothTqTotal = BigDecimal.valueOf(0);
|
|
|
- lastMothTqTotalList.add(lastMothTqTotal);
|
|
|
- }).join();
|
|
|
+ return lastMothTqTotal;
|
|
|
+ });
|
|
|
|
|
|
|
|
|
instance.setTime(new Date());
|
|
@@ -497,51 +504,66 @@ public class IndexServiceImpl implements IndexService {
|
|
|
setZeroMonth(instance);
|
|
|
Date lastYearMonthTqBeginDate = instance.getTime();
|
|
|
|
|
|
- ArrayList<BigDecimal> lastYearMonthTqTotalList = new ArrayList<>();
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
+ CompletableFuture<BigDecimal> lastYearMonthTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastYearMonthTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
if (ObjectUtils.isEmpty(lastYearMonthTqTotal)) lastYearMonthTqTotal = BigDecimal.valueOf(0);
|
|
|
- lastYearMonthTqTotalList.add(lastYearMonthTqTotal);
|
|
|
- }).join();
|
|
|
+ return lastYearMonthTqTotal;
|
|
|
+ });
|
|
|
+
|
|
|
+ CompletableFuture<Void> future = CompletableFuture.allOf(currentYearTotalFuture,lastYearTqTotalFuture, currentMonthTotalFuture, lastMothTqTotalFuture, lastYearMonthTqTotalFuture);
|
|
|
+ future.join();
|
|
|
+ BigDecimal currentYearTotal = currentYearTotalFuture.join();
|
|
|
+ BigDecimal lastYearTqTotal = lastYearTqTotalFuture.join();
|
|
|
+ BigDecimal currentMonthTotal = currentMonthTotalFuture.join();
|
|
|
+ BigDecimal lastMothTqTotal = lastMothTqTotalFuture.join();
|
|
|
+ BigDecimal lastYearMonthTqTotal = lastYearMonthTqTotalFuture.join();
|
|
|
|
|
|
+ indexTotalVo.setYearTotal(currentYearTotal);
|
|
|
+ indexTotalVo.setYearTq(lastYearTqTotal);
|
|
|
+ indexTotalVo.setMonthTotal(currentMonthTotal);
|
|
|
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- BigDecimal currentYearTotal = currentYearIncomeList.get(0);
|
|
|
- BigDecimal lastYearTqTotal = lastYearTqIncomeList.get(0);
|
|
|
+
|
|
|
+
|
|
|
+ CompletableFuture<BigDecimal> yearTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//去年同比
|
|
|
BigDecimal YearDifference = currentYearTotal.subtract(lastYearTqTotal);
|
|
|
BigDecimal incomeYearTb = BigDecimal.valueOf(1);
|
|
|
if (lastYearTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
incomeYearTb = YearDifference.divide(lastYearTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
- finalIncomeDataInfoVo.setYearTb(incomeYearTb);
|
|
|
- }).join();
|
|
|
+ return incomeYearTb;
|
|
|
+ });
|
|
|
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- BigDecimal currentMonthTotal = currentMonthTotalList.get(0);
|
|
|
- BigDecimal lastMothTqTotal = lastMothTqTotalList.get(0);
|
|
|
+ CompletableFuture<BigDecimal> mothHbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal MothDifference = currentMonthTotal.subtract(lastMothTqTotal);
|
|
|
BigDecimal incomeMothHb = BigDecimal.valueOf(1);
|
|
|
if (lastMothTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
incomeMothHb = MothDifference.divide(lastMothTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
- finalIncomeDataInfoVo.setMonthHb(incomeMothHb);
|
|
|
- }).join();
|
|
|
+ return incomeMothHb;
|
|
|
+ });
|
|
|
|
|
|
- CompletableFuture.runAsync(() -> {
|
|
|
- BigDecimal currentMonthTotal = currentMonthTotalList.get(0);
|
|
|
- BigDecimal lastYearMonthTqTotal = lastYearMonthTqTotalList.get(0);
|
|
|
+ CompletableFuture<BigDecimal> yearMothTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal yearMothDifference = currentMonthTotal.subtract(lastYearMonthTqTotal);
|
|
|
BigDecimal incomeYearMothTb = BigDecimal.valueOf(1);
|
|
|
if (lastYearMonthTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
incomeYearMothTb = yearMothDifference.divide(lastYearMonthTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
- finalIncomeDataInfoVo.setMonthTb(incomeYearMothTb);
|
|
|
- }).join();
|
|
|
+ return incomeYearMothTb;
|
|
|
+ });
|
|
|
+
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(yearTbFuture, mothHbFuture, yearMothTbFuture);
|
|
|
+ future1.join();
|
|
|
+ BigDecimal yearTb = yearTbFuture.join();
|
|
|
+ BigDecimal mothHb = mothHbFuture.join();
|
|
|
+ BigDecimal yearMothTb = yearMothTbFuture.join();
|
|
|
+ indexTotalVo.setYearTb(yearTb);
|
|
|
+ indexTotalVo.setMonthTb(yearMothTb);
|
|
|
+ indexTotalVo.setMonthHb(mothHb);
|
|
|
|
|
|
- redisUtil.set(RECEIVED_DATA_REDIS_KEY + depart, finalIncomeDataInfoVo, 1000L * 60 * 60 * 2);
|
|
|
+ redisUtil.set(RECEIVED_DATA_REDIS_KEY + depart, indexTotalVo, 1000L * 60 * 60 * 2);
|
|
|
|
|
|
- return finalIncomeDataInfoVo;
|
|
|
+ return indexTotalVo;
|
|
|
}
|
|
|
|
|
|
- public void setZeroYear(Calendar instance) {
|
|
|
+ public void setZeroYear(Calendar instance) {
|
|
|
instance.set(Calendar.MONTH, 0);
|
|
|
instance.set(Calendar.DAY_OF_MONTH, 0);
|
|
|
instance.set(Calendar.HOUR_OF_DAY, 0);
|
|
@@ -577,7 +599,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return resultl;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
public ContractChartInfoVo getContractAmountInfo(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto,String Time) {
|
|
|
/*根据传进来年份或者月份初始化返回结果对象*/
|
|
|
ContractChartInfoVo resVo = new ContractChartInfoVo();
|