Browse Source

首页柱状图

kxc
zth 8 months ago
parent
commit
9088e39cbe
  1. 2
      jwtech-admin-page/src/views/building/projectInfo/projectProcess/scheduleManagement/options/progressFilling.vue
  2. 44
      jwtech-admin-page/src/views/welcome/index.vue
  3. 25
      jwtech-system/src/main/java/com/kms/build/service/BsSgcjsjdBuiProInfoService.java

2
jwtech-admin-page/src/views/building/projectInfo/projectProcess/scheduleManagement/options/progressFilling.vue

@ -273,7 +273,7 @@
<el-dialog
title="进度填报"
:visible.sync="PF_open"
width="1600px"
width="1400px"
append-to-body
:close-on-click-modal="false"
custom-class="progressFillingDialog"

44
jwtech-admin-page/src/views/welcome/index.vue

@ -225,6 +225,12 @@ export default {
zd:{},
adcd:[],
year:"2024",
routeList: [
{
path: "/evaluationEarlyWarning/earlyWarningManage/warning",
routeName: "项目预警管理",
},
],
formattedZd:{},
formattedMs:{},
projectType:[],
@ -383,7 +389,22 @@ export default {
},
viewInfo(row){
// console.log(row)
this.$router.push("/evaluationEarlyWarning/earlyWarningManage/warning/options?baseDataId="+row.id)
this.routeList[0].routeName = row.projectName;
this.routeList.push({
path: "/evaluationEarlyWarning/earlyWarningManage/warning/options",
routeName: row.proCode,
isEdit: true,
});
//
this.$store.commit("setRouteList", JSON.stringify(this.routeList));
//
this.$router.push({
path:
"/evaluationEarlyWarning/earlyWarningManage/warning/options?baseDataId=" +
row.id,
})
},
eleInit() {
let chartDom = this.$refs.Ele;
@ -479,8 +500,23 @@ export default {
const filteredSourceFound = Object.values(this.sourceFound)
.filter((_, index) => validIndices.includes(index));
const progressPlans = filteredSourceFound.map(obj => obj.progressPlan);
const actuals = filteredSourceFound.map(obj => obj.actual);
const indexedSourceFound = filteredSourceFound.map((obj, index) => ({ ...obj, index }));
const indexedActuals = indexedSourceFound.map(obj => obj.actual);
// actuals
const sortedByActuals = indexedSourceFound
.map(obj => ({ ...obj, actual: indexedActuals[obj.index] }))
.sort((a, b) => b.actual - a.actual);
//
const sortedIndices = sortedByActuals.map(obj => obj.index);
// filteredData filteredSourceFound
const sortedFilteredData = sortedIndices.map(index => filteredData[index]);
const sortedFilteredSourceFound = sortedIndices.map(index => filteredSourceFound[index]);
const progressPlans = sortedFilteredSourceFound.map(obj => obj.progressPlan);
const actuals = sortedFilteredSourceFound.map(obj => obj.actual);
// yAxis max
const yAxisMax = Math.max(maxProgressPlan, maxActual);
@ -512,7 +548,7 @@ export default {
},
axisLabel: { interval: 0,rotate: 45 },
type: 'category',
data:filteredData,
data:sortedFilteredData,
axisPointer: {
type: 'shadow'
},

25
jwtech-system/src/main/java/com/kms/build/service/BsSgcjsjdBuiProInfoService.java

@ -884,8 +884,9 @@ public class BsSgcjsjdBuiProInfoService extends BaseService<BsSgcjsjdBuiProInfoM
@Autowired
private BsSgcJsjdBuiProgressPlanService bsSgcJsjdBuiProgressPlanService;
private Map<String, HashMap<String, BigDecimal>> map = new ConcurrentHashMap<>(); // 使用 ConcurrentHashMap 确保线程安全
public HashMap<String,HashMap<String,BigDecimal>>getSourceFundsNum(String year){
Map<String, HashMap<String, BigDecimal>> map = new ConcurrentHashMap<>();
SysUser sysUser = UserUtils.getUser();
String deptId = sysUser.getDeptId();
SysDept sysDept = sysDeptService.get(deptId);
@ -919,8 +920,7 @@ public class BsSgcjsjdBuiProInfoService extends BaseService<BsSgcjsjdBuiProInfoM
} else {
HashMap<String, BigDecimal> stringBigDecimalHashMap = map.get(adcd);
LambdaQueryWrapper<BsSgcJsjdBuiProgressPlan> lw = new LambdaQueryWrapper<>();
List<BsSgcJsjdBuiProgressPlan> bsSgcJsjdBuiProgressPlans = bsSgcJsjdBuiProgressPlanMapper.selectList(lw.eq(BsSgcJsjdBuiProgressPlan::getProNo, bs.getProNo())
.eq(BsSgcJsjdBuiProgressPlan::getPlanYear, year));
List<BsSgcJsjdBuiProgressPlan> bsSgcJsjdBuiProgressPlans = bsSgcJsjdBuiProgressPlanMapper.selectList(lw.eq(BsSgcJsjdBuiProgressPlan::getProNo, bs.getProNo()));
for (BsSgcJsjdBuiProgressPlan pp : bsSgcJsjdBuiProgressPlans) {
BigDecimal progressPlan = getProgressPlan(pp);
BigDecimal actualCompletion = getActualCompletion(pp);
@ -940,16 +940,19 @@ public class BsSgcjsjdBuiProInfoService extends BaseService<BsSgcjsjdBuiProInfoM
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
HashMap<String, HashMap<String, BigDecimal>> sortedMap = map.entrySet()
.stream()
List<Map.Entry<String, HashMap<String, BigDecimal>>> entries = new ArrayList<>(map.entrySet());
// 使用 Stream API 对 List 进行排序,并获取最大的 10 个元素
List<Map.Entry<String, HashMap<String, BigDecimal>>> sortedEntries = entries.stream()
.sorted((e1, e2) -> e2.getValue().get("actual").compareTo(e1.getValue().get("actual")))
.limit(10)
.collect(Collectors.toMap(
Map.Entry::getKey,
Map.Entry::getValue,
(existing, replacement) -> existing,
LinkedHashMap::new // 保持插入顺序
));
.collect(Collectors.toList());
// 将排序后的 List 转换回 Map
HashMap<String, HashMap<String, BigDecimal>> sortedMap = new LinkedHashMap<>();
for (Map.Entry<String, HashMap<String, BigDecimal>> entry : sortedEntries) {
sortedMap.put(entry.getKey(), entry.getValue());
}
return sortedMap;
}

Loading…
Cancel
Save