|
@@ -138,7 +138,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
if (departNameList != null && !departNameList.isEmpty()) {
|
|
|
departNames = departNameList;
|
|
|
} else {
|
|
|
- //departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
String[] deptIds = sysUser.getDepartIds().split(",");
|
|
|
departNames = sysDepartMapper.getDepNameByIds(deptIds);
|
|
|
}
|
|
@@ -171,15 +170,14 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //当年合同额,例:>= 2023-01-01 00:00:00 < 2024-01-01 00:00:00
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
setZeroMonth(instance);
|
|
|
instance.add(Calendar.MONTH, 1);
|
|
|
- instance.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
- Date currentYearEndDate = instance.getTime(); //加一天
|
|
|
+ Date currentYearEndDate = instance.getTime();
|
|
|
setZeroYear(instance);
|
|
|
Date currentYearBeginDate = instance.getTime();
|
|
|
|
|
|
-
|
|
|
String finalRole = role;
|
|
|
CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//根据年份和当前部门对应的任务号查询,部门当前年的年收入
|
|
@@ -193,14 +191,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return currentYearTotal;
|
|
|
});
|
|
|
|
|
|
+ //去年合同额,例:>= 2022-01-01 00:00:00 < 2023-01-01 00:00:00
|
|
|
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();
|
|
|
|
|
@@ -216,17 +213,14 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return lastYearTqTotal;
|
|
|
});
|
|
|
|
|
|
-/* instance.setTime(new Date());
|
|
|
- Date currentMothEndDate = instance.getTime();
|
|
|
- setZeroMonth(instance);
|
|
|
- Date currentMothBginDate = instance.getTime();*/
|
|
|
+ //当月合同额,例:>= 2023-12-01 00:00:00 < 2024-01-01 00:00:00
|
|
|
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;
|
|
|
if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
@@ -238,12 +232,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return currentMonthTotal;
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+ //上月同期已收款,例:>= 2023-11-01 00:00:00 < 2023-12-01 00:00:00
|
|
|
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();
|
|
@@ -260,12 +251,11 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return lastMothTqTotal;
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+ //去年当月同期已收款,例:>= 2022-12-01 00:00:00 < 2023-01-01 00:00:00
|
|
|
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();
|
|
@@ -336,219 +326,14 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return incomeDataInfoVO;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /*合同数量一层*/
|
|
|
+ /*已收款一层*/
|
|
|
@Override
|
|
|
- public IndexTotalVo getTotalContractNum(HttpServletRequest request) {
|
|
|
- //首页合同数量渲染对象
|
|
|
- BigDecimal initValue = BigDecimal.valueOf(0);
|
|
|
- IndexTotalVo totalContractNumInfoVO = new IndexTotalVo();
|
|
|
- totalContractNumInfoVO.setYearTotal(initValue);
|
|
|
- totalContractNumInfoVO.setYearTq(initValue);
|
|
|
- totalContractNumInfoVO.setYearTb(initValue);
|
|
|
- totalContractNumInfoVO.setMonthTotal(initValue);
|
|
|
- totalContractNumInfoVO.setMonthHb(initValue);
|
|
|
- totalContractNumInfoVO.setMonthTb(initValue);
|
|
|
-
|
|
|
+ public IndexTotalVo getTotalReceived(HttpServletRequest request, List<String> departNameList) {
|
|
|
String userNameByToken = JwtUtil.getUserNameByToken(request);
|
|
|
LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
-
|
|
|
String role = commonMethod.getRole(userNameByToken);
|
|
|
-
|
|
|
- String depart = null;
|
|
|
- ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
-
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
- String[] deptIds = sysUser.getDepartIds().split(",");
|
|
|
- List<String> departNames = sysDepartMapper.getDepNameByIds(deptIds);
|
|
|
- if (departNames.isEmpty()) return totalContractNumInfoVO;
|
|
|
-
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
- for (String departName : departNames) {
|
|
|
- stringBuilder.append(departName).append("|");
|
|
|
- }
|
|
|
- depart = stringBuilder.toString();
|
|
|
- IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.CONTRACT_DATA_REDIS_KEY + ":" + depart + ":" + role);
|
|
|
- if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
- totalContractNumInfoVO = cacheObject;
|
|
|
- return totalContractNumInfoVO;
|
|
|
- }
|
|
|
-
|
|
|
- List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
|
|
|
- List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
|
|
|
- tasknoList.addAll(ZrbmTasknoList);
|
|
|
- tasknoList.addAll(XdbmTasknoList);
|
|
|
- if (tasknoList.isEmpty()) return totalContractNumInfoVO;
|
|
|
- }
|
|
|
- if (depart == null) {
|
|
|
- depart = "Boss";
|
|
|
- IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.CONTRACT_DATA_REDIS_KEY + ":" + depart + ":" + role);
|
|
|
- if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
- totalContractNumInfoVO = cacheObject;
|
|
|
- return totalContractNumInfoVO;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- 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();
|
|
|
-
|
|
|
-
|
|
|
- CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal currentYearTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
- //根据年份和当前部门对应的任务号查询,部门当前年的年收入
|
|
|
- currentYearTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
- currentYearTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
- }
|
|
|
- if (ObjectUtils.isEmpty(currentYearTotal)) currentYearTotal = BigDecimal.valueOf(0);
|
|
|
- return currentYearTotal;
|
|
|
- });
|
|
|
-
|
|
|
- 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();
|
|
|
-
|
|
|
- //根据年份和当前部门对应的任务号查询,部门去年同期年收入
|
|
|
- CompletableFuture<BigDecimal> lastYearTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastYearTqTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
- lastYearTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
- lastYearTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
- }
|
|
|
- if (ObjectUtils.isEmpty(lastYearTqTotal)) lastYearTqTotal = BigDecimal.valueOf(0);
|
|
|
- return lastYearTqTotal;
|
|
|
- });
|
|
|
-
|
|
|
- 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;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
- currentMonthTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
- currentMonthTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
- }
|
|
|
- if (ObjectUtils.isEmpty(currentMonthTotal)) currentMonthTotal = BigDecimal.valueOf(0);
|
|
|
- return currentMonthTotal;
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- 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();
|
|
|
-
|
|
|
-
|
|
|
- CompletableFuture<BigDecimal> lastMothTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastMothTqTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
- lastMothTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
- lastMothTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
- }
|
|
|
- if (ObjectUtils.isEmpty(lastMothTqTotal)) lastMothTqTotal = BigDecimal.valueOf(0);
|
|
|
- return lastMothTqTotal;
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- 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();
|
|
|
-
|
|
|
- CompletableFuture<BigDecimal> lastYearMonthTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastYearMonthTqTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
- lastYearMonthTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
- lastYearMonthTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
- }
|
|
|
- if (ObjectUtils.isEmpty(lastYearMonthTqTotal)) lastYearMonthTqTotal = BigDecimal.valueOf(0);
|
|
|
- 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.setScale(2, RoundingMode.HALF_UP));
|
|
|
- totalContractNumInfoVO.setYearTq(lastYearTqTotal.setScale(2, RoundingMode.HALF_UP));
|
|
|
- totalContractNumInfoVO.setMonthTotal(currentMonthTotal.setScale(2, RoundingMode.HALF_UP));
|
|
|
-
|
|
|
-
|
|
|
- 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);
|
|
|
- return incomeYearTb;
|
|
|
- });
|
|
|
-
|
|
|
- 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);
|
|
|
- return incomeMothHb;
|
|
|
- });
|
|
|
-
|
|
|
- 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);
|
|
|
- return incomeYearMothTb;
|
|
|
- });
|
|
|
-
|
|
|
- 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.setScale(2, RoundingMode.HALF_UP));
|
|
|
- totalContractNumInfoVO.setMonthTb(yearMothTb.setScale(2, RoundingMode.HALF_UP));
|
|
|
- totalContractNumInfoVO.setMonthHb(mothHb.setScale(2, RoundingMode.HALF_UP));
|
|
|
-
|
|
|
- redisUtil.set(CacheKey.CONTRACT_DATA_REDIS_KEY + ":" + depart + ":" + role, totalContractNumInfoVO, 1000L * 60 * 60 * 10);
|
|
|
-
|
|
|
- return totalContractNumInfoVO;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /*已收款一层*/
|
|
|
- @Override
|
|
|
- public IndexTotalVo getTotalReceived(HttpServletRequest request, List<String> departNameList) {
|
|
|
+ if (departNameList != null && !departNameList.isEmpty() && AuthMark.BOSS.equals(role))
|
|
|
+ role = AuthMark.DEPT_LEADER;
|
|
|
//首页已收款渲染对象
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0);
|
|
|
IndexTotalVo indexTotalVo = new IndexTotalVo();
|
|
@@ -558,12 +343,10 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexTotalVo.setMonthTotal(initValue);
|
|
|
indexTotalVo.setMonthHb(initValue);
|
|
|
indexTotalVo.setMonthTb(initValue);
|
|
|
+ //sl添加,计算利润额使用
|
|
|
+ indexTotalVo.setMonthTq(initValue);
|
|
|
+ indexTotalVo.setMonthLast(initValue);
|
|
|
|
|
|
- String userNameByToken = JwtUtil.getUserNameByToken(request);
|
|
|
- LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
- String role = commonMethod.getRole(userNameByToken);
|
|
|
- if (departNameList != null && !departNameList.isEmpty() && AuthMark.BOSS.equals(role))
|
|
|
- role = AuthMark.DEPT_LEADER;
|
|
|
String depart = null;
|
|
|
ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
|
|
@@ -604,15 +387,14 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //当年已收款,例:>= 2023-01-01 00:00:00 < 2024-01-01 00:00:00
|
|
|
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();
|
|
|
|
|
|
-
|
|
|
String finalRole = role;
|
|
|
CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
|
@@ -626,11 +408,11 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return currentYearTotal;
|
|
|
});
|
|
|
|
|
|
+ //去年已收款,例:>= 2022-01-01 00:00:00 < 2023-01-01 00:00:00
|
|
|
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);
|
|
@@ -647,11 +429,11 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return lastYearTqTotal;
|
|
|
});
|
|
|
|
|
|
+ //当月已收款,例:>= 2023-12-01 00:00:00 < 2024-01-01 00:00:00
|
|
|
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(() -> {
|
|
@@ -665,12 +447,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return currentMonthTotal;
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+ //上月同期已收款,例:>= 2023-11-01 00:00:00 < 2023-12-01 00:00:00
|
|
|
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();
|
|
@@ -687,12 +466,11 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return lastMothTqTotal;
|
|
|
});
|
|
|
|
|
|
-
|
|
|
+ //去年当月同期已收款,例:>= 2022-12-01 00:00:00 < 2023-01-01 00:00:00
|
|
|
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();
|
|
@@ -719,10 +497,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexTotalVo.setYearTotal(currentYearTotal.setScale(2, RoundingMode.HALF_UP));
|
|
|
indexTotalVo.setYearTq(lastYearTqTotal.setScale(2, RoundingMode.HALF_UP));
|
|
|
indexTotalVo.setMonthTotal(currentMonthTotal.setScale(2, RoundingMode.HALF_UP));
|
|
|
-
|
|
|
+ //sl添加,计算利润额使用
|
|
|
+ indexTotalVo.setMonthTq(lastYearMonthTqTotal);
|
|
|
+ indexTotalVo.setMonthLast(lastMothTqTotal);
|
|
|
|
|
|
CompletableFuture<BigDecimal> yearTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- //去年同比
|
|
|
+ //同比
|
|
|
BigDecimal YearDifference = currentYearTotal.subtract(lastYearTqTotal);
|
|
|
BigDecimal incomeYearTb = BigDecimal.valueOf(1);
|
|
|
if (lastYearTqTotal.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
@@ -730,6 +510,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return incomeYearTb;
|
|
|
});
|
|
|
|
|
|
+ //环比
|
|
|
CompletableFuture<BigDecimal> mothHbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal MothDifference = currentMonthTotal.subtract(lastMothTqTotal);
|
|
|
BigDecimal incomeMothHb = BigDecimal.valueOf(1);
|
|
@@ -737,7 +518,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
incomeMothHb = MothDifference.divide(lastMothTqTotal, 2, RoundingMode.HALF_UP);
|
|
|
return incomeMothHb;
|
|
|
});
|
|
|
-
|
|
|
+ //同期
|
|
|
CompletableFuture<BigDecimal> yearMothTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal yearMothDifference = currentMonthTotal.subtract(lastYearMonthTqTotal);
|
|
|
BigDecimal incomeYearMothTb = BigDecimal.valueOf(1);
|
|
@@ -761,20 +542,24 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
|
|
|
public void setZeroYear(Calendar instance) {
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,-1);
|
|
|
instance.set(Calendar.MONTH, 0);
|
|
|
instance.set(Calendar.DAY_OF_MONTH, 0);
|
|
|
instance.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
instance.set(Calendar.MINUTE, 0);
|
|
|
instance.set(Calendar.SECOND, 0);
|
|
|
instance.set(Calendar.MILLISECOND, 0);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
}
|
|
|
|
|
|
public void setZeroMonth(Calendar instance) {
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,-1);
|
|
|
instance.set(Calendar.DAY_OF_MONTH, 0);
|
|
|
instance.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
instance.set(Calendar.MINUTE, 0);
|
|
|
instance.set(Calendar.SECOND, 0);
|
|
|
instance.set(Calendar.MILLISECOND, 0);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
}
|
|
|
|
|
|
/*合同额和合同数量二层图表*/
|