| | |
| | | |
| | | 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; |
| | |
| | | |
| | | 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} |
| | |
| | | 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)) { |
| | |
| | | // 已完成 |
| | | if (node.getActualCompletion() != null && actualCompletionDate.after(requiredCompletionDate)) { |
| | | statusMap.put(node.getId(), StatusEnum.cqwc); |
| | | int days = (int) ((today.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24)); |
| | | int days = (int) ((actualCompletionDate.getTime() - requiredCompletionDate.getTime()) / (1000 * 60 * 60 * 24)); |
| | | node.setCqText("要求时间为" + sdf.format(requiredCompletionDate) + "超期" + days + "天完成"); |
| | | } else { |
| | | statusMap.put(node.getId(), StatusEnum.zcwc); |
| | |
| | | |
| | | 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); |
| | | }*/ |
| | | } |