|
@@ -8,7 +8,10 @@ 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.entity.pojo.LreInfoByDate;
|
|
|
+import org.jeecg.modules.Index.entity.pojo.ReceivedByDate;
|
|
|
import org.jeecg.modules.Index.mapper.IndexMapper;
|
|
|
+import org.jeecg.modules.Index.service.IndexZcbService;
|
|
|
import org.jeecg.modules.Index.util.AuthMark;
|
|
|
import org.jeecg.modules.Index.util.CacheKey;
|
|
|
import org.jeecg.modules.Index.entity.dto.IndexInfoParamDto;
|
|
@@ -80,6 +83,15 @@ public class IndexServiceImpl implements IndexService {
|
|
|
private IndexMapper indexMapper;
|
|
|
|
|
|
/**
|
|
|
+ * indexZcbMapper
|
|
|
+ */
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ private IndexZcbService indexZcbService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
* 科研任务信息表
|
|
|
*/
|
|
|
@Autowired
|
|
@@ -114,6 +126,10 @@ public class IndexServiceImpl implements IndexService {
|
|
|
incomeDataInfoVO.setMonthTotal(initValue);
|
|
|
incomeDataInfoVO.setMonthHb(initValue);
|
|
|
incomeDataInfoVO.setMonthTb(initValue);
|
|
|
+ //sl添加,计算利润额使用
|
|
|
+ incomeDataInfoVO.setMonthTq(initValue);
|
|
|
+ incomeDataInfoVO.setMonthLast(initValue);
|
|
|
+
|
|
|
|
|
|
String depart = null;
|
|
|
ArrayList<String> tasknoList = new ArrayList<>();
|
|
@@ -250,6 +266,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
incomeDataInfoVO.setYearTotal(currentYearTotal.setScale(2, RoundingMode.HALF_UP));
|
|
|
incomeDataInfoVO.setYearTq(lastYearTqTotal.setScale(2, RoundingMode.HALF_UP));
|
|
|
incomeDataInfoVO.setMonthTotal(currentMonthTotal.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //sl添加,计算利润额使用
|
|
|
+ incomeDataInfoVO.setMonthTq(lastYearMonthTqTotal);
|
|
|
+ incomeDataInfoVO.setMonthLast(lastMothTqTotal);
|
|
|
|
|
|
|
|
|
CompletableFuture<BigDecimal> incomeYearTbFuture = CompletableFuture.supplyAsync(() -> {
|
|
@@ -1720,14 +1739,35 @@ public class IndexServiceImpl implements IndexService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<String> testSl() {
|
|
|
+ public List<String> testSl(IndexInfoParamDto indexInfoParamDto) {
|
|
|
List<String> tasknoList = new ArrayList<>();
|
|
|
- System.out.println(tasknoList);
|
|
|
+// System.out.println(tasknoList);
|
|
|
+ //得到日期列表
|
|
|
+ //年/月
|
|
|
+ String timeType = indexInfoParamDto.getTime();
|
|
|
+ //起始时间
|
|
|
+ String startString = indexInfoParamDto.getBeginDate();
|
|
|
+ //结束时间
|
|
|
+ String endString = indexInfoParamDto.getEndDate();
|
|
|
+
|
|
|
+ if(timeType.equals("year")){
|
|
|
+ List<LreInfoByDate> lreDetail = indexMapper.getTasknoByGroupYear(startString, endString);
|
|
|
+ System.out.println(lreDetail);
|
|
|
+ }else if(timeType.equals("month")){
|
|
|
+ List<LreInfoByDate> lreDetail = indexMapper.getTasknoByGroupMonth(startString, endString);
|
|
|
+ System.out.println(lreDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
return tasknoList;
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 首页一层利润额参数类 IndexTotalVo 初始化
|
|
|
*/
|
|
@@ -1740,6 +1780,8 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexTotalVo.setMonthTotal(initValue);
|
|
|
indexTotalVo.setMonthTb(initValue);
|
|
|
indexTotalVo.setMonthHb(initValue);
|
|
|
+ indexTotalVo.setMonthTq(initValue);
|
|
|
+ indexTotalVo.setMonthLast(initValue);
|
|
|
return indexTotalVo;
|
|
|
}
|
|
|
|
|
@@ -2241,6 +2283,10 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
//添加纵坐标列表
|
|
|
indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+// //添加横坐标列表
|
|
|
+// indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+// //添加纵坐标列表
|
|
|
+// indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
|
|
|
// List<String> tasknoList = projectCostMapper.queryTasknoListAll();
|
|
|
// System.out.println("查到的所有部门对应的任务号列表:");
|
|
@@ -2249,12 +2295,48 @@ public class IndexServiceImpl implements IndexService {
|
|
|
// System.out.println(indexChartInfoVo);
|
|
|
|
|
|
//4.计算该时间列表中某年或某月对应的总收款
|
|
|
+ List<ReceivedByDate> receivedByDates = new ArrayList<>();
|
|
|
+ if(timeType.equals("year")){
|
|
|
+ receivedByDates = exchangeMapper.getReceivedAllByYear(startString, endString);
|
|
|
+// System.out.println("已收款二层按年查询结果:");
|
|
|
+// for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+// System.out.println(receivedByDate.getDate());
|
|
|
+// System.out.println(receivedByDate.getReceived());
|
|
|
+// }
|
|
|
+// System.out.println(receivedByDates);
|
|
|
+
|
|
|
+ }else if(timeType.equals("month")){
|
|
|
+ receivedByDates = exchangeMapper.getReceivedAllByYMonth(startString, endString);
|
|
|
+// System.out.println("已收款二层按月查询结果:");
|
|
|
+// for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+// System.out.println(receivedByDate.getDate());
|
|
|
+// System.out.println(receivedByDate.getReceived());
|
|
|
+// }
|
|
|
+// System.out.println(receivedByDates);
|
|
|
+ }
|
|
|
+ if(receivedByDates.isEmpty()) return indexChartInfoVo;
|
|
|
+
|
|
|
+ for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+ String date = receivedByDate.getDate();
|
|
|
+ if(timeRangeList.contains(date)){
|
|
|
+ seriesDataList.set(timeRangeList.indexOf(date), receivedByDate.getReceived());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //添加横坐标列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ //添加纵坐标列表
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+
|
|
|
+ /*
|
|
|
+
|
|
|
+ //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);
|
|
@@ -2292,6 +2374,10 @@ public class IndexServiceImpl implements IndexService {
|
|
|
//添加横纵坐标列表
|
|
|
indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
indexChartInfoVo.setSeriesData(seriesDataList2);
|
|
|
+
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
return indexChartInfoVo;
|
|
|
}
|
|
|
|
|
@@ -2341,19 +2427,58 @@ public class IndexServiceImpl implements IndexService {
|
|
|
//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("查出的部门列表:");
|
|
|
+ System.out.println(sysDepartNames);
|
|
|
+ if(sysDepartNames.isEmpty()) return indexChartInfoVo;
|
|
|
+
|
|
|
+// ArrayList<String> tasknoList = new ArrayList<>();
|
|
|
+// List<String> ZrbmTasknoList = projectCostMapper.queryZrbmTasknoListbydepartNames(sysDepartNames);
|
|
|
+// List<String> XdbmTasknoList = projectCostMapper.queryXdbmTasknoListbydepartNames(sysDepartNames);
|
|
|
+// System.out.println(ZrbmTasknoList);
|
|
|
+// System.out.println(XdbmTasknoList);
|
|
|
+// tasknoList.addAll(ZrbmTasknoList);
|
|
|
+// tasknoList.addAll(XdbmTasknoList);
|
|
|
+// System.out.println("查到的所有部门对应的任务号列表:");
|
|
|
+// System.out.println(tasknoList);
|
|
|
+// if (tasknoList.isEmpty()) return indexChartInfoVo;
|
|
|
// System.out.println(indexChartInfoVo);
|
|
|
|
|
|
//4.计算该时间列表中某年或某月对应的总收款
|
|
|
+ List<ReceivedByDate> receivedByDates = new ArrayList<>();
|
|
|
+ if(timeType.equals("year")){
|
|
|
+ receivedByDates = exchangeMapper.getReceivedByYear2(sysDepartNames, startString, endString);
|
|
|
+ System.out.println("部门领导已收款二层按年查询结果:");
|
|
|
+ for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+ System.out.println(receivedByDate.getDate());
|
|
|
+ System.out.println(receivedByDate.getReceived());
|
|
|
+ }
|
|
|
+ System.out.println(receivedByDates);
|
|
|
+
|
|
|
+ }else if(timeType.equals("month")){
|
|
|
+ receivedByDates = exchangeMapper.getReceivedByYMonth2(sysDepartNames, startString, endString);
|
|
|
+ System.out.println("部门领导已收款二层按月查询结果:");
|
|
|
+ for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+ System.out.println(receivedByDate.getDate());
|
|
|
+ System.out.println(receivedByDate.getReceived());
|
|
|
+ }
|
|
|
+ System.out.println(receivedByDates);
|
|
|
+ }
|
|
|
+ if(receivedByDates.isEmpty()) return indexChartInfoVo;
|
|
|
+
|
|
|
+ for(ReceivedByDate receivedByDate:receivedByDates){
|
|
|
+ String date = receivedByDate.getDate();
|
|
|
+ if(timeRangeList.contains(date)){
|
|
|
+ seriesDataList.set(timeRangeList.indexOf(date), receivedByDate.getReceived());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //添加横坐标列表
|
|
|
+ indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
+ //添加纵坐标列表
|
|
|
+ indexChartInfoVo.setSeriesData(seriesDataList);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
//创建CompletableFuture集合,因为allOf()方法参数可变参数
|
|
|
List<CompletableFuture<BigDecimal>> futures = new ArrayList<>();
|
|
|
for (String timeRange2 : timeRangeList) {
|
|
@@ -2398,6 +2523,8 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexChartInfoVo.setXAxisData(timeRangeList);
|
|
|
indexChartInfoVo.setSeriesData(seriesDataList2);
|
|
|
|
|
|
+ */
|
|
|
+
|
|
|
return indexChartInfoVo;
|
|
|
}
|
|
|
|
|
@@ -2408,7 +2535,72 @@ public class IndexServiceImpl implements IndexService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public IndexTotalVo getLreByRole() {
|
|
|
+ public IndexTotalVo getLreByRole(HttpServletRequest request) {
|
|
|
+ //初始化
|
|
|
+ IndexTotalVo lrIndexTotalVo = indexTotalVoInit();
|
|
|
+
|
|
|
+ //获取一层合同额
|
|
|
+ IndexTotalVo hteindexTotalVo = getTotalIncome(request);
|
|
|
+ //获取一层支出成本额
|
|
|
+ IndexTotalVo zceindexTotalVo = indexZcbService.getZhiChuTotalList().get(0);
|
|
|
+ System.out.println(hteindexTotalVo);
|
|
|
+ System.out.println(zceindexTotalVo);
|
|
|
+
|
|
|
+ //当年利润额 合同额-成本额
|
|
|
+ if(hteindexTotalVo.getYearTotal() == null) hteindexTotalVo.setYearTotal(BigDecimal.valueOf(0));
|
|
|
+ if(zceindexTotalVo.getYearTotal() == null) zceindexTotalVo.setYearTotal(BigDecimal.valueOf(0));
|
|
|
+ BigDecimal lreYearTotal = hteindexTotalVo.getYearTotal().subtract(zceindexTotalVo.getYearTotal());
|
|
|
+ //去年同期利润额 去年同期合同额-去年同期成本额
|
|
|
+ if(hteindexTotalVo.getYearTq() == null) hteindexTotalVo.setYearTq(BigDecimal.valueOf(0));
|
|
|
+ if(zceindexTotalVo.getYearTq() == null) zceindexTotalVo.setYearTq(BigDecimal.valueOf(0));
|
|
|
+ BigDecimal lreLastYearTotal = hteindexTotalVo.getYearTq().subtract(zceindexTotalVo.getYearTq());
|
|
|
+ //当月利润额 当月合同额-当月成本额
|
|
|
+ if(hteindexTotalVo.getMonthTotal() == null) hteindexTotalVo.setMonthTotal(BigDecimal.valueOf(0));
|
|
|
+ if(zceindexTotalVo.getMonthTotal() == null) zceindexTotalVo.setMonthTotal(BigDecimal.valueOf(0));
|
|
|
+ BigDecimal lreMonthTotal = hteindexTotalVo.getMonthTotal().subtract(zceindexTotalVo.getMonthTotal());
|
|
|
+ //去年同期月份利润额 去年同期月份合同额-去年同期月份成本额
|
|
|
+ if(hteindexTotalVo.getMonthTq() == null) hteindexTotalVo.setMonthTq(BigDecimal.valueOf(0));
|
|
|
+ if(zceindexTotalVo.getMonthTq() == null) zceindexTotalVo.setMonthTq(BigDecimal.valueOf(0));
|
|
|
+ BigDecimal lreTqMonthTotal = hteindexTotalVo.getMonthTq().subtract(zceindexTotalVo.getMonthTq());
|
|
|
+ //上个月利润额 上个月合同额-上个月成本额
|
|
|
+ if(hteindexTotalVo.getMonthLast() == null) hteindexTotalVo.setMonthLast(BigDecimal.valueOf(0));
|
|
|
+ if(zceindexTotalVo.getMonthLast() == null) zceindexTotalVo.setMonthLast(BigDecimal.valueOf(0));
|
|
|
+ BigDecimal lreLastMonthTotal = hteindexTotalVo.getMonthLast().subtract(zceindexTotalVo.getMonthLast());
|
|
|
+
|
|
|
+ //年同比 (当年利润-去年利润)/去年利润
|
|
|
+ BigDecimal lrYearTb = BigDecimal.valueOf(0);
|
|
|
+ if(lreLastYearTotal.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
+ lrYearTb = BigDecimal.valueOf(1);
|
|
|
+ }else {
|
|
|
+ lrYearTb = (lreYearTotal.subtract(lreLastYearTotal)).divide(lreLastYearTotal, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ //月同比 (当月利润-去年同期月份利润)/去年同期月份利润
|
|
|
+ BigDecimal lrMonthTb = BigDecimal.valueOf(0);
|
|
|
+ if(lreTqMonthTotal.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
+ lrMonthTb = BigDecimal.valueOf(1);
|
|
|
+ }else {
|
|
|
+ lrMonthTb = (lreMonthTotal.subtract(lreTqMonthTotal)).divide(lreTqMonthTotal, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ //月环比 (当月利润-上个月利润)/上个月利润
|
|
|
+ BigDecimal lrMonthHb = BigDecimal.valueOf(0);
|
|
|
+ if(lreLastMonthTotal.compareTo(BigDecimal.valueOf(0)) == 0){
|
|
|
+ lrMonthHb = BigDecimal.valueOf(1);
|
|
|
+ }else {
|
|
|
+ lrMonthHb = (lreMonthTotal.subtract(lreLastMonthTotal)).divide(lreLastMonthTotal, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+
|
|
|
+ lrIndexTotalVo.setYearTotal(lreYearTotal);//当年利润
|
|
|
+ lrIndexTotalVo.setYearTq(lreLastYearTotal);//去年同期利润
|
|
|
+ lrIndexTotalVo.setYearTb(lrYearTb);//年同比
|
|
|
+ lrIndexTotalVo.setMonthTotal(lreMonthTotal);//当月利润
|
|
|
+ lrIndexTotalVo.setMonthTq(lreTqMonthTotal);//去年同期月份利润
|
|
|
+ lrIndexTotalVo.setMonthLast(lreLastMonthTotal);//上个月利润
|
|
|
+ lrIndexTotalVo.setMonthTb(lrMonthTb);//月同比
|
|
|
+ lrIndexTotalVo.setMonthHb(lrMonthHb);//月环比
|
|
|
+
|
|
|
+ return lrIndexTotalVo;
|
|
|
+
|
|
|
+ /*
|
|
|
//初始化
|
|
|
IndexTotalVo indexTotalVo = indexTotalVoInit();
|
|
|
//获取角色
|
|
@@ -2431,15 +2623,30 @@ public class IndexServiceImpl implements IndexService {
|
|
|
indexTotalVo = getLreOne(departNames);
|
|
|
}
|
|
|
return indexTotalVo;
|
|
|
+ */
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 首页二层 利润额
|
|
|
+ * 首页二层 利润额 根据合同额和支出成本来进行计算
|
|
|
* 通过登录的用户找到角色,根据角色来判断部门,根据部门和实际完成时间选择任务列表,根据任务列表计算利润额
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public IndexChartInfoVo<BigDecimal> getLreDetailByRole(IndexInfoParamDto indexInfoParamDto) {
|
|
|
+ public IndexChartInfoVo<BigDecimal> getLreDetailByRole(HttpServletRequest request, IndexInfoParamDto indexInfoParamDto) {
|
|
|
+ //初始化
|
|
|
+ IndexChartInfoVo<BigDecimal> indexChartInfoVo = indexChartInfoVoInit();
|
|
|
+
|
|
|
+ //获取二层合同额
|
|
|
+ ContractChartInfoVo contractChartInfoVo = getContractAmountInfo(request, indexInfoParamDto);
|
|
|
+ System.out.println(contractChartInfoVo);
|
|
|
+ //获取二层支出成本额 八项成本
|
|
|
+ List<IndexChartInfoVo> resultList = indexZcbService.getEightCostsList(indexInfoParamDto);
|
|
|
+ System.out.println(resultList);
|
|
|
+
|
|
|
+ return indexChartInfoVo;
|
|
|
+
|
|
|
+ /*
|
|
|
//初始化
|
|
|
IndexChartInfoVo<BigDecimal> indexChartInfoVo = indexChartInfoVoInit();
|
|
|
|
|
@@ -2461,6 +2668,9 @@ public class IndexServiceImpl implements IndexService {
|
|
|
}
|
|
|
|
|
|
return indexChartInfoVo;
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|