|
@@ -9,11 +9,13 @@ import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.common.system.util.JwtUtil;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.common.util.RedisUtil;
|
|
|
+import org.jeecg.modules.Index.util.AuthMark;
|
|
|
import org.jeecg.modules.Index.util.CacheKey;
|
|
|
import org.jeecg.modules.Index.entity.dto.IndexInfoParamDto;
|
|
|
import org.jeecg.modules.Index.entity.pojo.ContractAmount;
|
|
|
import org.jeecg.modules.Index.entity.vo.*;
|
|
|
import org.jeecg.modules.Index.service.IndexService;
|
|
|
+import org.jeecg.modules.Index.util.CommonMethod;
|
|
|
import org.jeecg.modules.kyTaskInfo.service.IKyTaskInfoService;
|
|
|
import org.jeecg.modules.projectCost.entity.ProjectCost;
|
|
|
import org.jeecg.modules.projectCost.mapper.ProjectCostMapper;
|
|
@@ -52,6 +54,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
@Autowired
|
|
|
private RedisUtil redisUtil;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommonMethod commonMethod;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 用户id与部门id对应表
|
|
@@ -82,7 +87,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
private IProjectCostService projectCostService;
|
|
|
|
|
|
|
|
|
-
|
|
|
private static final String YEAR = "year";
|
|
|
|
|
|
private static final String MONTH = "month";
|
|
@@ -93,9 +97,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
String userNameByToken = JwtUtil.getUserNameByToken(request);
|
|
|
LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ String role = commonMethod.getRole(userNameByToken);
|
|
|
|
|
|
//首页收入渲染对象
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0);
|
|
@@ -107,29 +109,31 @@ public class IndexServiceImpl implements IndexService {
|
|
|
incomeDataInfoVO.setMonthHb(initValue);
|
|
|
incomeDataInfoVO.setMonthTb(initValue);
|
|
|
|
|
|
+ String depart = null;
|
|
|
+ ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ if (departNames.isEmpty()) return incomeDataInfoVO;
|
|
|
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ for (String departName : departNames) {
|
|
|
+ stringBuilder.append(departName).append("|");
|
|
|
+ }
|
|
|
+ depart = stringBuilder.toString();
|
|
|
+ IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.INCOME_DATA_REDIS_KEY + depart + ":" + role);
|
|
|
+ if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
+ incomeDataInfoVO = cacheObject;
|
|
|
+ return incomeDataInfoVO;
|
|
|
+ }
|
|
|
|
|
|
- List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
- if (departNames.isEmpty()) return incomeDataInfoVO;
|
|
|
-
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
- for (String departName : departNames) {
|
|
|
- stringBuilder.append(departName).append("|");
|
|
|
- }
|
|
|
- String depart = stringBuilder.toString();
|
|
|
- IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.INCOME_DATA_REDIS_KEY + depart);
|
|
|
- if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
- incomeDataInfoVO = cacheObject;
|
|
|
- return incomeDataInfoVO;
|
|
|
+ List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
|
|
|
+ List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
|
|
|
+ tasknoList.addAll(ZrbmTasknoList);
|
|
|
+ tasknoList.addAll(XdbmTasknoList);
|
|
|
+ if (tasknoList.isEmpty()) return incomeDataInfoVO;
|
|
|
}
|
|
|
|
|
|
- ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
- List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
|
|
|
- List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
|
|
|
- tasknoList.addAll(ZrbmTasknoList);
|
|
|
- tasknoList.addAll(XdbmTasknoList);
|
|
|
- if (tasknoList.isEmpty()) return incomeDataInfoVO;
|
|
|
-
|
|
|
+ if (depart == null) depart = "Boss";
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
|
|
@@ -140,7 +144,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//根据年份和当前部门对应的任务号查询,部门当前年的年收入
|
|
|
- BigDecimal currentYearTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
+ BigDecimal currentYearTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ currentYearTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ currentYearTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(currentYearTotal)) currentYearTotal = BigDecimal.valueOf(0);
|
|
|
return currentYearTotal;
|
|
|
});
|
|
@@ -154,7 +163,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
//根据年份和当前部门对应的任务号查询,部门去年同期年收入
|
|
|
CompletableFuture<BigDecimal> lastYearTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastYearTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
+ BigDecimal lastYearTqTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ lastYearTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ lastYearTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(lastYearTqTotal)) lastYearTqTotal = BigDecimal.valueOf(0);
|
|
|
return lastYearTqTotal;
|
|
|
});
|
|
@@ -165,7 +179,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal currentMonthTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
+ BigDecimal currentMonthTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ currentMonthTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ currentMonthTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(currentMonthTotal)) currentMonthTotal = BigDecimal.valueOf(0);
|
|
|
return currentMonthTotal;
|
|
|
});
|
|
@@ -179,7 +198,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastMothTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastMothTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
+ BigDecimal lastMothTqTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ lastMothTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ lastMothTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(lastMothTqTotal)) lastMothTqTotal = BigDecimal.valueOf(0);
|
|
|
return lastMothTqTotal;
|
|
|
});
|
|
@@ -192,12 +216,17 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Date lastYearMonthTqBeginDate = instance.getTime();
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastYearMonthTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastYearMonthTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
+ BigDecimal lastYearMonthTqTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ lastYearMonthTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ lastYearMonthTqTotal = exchangeMapper.getIncomeYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(lastYearMonthTqTotal)) lastYearMonthTqTotal = BigDecimal.valueOf(0);
|
|
|
return lastYearMonthTqTotal;
|
|
|
});
|
|
|
|
|
|
- CompletableFuture<Void> future = CompletableFuture.allOf(currentYearTotalFuture,lastYearTqTotalFuture, currentMonthTotalFuture, lastMothTqTotalFuture, lastYearMonthTqTotalFuture);
|
|
|
+ CompletableFuture<Void> future = CompletableFuture.allOf(currentYearTotalFuture, lastYearTqTotalFuture, currentMonthTotalFuture, lastMothTqTotalFuture, lastYearMonthTqTotalFuture);
|
|
|
future.join();
|
|
|
BigDecimal currentYearTotal = currentYearTotalFuture.join();
|
|
|
BigDecimal lastYearTqTotal = lastYearTqTotalFuture.join();
|
|
@@ -210,7 +239,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
incomeDataInfoVO.setMonthTotal(currentMonthTotal);
|
|
|
|
|
|
|
|
|
-
|
|
|
CompletableFuture<BigDecimal> incomeYearTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//去年同比
|
|
|
BigDecimal YearDifference = currentYearTotal.subtract(lastYearTqTotal);
|
|
@@ -245,7 +273,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
incomeDataInfoVO.setMonthTb(incomeYearMothTb);
|
|
|
incomeDataInfoVO.setMonthHb(incomeMothHb);
|
|
|
|
|
|
- redisUtil.set(CacheKey.INCOME_DATA_REDIS_KEY + depart, incomeDataInfoVO, 1000L * 60 * 60 * 2);
|
|
|
+ redisUtil.set(CacheKey.INCOME_DATA_REDIS_KEY + depart + ":" + role, incomeDataInfoVO, 1000L * 60 * 60 * 2);
|
|
|
|
|
|
return incomeDataInfoVO;
|
|
|
}
|
|
@@ -267,27 +295,33 @@ public class IndexServiceImpl implements IndexService {
|
|
|
String userNameByToken = JwtUtil.getUserNameByToken(request);
|
|
|
LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
|
|
|
- List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
- if (departNames.isEmpty()) return totalContractNumInfoVO;
|
|
|
-
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
- for (String departName : departNames) {
|
|
|
- stringBuilder.append(departName).append("|");
|
|
|
- }
|
|
|
- String depart = stringBuilder.toString();
|
|
|
- IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.CONTRACT_DATA_REDIS_KEY + depart);
|
|
|
- if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
- totalContractNumInfoVO = cacheObject;
|
|
|
- return totalContractNumInfoVO;
|
|
|
- }
|
|
|
+ String role = commonMethod.getRole(userNameByToken);
|
|
|
|
|
|
+ String depart = null;
|
|
|
ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
- List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
|
|
|
- List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
|
|
|
- tasknoList.addAll(ZrbmTasknoList);
|
|
|
- tasknoList.addAll(XdbmTasknoList);
|
|
|
- if (tasknoList.isEmpty()) return totalContractNumInfoVO;
|
|
|
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ 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";
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
|
|
@@ -297,8 +331,13 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- //根据年份和当前部门对应的任务号查询,部门当前年的年收入
|
|
|
- BigDecimal currentYearTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
+ 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;
|
|
|
});
|
|
@@ -312,7 +351,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
//根据年份和当前部门对应的任务号查询,部门去年同期年收入
|
|
|
CompletableFuture<BigDecimal> lastYearTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastYearTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
+ 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;
|
|
|
});
|
|
@@ -323,7 +367,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal currentMonthTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
+ 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;
|
|
|
});
|
|
@@ -337,7 +386,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastMothTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastMothTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
+ 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;
|
|
|
});
|
|
@@ -350,12 +404,17 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Date lastYearMonthTqBeginDate = instance.getTime();
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastYearMonthTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastYearMonthTqTotal = exchangeMapper.getContractNumYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
+ 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);
|
|
|
+ CompletableFuture<Void> future = CompletableFuture.allOf(currentYearTotalFuture, lastYearTqTotalFuture, currentMonthTotalFuture, lastMothTqTotalFuture, lastYearMonthTqTotalFuture);
|
|
|
future.join();
|
|
|
BigDecimal currentYearTotal = currentYearTotalFuture.join();
|
|
|
BigDecimal lastYearTqTotal = lastYearTqTotalFuture.join();
|
|
@@ -368,7 +427,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
totalContractNumInfoVO.setMonthTotal(currentMonthTotal);
|
|
|
|
|
|
|
|
|
-
|
|
|
CompletableFuture<BigDecimal> yearTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//去年同比
|
|
|
BigDecimal YearDifference = currentYearTotal.subtract(lastYearTqTotal);
|
|
@@ -403,7 +461,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
totalContractNumInfoVO.setMonthTb(yearMothTb);
|
|
|
totalContractNumInfoVO.setMonthHb(mothHb);
|
|
|
|
|
|
- redisUtil.set(CacheKey.CONTRACT_DATA_REDIS_KEY + depart, totalContractNumInfoVO, 1000L * 60 * 60 * 2);
|
|
|
+ redisUtil.set(CacheKey.CONTRACT_DATA_REDIS_KEY + depart + ":" + role, totalContractNumInfoVO, 1000L * 60 * 60 * 2);
|
|
|
|
|
|
return totalContractNumInfoVO;
|
|
|
}
|
|
@@ -424,38 +482,49 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
String userNameByToken = JwtUtil.getUserNameByToken(request);
|
|
|
LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
+ String role = commonMethod.getRole(userNameByToken);
|
|
|
|
|
|
- List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
- if (departNames.isEmpty()) return indexTotalVo;
|
|
|
+ String depart = null;
|
|
|
+ ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
- for (String departName : departNames) {
|
|
|
- stringBuilder.append(departName).append("|");
|
|
|
- }
|
|
|
- String depart = stringBuilder.toString();
|
|
|
- IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.RECEIVED_DATA_REDIS_KEY + depart);
|
|
|
- if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
- indexTotalVo = cacheObject;
|
|
|
- return indexTotalVo;
|
|
|
- }
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ if (departNames.isEmpty()) return indexTotalVo;
|
|
|
|
|
|
- ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
- List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
|
|
|
- List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
|
|
|
- tasknoList.addAll(ZrbmTasknoList);
|
|
|
- tasknoList.addAll(XdbmTasknoList);
|
|
|
- if (tasknoList.isEmpty()) return indexTotalVo;
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ for (String departName : departNames) {
|
|
|
+ stringBuilder.append(departName).append("|");
|
|
|
+ }
|
|
|
+ depart = stringBuilder.toString();
|
|
|
+ IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.RECEIVED_DATA_REDIS_KEY + depart + ":" + role);
|
|
|
+ if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
+ indexTotalVo = cacheObject;
|
|
|
+ return indexTotalVo;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- Calendar instance = Calendar.getInstance();
|
|
|
+ List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
|
|
|
+ List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
|
|
|
+ tasknoList.addAll(ZrbmTasknoList);
|
|
|
+ tasknoList.addAll(XdbmTasknoList);
|
|
|
+ if (tasknoList.isEmpty()) return indexTotalVo;
|
|
|
+ }
|
|
|
+ if (depart == null) depart = "Boss";
|
|
|
|
|
|
+ Calendar instance = Calendar.getInstance();
|
|
|
Date currentYearEndDate = instance.getTime();
|
|
|
setZeroYear(instance);
|
|
|
Date currentYearBeginDate = instance.getTime();
|
|
|
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentYearTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal currentYearTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
+
|
|
|
+ BigDecimal currentYearTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ currentYearTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ currentYearTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentYearBeginDate, currentYearEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(currentYearTotal)) currentYearTotal = BigDecimal.valueOf(0);
|
|
|
return currentYearTotal;
|
|
|
});
|
|
@@ -468,7 +537,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Date LastYearBeginDate = instance.getTime();
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastYearTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastYearTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
+ BigDecimal lastYearTqTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ lastYearTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ lastYearTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastYearBeginDate, LastTqEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(lastYearTqTotal)) lastYearTqTotal = BigDecimal.valueOf(0);
|
|
|
return lastYearTqTotal;
|
|
|
});
|
|
@@ -479,7 +553,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
|
|
|
CompletableFuture<BigDecimal> currentMonthTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal currentMonthTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
+ BigDecimal currentMonthTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ currentMonthTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ currentMonthTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, currentMothBginDate, currentMothEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(currentMonthTotal)) currentMonthTotal = BigDecimal.valueOf(0);
|
|
|
return currentMonthTotal;
|
|
|
});
|
|
@@ -493,7 +572,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastMothTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastMothTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
+ BigDecimal lastMothTqTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ lastMothTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ lastMothTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, LastMothTqBeginDate, LastMothTqEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(lastMothTqTotal)) lastMothTqTotal = BigDecimal.valueOf(0);
|
|
|
return lastMothTqTotal;
|
|
|
});
|
|
@@ -506,12 +590,17 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Date lastYearMonthTqBeginDate = instance.getTime();
|
|
|
|
|
|
CompletableFuture<BigDecimal> lastYearMonthTqTotalFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
- BigDecimal lastYearMonthTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
+ BigDecimal lastYearMonthTqTotal = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ lastYearMonthTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRange(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
+ } else if (AuthMark.BOSS.equals(role)) {
|
|
|
+ lastYearMonthTqTotal = exchangeMapper.getReceivedYearTotalByTasknoListAndByQsrqRangeIfBoss(tasknoList, lastYearMonthTqBeginDate, lastYearMonthTqEndDate);
|
|
|
+ }
|
|
|
if (ObjectUtils.isEmpty(lastYearMonthTqTotal)) lastYearMonthTqTotal = BigDecimal.valueOf(0);
|
|
|
return lastYearMonthTqTotal;
|
|
|
});
|
|
|
|
|
|
- CompletableFuture<Void> future = CompletableFuture.allOf(currentYearTotalFuture,lastYearTqTotalFuture, currentMonthTotalFuture, lastMothTqTotalFuture, lastYearMonthTqTotalFuture);
|
|
|
+ CompletableFuture<Void> future = CompletableFuture.allOf(currentYearTotalFuture, lastYearTqTotalFuture, currentMonthTotalFuture, lastMothTqTotalFuture, lastYearMonthTqTotalFuture);
|
|
|
future.join();
|
|
|
BigDecimal currentYearTotal = currentYearTotalFuture.join();
|
|
|
BigDecimal lastYearTqTotal = lastYearTqTotalFuture.join();
|
|
@@ -524,7 +613,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexTotalVo.setMonthTotal(currentMonthTotal);
|
|
|
|
|
|
|
|
|
-
|
|
|
CompletableFuture<BigDecimal> yearTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
//去年同比
|
|
|
BigDecimal YearDifference = currentYearTotal.subtract(lastYearTqTotal);
|
|
@@ -559,12 +647,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexTotalVo.setMonthTb(yearMothTb);
|
|
|
indexTotalVo.setMonthHb(mothHb);
|
|
|
|
|
|
- redisUtil.set(CacheKey.RECEIVED_DATA_REDIS_KEY + depart, indexTotalVo, 1000L * 60 * 60 * 2);
|
|
|
+ redisUtil.set(CacheKey.RECEIVED_DATA_REDIS_KEY + depart + ":" + role, indexTotalVo, 1000L * 60 * 60 * 2);
|
|
|
|
|
|
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);
|
|
@@ -588,10 +676,10 @@ public class IndexServiceImpl implements IndexService {
|
|
|
ContractChartInfoVo resultl;
|
|
|
switch (indexInfoParamDto.getTime()) {
|
|
|
case "year":
|
|
|
- resultl = getContractAmountInfo(request, indexInfoParamDto,YEAR);
|
|
|
+ resultl = getContractAmountInfo(request, indexInfoParamDto, YEAR);
|
|
|
break;
|
|
|
case "month":
|
|
|
- resultl = getContractAmountInfo(request, indexInfoParamDto,MONTH);
|
|
|
+ resultl = getContractAmountInfo(request, indexInfoParamDto, MONTH);
|
|
|
break;
|
|
|
default:
|
|
|
resultl = null;
|
|
@@ -600,7 +688,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
return resultl;
|
|
|
}
|
|
|
|
|
|
- public ContractChartInfoVo getContractAmountInfo(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto,String Time) {
|
|
|
+ public ContractChartInfoVo getContractAmountInfo(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto, String Time) {
|
|
|
/*根据传进来年份或者月份初始化返回结果对象*/
|
|
|
ContractChartInfoVo resVo = new ContractChartInfoVo();
|
|
|
Date beginDate = dateFormat(indexInfoParamDto.getBeginDate(), Time);
|
|
@@ -658,7 +746,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
List<ContractAmount> contractAmountList;
|
|
|
if (YEAR.equals(Time)) {
|
|
|
contractAmountList = exchangeMapper.getContractAmountandNumByYear(tasknoList, beginDate, endDate);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
contractAmountList = exchangeMapper.getContractAmountandNumByMonth(tasknoList, beginDate, endDate);
|
|
|
}
|
|
|
ContractChartInfoVo newResVo = new ContractChartInfoVo();
|
|
@@ -668,10 +756,10 @@ public class IndexServiceImpl implements IndexService {
|
|
|
Long contractTotalResult = amount.getContractTotal();
|
|
|
|
|
|
for (int i = 0; i < xAxisData.size(); i++) {
|
|
|
- if (ObjectUtils.isNotEmpty(dateResult) && xAxisData.get(i).equals(dateResult)){
|
|
|
- xAxisData.set(i,dateResult);
|
|
|
- contractAmount.set(i,contractAmountResult);
|
|
|
- contractTotal.set(i,contractTotalResult);
|
|
|
+ if (ObjectUtils.isNotEmpty(dateResult) && xAxisData.get(i).equals(dateResult)) {
|
|
|
+ xAxisData.set(i, dateResult);
|
|
|
+ contractAmount.set(i, contractAmountResult);
|
|
|
+ contractTotal.set(i, contractTotalResult);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -887,7 +975,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<String> getTaskNoListFDepTime2(List<String> sysDepartNames, String timeType, String timeRange){
|
|
|
+ public List<String> getTaskNoListFDepTime2(List<String> sysDepartNames, String timeType, String timeRange) {
|
|
|
//2.根据部门名称(zrbm、jycs)和实际完成时间查询taskno
|
|
|
List<String> taskNoList = new ArrayList<>();
|
|
|
for (String sysDepartName : sysDepartNames) {
|
|
@@ -945,7 +1033,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
BigDecimal sumLreYear = countLre(taskNoListNew);
|
|
|
System.out.println("当年的利润额为:");
|
|
|
System.out.println(sumLreYear);
|
|
|
- if(sumLreYear == null){
|
|
|
+ if (sumLreYear == null) {
|
|
|
sumLreYear = initValue;
|
|
|
}
|
|
|
lreDataInfoVo.setYearTotal(sumLreYear);
|
|
@@ -958,7 +1046,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
BigDecimal sumLreLastYear = countLre(taskNoListNew2);
|
|
|
System.out.println("上一年的利润额为:");
|
|
|
System.out.println(sumLreLastYear);
|
|
|
- if(sumLreLastYear == null){
|
|
|
+ if (sumLreLastYear == null) {
|
|
|
sumLreLastYear = initValue;
|
|
|
}
|
|
|
lreDataInfoVo.setYearTq(sumLreLastYear);
|
|
@@ -982,7 +1070,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
BigDecimal sumLreCurrMonth = countLre(taskNoListNew3);
|
|
|
System.out.println("当月的利润额为:");
|
|
|
System.out.println(sumLreCurrMonth);
|
|
|
- if(sumLreCurrMonth == null){
|
|
|
+ if (sumLreCurrMonth == null) {
|
|
|
sumLreCurrMonth = initValue;
|
|
|
}
|
|
|
lreDataInfoVo.setMonthTotal(sumLreCurrMonth);
|
|
@@ -995,7 +1083,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
BigDecimal sumLreLastMonth = countLre(taskNoListNew4);
|
|
|
System.out.println("上个月的利润额为:");
|
|
|
System.out.println(sumLreLastMonth);
|
|
|
- if(sumLreLastMonth == null){
|
|
|
+ if (sumLreLastMonth == null) {
|
|
|
sumLreLastMonth = initValue;
|
|
|
}
|
|
|
System.out.println("----------------------------------------------------");
|
|
@@ -1018,7 +1106,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
BigDecimal sumLreTqMonth = countLre(taskNoListNew5);
|
|
|
System.out.println("去年同期月份的利润额为:");
|
|
|
System.out.println(sumLreTqMonth);
|
|
|
- if(sumLreTqMonth == null){
|
|
|
+ if (sumLreTqMonth == null) {
|
|
|
sumLreTqMonth = initValue;
|
|
|
}
|
|
|
System.out.println("----------------------------------------------------");
|
|
@@ -1059,11 +1147,11 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取年月列表
|
|
|
- * @Param dateFormat 日期格式 timeType 日期增加的格式(年/月)
|
|
|
- *
|
|
|
- */
|
|
|
- public List<String> getDateList(List<String> timeRangeList, String startString, String endString, String dateFormat, String timeType){
|
|
|
+ * 获取年月列表
|
|
|
+ *
|
|
|
+ * @Param dateFormat 日期格式 timeType 日期增加的格式(年/月)
|
|
|
+ */
|
|
|
+ public List<String> getDateList(List<String> timeRangeList, String startString, String endString, String dateFormat, String timeType) {
|
|
|
//用Calendar 进行日期比较判断
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
|
|
@@ -1071,20 +1159,19 @@ public class IndexServiceImpl implements IndexService {
|
|
|
// 转化成日期类型
|
|
|
Date startDate = sdf.parse(startString);
|
|
|
Date endDate = sdf.parse(endString);
|
|
|
- while (startDate.getTime()<=endDate.getTime()){
|
|
|
+ while (startDate.getTime() <= endDate.getTime()) {
|
|
|
// 把日期添加到集合
|
|
|
timeRangeList.add(sdf.format(startDate));
|
|
|
// 设置日期
|
|
|
calendar.setTime(startDate);
|
|
|
//把日期增加一天
|
|
|
- if(timeType.equals("year")){
|
|
|
+ if (timeType.equals("year")) {
|
|
|
calendar.add(Calendar.YEAR, 1);
|
|
|
- }
|
|
|
- else if(timeType.equals("month")){
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
calendar.add(Calendar.MONTH, 1);
|
|
|
}
|
|
|
// 获取增加后的日期
|
|
|
- startDate=calendar.getTime();
|
|
|
+ startDate = calendar.getTime();
|
|
|
}
|
|
|
} catch (ParseException e) {
|
|
|
e.printStackTrace();
|
|
@@ -1099,7 +1186,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
* @param indexInfoParamDto
|
|
|
* @return IndexChartInfoVo<BigDecimal>
|
|
|
*/
|
|
|
- public Result<IndexChartInfoVo<BigDecimal>> countTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto){
|
|
|
+ public Result<IndexChartInfoVo<BigDecimal>> countTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto) {
|
|
|
//1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
|
|
|
IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
|
|
@@ -1117,17 +1204,16 @@ public class IndexServiceImpl implements IndexService {
|
|
|
String startString = indexInfoParamDto.getBeginDate();
|
|
|
//结束时间
|
|
|
String endString = indexInfoParamDto.getEndDate();
|
|
|
- if(timeType.equals("year")){
|
|
|
+ if (timeType.equals("year")) {
|
|
|
timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
|
|
|
- }
|
|
|
- else if (timeType.equals("month")){
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
|
|
|
}
|
|
|
// System.out.println("获取的日期列表为:");
|
|
|
// System.out.println(timeRangeList);
|
|
|
if (timeRangeList.isEmpty()) return Result.OK(indexChartInfoVo);//日期为空,直接传回两个空list
|
|
|
//根据日期长度初始化纵坐标值 0
|
|
|
- for(String timeRange:timeRangeList){
|
|
|
+ for (String timeRange : timeRangeList) {
|
|
|
seriesDataList.add(initValue);
|
|
|
}
|
|
|
//添加横坐标列表
|
|
@@ -1151,18 +1237,17 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
//4.计算该时间列表中某年或某月对应的总利润额
|
|
|
List<BigDecimal> seriesDataList2 = new ArrayList<>();
|
|
|
- for(String timeRange2:timeRangeList){
|
|
|
+ for (String timeRange2 : timeRangeList) {
|
|
|
//根据日期和当前部门对应的任务号查询,部门某年或某月的年收入
|
|
|
- if(timeType.equals("year")){
|
|
|
+ if (timeType.equals("year")) {
|
|
|
BigDecimal yearTotal = exchangeMapper.getReceivedByYear(tasknoList, timeRange2);
|
|
|
- if(yearTotal == null){
|
|
|
+ if (yearTotal == null) {
|
|
|
yearTotal = initValue;
|
|
|
}
|
|
|
seriesDataList2.add(yearTotal);
|
|
|
- }
|
|
|
- else if(timeType.equals("month")){
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
BigDecimal yearTotal = exchangeMapper.getReceivedByYMonth(tasknoList, timeRange2);
|
|
|
- if(yearTotal == null){
|
|
|
+ if (yearTotal == null) {
|
|
|
yearTotal = initValue;
|
|
|
}
|
|
|
seriesDataList2.add(yearTotal);
|
|
@@ -1180,7 +1265,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public Result<IndexChartInfoVo<BigDecimal>> countLreByDate(IndexInfoParamDto indexInfoParamDto){
|
|
|
+ public Result<IndexChartInfoVo<BigDecimal>> countLreByDate(IndexInfoParamDto indexInfoParamDto) {
|
|
|
//1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
|
|
|
IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,利润额为0
|
|
@@ -1200,10 +1285,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
//结束时间
|
|
|
String endString = indexInfoParamDto.getEndDate();
|
|
|
|
|
|
- if(timeType.equals("year")){
|
|
|
+ if (timeType.equals("year")) {
|
|
|
timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
|
|
|
- }
|
|
|
- else if (timeType.equals("month")){
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
|
|
|
}
|
|
|
System.out.println("获取的日期列表为:");
|
|
@@ -1211,7 +1295,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
|
|
|
if (timeRangeList.isEmpty()) return Result.OK(indexChartInfoVo);//日期为空,直接传回两个空list
|
|
|
//根据日期长度初始化纵坐标值 0
|
|
|
- for(String timeRange:timeRangeList){
|
|
|
+ for (String timeRange : timeRangeList) {
|
|
|
seriesDataList.add(initValue);
|
|
|
}
|
|
|
//初始化横坐标有日期时,相应的纵坐标先赋一个0
|
|
@@ -1225,7 +1309,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
if (sysDepartNames.isEmpty()) return Result.OK(indexChartInfoVo);
|
|
|
//4.计算该时间列表中某年或某月对应的总利润额
|
|
|
List<BigDecimal> seriesDataList2 = new ArrayList<>();
|
|
|
- for(String timeRange:timeRangeList) {
|
|
|
+ for (String timeRange : timeRangeList) {
|
|
|
//根据时间和部门去查找任务号
|
|
|
List<String> taskNoListNew = getTaskNoListFDepTime2(sysDepartNames, timeType, timeRange);
|
|
|
System.out.println(timeRange + "的任务号列表:");
|
|
@@ -1245,4 +1329,5 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexChartInfoVo.setSeriesData(seriesDataList2);
|
|
|
return Result.OK(indexChartInfoVo);
|
|
|
}
|
|
|
+
|
|
|
}
|