|
@@ -133,7 +133,14 @@ public class IndexServiceImpl implements IndexService {
|
|
|
if (tasknoList.isEmpty()) return incomeDataInfoVO;
|
|
|
}
|
|
|
|
|
|
- if (depart == null) depart = "Boss";
|
|
|
+ if (depart == null) {
|
|
|
+ depart = "Boss";
|
|
|
+ IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.INCOME_DATA_REDIS_KEY + depart + ":" + role);
|
|
|
+ if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
+ incomeDataInfoVO = cacheObject;
|
|
|
+ return incomeDataInfoVO;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
|
|
@@ -321,7 +328,14 @@ public class IndexServiceImpl implements IndexService {
|
|
|
tasknoList.addAll(XdbmTasknoList);
|
|
|
if (tasknoList.isEmpty()) return totalContractNumInfoVO;
|
|
|
}
|
|
|
- if (depart == null) depart = "Boss";
|
|
|
+ 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();
|
|
|
|
|
@@ -509,7 +523,14 @@ public class IndexServiceImpl implements IndexService {
|
|
|
tasknoList.addAll(XdbmTasknoList);
|
|
|
if (tasknoList.isEmpty()) return indexTotalVo;
|
|
|
}
|
|
|
- if (depart == null) depart = "Boss";
|
|
|
+ if (depart == null) {
|
|
|
+ depart = "Boss";
|
|
|
+ IndexTotalVo cacheObject = (IndexTotalVo) redisUtil.get(CacheKey.RECEIVED_DATA_REDIS_KEY + depart + ":" + role);
|
|
|
+ if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
+ indexTotalVo = cacheObject;
|
|
|
+ return indexTotalVo;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
Calendar instance = Calendar.getInstance();
|
|
|
Date currentYearEndDate = instance.getTime();
|
|
@@ -714,40 +735,66 @@ public class IndexServiceImpl implements IndexService {
|
|
|
resVo.setContractTotal(contractTotal);
|
|
|
resVo.setXAxisData(xAxisData);
|
|
|
|
|
|
-
|
|
|
endDate = endDateProcess(endDate, Time);
|
|
|
|
|
|
String userNameByToken = JwtUtil.getUserNameByToken(request);
|
|
|
LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
|
|
|
- List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
- if (departNames.isEmpty()) return resVo;
|
|
|
+ String role = commonMethod.getRole(userNameByToken);
|
|
|
+ if (role == null) return resVo;
|
|
|
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
- for (String departName : departNames) {
|
|
|
- stringBuilder.append(departName).append("|");
|
|
|
- }
|
|
|
- String depart = stringBuilder.toString();
|
|
|
- Object cacheObject = redisUtil.get(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + depart);
|
|
|
- ContractChartInfoVo Object = JSONObject.parseObject(JSONObject.toJSONString(cacheObject), new TypeReference<ContractChartInfoVo>() {
|
|
|
- });
|
|
|
- if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
- resVo = Object;
|
|
|
- return resVo;
|
|
|
- }
|
|
|
|
|
|
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 resVo;
|
|
|
+ String depart = null;
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+
|
|
|
+ List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ if (departNames.isEmpty()) return resVo;
|
|
|
+
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ for (String departName : departNames) {
|
|
|
+ stringBuilder.append(departName).append("|");
|
|
|
+ }
|
|
|
+ depart = stringBuilder.toString();
|
|
|
+ Object cacheObject = redisUtil.get(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + depart + ":" + role);
|
|
|
+ ContractChartInfoVo Object = JSONObject.parseObject(JSONObject.toJSONString(cacheObject), new TypeReference<ContractChartInfoVo>() {
|
|
|
+ });
|
|
|
+ if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
+ resVo = Object;
|
|
|
+ return resVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(departNames);
|
|
|
+ List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(departNames);
|
|
|
+ tasknoList.addAll(ZrbmTasknoList);
|
|
|
+ tasknoList.addAll(XdbmTasknoList);
|
|
|
+ if (tasknoList.isEmpty()) return resVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (depart == null) {
|
|
|
+ depart = "Boss";
|
|
|
+ Object cacheObject = redisUtil.get(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + depart + ":" + role);
|
|
|
+ ContractChartInfoVo Object = JSONObject.parseObject(JSONObject.toJSONString(cacheObject), new TypeReference<ContractChartInfoVo>() {
|
|
|
+ });
|
|
|
+ if (ObjectUtils.isNotEmpty(cacheObject)) {
|
|
|
+ resVo = Object;
|
|
|
+ return resVo;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
List<ContractAmount> contractAmountList;
|
|
|
if (YEAR.equals(Time)) {
|
|
|
- contractAmountList = exchangeMapper.getContractAmountandNumByYear(tasknoList, beginDate, endDate);
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ contractAmountList = exchangeMapper.getContractAmountandNumByYear(tasknoList, beginDate, endDate);
|
|
|
+ } else {
|
|
|
+ contractAmountList = exchangeMapper.getContractAmountandNumByYearIfBoss(tasknoList, beginDate, endDate);
|
|
|
+ }
|
|
|
} else {
|
|
|
- contractAmountList = exchangeMapper.getContractAmountandNumByMonth(tasknoList, beginDate, endDate);
|
|
|
+ if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
|
+ contractAmountList = exchangeMapper.getContractAmountandNumByMonth(tasknoList, beginDate, endDate);
|
|
|
+ } else {
|
|
|
+ contractAmountList = exchangeMapper.getContractAmountandNumByMonthIfBoss(tasknoList, beginDate, endDate);
|
|
|
+ }
|
|
|
}
|
|
|
ContractChartInfoVo newResVo = new ContractChartInfoVo();
|
|
|
for (ContractAmount amount : contractAmountList) {
|
|
@@ -769,6 +816,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
newResVo.setContractAmount(contractAmount);
|
|
|
newResVo.setContractTotal(contractTotal);
|
|
|
|
|
|
+ redisUtil.set(CacheKey.CONTRACT_CHART_INFO_DATA_REDIS_KEY + depart + ":" + role, newResVo, 1000L * 60 * 60 * 2);
|
|
|
return newResVo;
|
|
|
}
|
|
|
|