czt
2025-12-25 9e8d09ec8c825872f732f98cad402cbc6a85959a
fzzy-igdss-web/src/main/java/com/fzzy/group/manager/GroupManager.java
@@ -125,6 +125,70 @@
        return deptService.listDept(null, companyId, null);
    }
    /**
     * 获取库区封装信息
     * @param companyId
     * @return
     */
    public List<GroupDeptData> getDeptData(String companyId) {
        List<GroupDeptData> list = new ArrayList<>();
        GroupDeptData deptData;
        List<Dept> deptList = deptService.getDeptData();
        if (null != deptList && !deptList.isEmpty()) {
            List<Depot> depotList;
            for (Dept dept : deptList) {
                deptData = new GroupDeptData();
                deptData.setDeptId(dept.getId());
                deptData.setDeptName(dept.getKqmc());
                deptData.setCode(dept.getXzqhdm());
                deptData.setCounty(dept.getXzqhmc());
                deptData.setJd(dept.getJd());
                deptData.setWd(dept.getWd());
                //统计仓库数
                depotList = depotService.getCacheDepotList(dept.getCompanyId(), dept.getId());
                if (null != depotList && !depotList.isEmpty()) {
                    for (Depot depot : depotList) {
                        deptData.setDepotNumber(deptData.getDepotNumber() + 1);
                        if(StringUtils.isNotBlank(depot.getPledgeBank())){
                            deptData.setDepotBankNumber(deptData.getDepotBankNumber() + 1);
                        }
                        if(null == depot.getStorageReal()){
                            depot.setStorageReal(0.0);
                        }
                        deptData.setStorageNum(deptData.getStorageNum() + depot.getStorageReal()/1000);
                    }
                }
                //统计出入库数量
                InoutParam inoutParam = new InoutParam();
                inoutParam.setDeptId(dept.getId());
                inoutParam.setCompanyId(companyId);
                inoutParam.setStart(DateUtil.getCurZero(new Date()));
                inoutParam.setEnd(DateUtil.getNextZero(new Date()));
                List<InoutRecord> inoutRecords = inoutRecordService.listInout(inoutParam);
                if (null != inoutRecords && !inoutRecords.isEmpty()) {
                    for (InoutRecord inoutRecord : inoutRecords) {
                        if (Constant.TYPE_IN.equals(inoutRecord.getType())) {
                            deptData.setInNum(deptData.getInNum() + 1);
                        }
                        if (Constant.TYPE_OUT.equals(inoutRecord.getType())){
                            deptData.setOutNum(deptData.getOutNum() + 1);
                        }
                    }
                }
                list.add(deptData);
            }
        }
        return list;
    }
    /**
     * 大屏首页统计信息:企业数、库区数、仓库数、质押仓数、散粮及成品粮数、分品种库存数