| | |
| | | |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.service.BaseService; |
| | | import com.example.client.utils.TranslateToPlainStrUtils; |
| | | import com.example.server.ExportExcel.dto.ExcelColumnDto; |
| | | import com.example.server.ExportExcel.dto.ExprotExcelDto; |
| | | import com.example.server.ExportExcel.method.ExcelExport; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.Dto.Level3ExportCloum; |
| | | import com.example.server.progressTrack.Dto.NetworkNodeStatusDto; |
| | | import com.example.server.progressTrack.Dto.StatistProductDto; |
| | | import com.example.server.progressTrack.Dto.TableNodeDto; |
| | | import com.example.server.progressTrack.dao.DjJdgzNetworkLevel3Dao; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3List; |
| | | import com.example.server.progressTrack.model.DjJdgzTrackRecord; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import com.example.server.utils.FileUtils; |
| | | import com.example.server.utils.ImportUtil; |
| | | import com.example.server.utils.UUIDUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.ss.usermodel.HorizontalAlignment; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | @Value("${zt.oss.local-path}") |
| | | private String path; |
| | | |
| | | public List<StatistProductDto> getStatist(Long level1Id) { |
| | | return baseDao.getStatist(level1Id); |
| | | public List<StatistProductDto> getStatist(Long level1Id,String type) { |
| | | return baseDao.getStatist(level1Id,type); |
| | | } |
| | | |
| | | public void exportExcel(String path, Long level1NetworkId, Long deptId, Long teamGroupId, String status) { |
| | | List<ExprotExcelDto> dtos = new ArrayList<>(); |
| | | ExprotExcelDto dto = new ExprotExcelDto(); |
| | | dto.setSheetName("设备节点状态记录"); |
| | | |
| | | List<Level3ExportCloum> list = baseDao.getdata(level1NetworkId, deptId, teamGroupId, status); |
| | | Date today = new Date(); |
| | | for (Level3ExportCloum data :list){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date requiredCompletionDate = null; |
| | | Date actualCompletionDate = null; |
| | | try { |
| | | if (StringUtils.isNotBlank(data.getRequiredCompletionTime())) { |
| | | requiredCompletionDate = sdf.parse(data.getRequiredCompletionTime()); |
| | | } |
| | | if (StringUtils.isNotBlank(data.getActualCompletion())) { |
| | | actualCompletionDate = sdf.parse(data.getActualCompletion()); |
| | | } |
| | | |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (data.getCurrentStatus() == null || data.getCurrentStatus() == 0) { |
| | | if (today.after(requiredCompletionDate)) { |
| | | int days = (int) ((today.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24)); |
| | | data.setStatus("已逾期" + days + "天"); |
| | | } else if ((requiredCompletionDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24) < 7) { |
| | | int days = (int) ((requiredCompletionDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24)); |
| | | data.setStatus("还有" + days + "天临期"); |
| | | } else { |
| | | data.setStatus("进行中"); |
| | | } |
| | | } else if (data.getCurrentStatus() == 1) { |
| | | // 已完成 |
| | | if (data.getActualCompletion() != null && actualCompletionDate.after(requiredCompletionDate)) { |
| | | int days = (int) ((actualCompletionDate.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24)); |
| | | data.setStatus("超期" + days + "天完成"); |
| | | } else { |
| | | data.setStatus("正常完成"); |
| | | } |
| | | } |
| | | |
| | | data.setDeptName(sysTeamGroupClassService.get(data.getDeptId()).getName()); |
| | | data.setTeamName(sysTeamGroupClassService.get(data.getTeamgroupId()).getName()); |
| | | } |
| | | dto.setDataList(list); |
| | | List<ExcelColumnDto> columnDto2 = new ArrayList<>(); |
| | | columnDto2.add(new ExcelColumnDto("部门", "deptName", 25, HorizontalAlignment.CENTER)); |
| | | columnDto2.add(new ExcelColumnDto("专业", "teamName", 25, HorizontalAlignment.CENTER)); |
| | | columnDto2.add(new ExcelColumnDto("设备名称", "name", 50, HorizontalAlignment.CENTER)); |
| | | columnDto2.add(new ExcelColumnDto("节点名称", "processName", 25, HorizontalAlignment.CENTER)); |
| | | columnDto2.add(new ExcelColumnDto("要求完成时间", "requiredCompletionTime", 25, HorizontalAlignment.CENTER)); |
| | | columnDto2.add(new ExcelColumnDto("状态", "status", 25, HorizontalAlignment.LEFT)); |
| | | dto.setColumnDto(columnDto2); |
| | | dtos.add(dto); |
| | | try { |
| | | ExcelExport.getHSSFWorkbook(path, dtos); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | enum StatusEnum {zy, jxz, lq, yq, zcwc, cqwc} |
| | |
| | | String[] fillColorArr = {"#e5e5e5", "#3498DB", "#F1C40F", "#E74C3C", "#2ECC71", "#006400"}; |
| | | String[] fontColorArr = {"#e5e5e5", "#3498DB", "#F1C40F", "#E74C3C", "#2ECC71", "#006400"}; |
| | | |
| | | public List<DjJdgzNetworkLevel3> getList(Long shipId, Long deptId, Long teamId, Long cabinId, String type, String name) { |
| | | List<DjJdgzNetworkLevel3> list = baseDao.getList(shipId, deptId, teamId, cabinId, type, name); |
| | | public List<DjJdgzNetworkLevel3> getList(Long shipId, Long deptId, Long teamId, Long cabinId, String type, Integer isealCabin,Integer isLt, String name) { |
| | | List<DjJdgzNetworkLevel3> list = baseDao.getList(shipId, deptId, teamId, cabinId, type, isealCabin,isLt, name); |
| | | return list; |
| | | } |
| | | |
| | |
| | | sheetName = sheet.getSheetName(); //获取当前sheet名称 |
| | | sum = sum + num; |
| | | |
| | | Map<Integer, String> mapProcessName = new HashMap<>(); |
| | | mapProcessName.put(1, "设备拆卸出舱"); |
| | | mapProcessName.put(2, "设备分交"); |
| | | mapProcessName.put(3, "拆检鉴定"); |
| | | mapProcessName.put(4, "设备返厂"); |
| | | mapProcessName.put(5, "回装"); |
| | | |
| | | Map<String, String> mapTeamGroup = sysTeamGroupClassService.getMapGroup(false, "hld"); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | |
| | | Row row = sheet.getRow(j); |
| | | |
| | | String name = ImportUtil.getCellValue(row, 0, pattern); |
| | | String deptStr = ImportUtil.getCellValue(row, 1, pattern); |
| | | String teamGroupStr = ImportUtil.getCellValue(row, 2, pattern); |
| | | String cabinStr = ImportUtil.getCellValue(row, 3, pattern); |
| | | String typeStr = ImportUtil.getCellValue(row, 4, pattern); |
| | | String time1 = ImportUtil.getCellValue(row, 5, pattern); |
| | | String time2 = ImportUtil.getCellValue(row, 6, pattern); |
| | | String time3 = ImportUtil.getCellValue(row, 7, pattern); |
| | | String time4 = ImportUtil.getCellValue(row, 8, pattern); |
| | | String time5 = ImportUtil.getCellValue(row, 9, pattern); |
| | | String repairUnit = ImportUtil.getCellValue(row, 10, pattern); |
| | | String repairUnitDirector = ImportUtil.getCellValue(row, 11, pattern); |
| | | String repairUnitContact = ImportUtil.getCellValue(row, 12, pattern); |
| | | String generalRepairUnit = ImportUtil.getCellValue(row, 13, pattern); |
| | | String generalRepairUnitDirector = ImportUtil.getCellValue(row, 14, pattern); |
| | | String generalRepairUnitContact = ImportUtil.getCellValue(row, 15, pattern); |
| | | String isealCabinStr = ImportUtil.getCellValue(row, 1, pattern); |
| | | String isltStr = ImportUtil.getCellValue(row, 2, pattern); |
| | | String deptStr = ImportUtil.getCellValue(row, 3, pattern); |
| | | String teamGroupStr = ImportUtil.getCellValue(row, 4, pattern); |
| | | String cabinStr = ImportUtil.getCellValue(row, 5, pattern); |
| | | String typeStr = ImportUtil.getCellValue(row, 6, pattern); |
| | | String time1 = ImportUtil.getCellValue(row, 7, pattern); |
| | | String time2 = ImportUtil.getCellValue(row, 8, pattern); |
| | | String time3 = ImportUtil.getCellValue(row, 9, pattern); |
| | | String time4 = ImportUtil.getCellValue(row, 10, pattern); |
| | | String time5 = ImportUtil.getCellValue(row, 11, pattern); |
| | | String repairUnit = ImportUtil.getCellValue(row, 12, pattern); |
| | | String repairUnitDirector = ImportUtil.getCellValue(row, 13, pattern); |
| | | String repairUnitContact = ImportUtil.getCellValue(row, 14, pattern); |
| | | String generalRepairUnit = ImportUtil.getCellValue(row, 15, pattern); |
| | | String generalRepairUnitDirector = ImportUtil.getCellValue(row, 16, pattern); |
| | | String generalRepairUnitContact = ImportUtil.getCellValue(row, 17, pattern); |
| | | |
| | | Integer isealCabin = 0; |
| | | Integer islt = 0; |
| | | if (isealCabinStr.equals("是")) { |
| | | isealCabin = 1; |
| | | } |
| | | if (isltStr.equals("是")) { |
| | | islt = 1; |
| | | } |
| | | |
| | | Long id = UUIDUtil.generateId(); |
| | | if (StringUtils.isEmpty(name)) { |
| | |
| | | data.setLevel1NetworkId(level1NetworkId); |
| | | data.setLevel2NetworkId(level2NetworkId); |
| | | data.setLevel2NodeId(level2NodeId); |
| | | data.setIsealCabin(isealCabin); |
| | | data.setIslt(islt); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(deptStr)) { |
| | |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(time1)) { |
| | | String Pname = ""; |
| | | if (typeStr.equals("改换装")||typeStr.equals("改进性修理")){ |
| | | Pname = "设备到厂"; |
| | | }else if(typeStr.equals("修理")){ |
| | | Pname = "设备拆卸出舱"; |
| | | }else if(typeStr.equals("不复装设备")){ |
| | | Pname = "拆卸出舱"; |
| | | } |
| | | if (time1.matches("[0-9/]+")) { |
| | | time1 = time1.replace("/", "-"); |
| | | node.setRequiredCompletionTime(time1); |
| | | node.setProcessName(mapProcessName.get(1)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time1.matches("[0-9.]+")) { |
| | | time1 = time1.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time1); |
| | | node.setProcessName(mapProcessName.get(1)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time1.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time1); |
| | | node.setProcessName(mapProcessName.get(1)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | |
| | | if (node.getId() != null) { |
| | | node.setId(null); |
| | | } |
| | | String Pname = ""; |
| | | if (typeStr.equals("改换装")||typeStr.equals("改进性修理")){ |
| | | Pname = "设备安装"; |
| | | }else if(typeStr.equals("修理")){ |
| | | Pname = "设备分交"; |
| | | }else if(typeStr.equals("不复装设备")){ |
| | | Pname = "入库"; |
| | | } |
| | | if (time2.matches("[0-9/]+")) { |
| | | node.setRequiredCompletionTime(time2); |
| | | node.setProcessName(mapProcessName.get(2)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(2); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time2.matches("[0-9.]+")) { |
| | | time2 = time2.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time2); |
| | | node.setProcessName(mapProcessName.get(2)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(2); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time2.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time2); |
| | | node.setProcessName(mapProcessName.get(2)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(2); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | |
| | | if (node.getId() != null) { |
| | | node.setId(null); |
| | | } |
| | | String Pname = ""; |
| | | if(typeStr.equals("修理")){ |
| | | Pname = "拆检鉴定"; |
| | | }else if(typeStr.equals("不复装设备")){ |
| | | Pname = "存放位置"; |
| | | } |
| | | if (time3.matches("[0-9/]+")) { |
| | | time3 = time3.replace("/", "-"); |
| | | node.setRequiredCompletionTime(time3); |
| | | node.setProcessName(mapProcessName.get(3)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(3); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time3.matches("[0-9.]+")) { |
| | | time3 = time3.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time3); |
| | | node.setProcessName(mapProcessName.get(3)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(3); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time3.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time3); |
| | | node.setProcessName(mapProcessName.get(3)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(3); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | |
| | | if (node.getId() != null) { |
| | | node.setId(null); |
| | | } |
| | | String Pname = ""; |
| | | if(typeStr.equals("修理")){ |
| | | Pname = "设备返厂"; |
| | | }else if(typeStr.equals("不复装设备")){ |
| | | Pname = "移交T队"; |
| | | } |
| | | if (time4.matches("[0-9/]+")) { |
| | | time4 = time4.replace("/", "-"); |
| | | node.setRequiredCompletionTime(time4); |
| | | node.setProcessName(mapProcessName.get(4)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(4); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time4.matches("[0-9.]+")) { |
| | | time4 = time4.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time4); |
| | | node.setProcessName(mapProcessName.get(4)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(4); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time4.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time4); |
| | | node.setProcessName(mapProcessName.get(4)); |
| | | node.setProcessName(Pname); |
| | | node.setSort(4); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | |
| | | if (time5.matches("[0-9/]+")) { |
| | | time5 = time5.replace("/", "-"); |
| | | node.setRequiredCompletionTime(time5); |
| | | node.setProcessName(mapProcessName.get(5)); |
| | | node.setProcessName("回装"); |
| | | node.setSort(5); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time5.matches("[0-9.]+")) { |
| | | time5 = time5.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time5); |
| | | node.setProcessName(mapProcessName.get(5)); |
| | | node.setProcessName("回装"); |
| | | node.setSort(5); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time5.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time5); |
| | | node.setProcessName(mapProcessName.get(5)); |
| | | node.setProcessName("回装"); |
| | | node.setSort(5); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | |
| | | data.setGeneralRepairUnit(generalRepairUnit); |
| | | } |
| | | if (StringUtils.isNotBlank(generalRepairUnitContact)) { |
| | | generalRepairUnitContact = TranslateToPlainStrUtils.translateToPlainStr(generalRepairUnitContact); |
| | | data.setGeneralRepairUnitContact(generalRepairUnitContact); |
| | | } |
| | | if (StringUtils.isNotBlank(generalRepairUnitDirector)) { |
| | |
| | | data.setRepairUnit(repairUnit); |
| | | } |
| | | if (StringUtils.isNotBlank(repairUnitContact)) { |
| | | repairUnitContact = TranslateToPlainStrUtils.translateToPlainStr(repairUnitContact); |
| | | data.setRepairUnitContact(repairUnitContact); |
| | | } |
| | | if (StringUtils.isNotBlank(repairUnitDirector)) { |
| | |
| | | return list; |
| | | } |
| | | |
| | | public List<TableNodeDto> getNodeList(Long shipId, Long deptId, Long teamId, Long cabinId, String type, String name) { |
| | | List<TableNodeDto> list = baseDao.getNodeList(shipId, deptId, teamId, cabinId, type, name); |
| | | public List<TableNodeDto> getNodeList(Long shipId, Long deptId, Long teamId, Long cabinId, String type,Integer isCabin,Integer islt, String name) { |
| | | List<TableNodeDto> list = baseDao.getNodeList(shipId, deptId, teamId, cabinId, type,isCabin,islt, name); |
| | | |
| | | Map<Long, StatusEnum> statusMap = new HashMap<>(); |
| | | Date today = new Date(); |
| | |
| | | if (node.getCurrentStatus() == null || node.getCurrentStatus() == 0) { |
| | | if (today.after(requiredCompletionDate)) { |
| | | statusMap.put(node.getId(), StatusEnum.yq); |
| | | int days = (int) ((today.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24)); |
| | | node.setYqText("要求时间为" + sdf.format(requiredCompletionDate) + "已逾期" + days + "天"); |
| | | } else if ((requiredCompletionDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24) < 7) { |
| | | statusMap.put(node.getId(), StatusEnum.lq); |
| | | int days = (int) ((requiredCompletionDate.getTime() - today.getTime()) / (1000 * 60 * 60 * 24)); |
| | | node.setLqText("要求时间为" + sdf.format(requiredCompletionDate) + "还有" + days + "天临期"); |
| | | } else { |
| | | statusMap.put(node.getId(), StatusEnum.jxz); |
| | | } |
| | |
| | | // 已完成 |
| | | if (node.getActualCompletion() != null && actualCompletionDate.after(requiredCompletionDate)) { |
| | | statusMap.put(node.getId(), StatusEnum.cqwc); |
| | | int days = (int) ((actualCompletionDate.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24)); |
| | | node.setCqText("要求时间为" + sdf.format(requiredCompletionDate) + "超期" + days + "天完成"); |
| | | } else { |
| | | statusMap.put(node.getId(), StatusEnum.zcwc); |
| | | } |
| | |
| | | Long oldId = 0L; |
| | | TableNodeDto data = null; |
| | | for (TableNodeDto node : list) { |
| | | if (oldId.equals(node.getNetworkId())){ |
| | | if (oldId.equals(node.getNetworkId())) { |
| | | |
| | | }else{ |
| | | } else { |
| | | data = new TableNodeDto(); |
| | | String remark = baseDao.getRemark(node.getNetworkId(),type); |
| | | if (StringUtils.isNotBlank(remark)){ |
| | | data.setRemark(remark); |
| | | } |
| | | data.setName(node.getName()); |
| | | data.setNetworkId(node.getNetworkId()); |
| | | data.setIsealCabin(node.getIsealCabin()); |
| | | data.setIslt(node.getIslt()); |
| | | dataList.add(data); |
| | | oldId = node.getNetworkId(); |
| | | } |
| | | |
| | | |
| | | status = statusMap.get(node.getId()); |
| | | if (node.getProcessName().equals("设备拆卸出舱")) { |
| | | if (StringUtils.isNotBlank(node.getLqText())) { |
| | | data.setLqText(node.getLqText()); |
| | | } |
| | | if (StringUtils.isNotBlank(node.getYqText())) { |
| | | data.setYqText(node.getYqText()); |
| | | } |
| | | if (StringUtils.isNotBlank(node.getCqText())) { |
| | | data.setCqText(node.getCqText()); |
| | | } |
| | | |
| | | if (node.getProcessName().equals("设备拆卸出舱")||node.getProcessName().equals("设备到厂")||node.getProcessName().equals("拆卸出舱")) { |
| | | data.setTime1Color(fillColorArr[status.ordinal()]); |
| | | } else if (node.getProcessName().equals("设备分交")) { |
| | | } else if (node.getProcessName().equals("设备分交")||node.getProcessName().equals("设备安装")||node.getProcessName().equals("入库")) { |
| | | data.setTime2Color(fillColorArr[status.ordinal()]); |
| | | } else if (node.getProcessName().equals("拆检鉴定")) { |
| | | } else if (node.getProcessName().equals("拆检鉴定")||node.getProcessName().equals("存放位置")) { |
| | | data.setTime3Color(fillColorArr[status.ordinal()]); |
| | | } else if (node.getProcessName().equals("设备返厂")) { |
| | | } else if (node.getProcessName().equals("设备返厂")||node.getProcessName().equals("移交T队")) { |
| | | data.setTime4Color(fillColorArr[status.ordinal()]); |
| | | } else if (node.getProcessName().equals("回装")) { |
| | | data.setTime5Color(fillColorArr[status.ordinal()]); |
| | |
| | | |
| | | return dataList; |
| | | } |
| | | /* public void exportExcelTemplate(HttpServletResponse response, HttpServletRequest request) throws IOException { |
| | | String excelName="三级网络图批量模版"; |
| | | String excelPath = path + "template/jx-model/" + excelName + ".xlsx"; //模板路径 |
| | | File file = new File(excelPath); |
| | | excelName = excelName + "_" + DateUtil.now() + ".xlsx"; |
| | | DownloadService.exportModelPath(excelPath, excelName, file, response, request); |
| | | }*/ |
| | | } |