From a1cc1dca3ad00d2ac1b81c54b0f98b3684c31da1 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期四, 25 十二月 2025 11:48:20 +0800
Subject: [PATCH] Gis大屏调整及数据交互
---
fzzy-igdss-web/src/main/java/com/fzzy/group/manager/GroupManager.java | 79 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/fzzy-igdss-web/src/main/java/com/fzzy/group/manager/GroupManager.java b/fzzy-igdss-web/src/main/java/com/fzzy/group/manager/GroupManager.java
index 6ab869d..adfc479 100644
--- a/fzzy-igdss-web/src/main/java/com/fzzy/group/manager/GroupManager.java
+++ b/fzzy-igdss-web/src/main/java/com/fzzy/group/manager/GroupManager.java
@@ -1,16 +1,22 @@
package com.fzzy.group.manager;
import com.fzzy.igds.constant.Constant;
+import com.fzzy.igds.data.ChartPie;
+import com.fzzy.igds.data.GisData;
+import com.fzzy.igds.domain.Depot;
import com.fzzy.igds.domain.Dept;
import com.fzzy.igds.domain.DicArea;
import com.fzzy.igds.service.CoreDeptService;
+import com.fzzy.igds.service.DepotService;
import com.fzzy.igds.service.DicAreaService;
+import com.fzzy.igds.utils.ContextUtil;
+import com.ruoyi.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
+import java.text.DecimalFormat;
+import java.util.*;
/**
* @Description
@@ -25,6 +31,8 @@
private DicAreaService dicAreaService;
@Resource
private CoreDeptService deptService;
+ @Resource
+ private DepotService depotService;
/**
* 鑾峰彇鐪佸強涓嬪睘甯傚窞闆嗗悎
@@ -105,4 +113,71 @@
public List<Dept> getAllDept(String companyId) {
return deptService.listDept(null, companyId, null);
}
+
+ /**
+ * 缁熻gis鏁版嵁锛屽彧缁熻鐧诲綍浜轰笅灞炵殑鏁版嵁缁熻
+ * @return
+ */
+ public GisData getGisData() {
+
+ GisData gisData = new GisData();
+
+ //鏌ヨ浼婄妬涓嬪睘鍖哄幙
+ //鍖哄幙
+ List<DicArea> dicAreaList = dicAreaService.listData("654000", null, null);
+
+ //缁熻鍖哄幙涓嬪簱鍖烘暟
+ LinkedHashMap<String, Integer> valuePieChart = new LinkedHashMap<>();
+ LinkedHashMap<String, String> namePieChart = new LinkedHashMap<>();
+ if (null != dicAreaList && !dicAreaList.isEmpty()) {
+ for (DicArea dicArea : dicAreaList) {
+ valuePieChart.put(dicArea.getCode(), 0);
+ namePieChart.put(dicArea.getCode(), dicArea.getName());
+ }
+ }
+ List<Dept> deptList = deptService.getDeptData();
+ if (null != deptList && !deptList.isEmpty()) {
+ //搴撳尯鎬绘暟
+ gisData.setDeptNum(deptList.size());
+ for (Dept dept : deptList) {
+ if (StringUtils.isBlank(dept.getXzqhdm()) || null == valuePieChart.get(dept.getXzqhdm())) {
+ if(null == valuePieChart.get("999999")){
+ valuePieChart.put("999999", 0);
+ namePieChart.put("999999", "鍏朵粬鍖哄幙");
+ }
+ dept.setXzqhdm("999999");
+ }
+ valuePieChart.put(dept.getXzqhdm(), valuePieChart.get(dept.getXzqhdm()) + 1);
+ }
+ }
+
+ if(gisData.getDeptNum() > 0){
+ for (String mapKey : valuePieChart.keySet()) {
+ gisData.getDeptList().add(new ChartPie(valuePieChart.get(mapKey) + "", namePieChart.get(mapKey), new DecimalFormat("0.0").format((double)valuePieChart.get(mapKey) / gisData.getDeptNum() * 100)));
+ }
+ }
+
+ //缁熻閲嶉噺
+ List<Depot> depotLisst = depotService.getData(ContextUtil.getCompanyId(), ContextUtil.subDeptId(null), false);
+ if (null != depotLisst && !depotLisst.isEmpty()) {
+ for (Depot depot : depotLisst) {
+ if(null == depot.getStorageReal()){
+ depot.setStorageReal(0.0);
+ }
+ gisData.setSum(gisData.getSum() + depot.getStorageReal());
+ if(StringUtils.isNotBlank(depot.getPledgeBank())){
+ gisData.setBankSum(gisData.getBankSum() + depot.getStorageReal());
+ }else{
+ gisData.setNormalSum(gisData.getNormalSum() + depot.getStorageReal());
+ }
+ }
+ }
+ if(gisData.getSum() > 0){
+ gisData.setSumPer(new DecimalFormat("0.00").format(gisData.getSum() / gisData.getSum() * 100L));
+ gisData.setBankSumPer(new DecimalFormat("0.00").format(gisData.getBankSum() / gisData.getSum() * 100L));
+ gisData.setNormalSumPer(new DecimalFormat("0.00").format(gisData.getNormalSum() / gisData.getSum() * 100L));
+ }
+
+ return gisData;
+ }
}
--
Gitblit v1.9.3