|
@@ -141,6 +141,11 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
//所长权限,查看部门指标排行
|
|
//所长权限,查看部门指标排行
|
|
if (role.equals(AuthMark.BOSS)) {
|
|
if (role.equals(AuthMark.BOSS)) {
|
|
System.out.println("当前账户权限:所长,可以查看部门指标排行");
|
|
System.out.println("当前账户权限:所长,可以查看部门指标排行");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ IndexKpiDataDepart indexKpiDataDepart1 = (IndexKpiDataDepart) redisUtil.get(CacheKey.INDEX_ZRBM_NEW + ":" + indexKpiParamDto.getTime() + ":" + indexKpiParamDto.getBeginDate());
|
|
|
|
+ if (indexKpiDataDepart1 != null) return indexKpiDataDepart1;
|
|
|
|
+
|
|
//目前是算某个月的指标,不涉及范围
|
|
//目前是算某个月的指标,不涉及范围
|
|
String timeType = indexKpiParamDto.getTime();//年/月
|
|
String timeType = indexKpiParamDto.getTime();//年/月
|
|
String dateString = indexKpiParamDto.getBeginDate();//日期
|
|
String dateString = indexKpiParamDto.getBeginDate();//日期
|
|
@@ -157,7 +162,11 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
try{
|
|
try{
|
|
if(timeType.equals("year")){
|
|
if(timeType.equals("year")){
|
|
isCurrentDate = dateString.equals(String.valueOf(currentDateYear));
|
|
isCurrentDate = dateString.equals(String.valueOf(currentDateYear));
|
|
- dateYm = String.format("%s-%d", Integer.parseInt(dateString), 12);
|
|
|
|
|
|
+ if(currentYm.equals(dateString)){
|
|
|
|
+ dateYm = getCurronMonthString(currentYm);
|
|
|
|
+ }else {
|
|
|
|
+ dateYm = String.format("%s-%d", Integer.parseInt(dateString), 12);
|
|
|
|
+ }
|
|
dateLastYm = String.format("%d-%d", Integer.parseInt(dateString)-1, 12);
|
|
dateLastYm = String.format("%d-%d", Integer.parseInt(dateString)-1, 12);
|
|
}else if(timeType.equals("month")){
|
|
}else if(timeType.equals("month")){
|
|
isCurrentDate = dateString.equals(currentYm);
|
|
isCurrentDate = dateString.equals(currentYm);
|
|
@@ -213,125 +222,126 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
// 如果前端查询 2023-01 到 2023-10 之间任意一个月份的数据
|
|
// 如果前端查询 2023-01 到 2023-10 之间任意一个月份的数据
|
|
// 那么 责任部门 的合同额 = 实际完成时间等于当前月份的100%的合同额之和 ; 已收款 = 实际完成时间等于当前月份的100%的已收款之和
|
|
// 那么 责任部门 的合同额 = 实际完成时间等于当前月份的100%的合同额之和 ; 已收款 = 实际完成时间等于当前月份的100%的已收款之和
|
|
// 下达部门 的合同额 = 签署日期是当前年份的合同额之和 ; 已收款 = 到款日期是当前年份的已收款之和
|
|
// 下达部门 的合同额 = 签署日期是当前年份的合同额之和 ; 已收款 = 到款日期是当前年份的已收款之和
|
|
- if (timeType.equals("year")){
|
|
|
|
- if (clYear.contains(indexKpiParamDto.getBeginDate())){
|
|
|
|
- // 责任部门 查询 1到10月份的总合同额
|
|
|
|
- CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedZrbmClMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
- Map<String, IndexKpiCompletByDate> htereceivedZrbmClMap = new TreeMap<>();//用来保存部门该月合计的合同额、已收款以及责任部门
|
|
|
|
- if (zrbmList.isEmpty()) return htereceivedZrbmClMap;
|
|
|
|
- List<IndexKpiCompletByDate> zrbmHteCl = projectCostService.getZrbmHteCl(zrbmList);
|
|
|
|
- for(IndexKpiCompletByDate htereceivedZrbmCl:zrbmHteCl){
|
|
|
|
- htereceivedZrbmClMap.put(htereceivedZrbmCl.getDepart(), htereceivedZrbmCl);
|
|
|
|
- }
|
|
|
|
- return htereceivedZrbmClMap;
|
|
|
|
- });
|
|
|
|
- // 责任部门 查询 10月份之后的总合同额 当前查询项目和成本表中的所有的 - 十月份的
|
|
|
|
- // 责任部门 当期的合同额
|
|
|
|
- CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedZrbmMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
- TreeMap<String, IndexKpiCompletByDate> htereceivedZrbmMap = new TreeMap<>();
|
|
|
|
- if (zrbmList.isEmpty()) return htereceivedZrbmMap;
|
|
|
|
- List<IndexKpiCompletByDate> hteReceivedZrbmCost = indexKpiMapper.getHteReceivedZrbmCost(zrbmList);
|
|
|
|
- for (IndexKpiCompletByDate htereceivedZrbm:hteReceivedZrbmCost) {
|
|
|
|
- htereceivedZrbmMap.put(htereceivedZrbm.getDepart(),htereceivedZrbm);
|
|
|
|
- }
|
|
|
|
- return htereceivedZrbmMap;
|
|
|
|
- });
|
|
|
|
- // 责任部门 10月份的合同额
|
|
|
|
- CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedZrbmLastMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
- Map<String, IndexKpiCompletByDate> htereceivedZrbmLastMap = new TreeMap<>();//用来保存部门上月合计的合同额、已收款以及责任部门
|
|
|
|
- if (zrbmList.isEmpty()) return htereceivedZrbmLastMap;
|
|
|
|
- List<IndexKpiCompletByDate> htereceivedZrbmLastList = indexKpiMapper.getHteReceivedZrbmYm("2023-10", zrbmList);
|
|
|
|
- for(IndexKpiCompletByDate htereceivedZrbmLast:htereceivedZrbmLastList){
|
|
|
|
- htereceivedZrbmLastMap.put(htereceivedZrbmLast.getDepart(), htereceivedZrbmLast);
|
|
|
|
- }
|
|
|
|
- return htereceivedZrbmLastMap;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // 求下达部门的合同额
|
|
|
|
- CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedXdbmHteMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
- Map<String, IndexKpiCompletByDate> htereceivedXdbmHteMap = new TreeMap<>();//用来保存部门上月合计的合同额、已收款以及责任部门
|
|
|
|
- if (xdbmList.isEmpty()) return htereceivedXdbmHteMap;
|
|
|
|
- List<IndexKpiCompletByDate> xdbmHte = contractInfoExchangeNewMapper.getXdbmHte(indexKpiParamDto.getBeginDate(), xdbmList);
|
|
|
|
- for (IndexKpiCompletByDate d:xdbmHte) {
|
|
|
|
- htereceivedXdbmHteMap.put(d.getDepart(),d);
|
|
|
|
- }
|
|
|
|
- return htereceivedXdbmHteMap;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // 求下达部门的 已收款
|
|
|
|
- CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedXdbmYskMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
- Map<String, IndexKpiCompletByDate> htereceivedXdbmYskMap = new TreeMap<>();//用来保存部门上月合计的合同额、已收款以及责任部门
|
|
|
|
- if (xdbmList.isEmpty()) return htereceivedXdbmYskMap;
|
|
|
|
- List<IndexKpiCompletByDate> xdbmHte = contractInfoExchangeNewMapper.getXdbmYsk(indexKpiParamDto.getBeginDate(), xdbmList);
|
|
|
|
- for (IndexKpiCompletByDate d:xdbmHte) {
|
|
|
|
- htereceivedXdbmYskMap.put(d.getDepart(),d);
|
|
|
|
- }
|
|
|
|
- return htereceivedXdbmYskMap;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- CompletableFuture<Void> future = CompletableFuture.allOf(getHtereceivedZrbmClMapFuture, getHtereceivedZrbmMapFuture, getHtereceivedZrbmLastMapFuture,getHtereceivedXdbmHteMapFuture,getHtereceivedXdbmYskMapFuture);
|
|
|
|
- future.join();
|
|
|
|
- Map<String, IndexKpiCompletByDate> htereceivedZrbmClMap = getHtereceivedZrbmClMapFuture.join();
|
|
|
|
- Map<String, IndexKpiCompletByDate> htereceivedZrbmMap = getHtereceivedZrbmMapFuture.join();
|
|
|
|
- Map<String, IndexKpiCompletByDate> htereceivedZrbmLastMap = getHtereceivedZrbmLastMapFuture.join();
|
|
|
|
- Map<String, IndexKpiCompletByDate> htereceivedXdbmHteMap = getHtereceivedXdbmHteMapFuture.join();
|
|
|
|
- Map<String, IndexKpiCompletByDate> htereceivedXdbmYskMap = getHtereceivedXdbmYskMapFuture.join();
|
|
|
|
-
|
|
|
|
- // 责任部门排行
|
|
|
|
- CompletableFuture<Void> setKpiDataZrbmList = CompletableFuture.runAsync(() -> {
|
|
|
|
- for(IndexKpiCompletByDate kpiDataZrbm:kpiDataZrbmList){
|
|
|
|
- // 1到10月份的合同额
|
|
|
|
- IndexKpiCompletByDate htereceivedZrbmCl = htereceivedZrbmClMap.getOrDefault(kpiDataZrbm.getDepart(), kpiDataZrbm);
|
|
|
|
- // 当前日期之前的所有的合同额
|
|
|
|
- IndexKpiCompletByDate htereceivedZrbm = htereceivedZrbmMap.getOrDefault(kpiDataZrbm.getDepart(), kpiDataZrbm);
|
|
|
|
- // 10月份之前的所有的合同额
|
|
|
|
- IndexKpiCompletByDate htereceivedZrbmLast = htereceivedZrbmLastMap.getOrDefault(kpiDataZrbm.getDepart(), kpiDataZrbm);
|
|
|
|
- // 显示的当年的合同额 = 1到10月份的合同额 + (当前日期之前的所有的合同额 - 10月份之前的所有的合同额)
|
|
|
|
- kpiDataZrbm.setContractAmount(htereceivedZrbmCl.getContractAmount().add(htereceivedZrbm.getContractAmount().subtract(htereceivedZrbmLast.getContractAmount())));
|
|
|
|
- // 显示的当年的已收款 = 1到10月份的已收款 + (当前日期之前的所有的已收款 - 10月份之前的所有的已收款)
|
|
|
|
- kpiDataZrbm.setReceived(htereceivedZrbmCl.getReceived().add(htereceivedZrbm.getReceived().subtract(htereceivedZrbmLast.getReceived())));
|
|
|
|
- // 计算 当年的完成度 = 当年的合同额 / 当年的指标
|
|
|
|
- if(kpiDataZrbm.getDepartKpi() != null){
|
|
|
|
- if(kpiDataZrbm.getDepartKpi().equals(BigDecimal.valueOf(0))){
|
|
|
|
- kpiDataZrbm.setKpiCompletRate(BigDecimal.valueOf(1));
|
|
|
|
- }else{
|
|
|
|
- kpiDataZrbm.setKpiCompletRate(kpiDataZrbm.getContractAmount().divide(kpiDataZrbm.getDepartKpi(), 2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //责任部门 根据指标进行排序
|
|
|
|
- kpiDataZrbmList.sort(Comparator.comparing(IndexKpiCompletByDate::getKpiCompletRate, Comparator.nullsFirst(BigDecimal::compareTo)).reversed());
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // 下达部门排行
|
|
|
|
- CompletableFuture<Void> setKpiDataXdbmList = CompletableFuture.runAsync(() -> {
|
|
|
|
- for (IndexKpiCompletByDate kpiDataXdbm:kpiDataJycsList) {
|
|
|
|
- IndexKpiCompletByDate htereceivedXdbmHte = htereceivedXdbmHteMap.getOrDefault(kpiDataXdbm.getDepart(), kpiDataXdbm);
|
|
|
|
- IndexKpiCompletByDate htereceivedXdbmYsk = htereceivedXdbmYskMap.getOrDefault(kpiDataXdbm.getDepart(), kpiDataXdbm);
|
|
|
|
- kpiDataXdbm.setContractAmount(htereceivedXdbmHte.getContractAmount()); // 合同额
|
|
|
|
- kpiDataXdbm.setReceived(htereceivedXdbmYsk.getReceived()); // 已收款
|
|
|
|
-
|
|
|
|
- if(kpiDataXdbm.getDepartKpi() != null){
|
|
|
|
- if(kpiDataXdbm.getDepartKpi().equals(BigDecimal.valueOf(0))){
|
|
|
|
- kpiDataXdbm.setKpiCompletRate(BigDecimal.valueOf(1));
|
|
|
|
- }else{
|
|
|
|
- kpiDataXdbm.setKpiCompletRate(kpiDataXdbm.getReceived().divide(kpiDataXdbm.getDepartKpi(), 2, RoundingMode.HALF_UP));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //下达部门 根据指标进行排序
|
|
|
|
- kpiDataJycsList.sort(Comparator.comparing(IndexKpiCompletByDate::getKpiCompletRate, Comparator.nullsFirst(BigDecimal::compareTo)).reversed());
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- CompletableFuture<Void> future1 = CompletableFuture.allOf(setKpiDataZrbmList,setKpiDataXdbmList);
|
|
|
|
- future1.join();
|
|
|
|
-
|
|
|
|
- indexKpiDataDepart.setZrbmCharts(kpiDataZrbmList);
|
|
|
|
- indexKpiDataDepart.setJycsCharts(kpiDataJycsList);
|
|
|
|
- return indexKpiDataDepart;
|
|
|
|
- }
|
|
|
|
- }else if (timeType.equals("month")){
|
|
|
|
|
|
+// if (timeType.equals("year")){
|
|
|
|
+// if (clYear.contains(indexKpiParamDto.getBeginDate())){
|
|
|
|
+// // 责任部门 查询 1到10月份的总合同额
|
|
|
|
+// CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedZrbmClMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
+// Map<String, IndexKpiCompletByDate> htereceivedZrbmClMap = new TreeMap<>();//用来保存部门该月合计的合同额、已收款以及责任部门
|
|
|
|
+// if (zrbmList.isEmpty()) return htereceivedZrbmClMap;
|
|
|
|
+// List<IndexKpiCompletByDate> zrbmHteCl = projectCostService.getZrbmHteCl(zrbmList);
|
|
|
|
+// for(IndexKpiCompletByDate htereceivedZrbmCl:zrbmHteCl){
|
|
|
|
+// htereceivedZrbmClMap.put(htereceivedZrbmCl.getDepart(), htereceivedZrbmCl);
|
|
|
|
+// }
|
|
|
|
+// return htereceivedZrbmClMap;
|
|
|
|
+// });
|
|
|
|
+// // 责任部门 查询 10月份之后的总合同额 当前查询项目和成本表中的所有的 - 十月份的
|
|
|
|
+// // 责任部门 当期的合同额
|
|
|
|
+// CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedZrbmMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
+// TreeMap<String, IndexKpiCompletByDate> htereceivedZrbmMap = new TreeMap<>();
|
|
|
|
+// if (zrbmList.isEmpty()) return htereceivedZrbmMap;
|
|
|
|
+// List<IndexKpiCompletByDate> hteReceivedZrbmCost = indexKpiMapper.getHteReceivedZrbmCost(zrbmList);
|
|
|
|
+// for (IndexKpiCompletByDate htereceivedZrbm:hteReceivedZrbmCost) {
|
|
|
|
+// htereceivedZrbmMap.put(htereceivedZrbm.getDepart(),htereceivedZrbm);
|
|
|
|
+// }
|
|
|
|
+// return htereceivedZrbmMap;
|
|
|
|
+// });
|
|
|
|
+// // 责任部门 10月份的合同额
|
|
|
|
+// CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedZrbmLastMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
+// Map<String, IndexKpiCompletByDate> htereceivedZrbmLastMap = new TreeMap<>();//用来保存部门上月合计的合同额、已收款以及责任部门
|
|
|
|
+// if (zrbmList.isEmpty()) return htereceivedZrbmLastMap;
|
|
|
|
+// List<IndexKpiCompletByDate> htereceivedZrbmLastList = indexKpiMapper.getHteReceivedZrbmYm("2023-10", zrbmList);
|
|
|
|
+// for(IndexKpiCompletByDate htereceivedZrbmLast:htereceivedZrbmLastList){
|
|
|
|
+// htereceivedZrbmLastMap.put(htereceivedZrbmLast.getDepart(), htereceivedZrbmLast);
|
|
|
|
+// }
|
|
|
|
+// return htereceivedZrbmLastMap;
|
|
|
|
+// });
|
|
|
|
+//
|
|
|
|
+// // 求下达部门的合同额
|
|
|
|
+// CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedXdbmHteMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
+// Map<String, IndexKpiCompletByDate> htereceivedXdbmHteMap = new TreeMap<>();//用来保存部门上月合计的合同额、已收款以及责任部门
|
|
|
|
+// if (xdbmList.isEmpty()) return htereceivedXdbmHteMap;
|
|
|
|
+// List<IndexKpiCompletByDate> xdbmHte = contractInfoExchangeNewMapper.getXdbmHte(indexKpiParamDto.getBeginDate(), xdbmList);
|
|
|
|
+// for (IndexKpiCompletByDate d:xdbmHte) {
|
|
|
|
+// htereceivedXdbmHteMap.put(d.getDepart(),d);
|
|
|
|
+// }
|
|
|
|
+// return htereceivedXdbmHteMap;
|
|
|
|
+// });
|
|
|
|
+//
|
|
|
|
+// // 求下达部门的 已收款
|
|
|
|
+// CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedXdbmYskMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
+// Map<String, IndexKpiCompletByDate> htereceivedXdbmYskMap = new TreeMap<>();//用来保存部门上月合计的合同额、已收款以及责任部门
|
|
|
|
+// if (xdbmList.isEmpty()) return htereceivedXdbmYskMap;
|
|
|
|
+// List<IndexKpiCompletByDate> xdbmHte = contractInfoExchangeNewMapper.getXdbmYsk(indexKpiParamDto.getBeginDate(), xdbmList);
|
|
|
|
+// for (IndexKpiCompletByDate d:xdbmHte) {
|
|
|
|
+// htereceivedXdbmYskMap.put(d.getDepart(),d);
|
|
|
|
+// }
|
|
|
|
+// return htereceivedXdbmYskMap;
|
|
|
|
+// });
|
|
|
|
+//
|
|
|
|
+//
|
|
|
|
+// CompletableFuture<Void> future = CompletableFuture.allOf(getHtereceivedZrbmClMapFuture, getHtereceivedZrbmMapFuture, getHtereceivedZrbmLastMapFuture,getHtereceivedXdbmHteMapFuture,getHtereceivedXdbmYskMapFuture);
|
|
|
|
+// future.join();
|
|
|
|
+// Map<String, IndexKpiCompletByDate> htereceivedZrbmClMap = getHtereceivedZrbmClMapFuture.join();
|
|
|
|
+// Map<String, IndexKpiCompletByDate> htereceivedZrbmMap = getHtereceivedZrbmMapFuture.join();
|
|
|
|
+// Map<String, IndexKpiCompletByDate> htereceivedZrbmLastMap = getHtereceivedZrbmLastMapFuture.join();
|
|
|
|
+// Map<String, IndexKpiCompletByDate> htereceivedXdbmHteMap = getHtereceivedXdbmHteMapFuture.join();
|
|
|
|
+// Map<String, IndexKpiCompletByDate> htereceivedXdbmYskMap = getHtereceivedXdbmYskMapFuture.join();
|
|
|
|
+//
|
|
|
|
+// // 责任部门排行
|
|
|
|
+// CompletableFuture<Void> setKpiDataZrbmList = CompletableFuture.runAsync(() -> {
|
|
|
|
+// for(IndexKpiCompletByDate kpiDataZrbm:kpiDataZrbmList){
|
|
|
|
+// // 1到10月份的合同额
|
|
|
|
+// IndexKpiCompletByDate htereceivedZrbmCl = htereceivedZrbmClMap.getOrDefault(kpiDataZrbm.getDepart(), kpiDataZrbm);
|
|
|
|
+// // 当前日期之前的所有的合同额
|
|
|
|
+// IndexKpiCompletByDate htereceivedZrbm = htereceivedZrbmMap.getOrDefault(kpiDataZrbm.getDepart(), kpiDataZrbm);
|
|
|
|
+// // 10月份之前的所有的合同额
|
|
|
|
+// IndexKpiCompletByDate htereceivedZrbmLast = htereceivedZrbmLastMap.getOrDefault(kpiDataZrbm.getDepart(), kpiDataZrbm);
|
|
|
|
+// // 显示的当年的合同额 = 1到10月份的合同额 + (当前日期之前的所有的合同额 - 10月份之前的所有的合同额)
|
|
|
|
+// kpiDataZrbm.setContractAmount(htereceivedZrbmCl.getContractAmount().add(htereceivedZrbm.getContractAmount().subtract(htereceivedZrbmLast.getContractAmount())));
|
|
|
|
+// // 显示的当年的已收款 = 1到10月份的已收款 + (当前日期之前的所有的已收款 - 10月份之前的所有的已收款)
|
|
|
|
+// kpiDataZrbm.setReceived(htereceivedZrbmCl.getReceived().add(htereceivedZrbm.getReceived().subtract(htereceivedZrbmLast.getReceived())));
|
|
|
|
+// // 计算 当年的完成度 = 当年的合同额 / 当年的指标
|
|
|
|
+// if(kpiDataZrbm.getDepartKpi() != null){
|
|
|
|
+// if(kpiDataZrbm.getDepartKpi().equals(BigDecimal.valueOf(0))){
|
|
|
|
+// kpiDataZrbm.setKpiCompletRate(BigDecimal.valueOf(1));
|
|
|
|
+// }else{
|
|
|
|
+// kpiDataZrbm.setKpiCompletRate(kpiDataZrbm.getContractAmount().divide(kpiDataZrbm.getDepartKpi(), 2, RoundingMode.HALF_UP));
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// //责任部门 根据指标进行排序
|
|
|
|
+// kpiDataZrbmList.sort(Comparator.comparing(IndexKpiCompletByDate::getKpiCompletRate, Comparator.nullsFirst(BigDecimal::compareTo)).reversed());
|
|
|
|
+// });
|
|
|
|
+//
|
|
|
|
+// // 下达部门排行
|
|
|
|
+// CompletableFuture<Void> setKpiDataXdbmList = CompletableFuture.runAsync(() -> {
|
|
|
|
+// for (IndexKpiCompletByDate kpiDataXdbm:kpiDataJycsList) {
|
|
|
|
+// IndexKpiCompletByDate htereceivedXdbmHte = htereceivedXdbmHteMap.getOrDefault(kpiDataXdbm.getDepart(), kpiDataXdbm);
|
|
|
|
+// IndexKpiCompletByDate htereceivedXdbmYsk = htereceivedXdbmYskMap.getOrDefault(kpiDataXdbm.getDepart(), kpiDataXdbm);
|
|
|
|
+// kpiDataXdbm.setContractAmount(htereceivedXdbmHte.getContractAmount()); // 合同额
|
|
|
|
+// kpiDataXdbm.setReceived(htereceivedXdbmYsk.getReceived()); // 已收款
|
|
|
|
+//
|
|
|
|
+// if(kpiDataXdbm.getDepartKpi() != null){
|
|
|
|
+// if(kpiDataXdbm.getDepartKpi().equals(BigDecimal.valueOf(0))){
|
|
|
|
+// kpiDataXdbm.setKpiCompletRate(BigDecimal.valueOf(1));
|
|
|
|
+// }else{
|
|
|
|
+// kpiDataXdbm.setKpiCompletRate(kpiDataXdbm.getReceived().divide(kpiDataXdbm.getDepartKpi(), 2, RoundingMode.HALF_UP));
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// //下达部门 根据指标进行排序
|
|
|
|
+// kpiDataJycsList.sort(Comparator.comparing(IndexKpiCompletByDate::getKpiCompletRate, Comparator.nullsFirst(BigDecimal::compareTo)).reversed());
|
|
|
|
+// });
|
|
|
|
+//
|
|
|
|
+// CompletableFuture<Void> future1 = CompletableFuture.allOf(setKpiDataZrbmList,setKpiDataXdbmList);
|
|
|
|
+// future1.join();
|
|
|
|
+//
|
|
|
|
+// indexKpiDataDepart.setZrbmCharts(kpiDataZrbmList);
|
|
|
|
+// indexKpiDataDepart.setJycsCharts(kpiDataJycsList);
|
|
|
|
+// return indexKpiDataDepart;
|
|
|
|
+// }
|
|
|
|
+// }else
|
|
|
|
+ if (timeType.equals("month")){
|
|
if (clYearMonth.contains(finalDateYm)){
|
|
if (clYearMonth.contains(finalDateYm)){
|
|
// 责任 部门
|
|
// 责任 部门
|
|
CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedZrbmMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedZrbmMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
@@ -423,27 +433,19 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
// 那么 责任部门 的合同额 = (当前月份的合同额 * 当前月份的项目进度(当前月份之前的总进度-上个月之前的总进度)) ; 已收款 = (当前月份的已收款 - 上个月的已收款)
|
|
// 那么 责任部门 的合同额 = (当前月份的合同额 * 当前月份的项目进度(当前月份之前的总进度-上个月之前的总进度)) ; 已收款 = (当前月份的已收款 - 上个月的已收款)
|
|
// 下达部门 的合同额 = 签署日期是当前年份的合同额之和 ; 已收款 = 到款日期是当前年份的已收款之和
|
|
// 下达部门 的合同额 = 签署日期是当前年份的合同额之和 ; 已收款 = 到款日期是当前年份的已收款之和
|
|
|
|
|
|
- //责任部门 获取选择年月的数据 合同额、已收款
|
|
|
|
|
|
+ //责任部门 获取选择年月的数据 合同额、已收款 (不是当年当月的)
|
|
CompletableFuture<Map<String, IndexKpiCompletByDate>> getHtereceivedZrbmMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
CompletableFuture<Map<String, IndexKpiCompletByDate>> getHtereceivedZrbmMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
Map<String, IndexKpiCompletByDate> htereceivedZrbmMap = new TreeMap<>();//用来保存部门该月合计的合同额、已收款以及责任部门
|
|
Map<String, IndexKpiCompletByDate> htereceivedZrbmMap = new TreeMap<>();//用来保存部门该月合计的合同额、已收款以及责任部门
|
|
// List<IndexKpiCompletByDate> htereceivedZrbmList = indexKpiMapper.getHteReceivedZrbmYm(finalDateYm, zrbmList);
|
|
// List<IndexKpiCompletByDate> htereceivedZrbmList = indexKpiMapper.getHteReceivedZrbmYm(finalDateYm, zrbmList);
|
|
- List<IndexKpiCompletByDate> htereceivedZrbmList = indexKpiMapper.getHteReceivedZrbmSelectYm(finalDateYm,finalDateLastYm, zrbmList);
|
|
|
|
- for(IndexKpiCompletByDate htereceivedZrbm:htereceivedZrbmList){
|
|
|
|
- htereceivedZrbmMap.put(htereceivedZrbm.getDepart(), htereceivedZrbm);
|
|
|
|
|
|
+ List<IndexKpiCompletByDate> htereceivedZrbmList = new ArrayList<>();
|
|
|
|
+ if (!finalIsCurrentDate){
|
|
|
|
+ htereceivedZrbmList = indexKpiMapper.getHteReceivedZrbmSelectYm(finalDateYm,finalDateLastYm, zrbmList);
|
|
|
|
+ for(IndexKpiCompletByDate htereceivedZrbm:htereceivedZrbmList){
|
|
|
|
+ htereceivedZrbmMap.put(htereceivedZrbm.getDepart(), htereceivedZrbm);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return htereceivedZrbmMap;
|
|
return htereceivedZrbmMap;
|
|
});
|
|
});
|
|
- //责任部门 获取选择年月上月的数据 合同额、已收款
|
|
|
|
-// CompletableFuture<Map<String, IndexKpiCompletByDate>> getHtereceivedZrbmLastMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
|
-// Map<String, IndexKpiCompletByDate> htereceivedZrbmLastMap = new TreeMap<>();//用来保存部门上月合计的合同额、已收款以及责任部门
|
|
|
|
-// if (zrbmList.isEmpty()) return htereceivedZrbmLastMap;
|
|
|
|
-// //List<IndexKpiCompletByDate> htereceivedZrbmLastList = indexKpiMapper.getHteReceivedZrbmYm(finalDateLastYm, departList);
|
|
|
|
-// List<IndexKpiCompletByDate> htereceivedZrbmLastList = indexKpiMapper.getHteReceivedZrbmYm(finalDateLastYm, zrbmList);
|
|
|
|
-// for(IndexKpiCompletByDate htereceivedZrbmLast:htereceivedZrbmLastList){
|
|
|
|
-// htereceivedZrbmLastMap.put(htereceivedZrbmLast.getDepart(), htereceivedZrbmLast);
|
|
|
|
-// }
|
|
|
|
-// return htereceivedZrbmLastMap;
|
|
|
|
-// });
|
|
|
|
// 求下达部门的合同额
|
|
// 求下达部门的合同额
|
|
CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedXdbmHteMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
CompletableFuture<Map<String,IndexKpiCompletByDate>> getHtereceivedXdbmHteMapFuture = CompletableFuture.supplyAsync(() -> {
|
|
Map<String, IndexKpiCompletByDate> htereceivedXdbmHteMap = new TreeMap<>();//用来保存部门上月合计的合同额、已收款以及责任部门
|
|
Map<String, IndexKpiCompletByDate> htereceivedXdbmHteMap = new TreeMap<>();//用来保存部门上月合计的合同额、已收款以及责任部门
|
|
@@ -469,34 +471,22 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
// 责任部门
|
|
// 责任部门
|
|
CompletableFuture<Map<String, IndexKpiCompletByDate>> getHtereceivedZrbmFinalFuture = CompletableFuture.supplyAsync(() -> {
|
|
CompletableFuture<Map<String, IndexKpiCompletByDate>> getHtereceivedZrbmFinalFuture = CompletableFuture.supplyAsync(() -> {
|
|
Map<String, IndexKpiCompletByDate> htereceivedZrbmFinalMap = new TreeMap<>();
|
|
Map<String, IndexKpiCompletByDate> htereceivedZrbmFinalMap = new TreeMap<>();
|
|
- List<IndexKpiCompletByDate> rList = new ArrayList<>();
|
|
|
|
- List<IndexKpiCompletByDate> zrbmKpiList = (List<IndexKpiCompletByDate>) redisUtil.get(CacheKey.INDEX_ZRBM_FINAL);
|
|
|
|
- if(zrbmKpiList != null && zrbmKpiList.size() > 0 && zrbmKpiList.get(0) != null){
|
|
|
|
- rList = zrbmKpiList;
|
|
|
|
- }else {
|
|
|
|
- rList = indexKpiMapper.getFinallNum(finalDateLastYm, zrbmList);
|
|
|
|
- redisUtil.set(CacheKey.INDEX_ZRBM_FINAL,rList,1000L * 60 * 60 * 10);
|
|
|
|
- }
|
|
|
|
-// List<IndexKpiCompletByDate> list = indexKpiMapper.getFinallNum(finalDateLastYm, zrbmList);
|
|
|
|
- for (IndexKpiCompletByDate i : rList){
|
|
|
|
- htereceivedZrbmFinalMap.put(i.getDepart(),i);
|
|
|
|
|
|
+ if (finalIsCurrentDate){
|
|
|
|
+ List<IndexKpiCompletByDate> rList = indexKpiMapper.getFinallNum(finalDateLastYm, zrbmList);
|
|
|
|
+ for (IndexKpiCompletByDate i : rList){
|
|
|
|
+ htereceivedZrbmFinalMap.put(i.getDepart(),i);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return htereceivedZrbmFinalMap;
|
|
return htereceivedZrbmFinalMap;
|
|
});
|
|
});
|
|
|
|
|
|
CompletableFuture<Map<String, IndexKpiCompletByDate>> getHtereceivedZrbmNewFuture = CompletableFuture.supplyAsync(() -> {
|
|
CompletableFuture<Map<String, IndexKpiCompletByDate>> getHtereceivedZrbmNewFuture = CompletableFuture.supplyAsync(() -> {
|
|
Map<String, IndexKpiCompletByDate> htereceivedZrbmNewMap = new TreeMap<>();
|
|
Map<String, IndexKpiCompletByDate> htereceivedZrbmNewMap = new TreeMap<>();
|
|
- List<IndexKpiCompletByDate> rList = new ArrayList<>();
|
|
|
|
- List<IndexKpiCompletByDate> zrbmKpiList = (List<IndexKpiCompletByDate>)redisUtil.get(CacheKey.INDEX_ZRBM_NEW);
|
|
|
|
- if (zrbmKpiList != null && zrbmKpiList.size() > 0 && zrbmKpiList.get(0) != null){
|
|
|
|
- rList = zrbmKpiList;
|
|
|
|
- }else {
|
|
|
|
- rList = indexKpiMapper.getNewNum(finalDateLastYm, zrbmList);
|
|
|
|
- redisUtil.set(CacheKey.INDEX_ZRBM_NEW,rList,1000L * 60 * 60 * 10);
|
|
|
|
- }
|
|
|
|
-// List<IndexKpiCompletByDate> list = indexKpiMapper.getNewNum(finalDateLastYm, zrbmList);
|
|
|
|
- for (IndexKpiCompletByDate i : rList){
|
|
|
|
- htereceivedZrbmNewMap.put(i.getDepart(),i);
|
|
|
|
|
|
+ if (finalIsCurrentDate){
|
|
|
|
+ List<IndexKpiCompletByDate> rList = indexKpiMapper.getNewNum(finalDateLastYm, zrbmList);
|
|
|
|
+ for (IndexKpiCompletByDate i : rList){
|
|
|
|
+ htereceivedZrbmNewMap.put(i.getDepart(),i);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return htereceivedZrbmNewMap;
|
|
return htereceivedZrbmNewMap;
|
|
});
|
|
});
|
|
@@ -534,13 +524,6 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
kpiDataZrbm.setContractAmount(htereceivedZrbm.getContractAmount().setScale(2, RoundingMode.HALF_UP));
|
|
kpiDataZrbm.setContractAmount(htereceivedZrbm.getContractAmount().setScale(2, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
kpiDataZrbm.setReceived(htereceivedZrbm.getReceived().setScale(2, RoundingMode.HALF_UP));
|
|
kpiDataZrbm.setReceived(htereceivedZrbm.getReceived().setScale(2, RoundingMode.HALF_UP));
|
|
-// IndexKpiCompletByDate htereceivedZrbmLast = htereceivedZrbmLastMap.getOrDefault(kpiDataZrbm.getDepart(), kpiDataZrbm);
|
|
|
|
-// if(htereceivedZrbm.getContractAmount() == null || htereceivedZrbmLast.getContractAmount() == null){
|
|
|
|
-// kpiDataZrbm.setContractAmount(BigDecimal.valueOf(0).setScale(2, RoundingMode.HALF_UP));
|
|
|
|
-// }else {
|
|
|
|
-// kpiDataZrbm.setContractAmount(htereceivedZrbm.getContractAmount().subtract(htereceivedZrbmLast.getContractAmount()).setScale(2, RoundingMode.HALF_UP));//合同额
|
|
|
|
-// }
|
|
|
|
-// kpiDataZrbm.setReceived(htereceivedZrbm.getReceived().subtract(htereceivedZrbmLast.getReceived()).setScale(2, RoundingMode.HALF_UP));//已收款
|
|
|
|
}
|
|
}
|
|
//计算完成度 合同额(是计算的某个月或某个年的合同额 增量)/ 指标
|
|
//计算完成度 合同额(是计算的某个月或某个年的合同额 增量)/ 指标
|
|
if(kpiDataZrbm.getDepartKpi() != null){
|
|
if(kpiDataZrbm.getDepartKpi() != null){
|
|
@@ -573,21 +556,6 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
kpiDataJycs.setKpiCompletRate(kpiDataJycs.getReceived().divide(kpiDataJycs.getDepartKpi(), 2, RoundingMode.HALF_UP));
|
|
kpiDataJycs.setKpiCompletRate(kpiDataJycs.getReceived().divide(kpiDataJycs.getDepartKpi(), 2, RoundingMode.HALF_UP));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- ////根据部门找到今年的合同额和已收款
|
|
|
|
- //IndexKpiCompletByDate htereceivedJycs = htereceivedJycsMap.getOrDefault(kpiDataJycs.getDepart(), kpiDataJycs);
|
|
|
|
- //IndexKpiCompletByDate htereceivedJycsLast = htereceivedJycsLastMap.getOrDefault(kpiDataJycs.getDepart(), kpiDataJycs);
|
|
|
|
- ////kpiDataJycs.setContractAmount(htereceivedJycs.getContractAmount().subtract(htereceivedJycsLast.getContractAmount()).setScale(2, RoundingMode.HALF_UP));//合同额
|
|
|
|
- //kpiDataJycs.setContractAmount(htereceivedJycs.getContractAmount());//合同额
|
|
|
|
- //kpiDataJycs.setReceived(htereceivedJycs.getReceived().subtract(htereceivedJycsLast.getReceived()).setScale(2, RoundingMode.HALF_UP));//已收款
|
|
|
|
- //
|
|
|
|
- ////计算完成度 合同额(是计算的某个月或某个年的合同额 增量)/ 指标
|
|
|
|
- //if(kpiDataJycs.getDepartKpi() != null){
|
|
|
|
- // if(kpiDataJycs.getDepartKpi().equals(BigDecimal.valueOf(0))){
|
|
|
|
- // kpiDataJycs.setKpiCompletRate(BigDecimal.valueOf(1));
|
|
|
|
- // }else{
|
|
|
|
- // kpiDataJycs.setKpiCompletRate(kpiDataJycs.getContractAmount().divide(kpiDataJycs.getDepartKpi(), 2, RoundingMode.HALF_UP));
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
}
|
|
}
|
|
// System.out.println("kpiDataJycsList");
|
|
// System.out.println("kpiDataJycsList");
|
|
//下达部门指标完成度排序
|
|
//下达部门指标完成度排序
|
|
@@ -602,6 +570,8 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
}
|
|
}
|
|
System.out.println(indexKpiDataDepart);
|
|
System.out.println(indexKpiDataDepart);
|
|
|
|
|
|
|
|
+ redisUtil.set(CacheKey.INDEX_ZRBM_NEW+":"+indexKpiParamDto.getTime()+":"+indexKpiParamDto.getBeginDate(),indexKpiDataDepart,1000L * 60 * 60 * 10);
|
|
|
|
+
|
|
return indexKpiDataDepart;
|
|
return indexKpiDataDepart;
|
|
}
|
|
}
|
|
|
|
|