| | |
| | | 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 |
| | |
| | | private DicAreaService dicAreaService; |
| | | @Resource |
| | | private CoreDeptService deptService; |
| | | @Resource |
| | | private DepotService depotService; |
| | | |
| | | /** |
| | | * 获取省及下属市州集合 |
| | |
| | | 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; |
| | | } |
| | | } |