| | |
| | | private SnapRecordService snapRecordService; |
| | | @Resource |
| | | private SecCameraService cameraService; |
| | | @Resource |
| | | private BankService bankService; |
| | | |
| | | @Resource |
| | | private PledgeContractService pledgeContractService; |
| | | |
| | | /** |
| | | * 获取省及下属市州集合 |
| | |
| | | area.setChildren(children); |
| | | } |
| | | |
| | | } |
| | | list.add(area); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | public List<DicArea> getBankAndChildDept(String areaCode) { |
| | | |
| | | DicArea area = dicAreaService.listDicAreaByCode(areaCode); |
| | | if (null == area) { |
| | | return null; |
| | | } |
| | | List<DicArea> areaChildren = new ArrayList<>(); |
| | | |
| | | List<DicArea> list = new ArrayList<>(); |
| | | if (Constant.AREA_TYPE_1.equals(area.getType())) { |
| | | //查询所有的质押合同 |
| | | List<PledgeContract> pledgeContractList = pledgeContractService.listAll(null); |
| | | //查询所有的库区 |
| | | List<Dept> depotList = deptService.listDept(null, ContextUtil.getCompanyId(), null); |
| | | //查询所有的银行 |
| | | List<Bank> bankList = bankService.listAll(null); |
| | | DicArea defaultBank = new DicArea(); |
| | | defaultBank.setCode("-1"); |
| | | defaultBank.setName("无质押银行"); |
| | | defaultBank.setChildren(new ArrayList<>()); |
| | | |
| | | for (Dept dept : depotList) { |
| | | Boolean isPledge = false; |
| | | for (PledgeContract pledgeContract : pledgeContractList) { |
| | | if( dept.getId().equals(pledgeContract.getPledgeDept())){ |
| | | //从list中找到当前质押银行的数据 |
| | | DicArea pledgeBank = null; |
| | | int indexBank = -1; |
| | | for (DicArea item : areaChildren) { |
| | | if (pledgeContract.getPledgeBank().equals(item.getCode())) { |
| | | pledgeBank = item; |
| | | indexBank = areaChildren.indexOf(pledgeBank); |
| | | break; |
| | | } |
| | | } |
| | | if( null == pledgeBank){ |
| | | //未找到质押银行数据则新建 |
| | | pledgeBank = new DicArea(); |
| | | pledgeBank.setCode(pledgeContract.getPledgeBank()); |
| | | pledgeBank.setName("质押银行_"+pledgeContract.getPledgeBank()); |
| | | //从银行数据中找到质押银行的信息 |
| | | for (Bank bank : bankList) { |
| | | if (pledgeContract.getPledgeBank().equals(bank.getId())) { |
| | | pledgeBank.setName(bank.getName()); |
| | | } |
| | | } |
| | | //添加质押银行下的库区数据 |
| | | DicArea deptDic = new DicArea(); |
| | | deptDic.setCode(dept.getId()); |
| | | deptDic.setName(dept.getKqmc()); |
| | | |
| | | List<DicArea> children = pledgeBank.getChildren(); |
| | | if (null == children) { |
| | | pledgeBank.setChildren(new ArrayList<>()); |
| | | } |
| | | pledgeBank.getChildren().add(deptDic); |
| | | //新增质押银行数据到list中 |
| | | areaChildren.add(pledgeBank); |
| | | isPledge=true; |
| | | break; |
| | | }else{ |
| | | //添加质押银行下的库区数据 |
| | | DicArea deptDic = new DicArea(); |
| | | deptDic.setCode(dept.getId()); |
| | | deptDic.setName(dept.getKqmc()); |
| | | |
| | | List<DicArea> children = pledgeBank.getChildren(); |
| | | if (null == children) { |
| | | pledgeBank.setChildren(new ArrayList<>()); |
| | | } |
| | | pledgeBank.getChildren().add(deptDic); |
| | | //更新list中的质押银行数据 |
| | | areaChildren.set(indexBank,pledgeBank); |
| | | isPledge=true; |
| | | break; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | if(!isPledge){ |
| | | DicArea deptDic = new DicArea(); |
| | | deptDic.setCode(dept.getId()); |
| | | deptDic.setName(dept.getKqmc()); |
| | | |
| | | List<DicArea> children = defaultBank.getChildren(); |
| | | if (null == children) { |
| | | defaultBank.setChildren(new ArrayList<>()); |
| | | } |
| | | defaultBank.getChildren().add(deptDic); |
| | | } |
| | | } |
| | | List<DicArea> defaultBankChildren = defaultBank.getChildren(); |
| | | if (defaultBankChildren.size()>0) { |
| | | areaChildren.add(defaultBank); |
| | | } |
| | | area.setChildren(areaChildren); |
| | | } |
| | | list.add(area); |
| | | return list; |
| | |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取库区封装信息 |
| | | * |
| | | * @param companyId |
| | | * @return |
| | | */ |
| | | public List<GroupDepotData> getDepotData(String companyId) { |
| | | |
| | | List<GroupDepotData> list = new ArrayList<>(); |
| | | GroupDepotData depotData; |
| | | List<Dept> deptList = deptService.getDeptByUserType(null); |
| | | if (null != deptList && !deptList.isEmpty()) { |
| | | List<Depot> depotList; |
| | | for (Dept dept : deptList) { |
| | | //统计仓库数 |
| | | depotList = depotService.getCacheDepotList(dept.getCompanyId(), dept.getId()); |
| | | if (null != depotList && !depotList.isEmpty()) { |
| | | for (Depot depot : depotList) { |
| | | depotData = new GroupDepotData(); |
| | | depotData.setDeptId(dept.getId()); |
| | | depotData.setDeptName(dept.getKqmc()); |
| | | depotData.setCode(dept.getXzqhdm()); |
| | | depotData.setCounty(dept.getXzqhmc()); |
| | | depotData.setDepotId(depot.getId()); |
| | | depotData.setDepotName(depot.getName()); |
| | | if (null == depot.getStorageReal()) { |
| | | depot.setStorageReal(0.0); |
| | | } |
| | | depotData.setStorageNum(depot.getStorageReal() / 1000); |
| | | list.add(depotData); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 获取库区下监控信息 |
| | | * |