|
@@ -29,6 +29,7 @@ import org.jeecg.modules.system.service.ISysUserDepartService;
|
|
|
import org.jeecg.modules.xmcbDetail.mapper.ComContractInfoExchangeMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.math.BigDecimal;
|
|
@@ -111,11 +112,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
/*合同额一层*/
|
|
|
@Override
|
|
|
- public IndexTotalVo getTotalIncome(HttpServletRequest request) {
|
|
|
+ public IndexTotalVo getTotalIncome(HttpServletRequest request, List<String> departNameList) {
|
|
|
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;
|
|
|
//首页收入渲染对象
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0);
|
|
|
IndexTotalVo incomeDataInfoVO = new IndexTotalVo();
|
|
@@ -133,7 +135,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
String depart = null;
|
|
|
ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
- List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ List<String> departNames = null;
|
|
|
+ if (departNameList != null && !departNameList.isEmpty()) {
|
|
|
+ departNames = departNameList;
|
|
|
+ } else {
|
|
|
+ departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ }
|
|
|
if (departNames.isEmpty()) return incomeDataInfoVO;
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
@@ -165,19 +172,20 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
setZeroMonth(instance);
|
|
|
- instance.add(Calendar.MONTH,1);
|
|
|
- instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ 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(() -> {
|
|
|
//根据年份和当前部门对应的任务号查询,部门当前年的年收入
|
|
|
BigDecimal currentYearTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
currentYearTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
currentYearTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(currentYearTotal)) currentYearTotal = BigDecimal.valueOf(0);
|
|
@@ -188,8 +196,8 @@ public class IndexServiceImpl implements IndexService {
|
|
|
instance.add(Calendar.YEAR, -1);
|
|
|
//去年的今日
|
|
|
setZeroMonth(instance);
|
|
|
- instance.add(Calendar.MONTH,1);
|
|
|
- instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
Date LastTqEndDate = instance.getTime();
|
|
|
|
|
|
setZeroYear(instance);
|
|
@@ -198,9 +206,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
//根据年份和当前部门对应的任务号查询,部门去年同期年收入
|
|
|
CompletableFuture<BigDecimal> lastYearTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastYearTqTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
lastYearTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
lastYearTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(lastYearTqTotal)) lastYearTqTotal = BigDecimal.valueOf(0);
|
|
@@ -220,9 +228,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal currentMonthTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
currentMonthTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
currentMonthTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(currentMonthTotal)) currentMonthTotal = BigDecimal.valueOf(0);
|
|
@@ -233,8 +241,8 @@ 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);
|
|
|
+ instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
Date LastMothTqEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date LastMothTqBeginDate = instance.getTime();
|
|
@@ -242,9 +250,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastMothTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastMothTqTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
lastMothTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
lastMothTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(lastMothTqTotal)) lastMothTqTotal = BigDecimal.valueOf(0);
|
|
@@ -255,17 +263,17 @@ 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);
|
|
|
+ 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)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
lastYearMonthTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
lastYearMonthTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(lastYearMonthTqTotal)) lastYearMonthTqTotal = BigDecimal.valueOf(0);
|
|
@@ -380,7 +388,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();
|
|
@@ -400,6 +410,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);
|
|
@@ -418,9 +431,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;
|
|
@@ -436,6 +451,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();
|
|
@@ -455,6 +473,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();
|
|
@@ -525,7 +546,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
/*已收款一层*/
|
|
|
@Override
|
|
|
- public IndexTotalVo getTotalReceived(HttpServletRequest request) {
|
|
|
+ public IndexTotalVo getTotalReceived(HttpServletRequest request, List<String> departNameList) {
|
|
|
//首页已收款渲染对象
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0);
|
|
|
IndexTotalVo indexTotalVo = new IndexTotalVo();
|
|
@@ -539,12 +560,18 @@ public class IndexServiceImpl implements IndexService {
|
|
|
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<>();
|
|
|
|
|
|
if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
- List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ List<String> departNames = null;
|
|
|
+ if (departNameList != null && !departNameList.isEmpty()) {
|
|
|
+ departNames = departNameList;
|
|
|
+ } else {
|
|
|
+ departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ }
|
|
|
if (departNames.isEmpty()) return indexTotalVo;
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
@@ -576,19 +603,20 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
setZeroMonth(instance);
|
|
|
- instance.add(Calendar.MONTH,1);
|
|
|
- instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ 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(() -> {
|
|
|
|
|
|
BigDecimal currentYearTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
currentYearTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
currentYearTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(currentYearTotal)) currentYearTotal = BigDecimal.valueOf(0);
|
|
@@ -598,8 +626,8 @@ 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);
|
|
|
+ instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
//去年的今日
|
|
|
Date LastTqEndDate = instance.getTime();
|
|
|
setZeroYear(instance);
|
|
@@ -607,9 +635,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastYearTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastYearTqTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
lastYearTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
lastYearTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(lastYearTqTotal)) lastYearTqTotal = BigDecimal.valueOf(0);
|
|
@@ -625,9 +653,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal currentMonthTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
currentMonthTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
currentMonthTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(currentMonthTotal)) currentMonthTotal = BigDecimal.valueOf(0);
|
|
@@ -638,8 +666,8 @@ 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);
|
|
|
+ instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
Date LastMothTqEndDate = instance.getTime();
|
|
|
setZeroMonth(instance);
|
|
|
Date LastMothTqBeginDate = instance.getTime();
|
|
@@ -647,9 +675,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastMothTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
BigDecimal lastMothTqTotal = null;
|
|
|
- if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
lastMothTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
lastMothTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(lastMothTqTotal)) lastMothTqTotal = BigDecimal.valueOf(0);
|
|
@@ -660,17 +688,17 @@ 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);
|
|
|
+ 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)) {
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(finalRole)) {
|
|
|
lastYearMonthTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
- } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ } else if (AuthMark.BOSS.equals(finalRole)) {
|
|
|
lastYearMonthTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
}
|
|
|
if (ObjectUtils.isEmpty(lastYearMonthTqTotal)) lastYearMonthTqTotal = BigDecimal.valueOf(0);
|
|
@@ -748,15 +776,15 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
/*合同额和合同数量二层图表*/
|
|
|
@Override
|
|
|
- public ContractChartInfoVo getContractAmountInfo(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto) {
|
|
|
+ public ContractChartInfoVo getContractAmountInfo(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto, List<String> departNameList) {
|
|
|
|
|
|
ContractChartInfoVo result;
|
|
|
switch (indexInfoParamDto.getTime()) {
|
|
|
case "year":
|
|
|
- result = getContractAmountInfo(request, indexInfoParamDto, YEAR);
|
|
|
+ result = getContractAmountInfo(request, indexInfoParamDto, YEAR, departNameList);
|
|
|
break;
|
|
|
case "month":
|
|
|
- result = getContractAmountInfo(request, indexInfoParamDto, MONTH);
|
|
|
+ result = getContractAmountInfo(request, indexInfoParamDto, MONTH, departNameList);
|
|
|
break;
|
|
|
default:
|
|
|
result = null;
|
|
@@ -765,7 +793,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public ContractChartInfoVo getContractAmountInfo(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto, String Time) {
|
|
|
+ public ContractChartInfoVo getContractAmountInfo(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto, String Time, List<String> departNameList) {
|
|
|
/*根据传进来年份或者月份初始化返回结果对象*/
|
|
|
ContractChartInfoVo resVo = new ContractChartInfoVo();
|
|
|
Date beginDate = dateFormat(indexInfoParamDto.getBeginDate(), Time);
|
|
@@ -800,6 +828,8 @@ public class IndexServiceImpl implements IndexService {
|
|
|
LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
|
|
|
String role = commonMethod.getRole(userNameByToken);
|
|
|
+ if (AuthMark.BOSS.equals(role) && departNameList != null && !departNameList.isEmpty())
|
|
|
+ role = AuthMark.DEPT_LEADER;
|
|
|
if (role == null) return resVo;
|
|
|
|
|
|
|
|
@@ -807,7 +837,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
String depart = null;
|
|
|
if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
|
|
|
- List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ List<String> departNames = null;
|
|
|
+ if (departNameList != null && !departNameList.isEmpty()) {
|
|
|
+ departNames = departNameList;
|
|
|
+ } else {
|
|
|
+ departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ }
|
|
|
+
|
|
|
if (departNames.isEmpty()) return resVo;
|
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
@@ -2415,7 +2451,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
* @param indexInfoParamDto
|
|
|
* @return IndexChartInfoVo<BigDecimal>
|
|
|
*/
|
|
|
- public IndexChartInfoVo<BigDecimal> getTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto, String userId) {
|
|
|
+ public IndexChartInfoVo<BigDecimal> getTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto, String userId,List<String> departNameList) {
|
|
|
//1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
|
|
|
IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
|
|
@@ -2452,7 +2488,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
//3.通过登录的用户找到相应的部门,可能一个或两个
|
|
|
//获取部门名称列表
|
|
|
- List<String> sysDepartNames = sysDepartMapper.getSysUserOfDepartNameList(userId);
|
|
|
+ List<String> sysDepartNames = null;
|
|
|
+ if (departNameList!=null && !departNameList.isEmpty()){
|
|
|
+ sysDepartNames = departNameList;
|
|
|
+ }else {
|
|
|
+ sysDepartNames = sysDepartMapper.getSysUserOfDepartNameList(userId);
|
|
|
+ }
|
|
|
+
|
|
|
System.out.println("查出的部门列表:");
|
|
|
System.out.println(sysDepartNames);
|
|
|
if (sysDepartNames.isEmpty()) return indexChartInfoVo;
|
|
@@ -2561,19 +2603,19 @@ public class IndexServiceImpl implements IndexService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public IndexTotalVo getLreByRole(HttpServletRequest request) {
|
|
|
+ public IndexTotalVo getLreByRole(HttpServletRequest request, List<String> departNameList) {
|
|
|
//初始化
|
|
|
IndexTotalVo lrIndexTotalVo = indexTotalVoInit();
|
|
|
|
|
|
//获取一层已收款
|
|
|
CompletableFuture<IndexTotalVo> getYskFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- return getTotalReceived(request);
|
|
|
+ return getTotalReceived(request, departNameList);
|
|
|
// return getTotalIncome(request);
|
|
|
});
|
|
|
// IndexTotalVo hteindexTotalVo = getTotalIncome(request);
|
|
|
//获取一层支出成本额
|
|
|
CompletableFuture<IndexTotalVo> getZcbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- return indexZcbService.getZhiChuTotalList(request).get(0);
|
|
|
+ return indexZcbService.getZhiChuTotalList(request, departNameList).get(0);
|
|
|
});
|
|
|
// IndexTotalVo zceindexTotalVo = indexZcbService.getZhiChuTotalList(request).get(0);
|
|
|
CompletableFuture<Void> future1 = CompletableFuture.allOf(getYskFuture, getZcbFuture);
|
|
@@ -2672,7 +2714,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public IndexChartInfoVo<BigDecimal> getLreDetailByRole(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto) {
|
|
|
+ public IndexChartInfoVo<BigDecimal> getLreDetailByRole(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto,List<String> departNameList) {
|
|
|
//初始化
|
|
|
IndexChartInfoVo<BigDecimal> indexChartInfoVo = indexChartInfoVoInit();
|
|
|
List<String> xAxisDataList = new ArrayList<>();
|
|
@@ -2683,13 +2725,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
//获取二层合同额
|
|
|
CompletableFuture<IndexChartInfoVo> getHteFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
// return getContractAmountInfo(request, indexInfoParamDto);
|
|
|
- return getReceivedDetailByRoleDate(indexInfoParamDto);
|
|
|
+ return getReceivedDetailByRoleDate(indexInfoParamDto,departNameList);
|
|
|
});
|
|
|
// ContractChartInfoVo contractChartInfoVo = getContractAmountInfo(request, indexInfoParamDto);
|
|
|
|
|
|
//获取二层支出成本额 八项成本
|
|
|
CompletableFuture<List<EightCostChartInfoVo>> getZcbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- return indexZcbService.getEightCostsList(indexInfoParamDto, request);
|
|
|
+ return indexZcbService.getEightCostsList(indexInfoParamDto, request,departNameList);
|
|
|
});
|
|
|
// List<EightCostChartInfoVo> resultList = indexZcbService.getEightCostsList(indexInfoParamDto, request);
|
|
|
CompletableFuture<Void> future1 = CompletableFuture.allOf(getHteFuture, getZcbFuture);
|
|
@@ -2762,7 +2804,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
* @param indexInfoParamDto
|
|
|
* @return IndexChartInfoVo<BigDecimal>
|
|
|
*/
|
|
|
- public IndexChartInfoVo<BigDecimal> getReceivedDetailByRoleDate(IndexInfoParamDto indexInfoParamDto) {
|
|
|
+ public IndexChartInfoVo<BigDecimal> getReceivedDetailByRoleDate(IndexInfoParamDto indexInfoParamDto, List<String> departNameList) {
|
|
|
//1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
|
|
|
IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
|
|
@@ -2777,9 +2819,10 @@ public class IndexServiceImpl implements IndexService {
|
|
|
// 获取登录人用户信息 V2.0版本:
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
String role = commonMethod.getRole(sysUser.getUsername());
|
|
|
- if (role == null) {
|
|
|
- return indexChartInfoVo;
|
|
|
- }
|
|
|
+ if (AuthMark.BOSS.equals(role) && departNameList != null && !departNameList.isEmpty()) role = AuthMark.DEPT_LEADER;
|
|
|
+ if (role == null) {
|
|
|
+ return indexChartInfoVo;
|
|
|
+ }
|
|
|
//如果是所长,查看所有 部门领导查看本部门 员工后期增加
|
|
|
if (role.equals(AuthMark.BOSS)) {
|
|
|
System.out.println("当前账户权限:所长");
|
|
@@ -2787,7 +2830,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
// indexChartInfoVo = getTotalReceivedByDate(indexInfoParamDto, sysUser.getId());
|
|
|
} else if (role.equals(AuthMark.DEPT_LEADER)) {
|
|
|
System.out.println("当前账户权限:部门领导");
|
|
|
- indexChartInfoVo = getTotalReceivedByDate(indexInfoParamDto, sysUser.getId());
|
|
|
+ indexChartInfoVo = getTotalReceivedByDate(indexInfoParamDto, sysUser.getId(),departNameList);
|
|
|
}
|
|
|
return indexChartInfoVo;
|
|
|
}
|