|
@@ -3,6 +3,7 @@ package org.jeecg.modules.Index.service.impl;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.alibaba.fastjson2.TypeReference;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
|
@@ -36,6 +37,7 @@ import java.text.SimpleDateFormat;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
+import java.util.concurrent.ExecutionException;
|
|
|
|
|
|
@Service
|
|
|
public class IndexServiceImpl implements IndexService {
|
|
@@ -102,7 +104,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
/*合同额一层*/
|
|
|
@Override
|
|
|
public IndexTotalVo getTotalIncome(HttpServletRequest request) {
|
|
|
-
|
|
|
String userNameByToken = JwtUtil.getUserNameByToken(request);
|
|
|
LoginUser sysUser = sysBaseApi.getUserByName(userNameByToken);
|
|
|
String role = commonMethod.getRole(userNameByToken);
|
|
@@ -1397,39 +1398,6 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取年月列表
|
|
|
- *
|
|
|
- * @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);
|
|
|
- try {
|
|
|
- // 转化成日期类型
|
|
|
- Date startDate = sdf.parse(startString);
|
|
|
- Date endDate = sdf.parse(endString);
|
|
|
- while (startDate.getTime() <= endDate.getTime()) {
|
|
|
- // 把日期添加到集合
|
|
|
- timeRangeList.add(sdf.format(startDate));
|
|
|
- // 设置日期
|
|
|
- calendar.setTime(startDate);
|
|
|
- //把日期增加一天
|
|
|
- if (timeType.equals("year")) {
|
|
|
- calendar.add(Calendar.YEAR, 1);
|
|
|
- } else if (timeType.equals("month")) {
|
|
|
- calendar.add(Calendar.MONTH, 1);
|
|
|
- }
|
|
|
- // 获取增加后的日期
|
|
|
- startDate = calendar.getTime();
|
|
|
- }
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- return timeRangeList;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 部门领导查部门
|
|
|
* 首页二层:前端传送IndexInfoParamDto 有三个参数,都是string类型 time 年/月 beginDate 开始日期 endDate结束日期
|
|
|
* 跟据time来按月查或按年查
|
|
@@ -1754,14 +1722,26 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 首页一层 利润额
|
|
|
- * 年总利润、上一年同期总利润、年同比、当月总利润、当月同比、当月环比
|
|
|
- * 通过登录的用户找到角色,根据角色来判断部门,根据部门和实际完成时间选择任务列表,根据任务列表计算利润额
|
|
|
+ * 测试sl
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public IndexTotalVo getLreByRole() {
|
|
|
- //初始化
|
|
|
+ public List<String> testSl(){
|
|
|
+ List<String> tasknoList = new ArrayList<>();
|
|
|
+ System.out.println(tasknoList);
|
|
|
+
|
|
|
+ return tasknoList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页一层利润额参数类 IndexTotalVo 初始化
|
|
|
+ */
|
|
|
+ public IndexTotalVo indexTotalVoInit(){
|
|
|
IndexTotalVo indexTotalVo = new IndexTotalVo();
|
|
|
BigDecimal initValue = BigDecimal.valueOf(0);
|
|
|
indexTotalVo.setYearTotal(initValue);
|
|
@@ -1770,30 +1750,700 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexTotalVo.setMonthTotal(initValue);
|
|
|
indexTotalVo.setMonthTb(initValue);
|
|
|
indexTotalVo.setMonthHb(initValue);
|
|
|
+ return indexTotalVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页一层获取利润额 所长权限
|
|
|
+ * 年总利润、上一年同期总利润、年同比、当月总利润、当月同比、当月环比
|
|
|
+ */
|
|
|
+ public IndexTotalVo getLreOne(List<String> departNames){
|
|
|
+ //初始化
|
|
|
+ IndexTotalVo indexTotalVo = indexTotalVoInit();
|
|
|
+
|
|
|
+ //起线程 同时查找当年上一年当月上个月去年同期月份的任务号并计算利润额
|
|
|
+ CompletableFuture<BigDecimal> futureCurrYear = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit = BigDecimal.valueOf(0);
|
|
|
+ //1.根据实际时间查询任务列表
|
|
|
+ List<String> taskNoListCurrYear = indexMapper.getTaskNoByDepSjCurrYear(departNames);
|
|
|
+ System.out.println("当年的任务列表为:");
|
|
|
+ System.out.println(taskNoListCurrYear);
|
|
|
+ if(taskNoListCurrYear.isEmpty()) return lreinit;
|
|
|
+ BigDecimal lreCurrYear = indexMapper.getLreByTaskNoStatus(taskNoListCurrYear);
|
|
|
+ System.out.println("当年的利润额为:");
|
|
|
+ System.out.println(lreCurrYear);
|
|
|
+ if(ObjectUtils.isEmpty(lreCurrYear)) return lreinit;
|
|
|
+ return lreCurrYear;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureLastYear = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit2 = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListLastYear = indexMapper.getTaskNoByDepSjLastYear(departNames);
|
|
|
+ System.out.println("上一年的任务列表为:");
|
|
|
+ System.out.println(taskNoListLastYear);
|
|
|
+ if(taskNoListLastYear.isEmpty()) return lreinit2;
|
|
|
+ BigDecimal lreLastYear = indexMapper.getLreByTaskNoStatus(taskNoListLastYear);
|
|
|
+ System.out.println("上一年的利润额为:");
|
|
|
+ System.out.println(lreLastYear);
|
|
|
+ if(ObjectUtils.isEmpty(lreLastYear)) return lreinit2;
|
|
|
+ return lreLastYear;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureCurrMonth = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit3 = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListCurrMonth = indexMapper.getTaskNoByDepSjCurrMonth(departNames);
|
|
|
+ System.out.println("当月的任务列表为:");
|
|
|
+ System.out.println(taskNoListCurrMonth);
|
|
|
+ if(taskNoListCurrMonth.isEmpty()) return lreinit3;
|
|
|
+ BigDecimal lreCurrMonth = indexMapper.getLreByTaskNoStatus(taskNoListCurrMonth);
|
|
|
+ System.out.println("当月的利润额为:");
|
|
|
+ System.out.println(lreCurrMonth);
|
|
|
+ if(ObjectUtils.isEmpty(lreCurrMonth)) return lreinit3;
|
|
|
+ return lreCurrMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureLastMonth = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit4 = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListLastMonth = indexMapper.getTaskNoByDepSjLastMonth(departNames);
|
|
|
+ System.out.println("上个月的任务列表为:");
|
|
|
+ System.out.println(taskNoListLastMonth);
|
|
|
+ if(taskNoListLastMonth.isEmpty()) return lreinit4;
|
|
|
+ BigDecimal lreLastMonth = indexMapper.getLreByTaskNoStatus(taskNoListLastMonth);
|
|
|
+ System.out.println("上个月的利润额为:");
|
|
|
+ System.out.println(lreLastMonth);
|
|
|
+ if(ObjectUtils.isEmpty(lreLastMonth)) return lreinit4;
|
|
|
+ return lreLastMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureTqMonth = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit5 = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListTqMonth = indexMapper.getTaskNoByDepSjTqMonth(departNames);
|
|
|
+ System.out.println("去年同期月份的任务列表为:");
|
|
|
+ System.out.println(taskNoListTqMonth);
|
|
|
+ if(taskNoListTqMonth.isEmpty()) return lreinit5;
|
|
|
+ BigDecimal lreTqMonth = indexMapper.getLreByTaskNoStatus(taskNoListTqMonth);
|
|
|
+ System.out.println("去年同期月份的利润额为:");
|
|
|
+ System.out.println(lreTqMonth);
|
|
|
+ if(ObjectUtils.isEmpty(lreTqMonth)) return lreinit5;
|
|
|
+ return lreTqMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<Void> future = CompletableFuture.allOf(futureCurrYear, futureLastYear, futureCurrMonth, futureLastMonth, futureTqMonth);
|
|
|
+ future.join();
|
|
|
+ BigDecimal lreCurrYear = futureCurrYear.join();
|
|
|
+ BigDecimal lreLastYear = futureLastYear.join();
|
|
|
+ BigDecimal lreCurrMonth = futureCurrMonth.join();
|
|
|
+ BigDecimal lreLastMonth = futureLastMonth.join();
|
|
|
+ BigDecimal lreTqMonth = futureTqMonth.join();
|
|
|
+
|
|
|
+ indexTotalVo.setYearTotal(lreCurrYear.setScale(2,RoundingMode.HALF_UP));
|
|
|
+ indexTotalVo.setYearTq(lreLastYear.setScale(2,RoundingMode.HALF_UP));
|
|
|
+ indexTotalVo.setMonthTotal(lreCurrMonth.setScale(2,RoundingMode.HALF_UP));
|
|
|
+
|
|
|
+ //起线程 同时计算年同比、月环比、月同比
|
|
|
+ CompletableFuture<BigDecimal> futureTbYear = CompletableFuture.supplyAsync(() -> {
|
|
|
+ //去年同比
|
|
|
+ BigDecimal subYear = lreCurrYear.subtract(lreLastYear);
|
|
|
+ BigDecimal tbGrowthYear = BigDecimal.valueOf(1);
|
|
|
+ if (lreLastYear.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
+ tbGrowthYear = subYear.divide(lreLastYear, 2, RoundingMode.HALF_UP);
|
|
|
+ return tbGrowthYear;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureHbMonth = CompletableFuture.supplyAsync(() -> {
|
|
|
+ //月环比
|
|
|
+ BigDecimal subMonth = lreCurrMonth.subtract(lreLastMonth);
|
|
|
+ BigDecimal hbGrowthMonth = BigDecimal.valueOf(1);
|
|
|
+ if (lreLastMonth.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
+ hbGrowthMonth = subMonth.divide(lreLastMonth, 2, RoundingMode.HALF_UP);
|
|
|
+ return hbGrowthMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureTbMonth = CompletableFuture.supplyAsync(() -> {
|
|
|
+ //月同比
|
|
|
+ BigDecimal subMonth = lreCurrMonth.subtract(lreTqMonth);
|
|
|
+ BigDecimal tbGrowthMonth = BigDecimal.valueOf(1);
|
|
|
+ if (lreTqMonth.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
+ tbGrowthMonth = subMonth.divide(lreTqMonth, 2, RoundingMode.HALF_UP);
|
|
|
+ return tbGrowthMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(futureTbYear, futureHbMonth, futureTbMonth);
|
|
|
+ future1.join();
|
|
|
+ BigDecimal tbGrowthYear = futureTbYear.join();
|
|
|
+ BigDecimal hbGrowthMonth = futureHbMonth.join();
|
|
|
+ BigDecimal tbGrowthMonth = futureTbMonth.join();
|
|
|
+ indexTotalVo.setYearTb(tbGrowthYear.setScale(2,RoundingMode.HALF_UP));
|
|
|
+ indexTotalVo.setMonthHb(hbGrowthMonth.setScale(2,RoundingMode.HALF_UP));
|
|
|
+ indexTotalVo.setMonthTb(tbGrowthMonth.setScale(2,RoundingMode.HALF_UP));
|
|
|
+
|
|
|
+ return indexTotalVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页一层获取利润额 部门领导权限
|
|
|
+ * 年总利润、上一年同期总利润、年同比、当月总利润、当月同比、当月环比
|
|
|
+ */
|
|
|
+ public IndexTotalVo getLreAllOne(){
|
|
|
+ //初始化
|
|
|
+ IndexTotalVo indexTotalVo = indexTotalVoInit();
|
|
|
+
|
|
|
+ //起线程 同时查找当年上一年当月上个月去年同期月份的任务号并计算利润额
|
|
|
+ CompletableFuture<BigDecimal> futureCurrYear = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit = BigDecimal.valueOf(0);
|
|
|
+ //1.根据实际时间查询任务列表
|
|
|
+ List<String> taskNoListCurrYear = indexMapper.getTaskNoBySjCurrYear();
|
|
|
+ System.out.println("当年的任务列表为:");
|
|
|
+ System.out.println(taskNoListCurrYear);
|
|
|
+ if(taskNoListCurrYear.isEmpty()) return lreinit;
|
|
|
+ BigDecimal lreCurrYear = indexMapper.getLreByTaskNoStatus(taskNoListCurrYear);
|
|
|
+ System.out.println("当年的利润额为:");
|
|
|
+ System.out.println(lreCurrYear);
|
|
|
+ if(ObjectUtils.isEmpty(lreCurrYear)) return lreinit;
|
|
|
+ return lreCurrYear;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureLastYear = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit2 = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListLastYear = indexMapper.getTaskNoBySjLastYear();
|
|
|
+ System.out.println("上一年的任务列表为:");
|
|
|
+ System.out.println(taskNoListLastYear);
|
|
|
+ if(taskNoListLastYear.isEmpty()) return lreinit2;
|
|
|
+ BigDecimal lreLastYear = indexMapper.getLreByTaskNoStatus(taskNoListLastYear);
|
|
|
+ System.out.println("上一年的利润额为:");
|
|
|
+ System.out.println(lreLastYear);
|
|
|
+ if(ObjectUtils.isEmpty(lreLastYear)) return lreinit2;
|
|
|
+ return lreLastYear;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureCurrMonth = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit3 = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListCurrMonth = indexMapper.getTaskNoBySjCurrMonth();
|
|
|
+ System.out.println("当月的任务列表为:");
|
|
|
+ System.out.println(taskNoListCurrMonth);
|
|
|
+ if(taskNoListCurrMonth.isEmpty()) return lreinit3;
|
|
|
+ BigDecimal lreCurrMonth = indexMapper.getLreByTaskNoStatus(taskNoListCurrMonth);
|
|
|
+ System.out.println("当月的利润额为:");
|
|
|
+ System.out.println(lreCurrMonth);
|
|
|
+ if(ObjectUtils.isEmpty(lreCurrMonth)) return lreinit3;
|
|
|
+ return lreCurrMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureLastMonth = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit4 = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListLastMonth = indexMapper.getTaskNoBySjLastMonth();
|
|
|
+ System.out.println("上个月的任务列表为:");
|
|
|
+ System.out.println(taskNoListLastMonth);
|
|
|
+ if(taskNoListLastMonth.isEmpty()) return lreinit4;
|
|
|
+ BigDecimal lreLastMonth = indexMapper.getLreByTaskNoStatus(taskNoListLastMonth);
|
|
|
+ System.out.println("上个月的利润额为:");
|
|
|
+ System.out.println(lreLastMonth);
|
|
|
+ if(ObjectUtils.isEmpty(lreLastMonth)) return lreinit4;
|
|
|
+ return lreLastMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureTqMonth = CompletableFuture.supplyAsync(() ->{
|
|
|
+ BigDecimal lreinit5 = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListTqMonth = indexMapper.getTaskNoBySjTqMonth();
|
|
|
+ System.out.println("去年同期月份的任务列表为:");
|
|
|
+ System.out.println(taskNoListTqMonth);
|
|
|
+ if(taskNoListTqMonth.isEmpty()) return lreinit5;
|
|
|
+ BigDecimal lreTqMonth = indexMapper.getLreByTaskNoStatus(taskNoListTqMonth);
|
|
|
+ System.out.println("去年同期月份的利润额为:");
|
|
|
+ System.out.println(lreTqMonth);
|
|
|
+ if(ObjectUtils.isEmpty(lreTqMonth)) return lreinit5;
|
|
|
+ return lreTqMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<Void> future = CompletableFuture.allOf(futureCurrYear, futureLastYear, futureCurrMonth, futureLastMonth, futureTqMonth);
|
|
|
+ future.join();
|
|
|
+ BigDecimal lreCurrYear = futureCurrYear.join();
|
|
|
+ BigDecimal lreLastYear = futureLastYear.join();
|
|
|
+ BigDecimal lreCurrMonth = futureCurrMonth.join();
|
|
|
+ BigDecimal lreLastMonth = futureLastMonth.join();
|
|
|
+ BigDecimal lreTqMonth = futureTqMonth.join();
|
|
|
+
|
|
|
+ indexTotalVo.setYearTotal(lreCurrYear.setScale(2,RoundingMode.HALF_UP));
|
|
|
+ indexTotalVo.setYearTq(lreLastYear.setScale(2,RoundingMode.HALF_UP));
|
|
|
+ indexTotalVo.setMonthTotal(lreCurrMonth.setScale(2,RoundingMode.HALF_UP));
|
|
|
+
|
|
|
+ //起线程 同时计算年同比、月环比、月同比
|
|
|
+ CompletableFuture<BigDecimal> futureTbYear = CompletableFuture.supplyAsync(() -> {
|
|
|
+ //去年同比
|
|
|
+ BigDecimal subYear = lreCurrYear.subtract(lreLastYear);
|
|
|
+ BigDecimal tbGrowthYear = BigDecimal.valueOf(1);
|
|
|
+ if (lreLastYear.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
+ tbGrowthYear = subYear.divide(lreLastYear, 2, RoundingMode.HALF_UP);
|
|
|
+ return tbGrowthYear;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureHbMonth = CompletableFuture.supplyAsync(() -> {
|
|
|
+ //月环比
|
|
|
+ BigDecimal subMonth = lreCurrMonth.subtract(lreLastMonth);
|
|
|
+ BigDecimal hbGrowthMonth = BigDecimal.valueOf(1);
|
|
|
+ if (lreLastMonth.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
+ hbGrowthMonth = subMonth.divide(lreLastMonth, 2, RoundingMode.HALF_UP);
|
|
|
+ return hbGrowthMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<BigDecimal> futureTbMonth = CompletableFuture.supplyAsync(() -> {
|
|
|
+ //月同比
|
|
|
+ BigDecimal subMonth = lreCurrMonth.subtract(lreTqMonth);
|
|
|
+ BigDecimal tbGrowthMonth = BigDecimal.valueOf(1);
|
|
|
+ if (lreTqMonth.compareTo(BigDecimal.valueOf(0)) != 0)
|
|
|
+ tbGrowthMonth = subMonth.divide(lreTqMonth, 2, RoundingMode.HALF_UP);
|
|
|
+ return tbGrowthMonth;
|
|
|
+ });
|
|
|
+ CompletableFuture<Void> future1 = CompletableFuture.allOf(futureTbYear, futureHbMonth, futureTbMonth);
|
|
|
+ future1.join();
|
|
|
+ BigDecimal tbGrowthYear = futureTbYear.join();
|
|
|
+ BigDecimal hbGrowthMonth = futureHbMonth.join();
|
|
|
+ BigDecimal tbGrowthMonth = futureTbMonth.join();
|
|
|
+ indexTotalVo.setYearTb(tbGrowthYear.setScale(2,RoundingMode.HALF_UP));
|
|
|
+ indexTotalVo.setMonthHb(hbGrowthMonth.setScale(2,RoundingMode.HALF_UP));
|
|
|
+ indexTotalVo.setMonthTb(tbGrowthMonth.setScale(2,RoundingMode.HALF_UP));
|
|
|
+
|
|
|
+ return indexTotalVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页二层参数类的初始化
|
|
|
+ */
|
|
|
+ public IndexChartInfoVo<BigDecimal> indexChartInfoVoInit(){
|
|
|
+ //初始化
|
|
|
+ IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
|
|
|
+ //创建一个String列表用来存储横坐标日期
|
|
|
+ List<String> timeRangeList = new ArrayList<>();
|
|
|
+ //创建一个BigDecimal列表用来存储纵坐标利润
|
|
|
+ List<BigDecimal> seriesDataList = new ArrayList<>();
|
|
|
+ //初始化横纵列表都是一个空列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+ return indexChartInfoVo;
|
|
|
+ }
|
|
|
|
|
|
-// //获取角色
|
|
|
-// List<String> roleId = getRolesBySysUser();
|
|
|
-// //如果是所长,查看所有 部门领导查看本部门 员工后期增加
|
|
|
-// if(roleId.contains(AuthMark.BOSS)){
|
|
|
-// indexTotalVo = countLreAll();
|
|
|
-// }
|
|
|
-// else if(roleId.contains(AuthMark.DEPT_LEADER)){
|
|
|
-// indexTotalVo = countLre();
|
|
|
-// }
|
|
|
+ /**
|
|
|
+ * 获取年月列表
|
|
|
+ *
|
|
|
+ * @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);
|
|
|
+ try {
|
|
|
+ // 转化成日期类型
|
|
|
+ Date startDate = sdf.parse(startString);
|
|
|
+ Date endDate = sdf.parse(endString);
|
|
|
+ while (startDate.getTime() <= endDate.getTime()) {
|
|
|
+ // 把日期添加到集合
|
|
|
+ timeRangeList.add(sdf.format(startDate));
|
|
|
+ // 设置日期
|
|
|
+ calendar.setTime(startDate);
|
|
|
+ //把日期增加一天
|
|
|
+ if (timeType.equals("year")) {
|
|
|
+ calendar.add(Calendar.YEAR, 1);
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
+ calendar.add(Calendar.MONTH, 1);
|
|
|
+ }
|
|
|
+ // 获取增加后的日期
|
|
|
+ startDate = calendar.getTime();
|
|
|
+ }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return timeRangeList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页二层获取利润额 所长权限
|
|
|
+ * 某段时间内的利润
|
|
|
+ */
|
|
|
+ public IndexChartInfoVo<BigDecimal> getLreAllByDate(IndexInfoParamDto indexInfoParamDto){
|
|
|
+ //初始化
|
|
|
+ IndexChartInfoVo<BigDecimal> indexChartInfoVo = indexChartInfoVoInit();
|
|
|
+ BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
|
|
|
+ //创建一个String列表用来存储横坐标日期
|
|
|
+ List<String> timeRangeList = new ArrayList<>();
|
|
|
+ //创建一个BigDecimal列表用来存储纵坐标利润
|
|
|
+ List<BigDecimal> seriesDataList = new ArrayList<>();
|
|
|
+ //得到日期列表
|
|
|
+ //年/月
|
|
|
+ String timeType = indexInfoParamDto.getTime();
|
|
|
+ //起始时间
|
|
|
+ String startString = indexInfoParamDto.getBeginDate();
|
|
|
+ //结束时间
|
|
|
+ String endString = indexInfoParamDto.getEndDate();
|
|
|
+ if (timeType.equals("year")) {
|
|
|
+ timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
+ timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
|
|
|
+ }
|
|
|
+ System.out.println("获取的日期列表为:");
|
|
|
+ System.out.println(timeRangeList);
|
|
|
+ if (timeRangeList.isEmpty()) return indexChartInfoVo;//日期为空,直接传回两个空list
|
|
|
+ //根据日期长度初始化纵坐标值 0
|
|
|
+ for (String timeRange : timeRangeList) {
|
|
|
+ seriesDataList.add(initValue);
|
|
|
+ }
|
|
|
+ //添加横坐标列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ //添加纵坐标列表
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+
|
|
|
+ //创建CompletableFuture集合,因为allOf()方法参数可变参数
|
|
|
+ List<CompletableFuture<BigDecimal>> futures = new ArrayList<>();
|
|
|
+ for(String timeRange2:timeRangeList){
|
|
|
+ CompletableFuture<BigDecimal> future = CompletableFuture.supplyAsync(() -> {
|
|
|
+ // 子线程处理任务
|
|
|
+ BigDecimal lreinit = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListBysj = new ArrayList<>();
|
|
|
+ if (timeType.equals("year")) {
|
|
|
+ //1.根据实际时间查询任务列表
|
|
|
+ taskNoListBysj = indexMapper.getKyTaskNoAllByYear(timeRange2);
|
|
|
+// System.out.println(timeRange2 + "年的任务列表为:");
|
|
|
+// System.out.println(taskNoListBysj);
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
+ taskNoListBysj = indexMapper.getKyTaskNoAllByMonth(timeRange2);
|
|
|
+// System.out.println(timeRange2 + "月的任务列表为:");
|
|
|
+// System.out.println(taskNoListBysj);
|
|
|
+ }
|
|
|
+ if(taskNoListBysj.isEmpty()) return lreinit;
|
|
|
+ BigDecimal lreYear = indexMapper.getLreByTaskNoStatus(taskNoListBysj);
|
|
|
+// System.out.println(timeRange2 + "的利润额为:");
|
|
|
+// System.out.println(lreYear);
|
|
|
+ if(ObjectUtils.isEmpty(lreYear)) return lreinit;
|
|
|
+ return lreYear;
|
|
|
+ });
|
|
|
+ futures.add(future);
|
|
|
+ }
|
|
|
+ //allOf() 方法可以用于等待所有 CompletableFuture 对象的计算结果
|
|
|
+ CompletableFuture<Void> futureAll = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
|
|
+ futureAll.join();
|
|
|
+ List<BigDecimal> seriesDataList2 = new ArrayList<>();
|
|
|
+ futures.forEach(i -> {
|
|
|
+ try{
|
|
|
+ seriesDataList2.add(i.get());
|
|
|
+ }
|
|
|
+ catch (InterruptedException | ExecutionException e){
|
|
|
+ seriesDataList2.add(initValue);//出现异常当前利润额赋为0
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ System.out.println("获取的利润额列表为:");
|
|
|
+ System.out.println(seriesDataList2);
|
|
|
+
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList2);
|
|
|
+
|
|
|
+ return indexChartInfoVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页二层获取利润额 部门领导权限
|
|
|
+ * 某段时间内的利润
|
|
|
+ */
|
|
|
+ public IndexChartInfoVo<BigDecimal> getLreByDate(IndexInfoParamDto indexInfoParamDto, String userId){
|
|
|
+ //初始化
|
|
|
+ IndexChartInfoVo<BigDecimal> indexChartInfoVo = indexChartInfoVoInit();
|
|
|
+ BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
|
|
|
+ //创建一个String列表用来存储横坐标日期
|
|
|
+ List<String> timeRangeList = new ArrayList<>();
|
|
|
+ //创建一个BigDecimal列表用来存储纵坐标利润
|
|
|
+ List<BigDecimal> seriesDataList = new ArrayList<>();
|
|
|
+ //得到日期列表
|
|
|
+ //年/月
|
|
|
+ String timeType = indexInfoParamDto.getTime();
|
|
|
+ //起始时间
|
|
|
+ String startString = indexInfoParamDto.getBeginDate();
|
|
|
+ //结束时间
|
|
|
+ String endString = indexInfoParamDto.getEndDate();
|
|
|
+ if (timeType.equals("year")) {
|
|
|
+ timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
+ timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
|
|
|
+ }
|
|
|
+ System.out.println("获取的日期列表为:");
|
|
|
+ System.out.println(timeRangeList);
|
|
|
+ if (timeRangeList.isEmpty()) return indexChartInfoVo;//日期为空,直接传回两个空list
|
|
|
+ //根据日期长度初始化纵坐标值 0
|
|
|
+ for (String timeRange : timeRangeList) {
|
|
|
+ seriesDataList.add(initValue);
|
|
|
+ }
|
|
|
+ //添加横坐标列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ //添加纵坐标列表
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+
|
|
|
+ //获取部门名称列表
|
|
|
+ List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(userId);
|
|
|
+ if(departNames.isEmpty()) return indexChartInfoVo;
|
|
|
+
|
|
|
+ //创建CompletableFuture集合,因为allOf()方法参数可变参数
|
|
|
+ List<CompletableFuture<BigDecimal>> futures = new ArrayList<>();
|
|
|
+ for(String timeRange2:timeRangeList){
|
|
|
+ CompletableFuture<BigDecimal> future = CompletableFuture.supplyAsync(() -> {
|
|
|
+ // 子线程处理任务
|
|
|
+ BigDecimal lreinit = BigDecimal.valueOf(0);
|
|
|
+ List<String> taskNoListBysj = new ArrayList<>();
|
|
|
+ if (timeType.equals("year")) {
|
|
|
+ //1.根据实际时间查询任务列表
|
|
|
+ taskNoListBysj = indexMapper.getKyTaskNoAllByDepYear(departNames, timeRange2);
|
|
|
+// System.out.println(timeRange2 + "年的任务列表为:");
|
|
|
+// System.out.println(taskNoListBysj);
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
+ taskNoListBysj = indexMapper.getKyTaskNoAllByDepMonth(departNames, timeRange2);
|
|
|
+// System.out.println(timeRange2 + "月的任务列表为:");
|
|
|
+// System.out.println(taskNoListBysj);
|
|
|
+ }
|
|
|
+ if(taskNoListBysj.isEmpty()) return lreinit;
|
|
|
+ BigDecimal lreYear = indexMapper.getLreByTaskNoStatus(taskNoListBysj);
|
|
|
+// System.out.println(timeRange2 + "的利润额为:");
|
|
|
+// System.out.println(lreYear);
|
|
|
+ if(ObjectUtils.isEmpty(lreYear)) return lreinit;
|
|
|
+ return lreYear;
|
|
|
+ });
|
|
|
+ futures.add(future);
|
|
|
+ }
|
|
|
+ //allOf() 方法可以用于等待所有 CompletableFuture 对象的计算结果
|
|
|
+ CompletableFuture<Void> futureAll = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
|
|
+ futureAll.join();
|
|
|
+ List<BigDecimal> seriesDataList2 = new ArrayList<>();
|
|
|
+ futures.forEach(i -> {
|
|
|
+ try{
|
|
|
+ seriesDataList2.add(i.get());
|
|
|
+ }
|
|
|
+ catch (InterruptedException | ExecutionException e){
|
|
|
+ seriesDataList2.add(initValue);//出现异常当前利润额赋为0
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ System.out.println("获取的利润额列表为:");
|
|
|
+ System.out.println(seriesDataList2);
|
|
|
+
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList2);
|
|
|
+
|
|
|
+ return indexChartInfoVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页二层获取已收款 所长权限
|
|
|
+ * 某段时间的已收款
|
|
|
+ *
|
|
|
+ * @param indexInfoParamDto
|
|
|
+ * @return IndexChartInfoVo<BigDecimal>
|
|
|
+ */
|
|
|
+ public IndexChartInfoVo<BigDecimal> getTotalReceivedAllByDate(IndexInfoParamDto indexInfoParamDto){
|
|
|
+ //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
|
|
|
+ IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
|
|
|
+ BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
|
|
|
+ //创建一个String列表用来存储横坐标日期
|
|
|
+ List<String> timeRangeList = new ArrayList<>();
|
|
|
+ //创建一个BigDecimal列表用来存储纵坐标利润
|
|
|
+ List<BigDecimal> seriesDataList = new ArrayList<>();
|
|
|
+ //初始化传一个空列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+ //2.计算时间列表 横坐标时间string列表
|
|
|
+ //年/月
|
|
|
+ String timeType = indexInfoParamDto.getTime();
|
|
|
+ //起始时间
|
|
|
+ String startString = indexInfoParamDto.getBeginDate();
|
|
|
+ //结束时间
|
|
|
+ String endString = indexInfoParamDto.getEndDate();
|
|
|
+ if(timeType.equals("year")){
|
|
|
+ timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
|
|
|
+ }
|
|
|
+ else if (timeType.equals("month")){
|
|
|
+ timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
|
|
|
+ }
|
|
|
+ System.out.println("获取的日期列表为:");
|
|
|
+ System.out.println(timeRangeList);
|
|
|
+ if (timeRangeList.isEmpty()) return indexChartInfoVo;//日期为空,直接传回两个空list
|
|
|
+ //根据日期长度初始化纵坐标值 0
|
|
|
+ for(String timeRange:timeRangeList){
|
|
|
+ seriesDataList.add(initValue);
|
|
|
+ }
|
|
|
+ //添加横坐标列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ //添加纵坐标列表
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+
|
|
|
+// List<String> tasknoList = projectCostMapper.queryTasknoListAll();
|
|
|
+// System.out.println("查到的所有部门对应的任务号列表:");
|
|
|
+// System.out.println(tasknoList);
|
|
|
+// if (tasknoList.isEmpty()) return indexChartInfoVo;
|
|
|
+// System.out.println(indexChartInfoVo);
|
|
|
+
|
|
|
+ //4.计算该时间列表中某年或某月对应的总收款
|
|
|
+ //创建CompletableFuture集合,因为allOf()方法参数可变参数
|
|
|
+ List<CompletableFuture<BigDecimal>> futures = new ArrayList<>();
|
|
|
+ for(String timeRange2:timeRangeList){
|
|
|
+ CompletableFuture<BigDecimal> future = CompletableFuture.supplyAsync(() -> {
|
|
|
+ // 子线程处理任务
|
|
|
+ BigDecimal yearTotal = initValue;
|
|
|
+ if (timeType.equals("year")) {
|
|
|
+ //1.根据实际时间查询任务列表
|
|
|
+ yearTotal = exchangeMapper.getReceivedAllByYear(timeRange2);
|
|
|
+ if(yearTotal == null){
|
|
|
+ yearTotal = initValue;
|
|
|
+ }
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
+ yearTotal = exchangeMapper.getReceivedAllByYMonth(timeRange2);
|
|
|
+ if(yearTotal == null){
|
|
|
+ yearTotal = initValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+// System.out.println(timeRange2 + "的总收款为:");
|
|
|
+// System.out.println(yearTotal);
|
|
|
+ if(ObjectUtils.isEmpty(yearTotal)) return initValue;
|
|
|
+ return yearTotal;
|
|
|
+ });
|
|
|
+ futures.add(future);
|
|
|
+ }
|
|
|
+ //allOf() 方法可以用于等待所有 CompletableFuture 对象的计算结果
|
|
|
+ CompletableFuture<Void> futureAll = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
|
|
+ futureAll.join();
|
|
|
+ List<BigDecimal> seriesDataList2 = new ArrayList<>();
|
|
|
+ futures.forEach(i -> {
|
|
|
+ try{
|
|
|
+ seriesDataList2.add(i.get());
|
|
|
+ }
|
|
|
+ catch (InterruptedException | ExecutionException e){
|
|
|
+ seriesDataList2.add(initValue);//出现异常当前利润额赋为0
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ System.out.println("获取的已收款列表为:");
|
|
|
+ System.out.println(seriesDataList2);
|
|
|
+
|
|
|
+ //添加横纵坐标列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList2);
|
|
|
+ return indexChartInfoVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页二层获取已收款 部门领导权限
|
|
|
+ * 首页二层:前端传送IndexInfoParamDto 有三个参数,都是string类型 time 年/月 beginDate 开始日期 endDate结束日期
|
|
|
+ * 跟据time来按月查或按年查
|
|
|
+ *
|
|
|
+ * @param indexInfoParamDto
|
|
|
+ * @return IndexChartInfoVo<BigDecimal>
|
|
|
+ */
|
|
|
+ public IndexChartInfoVo<BigDecimal> getTotalReceivedByDate(IndexInfoParamDto indexInfoParamDto, String userId){
|
|
|
+ //1.创建一个IndexChartInfoVo实例用来存储最后返回前端的信息
|
|
|
+ IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
|
|
|
+ BigDecimal initValue = BigDecimal.valueOf(0); //某年或某月没有任务,已收款为0
|
|
|
+ //创建一个String列表用来存储横坐标日期
|
|
|
+ List<String> timeRangeList = new ArrayList<>();
|
|
|
+ //创建一个BigDecimal列表用来存储纵坐标利润
|
|
|
+ List<BigDecimal> seriesDataList = new ArrayList<>();
|
|
|
+ //初始化传一个空列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+ //2.计算时间列表 横坐标时间string列表
|
|
|
+ //年/月
|
|
|
+ String timeType = indexInfoParamDto.getTime();
|
|
|
+ //起始时间
|
|
|
+ String startString = indexInfoParamDto.getBeginDate();
|
|
|
+ //结束时间
|
|
|
+ String endString = indexInfoParamDto.getEndDate();
|
|
|
+ if (timeType.equals("year")) {
|
|
|
+ timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy", timeType);
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
+ timeRangeList = getDateList(timeRangeList, startString, endString, "yyyy-MM", timeType);
|
|
|
+ }
|
|
|
+ System.out.println("获取的日期列表为:");
|
|
|
+ System.out.println(timeRangeList);
|
|
|
+ if (timeRangeList.isEmpty()) return indexChartInfoVo;//日期为空,直接传回两个空list
|
|
|
+ //根据日期长度初始化纵坐标值 0
|
|
|
+ for (String timeRange : timeRangeList) {
|
|
|
+ seriesDataList.add(initValue);
|
|
|
+ }
|
|
|
+ //添加横坐标列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ //添加纵坐标列表
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+
|
|
|
+ //3.通过登录的用户找到相应的部门,可能一个或两个
|
|
|
+ //获取部门名称列表
|
|
|
+ List<String> sysDepartNames = sysDepartMapper.getSysUserOfDepartNameList(userId);
|
|
|
+ if(sysDepartNames.isEmpty()) return indexChartInfoVo;
|
|
|
+
|
|
|
+ ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
+ List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(sysDepartNames);
|
|
|
+ List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(sysDepartNames);
|
|
|
+ tasknoList.addAll(ZrbmTasknoList);
|
|
|
+ tasknoList.addAll(XdbmTasknoList);
|
|
|
+ System.out.println("查到的所有部门对应的任务号列表:");
|
|
|
+ System.out.println(tasknoList);
|
|
|
+ if (tasknoList.isEmpty()) return indexChartInfoVo;
|
|
|
+// System.out.println(indexChartInfoVo);
|
|
|
+
|
|
|
+ //4.计算该时间列表中某年或某月对应的总收款
|
|
|
+ //创建CompletableFuture集合,因为allOf()方法参数可变参数
|
|
|
+ List<CompletableFuture<BigDecimal>> futures = new ArrayList<>();
|
|
|
+ for(String timeRange2:timeRangeList){
|
|
|
+ CompletableFuture<BigDecimal> future = CompletableFuture.supplyAsync(() -> {
|
|
|
+ // 子线程处理任务
|
|
|
+ BigDecimal yearTotal = initValue;
|
|
|
+ if (timeType.equals("year")) {
|
|
|
+ //1.根据实际时间查询任务列表
|
|
|
+ yearTotal = exchangeMapper.getReceivedByYear(tasknoList, timeRange2);
|
|
|
+ if(yearTotal == null){
|
|
|
+ yearTotal = initValue;
|
|
|
+ }
|
|
|
+ } else if (timeType.equals("month")) {
|
|
|
+ yearTotal = exchangeMapper.getReceivedByYMonth(tasknoList, timeRange2);
|
|
|
+ if(yearTotal == null){
|
|
|
+ yearTotal = initValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+// System.out.println(timeRange2 + "的总收款为:");
|
|
|
+// System.out.println(yearTotal);
|
|
|
+ if(ObjectUtils.isEmpty(yearTotal)) return initValue;
|
|
|
+ return yearTotal;
|
|
|
+ });
|
|
|
+ futures.add(future);
|
|
|
+ }
|
|
|
+ //allOf() 方法可以用于等待所有 CompletableFuture 对象的计算结果
|
|
|
+ CompletableFuture<Void> futureAll = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
|
|
+ futureAll.join();
|
|
|
+ List<BigDecimal> seriesDataList2 = new ArrayList<>();
|
|
|
+ futures.forEach(i -> {
|
|
|
+ try{
|
|
|
+ seriesDataList2.add(i.get());
|
|
|
+ }
|
|
|
+ catch (InterruptedException | ExecutionException e){
|
|
|
+ seriesDataList2.add(initValue);//出现异常当前利润额赋为0
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ System.out.println("获取的已收款列表为:");
|
|
|
+ System.out.println(seriesDataList2);
|
|
|
+
|
|
|
+ //添加横纵坐标列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList2);
|
|
|
+
|
|
|
+ return indexChartInfoVo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页一层 利润额
|
|
|
+ * 年总利润、上一年同期总利润、年同比、当月总利润、当月同比、当月环比
|
|
|
+ * 通过登录的用户找到角色,根据角色来判断部门,根据部门和实际完成时间选择任务列表,根据任务列表计算利润额
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IndexTotalVo getLreByRole() {
|
|
|
+ //初始化
|
|
|
+ IndexTotalVo indexTotalVo = indexTotalVoInit();
|
|
|
//获取角色
|
|
|
// 获取登录人用户信息 V2.0版本:
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
String role = commonMethod.getRole(sysUser.getUsername());
|
|
|
+
|
|
|
if(role == null){
|
|
|
return indexTotalVo;
|
|
|
}
|
|
|
//如果是所长,查看所有 部门领导查看本部门 员工后期增加
|
|
|
if(role.equals(AuthMark.BOSS)){
|
|
|
System.out.println("当前账户权限:所长");
|
|
|
- indexTotalVo = countLreAll();
|
|
|
+ indexTotalVo = getLreAllOne();
|
|
|
} else if (role.equals(AuthMark.DEPT_LEADER)) {
|
|
|
System.out.println("当前账户权限:部门领导");
|
|
|
- indexTotalVo = countLre();
|
|
|
+ //获取部门名称列表
|
|
|
+ List<String> departNames = sysDepartMapper.getSysUserOfDepartNameList(sysUser.getId());
|
|
|
+ if(departNames.isEmpty()) return indexTotalVo;
|
|
|
+ indexTotalVo = getLreOne(departNames);
|
|
|
}
|
|
|
return indexTotalVo;
|
|
|
}
|
|
@@ -1806,14 +2456,7 @@ public class IndexServiceImpl implements IndexService {
|
|
|
*/
|
|
|
public IndexChartInfoVo<BigDecimal> getLreDetailByRole(IndexInfoParamDto indexInfoParamDto) {
|
|
|
//初始化
|
|
|
- IndexChartInfoVo<BigDecimal> indexChartInfoVo = new IndexChartInfoVo<>();
|
|
|
- //创建一个String列表用来存储横坐标日期
|
|
|
- List<String> timeRangeList = new ArrayList<>();
|
|
|
- //创建一个BigDecimal列表用来存储纵坐标利润
|
|
|
- List<BigDecimal> seriesDataList = new ArrayList<>();
|
|
|
- //初始化横纵列表都是一个空列表
|
|
|
- indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
- indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+ IndexChartInfoVo<BigDecimal> indexChartInfoVo = indexChartInfoVoInit();
|
|
|
|
|
|
//获取角色
|
|
|
// 获取登录人用户信息 V2.0版本:
|
|
@@ -1825,10 +2468,11 @@ public class IndexServiceImpl implements IndexService {
|
|
|
//如果是所长,查看所有 部门领导查看本部门 员工后期增加
|
|
|
if(role.equals(AuthMark.BOSS)){
|
|
|
System.out.println("当前账户权限:所长");
|
|
|
- indexChartInfoVo = countLreAllByDate(indexInfoParamDto);
|
|
|
+ indexChartInfoVo = getLreAllByDate(indexInfoParamDto);
|
|
|
+// indexChartInfoVo = getLreByDate(indexInfoParamDto,sysUser.getId());
|
|
|
} else if (role.equals(AuthMark.DEPT_LEADER)) {
|
|
|
System.out.println("当前账户权限:部门领导");
|
|
|
- indexChartInfoVo = countLreByDate(indexInfoParamDto);
|
|
|
+ indexChartInfoVo = getLreByDate(indexInfoParamDto,sysUser.getId());
|
|
|
}
|
|
|
|
|
|
return indexChartInfoVo;
|
|
@@ -1863,9 +2507,12 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
//如果是所长,查看所有 部门领导查看本部门 员工后期增加
|
|
|
if(role.equals(AuthMark.BOSS)){
|
|
|
- indexChartInfoVo = countTotalReceivedAllByDate(indexInfoParamDto);
|
|
|
+ System.out.println("当前账户权限:所长");
|
|
|
+ indexChartInfoVo = getTotalReceivedAllByDate(indexInfoParamDto);
|
|
|
+// indexChartInfoVo = getTotalReceivedByDate(indexInfoParamDto, sysUser.getId());
|
|
|
} else if (role.equals(AuthMark.DEPT_LEADER)) {
|
|
|
- indexChartInfoVo = countTotalReceivedByDate(indexInfoParamDto);
|
|
|
+ System.out.println("当前账户权限:部门领导");
|
|
|
+ indexChartInfoVo = getTotalReceivedByDate(indexInfoParamDto, sysUser.getId());
|
|
|
}
|
|
|
return indexChartInfoVo;
|
|
|
}
|