| | |
| | | import com.example.client.model.TableButton; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.ComplexTable; |
| | | import com.example.client.utils.Compute; |
| | | import com.example.server.progressTrack.Dto.ReportRecordDto; |
| | | import com.example.server.progressTrack.Dto.StatistReportsDto; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel1; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel1List; |
| | | import com.example.server.progressTrack.model.DjJdgzShip; |
| | | import com.example.server.progressTrack.model.DjJdgzTrackRecord; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel1Service; |
| | | import com.example.server.progressTrack.service.DjJdgzShipService; |
| | | import com.example.server.progressTrack.service.DjJdgzTrackRecordService; |
| | |
| | | @Autowired |
| | | private DjJdgzTrackRecordService djJdgzTrackRecordService; |
| | | |
| | | private JTable table; |
| | | |
| | | public void createTable(JFrame jFrame,Long level1NetworkId) { |
| | | public void createTable(JFrame jFrame, Long level1NetworkId) { |
| | | JFrame frame1 = new JFrame("统计报表"); |
| | | frame1.setSize(1200, 700); |
| | | frame1.setResizable(false); |
| | |
| | | } |
| | | }); |
| | | |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | | List<StatistReportsDto> list = djJdgzTrackRecordService.getReport(level1NetworkId); |
| | | |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | |
| | | //frame1.add(scrollTable); |
| | | |
| | | |
| | | |
| | | Object[][] headerRows = new Object[2][7]; |
| | | headerRows[0] = new Object[]{"班组专业","项目总数","未完成",ComplexTable.mergeCellX,ComplexTable.mergeCellX,"已完成",ComplexTable.mergeCellX}; |
| | | headerRows[0] = new Object[]{"班组专业", "项目总数", "未完成", ComplexTable.mergeCellX, ComplexTable.mergeCellX, "已完成", ComplexTable.mergeCellX}; |
| | | //此处2-5是不会显示出来的,因为1-4向下合并了一行 + 向右合并了一列 , 而2-5被这个矩形范围包括了 |
| | | headerRows[1] = new Object[]{ComplexTable.mergeCellY, ComplexTable.mergeCellY ,"进行中","临期","逾期","正常完成","超期完成"}; |
| | | headerRows[1] = new Object[]{ComplexTable.mergeCellY, ComplexTable.mergeCellY, "进行中", "临期", "逾期", "正常完成", "超期完成"}; |
| | | |
| | | String[][] body = new String[list.size()][7]; |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | StatistReportsDto data =list.get(i); |
| | | StatistReportsDto data = list.get(i); |
| | | body[i][0] = data.getTeamGroupName(); |
| | | body[i][1] = String.valueOf(data.getAllNum()); |
| | | body[i][2] = String.valueOf(data.getJxzNum()); |
| | |
| | | body[i][5] = String.valueOf(data.getZcwcNum()); |
| | | body[i][6] = String.valueOf(data.getCqwcNum()); |
| | | } |
| | | ComplexTable complexTable = new ComplexTable(headerRows, body, 171); |
| | | JScrollPane scrollTable = new JScrollPane(complexTable); |
| | | |
| | | JScrollPane scrollTable = new JScrollPane(new ComplexTable(headerRows , body,171)); |
| | | complexTable.addMouseListener(new MouseAdapter() { |
| | | @Override |
| | | public void mouseClicked(MouseEvent e) { |
| | | |
| | | int row = complexTable.rowAtPoint(e.getPoint()); |
| | | int column = complexTable.columnAtPoint(e.getPoint()); |
| | | |
| | | // 检查是否点击了有效单元格 |
| | | if (row >= 0 && column >= 1) { |
| | | Object cellValue = complexTable.getValueAt(row, column); |
| | | Integer value = Integer.parseInt(cellValue.toString()); |
| | | if (value > 0) { |
| | | Long teamgroupId = list.get(row).getTeamgroupId(); |
| | | reportRecord(column,level1NetworkId,teamgroupId); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | frame1.add(scrollTable); |
| | | frame1.setVisible(true); |
| | | } |
| | | |
| | | private void reportRecord(int column, Long level1NetworkId,Long teamgroupId) { |
| | | JFrame frame1 = new JFrame("记录"); |
| | | frame1.setSize(1000, 500); |
| | | frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| | | frame1.setLocationRelativeTo(null); |
| | | frame1.setVisible(true); |
| | | |
| | | List<ReportRecordDto> list = djJdgzTrackRecordService.getReportRecord(level1NetworkId,column,teamgroupId); |
| | | |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | columnDto.add(new ColumnDto("序号", "", 50, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("设备名称", "name", 770, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("节点名称", "processName", 160, null, false, null, null)); |
| | | |
| | | JTable table = CommonTable.createCommonTable(list, columnDto); |
| | | table.setRowHeight(25); |
| | | |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | scrollPane.setViewportView(table); |
| | | scrollPane.getViewport().setBackground(Color.WHITE); |
| | | scrollPane.setPreferredSize(new Dimension(1000 - 20, 400)); |
| | | |
| | | frame1.add(scrollPane); |
| | | } |
| | | |
| | | } |
| | | |
| | | |