| | |
| | | case "countExplorationPoints": |
| | | createCountExplorationPointsWord(source, target); |
| | | break; |
| | | case "countSizesByType": |
| | | createCountSizesByTypeWord(source, target); |
| | | break; |
| | | case "countSizesByPrj": |
| | | createCountSizesByPrjWord(source, target); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | break; |
| | | case "countExplorationPoints": |
| | | createCountExplorationPointsExcel(source, target); |
| | | break; |
| | | case "countSizesByType": |
| | | createCountSizesByTypeExcel(source, target); |
| | | break; |
| | | case "countSizesByPrj": |
| | | createCountSizesByPrjExcel(source, target); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建 服务调用量统计 Word |
| | | */ |
| | | public void createCountServicesWord(String source, String target) { |
| | | List<CountEntity> list = countServices(); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | int rows = 1, allCount = 0; |
| | | ArrayList<String[]> addList = new ArrayList<>(); |
| | | for (CountEntity ce : list) { |
| | | allCount += ce.getCount(); |
| | | String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getCount().toString()}; |
| | | addList.add(strs); |
| | | } |
| | | if (addList.size() > 0) { |
| | | addList.add(new String[]{"" + rows, "总计", "" + allCount}); |
| | | } |
| | | |
| | | WordHelper.generateWord(source, target, null, addList); |
| | | } |
| | | |
| | | /** |
| | | * 创建 数据量统计 Word |
| | | */ |
| | | public void createCountSizesWord(String source, String target) { |
| | |
| | | } |
| | | if (addList.size() > 0) { |
| | | addList.add(new String[]{"" + rows, "总计", FileHelper.getSizes(allSize)}); |
| | | } |
| | | |
| | | WordHelper.generateWord(source, target, null, addList); |
| | | } |
| | | |
| | | /** |
| | | * 创建 服务调用量统计 Word |
| | | */ |
| | | public void createCountServicesWord(String source, String target) { |
| | | List<CountEntity> list = countServices(); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | int rows = 1, allCount = 0; |
| | | ArrayList<String[]> addList = new ArrayList<>(); |
| | | for (CountEntity ce : list) { |
| | | allCount += ce.getCount(); |
| | | String[] strs = new String[]{"" + rows++, ce.getM1(), ce.getCount().toString()}; |
| | | addList.add(strs); |
| | | } |
| | | if (addList.size() > 0) { |
| | | addList.add(new String[]{"" + rows, "总计", "" + allCount}); |
| | | } |
| | | |
| | | WordHelper.generateWord(source, target, null, addList); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建 用户流量统计 Excel |
| | | * 创建 数据格式统计 Word |
| | | */ |
| | | public void createCountOperatesExcel(String source, String target) { |
| | | List<CountEntity> list = countOperates(); |
| | | public void createCountSizesByTypeWord(String source, String target) { |
| | | List<CountEntity> list = countSizesByType(); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | int rows = 1, allCount = 0; |
| | | Double allSize = 0d; |
| | | ArrayList<String[]> addList = new ArrayList<>(); |
| | | for (CountEntity ce : list) { |
| | | ce.setNo(rows++); |
| | | allSize += ce.getSizes(); |
| | | allCount += ce.getCount(); |
| | | String[] strs = new String[]{"" + rows++, ce.getM1(), "" + ce.getCount(), FileHelper.getSizes(ce.getSizes())}; |
| | | addList.add(strs); |
| | | } |
| | | if (list.size() > 0) { |
| | | CountEntity ce = new CountEntity(); |
| | | ce.setNo(rows); |
| | | ce.setM1("总计"); |
| | | ce.setCount((long) allCount); |
| | | list.add(ce); |
| | | if (addList.size() > 0) { |
| | | addList.add(new String[]{"" + rows, "总计", "" + allCount, FileHelper.getSizes(allSize)}); |
| | | } |
| | | |
| | | Map<String, List<CountEntity>> map = new HashMap<>(1); |
| | | map.put("data", list); |
| | | |
| | | ExcelHelper.writeToTemplate(source, target, map); |
| | | WordHelper.generateWord(source, target, null, addList); |
| | | } |
| | | |
| | | /** |
| | | * 创建 服务调用量统计 Excel |
| | | * 创建 项目数据统计 Word |
| | | */ |
| | | public void createCountServicesExcel(String source, String target) { |
| | | List<CountEntity> list = countServices(); |
| | | public void createCountSizesByPrjWord(String source, String target) { |
| | | List<CountEntity> list = countSizesByPrj(); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | int rows = 1, allCount = 0; |
| | | Double allSize = 0d; |
| | | ArrayList<String[]> addList = new ArrayList<>(); |
| | | for (CountEntity ce : list) { |
| | | allSize += ce.getSizes(); |
| | | allCount += ce.getCount(); |
| | | String[] strs = new String[]{"" + rows++, ce.getM1(), "" + ce.getCount(), FileHelper.getSizes(ce.getSizes())}; |
| | | addList.add(strs); |
| | | } |
| | | if (addList.size() > 0) { |
| | | addList.add(new String[]{"" + rows, "总计", "" + allCount, FileHelper.getSizes(allSize)}); |
| | | } |
| | | |
| | | WordHelper.generateWord(source, target, null, addList); |
| | | } |
| | | |
| | | /** |
| | | * 创建 用户流量统计 Excel |
| | | */ |
| | | public void createCountOperatesExcel(String source, String target) { |
| | | List<CountEntity> list = countOperates(); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建 服务调用量统计 Excel |
| | | */ |
| | | public void createCountServicesExcel(String source, String target) { |
| | | List<CountEntity> list = countServices(); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | int rows = 1, allCount = 0; |
| | | for (CountEntity ce : list) { |
| | | ce.setNo(rows++); |
| | | allCount += ce.getCount(); |
| | | } |
| | | if (list.size() > 0) { |
| | | CountEntity ce = new CountEntity(); |
| | | ce.setNo(rows); |
| | | ce.setM1("总计"); |
| | | ce.setCount((long) allCount); |
| | | list.add(ce); |
| | | } |
| | | |
| | | Map<String, List<CountEntity>> map = new HashMap<>(1); |
| | | map.put("data", list); |
| | | |
| | | ExcelHelper.writeToTemplate(source, target, map); |
| | | } |
| | | |
| | | /** |
| | | * 创建 钻孔数据统计 Excel |
| | | */ |
| | | public void createCountExplorationPointsExcel(String source, String target) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 创建 数据格式统计 Excel |
| | | */ |
| | | public void createCountSizesByTypeExcel(String source, String target) { |
| | | List<CountEntity> list = countSizesByType(); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | int rows = 1, allCount = 0; |
| | | Double allSize = 0d; |
| | | for (CountEntity ce : list) { |
| | | ce.setNo(rows++); |
| | | ce.setM2(FileHelper.getSizes(ce.getSizes())); |
| | | allCount += ce.getCount(); |
| | | allSize += ce.getSizes(); |
| | | } |
| | | if (list.size() > 0) { |
| | | CountEntity ce = new CountEntity(); |
| | | ce.setNo(rows); |
| | | ce.setM1("总计"); |
| | | ce.setCount((long) allCount); |
| | | ce.setM2(FileHelper.getSizes(allSize)); |
| | | list.add(ce); |
| | | } |
| | | |
| | | Map<String, List<CountEntity>> map = new HashMap<>(1); |
| | | map.put("data", list); |
| | | |
| | | ExcelHelper.writeToTemplate(source, target, map); |
| | | } |
| | | |
| | | /** |
| | | * 创建 项目数据统计 Excel |
| | | */ |
| | | public void createCountSizesByPrjExcel(String source, String target) { |
| | | List<CountEntity> list = countSizesByPrj(); |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | int rows = 1, allCount = 0; |
| | | Double allSize = 0d; |
| | | for (CountEntity ce : list) { |
| | | ce.setNo(rows++); |
| | | ce.setM2(FileHelper.getSizes(ce.getSizes())); |
| | | allCount += ce.getCount(); |
| | | allSize += ce.getSizes(); |
| | | } |
| | | if (list.size() > 0) { |
| | | CountEntity ce = new CountEntity(); |
| | | ce.setNo(rows); |
| | | ce.setM1("总计"); |
| | | ce.setCount((long) allCount); |
| | | ce.setM2(FileHelper.getSizes(allSize)); |
| | | list.add(ce); |
| | | } |
| | | |
| | | Map<String, List<CountEntity>> map = new HashMap<>(1); |
| | | map.put("data", list); |
| | | |
| | | ExcelHelper.writeToTemplate(source, target, map); |
| | | } |
| | | |
| | | /** |
| | | * 获取下载实体类 |
| | | */ |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file) { |