| | |
| | | String password = "admin"; |
| | | String site = ""; |
| | | String teamGroup = ""; |
| | | String team = ""; |
| | | |
| | | String path = Login.class.getClassLoader().getResource("config.properties").getPath(); |
| | | InputStream inStream = null; |
| | |
| | | password = properties.get("password").toString(); |
| | | site = properties.get("site").toString(); |
| | | teamGroup = properties.get("teamGroup").toString(); |
| | | team = properties.get("team").toString(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | } finally { |
| | | if (reader != null) { |
| | | try { |
| | | reader.close(); |
| | |
| | | |
| | | String finalSite = site; |
| | | String finalTeamGroup = teamGroup; |
| | | String finalTeam = team; |
| | | loginButton.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | |
| | | String str = String.valueOf(password); //å°charæ°ç»è½¬å为stringç±»å |
| | | |
| | | |
| | | user = userService.login(name,str); |
| | | user = userService.login(name, str); |
| | | exist = user.getExist(); |
| | | |
| | | |
| | |
| | | } |
| | | properties.setProperty("userName", name); |
| | | properties.setProperty("password", str); |
| | | properties.setProperty("url", "11"); |
| | | properties.store(outputStream, "rxkj"); |
| | | outputStream.close(); |
| | | } catch (FileNotFoundException ex) { |
| | |
| | | } catch (IOException ep) { |
| | | ep.printStackTrace(); |
| | | } |
| | | |
| | | user.setBoatfleet(finalTeam); |
| | | CacheUtils.put("user", "user", user); |
| | | CacheUtils.put("site", "site", finalSite); |
| | | CacheUtils.put("teamGroup", "teamGroup", finalTeamGroup); |
| | |
| | | Font font = new Font("å®ä½", Font.BOLD, 23); |
| | | setUIFontService.setFont(font); |
| | | |
| | | try { |
| | | UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | JPopupMenu.setDefaultLightWeightPopupEnabled(false); |
| | | |
| | | |
| | | JFrame frame = new JFrame("è¿åº¦è·è¸ª"); |
| | | frame.setSize(width, height); |
| | | frame.setExtendedState(JFrame.MAXIMIZED_BOTH); |
New file |
| | |
| | | package com.example.client.service; |
| | | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.model.TableButton; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.ComplexTable; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.Dto.StatistReportsDto; |
| | | import com.example.server.progressTrack.model.DjJdgzDismantTrack; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.service.DjJdgzDismantTrackService; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3Service; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import com.example.server.user.model.SysUser; |
| | | import com.example.server.utils.CacheUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | | import java.awt.*; |
| | | import java.awt.event.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class DismantTrackAddOrUpdate { |
| | | @Autowired |
| | | private ExportDismantTrackService exportDismantTrackService; |
| | | @Autowired |
| | | private ImportDismantTrackService importDismantTrackService; |
| | | @Autowired |
| | | private DjJdgzDismantTrackService djJdgzDismantTrackService; |
| | | @Autowired |
| | | private StatisDismantService statisDismantService; |
| | | @Autowired |
| | | private CabinService cabinService; |
| | | private JTable trackTable; |
| | | private List<ColumnDto> columnDto; |
| | | |
| | | public JPanel createTrack(Integer width, Integer height, DjJdgzNetworkLevel3 djJdgzNetworkLevel3,JFrame frame) { |
| | | JPanel panel = new JPanel(new BorderLayout()); |
| | | panel.setPreferredSize(new Dimension(width, height)); |
| | | |
| | | JPanel topJpanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| | | topJpanel.setPreferredSize(new Dimension(width - 10, 37)); |
| | | |
| | | JPanel centerJpanel = new JPanel(); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100)); |
| | | |
| | | panel.add(centerJpanel, BorderLayout.CENTER); |
| | | panel.add(topJpanel, BorderLayout.NORTH); |
| | | |
| | | JButton btnTj = new JButton("ç»è®¡æ¥è¡¨"); |
| | | JButton btnExport = new JButton("å¯¼åºæå¸æ¥è¡¨"); |
| | | JButton btnSave = new JButton("ä¿å"); |
| | | JButton btnImport = new JButton("æ¹é导å
¥"); |
| | | |
| | | topJpanel.add(btnTj); |
| | | topJpanel.add(btnExport); |
| | | topJpanel.add(btnSave); |
| | | topJpanel.add(btnImport); |
| | | |
| | | List<DjJdgzDismantTrack> list = djJdgzDismantTrackService.getList(djJdgzNetworkLevel3.getId(), null); |
| | | List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("edit", "ç¼è¾")); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] statusList = { |
| | | new JComboBoxItem(0, "è¿è¡ä¸"), |
| | | new JComboBoxItem(1, "已宿"), |
| | | }; |
| | | |
| | | // åå»ºå·¦ä¾§è¡¨æ ¼ |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | columnDto = new ArrayList<>(); |
| | | columnDto.add(new ColumnDto("åºå·", "", 50, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("è±å®¤", "cabinId", 120, "dict", false, null, cabinList)); |
| | | columnDto.add(new ColumnDto("é¨ä»¶åç§°", "name", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("æå¸æ¶é´", "dismantTime", 130, "selectDate", true, null, null)); |
| | | columnDto.add(new ColumnDto("æå¸åä½", "dismantUnit", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("æå¸äººå", "dismantStaff", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("æå¸å©ä¿®èå", "dismantAssistant", 180, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("åºè±æ¶é´", "exitTime", 130, "selectDate", true, null, null)); |
| | | columnDto.add(new ColumnDto("åºè±åä½", "exitUnit", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("åºè±äººå", "exitStaff", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("åºè±å©ä¿®èå", "exitAssistant", 180, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("ééæ¶é´", "returnWeightTime", 130, "selectDate", true, null, null)); |
| | | columnDto.add(new ColumnDto("ç§°éå", "weigher", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("éééé", "returnWeight", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("ééå©ä¿®èå", "returnWeightAssistant", 180, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("å
¥åºæ¶é´", "warehouseTime", 130, "selectDate", true, null, null)); |
| | | columnDto.add(new ColumnDto("å
¥åºäººå", "warehouseStaff", 120, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("å½ååæ¾ä½ç½®", "currentLocation", 160, null, true, null, null)); |
| | | columnDto.add(new ColumnDto("ç¶æ", "status", 120, "dict", true, null, statusList)); |
| | | |
| | | trackTable = CommonTable.createCommonTable(list, columnDto); |
| | | trackTable.setRowHeight(25); |
| | | trackTable.setAutoCreateRowSorter(true); |
| | | trackTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | |
| | | /* Object[][] headerRows = new Object[2][18]; |
| | | headerRows[0] = new Object[]{"åºå·","è±å®¤","é¨ä»¶åç§°","æå¸é¶æ®µ", ComplexTable.mergeCellX,ComplexTable.mergeCellX,ComplexTable.mergeCellX, |
| | | "åºè±é¶æ®µ",ComplexTable.mergeCellX,ComplexTable.mergeCellX,ComplexTable.mergeCellX,"ééé¶æ®µ",ComplexTable.mergeCellX,ComplexTable.mergeCellX,ComplexTable.mergeCellX, |
| | | "å
¥åºé¶æ®µ",ComplexTable.mergeCellX,"å½ååæ¾ä½ç½®"}; |
| | | //æ¤å¤2-5æ¯ä¸ä¼æ¾ç¤ºåºæ¥çï¼å 为1-4åä¸åå¹¶äºä¸è¡ + åå³åå¹¶äºä¸å ï¼ è2-5被è¿ä¸ªç©å½¢èå´å
æ¬äº |
| | | headerRows[1] = new Object[]{ComplexTable.mergeCellY, ComplexTable.mergeCellY ,ComplexTable.mergeCellY ,"æ¶é´","åä½","人å","å©ä¿®èå", |
| | | "æ¶é´","åä½","人å","å©ä¿®èå","æ¶é´","ç§°éå","éé","å©ä¿®èå","æ¶é´","人å",ComplexTable.mergeCellY}; |
| | | |
| | | String[][] body = CommonTable.getRowData(list,columnDto); |
| | | |
| | | trackTable = new ComplexTable(headerRows,body); |
| | | CommonTable.setColumnType(columnDto, trackTable);*/ |
| | | |
| | | btnTj.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | statisDismantService.createTable(frame,djJdgzNetworkLevel3.getLevel1NetworkId()); |
| | | } |
| | | }); |
| | | |
| | | btnExport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | exportDismantTrackService.openDialog(frame); |
| | | } |
| | | }); |
| | | |
| | | btnSave.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | SysUser user = (SysUser) CacheUtils.get("user", "user"); |
| | | if (user.getTeamgroup()==null||user.getTeamgroup().equals(djJdgzNetworkLevel3.getTeamgroupId())){ |
| | | CommonTable.saveTableList(list, trackTable, columnDto); |
| | | djJdgzDismantTrackService.save(list); |
| | | }else{ |
| | | JOptionPane.showMessageDialog(null, "ä¸å¯æä½å
¶ä»ä¸ä¸æ°æ®", "æç¤º", JOptionPane.WARNING_MESSAGE); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | btnImport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | importDismantTrackService.FileUpload(djJdgzNetworkLevel3.getId(),frame); |
| | | } |
| | | }); |
| | | |
| | | |
| | | JScrollPane scrollPane = new JScrollPane(trackTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | scrollPane.setViewportView(trackTable); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, height - 130)); |
| | | centerJpanel.add(scrollPane); |
| | | |
| | | return panel; |
| | | } |
| | | public void refreshTable(Long level3Id){ |
| | | List<DjJdgzDismantTrack> list = djJdgzDismantTrackService.getList(level3Id, null); |
| | | CommonTable.refreshTable(list, columnDto, trackTable); |
| | | trackTable.setRowHeight(25); |
| | | trackTable.setAutoCreateRowSorter(true); |
| | | trackTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.model.TableButton; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.GBC; |
| | | import com.example.client.utils.MultiSelectComboBox; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.Dto.NetworkNodeStatusDto; |
| | | import com.example.server.progressTrack.model.DjJdgzDismantTrack; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.model.DjJdgzTrackRecord; |
| | | import com.example.server.progressTrack.service.DjJdgzDismantTrackService; |
| | | import com.example.server.progressTrack.model.DjJdgzShip; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3Service; |
| | | import com.example.server.progressTrack.service.NetWorkDiagramService; |
| | | import com.example.server.progressTrack.service.DjJdgzShipService; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import com.mxgraph.swing.mxGraphComponent; |
| | | import com.mxgraph.view.mxGraph; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | import java.awt.*; |
| | | import java.awt.event.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | |
| | | @Autowired |
| | | private SysTeamGroupClassService sysTeamGroupClassService; |
| | | @Autowired |
| | | private DjJdgzDismantTrackService djJdgzDismantTrackService; |
| | | private DismantTrackAddOrUpdate addOrUpdate; |
| | | @Autowired |
| | | private CabinService cabinService; |
| | | @Autowired |
| | | private DjJdgzShipService djJdgzShipService; |
| | | private List<DjJdgzNetworkLevel3> list; |
| | | |
| | | public JPanel createTable(Integer width, Integer height) { |
| | | height = height - 100; |
| | | public JPanel createTable(Integer width, Integer height, JFrame frame) { |
| | | JPanel panel = new JPanel(); |
| | | panel.setPreferredSize(new Dimension(width, height)); |
| | | |
| | | JPanel jLeft = new JPanel(new BorderLayout()); |
| | | JPanel top = new JPanel(new BorderLayout()); |
| | | jLeft.setPreferredSize(new Dimension(width / 3 - 20, height)); |
| | | top.setPreferredSize(new Dimension(width / 3 - 20, 100)); |
| | | |
| | | JPanel top = new JPanel(); |
| | | |
| | | jLeft.setPreferredSize(new Dimension(600, height)); |
| | | top.setPreferredSize(new Dimension(600, 100)); |
| | | |
| | | GridBagLayout layout = new GridBagLayout(); |
| | | top.setLayout(layout); |
| | | |
| | | // åå»ºå·¦ä¾§è¡¨æ ¼ |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | | List<DjJdgzNetworkLevel3> list = level3Service.getList(null); |
| | | |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | String[] typeList = new String[]{ |
| | | "æ¹è£
","å è£
","æ¢è£
","æ¹è¿æ§ä¿®ç" |
| | | "æ¹è£
", "å è£
", "æ¢è£
", "æ¹è¿æ§ä¿®ç" |
| | | }; |
| | | List<DjJdgzShip> shipList = djJdgzShipService.getList(); |
| | | Map<String, Long> shipMap = new HashMap<>(); |
| | | |
| | | JLabel JLabel0 = new JLabel("å·¥ç¨"); |
| | | JComboBox comboBox = new JComboBox(); |
| | | |
| | | comboBox.setPreferredSize(new Dimension(112, 28)); |
| | | for (int i = 0; i < shipList.size(); i++) { |
| | | shipMap.put(shipList.get(i).getShipNo(), shipList.get(i).getId()); |
| | | comboBox.addItem(shipList.get(i).getShipNo()); |
| | | } |
| | | comboBox.setSelectedItem(shipList.get(0).getShipNo()); |
| | | |
| | | JLabel JLabel1 = new JLabel("é¨é¨"); |
| | | JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(deptList); |
| | | comboBox1.setPreferredSize(new Dimension(100, 28)); |
| | | comboBox1.setPreferredSize(new Dimension(112, 28)); |
| | | |
| | | JComboBoxItem[] teamList1 = sysTeamGroupClassService.getTeamList(deptList[0].getId()); |
| | | |
| | | JLabel JLabel2 = new JLabel("ä¸ä¸"); |
| | | JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>(teamList1); |
| | | comboBox2.setPreferredSize(new Dimension(100, 28)); |
| | | comboBox2.setPreferredSize(new Dimension(112, 28)); |
| | | |
| | | JLabel JLabel3= new JLabel("è±å®¤"); |
| | | JComboBox<JComboBoxItem> comboBox3 = new JComboBox(cabinList); |
| | | comboBox3.setPreferredSize(new Dimension(100, 28)); |
| | | JLabel JLabel3 = new JLabel("è±å®¤"); |
| | | JComboBox<JComboBoxItem> comboBox3 = new JComboBox<>(cabinList); |
| | | comboBox3.setPreferredSize(new Dimension(112, 28)); |
| | | |
| | | JLabel JLabel4 = new JLabel("ç±»å«"); |
| | | JComboBox<String> comboBox4 = new JComboBox<>(typeList); |
| | | comboBox3.setPreferredSize(new Dimension(100, 28)); |
| | | comboBox4.setPreferredSize(new Dimension(112, 28)); |
| | | |
| | | JTextField sb = new JTextField(); |
| | | JTextField sb = new JTextField(10); |
| | | JButton query = new JButton("æ¥è¯¢"); |
| | | |
| | | top.add(JLabel0, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(JLabel1, new GBC(2, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox1, new GBC(3, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(JLabel2, new GBC(4, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox2, new GBC(5, 0, 2, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | top.add(JLabel3, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox3, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(JLabel4, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox4, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(sb, new GBC(4, 1, 2, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(query, new GBC(6, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | jLeft.add(top, BorderLayout.NORTH); |
| | | |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | | list = level3Service.getList(null, deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null); |
| | | |
| | | columnDto.add(new ColumnDto("åºå·", "", 60, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("设å¤åç§°", "name", 112, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("é¨é¨", "deptId", 100, "dict", false, null, deptList)); |
| | | columnDto.add(new ColumnDto("ä¸ä¸", "teamgroupId", 100, "dict", false, null, teamList)); |
| | | columnDto.add(new ColumnDto("è±å®¤", "cabinId", 100, "dict", false, null, cabinList)); |
| | | columnDto.add(new ColumnDto("ç±»å«", "type", 100, null, false, null, null)); |
| | | |
| | | JTable subTable = CommonTable.createCommonTable(list, columnDto); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); |
| | | |
| | | comboBox.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId()); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | comboBox1.addItemListener(new ItemListener() { |
| | | @Override |
| | |
| | | |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(selectedId); |
| | | comboBox2.setModel(new DefaultComboBoxModel<>(teamList)); |
| | | comboBox2.setSelectedIndex(-1); |
| | | comboBox2.setSelectedIndex(0); |
| | | |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId()); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | top.add(JLabel1, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox1, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(JLabel2, new GBC(2, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox2, new GBC(3, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | comboBox2.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | top.add(JLabel3, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox3, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(JLabel4, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox4, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | top.add(sb, new GBC(0, 2, 2, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId()); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | comboBox3.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | jLeft.add(top,BorderLayout.NORTH); |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | columnDto.add(new ColumnDto("åºå·", "", width / 20 - 10, "autoCreate", false, null,null)); |
| | | columnDto.add(new ColumnDto("é¨é¨", "deptId", width / 18, "dict", false, null,deptList)); |
| | | columnDto.add(new ColumnDto("ä¸ä¸", "teamgroupId", width / 18, "dict", false, null,teamList)); |
| | | columnDto.add(new ColumnDto("è±å®¤", "cabinId", width / 18, "dicts", false, null,cabinList)); |
| | | columnDto.add(new ColumnDto("ç±»å«", "type", width / 18, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("设å¤åç§°", "name", width / 18, null, false, null,null)); |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId()); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | comboBox4.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | JTable subTable = CommonTable.createCommonTable(list, columnDto); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId()); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | query.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | list = level3Service.getList(null, null, null, null, null,sb.getText()); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId()); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | JScrollPane scrollTable = new JScrollPane(subTable); |
| | | jLeft.add(scrollTable, BorderLayout.CENTER); |
| | | |
| | | JTable trackTable = new JTable(); |
| | | JPanel track = this.createTrack(width,height,list.get(0),trackTable); |
| | | trackTable.setPreferredSize(new Dimension(width - width / 3, height)); |
| | | JPanel track = addOrUpdate.createTrack(width - 620, height, list.get(0),frame); |
| | | |
| | | |
| | | // å建水平åå²é¢æ¿ |
| | | JSplitPane hSplitPane = new JSplitPane( |
| | |
| | | jLeft, |
| | | track |
| | | ); |
| | | hSplitPane.setDividerLocation(width / 4); |
| | | hSplitPane.setDividerLocation(620); |
| | | hSplitPane.setDividerSize(10); |
| | | hSplitPane.setOneTouchExpandable(true); |
| | | hSplitPane.setContinuousLayout(true); |
| | |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId()); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return panel; |
| | | } |
| | | |
| | | private JPanel createTrack(Integer width, Integer height, DjJdgzNetworkLevel3 djJdgzNetworkLevel3, JTable trackTable) { |
| | | JPanel panel = new JPanel(); |
| | | |
| | | JPanel topJpanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| | | topJpanel.setPreferredSize(new Dimension(width, 37)); |
| | | topJpanel.setBackground(Color.WHITE); |
| | | |
| | | JPanel centerJpanel = new JPanel(); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100)); |
| | | centerJpanel.setBackground(Color.WHITE); |
| | | panel.add(topJpanel, BorderLayout.NORTH); |
| | | panel.add(centerJpanel, BorderLayout.CENTER); |
| | | |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | String[] typeList = new String[]{ |
| | | "æ¹è£
","å è£
","æ¢è£
","æ¹è¿æ§ä¿®ç" |
| | | }; |
| | | |
| | | JComboBox<JComboBoxItem> comboBox = new JComboBox(cabinList); |
| | | comboBox.setPreferredSize(new Dimension(100, 28)); |
| | | |
| | | JComboBox<String> comboBox2 = new JComboBox<>(typeList); |
| | | comboBox2.setPreferredSize(new Dimension(100, 28)); |
| | | |
| | | JButton btnTj = new JButton("ç»è®¡æ¥è¡¨"); |
| | | JButton btnExport = new JButton("å¯¼åºæå¸æ¥è¡¨"); |
| | | |
| | | topJpanel.add(btnTj); |
| | | topJpanel.add(btnExport); |
| | | topJpanel.add(comboBox); |
| | | topJpanel.add(comboBox2); |
| | | |
| | | comboBox.setPreferredSize(new Dimension(300, 28)); |
| | | comboBox2.setPreferredSize(new Dimension(300, 28)); |
| | | |
| | | List<DjJdgzDismantTrack> list = djJdgzDismantTrackService.getList(djJdgzNetworkLevel3.getId(),null); |
| | | List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("edit", "ç¼è¾")); |
| | | |
| | | // åå»ºå·¦ä¾§è¡¨æ ¼ |
| | | 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("é¨é¨", "deptId", 160, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("ä¸ä¸", "teamgroupId", 160, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("è±å®¤", "cabinId", 120, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("é¨ä»¶åç§°", "name", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("æå¸æ¶é´", "dismantTime", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("æå¸åä½", "dismantUnit", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("æå¸äººå", "dismantStaff", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("æå¸å©ä¿®èå", "dismantAssistant", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("åºè±æ¶é´", "exitTime", 200, "", true, buttonList, null)); |
| | | columnDto.add(new ColumnDto("åºè±åä½", "exitUnit", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("åºè±äººå", "exitStaff", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("åºè±å©ä¿®èå", "exitAssistant", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("ééæ¶é´", "returnWeightTime", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("ç§°éå", "weigher", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("éééé", "returnWeight", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("ééå©ä¿®èå", "returnWeightAssistant", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("å
¥åºæ¶é´", "warehouseTime", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("å
¥åºäººå", "warehouseStaff", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("å½ååæ¾ä½ç½®", "currentLocation", 200, null, false, null, null)); |
| | | |
| | | trackTable = CommonTable.createCommonTable(list, columnDto); |
| | | trackTable.setRowHeight(25); |
| | | trackTable.setAutoCreateRowSorter(true); |
| | | trackTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | trackTable.addMouseListener(new MouseAdapter() { |
| | | @Override |
| | | public void mouseClicked(MouseEvent e) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | btnTj.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | btnExport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | JScrollPane scrollPane = new JScrollPane(trackTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | scrollPane.setViewportView(trackTable); |
| | | scrollPane.getViewport().setBackground(Color.WHITE); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, height - 120)); |
| | | centerJpanel.add(scrollPane); |
| | | |
| | | return panel; |
| | | } |
New file |
| | |
| | | package com.example.client.service; |
| | | |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.GBC; |
| | | import com.example.client.utils.RequiredLabel; |
| | | import com.example.server.progressTrack.service.*; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import org.jdesktop.swingx.JXDatePicker; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | | import java.awt.*; |
| | | import java.awt.event.*; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | |
| | | @Service |
| | | public class ExportDismantTrackService { |
| | | @Autowired |
| | | private DjJdgzDismantTrackService djJdgzDismantTrackService; |
| | | @Autowired |
| | | private DjJdgzNetworkLevel1Service level1Service; |
| | | @Autowired |
| | | private DjJdgzNetworkLevel3Service djJdgzNetworkLevel3Service; |
| | | @Autowired |
| | | private DjJdgzNetworkLevel3ListService djJdgzNetworkLevel3ListService; |
| | | @Autowired |
| | | private SysTeamGroupClassService sysTeamGroupClassService; |
| | | |
| | | public void openDialog(JFrame jFrame) { |
| | | JFrame frame1 = new JFrame("æå¸è¿åº¦è¡¨å¯¼åºæ¡ä»¶"); |
| | | frame1.setSize(1000, 600); |
| | | frame1.setResizable(false); |
| | | frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| | | frame1.setLocationRelativeTo(null); |
| | | frame1.setVisible(true); |
| | | frame1.addWindowListener(new WindowAdapter() { |
| | | //æ·»å 第äºä¸ªçé¢çå
³éäºä»¶: |
| | | public void windowClosing(WindowEvent e) { |
| | | //æ·»å äºä»¶: |
| | | jFrame.setEnabled(true);//å°ä¸»çé¢åè®¾ç½®ä¸ºå¯æä½ç |
| | | } |
| | | }); |
| | | |
| | | GridBagLayout layout = new GridBagLayout(); |
| | | frame1.setLayout(layout); |
| | | |
| | | JComboBoxItem[] statusList = { |
| | | new JComboBoxItem(0, "è¿è¡ä¸"), |
| | | new JComboBoxItem(1, "已宿"), |
| | | }; |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | | JComboBoxItem[] teamGroupList = sysTeamGroupClassService.getList(); |
| | | |
| | | JComboBoxItem[] projectList = level1Service.getProjectList(); |
| | | RequiredLabel JLabel0 = new RequiredLabel("è¯·éæ©å·¥ç¨"); |
| | | JComboBox<JComboBoxItem> comboBox = new JComboBox<>(projectList); |
| | | comboBox.setPreferredSize(new Dimension(300, 28)); |
| | | comboBox.setSelectedIndex(-1); |
| | | |
| | | JLabel JLabel01 = new JLabel("é¨é¨"); |
| | | JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(deptList); |
| | | comboBox1.setPreferredSize(new Dimension(300, 28)); |
| | | comboBox1.setSelectedIndex(-1); |
| | | |
| | | JLabel JLabel1 = new JLabel("è¯·éæ©ä¸ä¸"); |
| | | JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>(); |
| | | comboBox2.setPreferredSize(new Dimension(300, 28)); |
| | | comboBox2.setSelectedIndex(-1); |
| | | |
| | | JLabel JLabel2 = new JLabel("è¯·éæ©è®¾å¤"); |
| | | JComboBox<JComboBoxItem> comboBox3 = new JComboBox<>(); |
| | | comboBox3.setPreferredSize(new Dimension(300, 28)); |
| | | comboBox3.setSelectedIndex(-1); |
| | | |
| | | JLabel JLabel4 = new JLabel("è¯·éæ©å®ææ
åµ"); |
| | | JComboBox<JComboBoxItem> comboBox5 = new JComboBox<>(statusList); |
| | | comboBox5.setPreferredSize(new Dimension(300, 28)); |
| | | comboBox5.setSelectedIndex(-1); |
| | | |
| | | comboBox.addItemListener(new ItemListener() { |
| | | @Override |
| | | public void itemStateChanged(ItemEvent e) { |
| | | if (e.getStateChange() == ItemEvent.SELECTED) { |
| | | JComboBoxItem selectedItem = (JComboBoxItem) comboBox.getSelectedItem(); |
| | | JComboBoxItem selectedItem1 = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem selectedItem2 = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | |
| | | Long projectId = selectedItem == null ? null : selectedItem.getId(); |
| | | Long deptId = selectedItem1 == null ? null : selectedItem1.getId(); |
| | | Long teamId = selectedItem2 == null ? null : selectedItem2.getId(); |
| | | |
| | | JComboBoxItem[] level3List = djJdgzNetworkLevel3Service.getListByExport(projectId, deptId, teamId); |
| | | comboBox3.setModel(new DefaultComboBoxModel<>(level3List)); |
| | | comboBox3.setSelectedIndex(-1); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | comboBox1.addItemListener(new ItemListener() { |
| | | @Override |
| | | public void itemStateChanged(ItemEvent e) { |
| | | if (e.getStateChange() == ItemEvent.SELECTED) { |
| | | JComboBoxItem selectedItem = (JComboBoxItem) comboBox.getSelectedItem(); |
| | | JComboBoxItem selectedItem1 = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem selectedItem2 = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | |
| | | Long projectId = selectedItem == null ? null : selectedItem.getId(); |
| | | Long deptId = selectedItem1 == null ? null : selectedItem1.getId(); |
| | | Long teamId = selectedItem2 == null ? null : selectedItem2.getId(); |
| | | |
| | | JComboBoxItem[] level3List = djJdgzNetworkLevel3Service.getListByExport(projectId, deptId, teamId); |
| | | comboBox3.setModel(new DefaultComboBoxModel<>(level3List)); |
| | | comboBox3.setSelectedIndex(-1); |
| | | } |
| | | } |
| | | }); |
| | | comboBox2.addItemListener(new ItemListener() { |
| | | @Override |
| | | public void itemStateChanged(ItemEvent e) { |
| | | if (e.getStateChange() == ItemEvent.SELECTED) { |
| | | JComboBoxItem selectedItem = (JComboBoxItem) comboBox.getSelectedItem(); |
| | | JComboBoxItem selectedItem1 = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem selectedItem2 = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | |
| | | Long projectId = selectedItem == null ? null : selectedItem.getId(); |
| | | Long deptId = selectedItem1 == null ? null : selectedItem1.getId(); |
| | | Long teamId = selectedItem2 == null ? null : selectedItem2.getId(); |
| | | |
| | | JComboBoxItem[] level3List = djJdgzNetworkLevel3Service.getListByExport(projectId, deptId, teamId); |
| | | comboBox3.setModel(new DefaultComboBoxModel<>(level3List)); |
| | | comboBox3.setSelectedIndex(-1); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | JButton exportButton = new JButton("导åº"); |
| | | |
| | | frame1.add(JLabel0, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel01, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox1, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | |
| | | frame1.add(JLabel1, new GBC(0, 2, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox2, new GBC(1, 2, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel2, new GBC(0, 3, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox3, new GBC(1, 3, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel4, new GBC(0, 4, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox5, new GBC(1, 4, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(exportButton, new GBC(0, 5, 2, 1).setWeight(0, 0)); |
| | | |
| | | exportButton.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | JComboBoxItem projectItem = (JComboBoxItem) comboBox.getSelectedItem(); |
| | | JComboBoxItem deptItem = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem teamGroupItem = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem level3NetworkItem = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | |
| | | JComboBoxItem statusItem = (JComboBoxItem) comboBox5.getSelectedItem(); |
| | | |
| | | |
| | | |
| | | Long level1NetworkId = null; |
| | | Long deptId = null; |
| | | Long teamGroupId = null; |
| | | Long level3NetworkId = null; |
| | | Long level3NodeId = null; |
| | | Integer status = null; |
| | | |
| | | if (projectItem != null) { |
| | | level1NetworkId = projectItem.getId(); |
| | | } else { |
| | | JOptionPane.showMessageDialog(null, "没æéæ©å·¥ç¨", "æç¤º", JOptionPane.WARNING_MESSAGE); |
| | | return; |
| | | } |
| | | if (teamGroupItem != null) { |
| | | teamGroupId = teamGroupItem.getId(); |
| | | } |
| | | if (level3NetworkItem != null) { |
| | | level3NetworkId = level3NetworkItem.getId(); |
| | | } |
| | | if (deptItem != null) { |
| | | deptId = deptItem.getId(); |
| | | } |
| | | if (statusItem != null) { |
| | | status = Math.toIntExact(statusItem.getId()); |
| | | } |
| | | |
| | | String filePath = "æå¸è¿åº¦æ¥è¡¨.xlsx"; |
| | | djJdgzDismantTrackService.exportExcel(filePath,deptId, teamGroupId, level1NetworkId, level3NetworkId, status); |
| | | JFileChooser fileChooser = new JFileChooser(); |
| | | fileChooser.setSelectedFile(new File(filePath)); |
| | | int result = fileChooser.showSaveDialog(frame1); |
| | | |
| | | if (result == JFileChooser.APPROVE_OPTION) { |
| | | File selectedFile = fileChooser.getSelectedFile(); |
| | | // å°æä»¶ç§»å¨å°ç¨æ·éæ©çä½ç½® |
| | | File originalFile = new File(filePath); |
| | | originalFile.renameTo(selectedFile); |
| | | JOptionPane.showMessageDialog(frame1, "æä»¶å¯¼åºæå"); |
| | | } else { |
| | | JOptionPane.showMessageDialog(frame1, "æä»¶å¯¼åºåæ¶"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.example.client.service; |
| | | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.utils.*; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.service.*; |
| | | import com.example.server.utils.DownLoadTmpFile; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | | import javax.swing.table.DefaultTableModel; |
| | | import java.awt.*; |
| | | import java.awt.datatransfer.DataFlavor; |
| | | import java.awt.datatransfer.Transferable; |
| | | import java.awt.event.ActionEvent; |
| | | import java.awt.event.ActionListener; |
| | | import java.awt.event.ItemEvent; |
| | | import java.awt.event.ItemListener; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class ImportDismantTrackService { |
| | | private JTable table; |
| | | private JFrame frame; |
| | | @Value("${data.imgDir}") |
| | | private String imgPath; |
| | | private File selectedFiles; |
| | | @Value("${data.tmp-path}") |
| | | private String tmpPath; |
| | | @Autowired |
| | | DjJdgzDismantTrackService djJdgzDismantTrackService; |
| | | @Autowired |
| | | SubunitAddOrUpdate addOrUpdate; |
| | | |
| | | |
| | | public void FileUpload(Long level3Id, JFrame jFrame) { |
| | | frame = new JFrame("导å
¥"); |
| | | frame.setSize(500, 300); |
| | | frame.setResizable(true); |
| | | frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| | | frame.setLocationRelativeTo(null); |
| | | frame.setVisible(true); |
| | | GridBagLayout layout = new GridBagLayout(); |
| | | frame.setLayout(layout); |
| | | |
| | | table = new JTable(); |
| | | table.setRowHeight(40); |
| | | DefaultTableModel model = new DefaultTableModel(); |
| | | String[] columnIdentifiers = {"æä»¶å°å", "æä½"};//表头 |
| | | |
| | | |
| | | JButton downloadbtn = new JButton("åé¨ä»¶æ¨¡æ¿ä¸è½½"); |
| | | |
| | | |
| | | downloadbtn.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | DownLoadTmpFile.down(tmpPath + "åé¨ä»¶å¯¼å
¥æ¨¡æ¿.xlsx", frame); |
| | | } |
| | | }); |
| | | |
| | | JScrollPane scrolltable = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | |
| | | scrolltable.setViewportView(table); |
| | | scrolltable.getViewport().setBackground(Color.WHITE); |
| | | |
| | | JButton browseButton = new JButton("éæ©æä»¶"); |
| | | JButton uploadButton = new JButton("ä¸ä¼ æä»¶"); |
| | | |
| | | |
| | | frame.add(downloadbtn, new GBC(0, 0, 2, 1).setFill(GBC.BOTH).setInsets(5)); |
| | | |
| | | frame.add(browseButton, new GBC(0, 1, 1, 1).setWeight(0, 1).setInsets(5)); |
| | | frame.add(scrolltable, new GBC(1, 1, 3, 1).setFill(GBC.BOTH).setWeight(0, 1).setInsets(5)); |
| | | |
| | | frame.add(uploadButton, new GBC(0, 2, 4, 1).setWeight(1, 0)); |
| | | |
| | | browseButton.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | Boolean flag = true; |
| | | // ä¿åå½åçå¤è§è®¾ç½® |
| | | LookAndFeel savedLookAndFeel = UIManager.getLookAndFeel(); |
| | | |
| | | // 设置æä»¶éæ©å¨å¤è§ |
| | | try { |
| | | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | |
| | | JFileChooser fileChooser = new JFileChooser(); |
| | | |
| | | fileChooser.setDialogTitle("éæ©æä»¶"); |
| | | fileChooser.setPreferredSize(new Dimension(800, 500)); |
| | | |
| | | |
| | | fileChooser.setMultiSelectionEnabled(true); |
| | | |
| | | //æ¢å¤å¤è§ï¼é¿å
æ¹åææç»ä»¶å¤è§ |
| | | try { |
| | | UIManager.setLookAndFeel(savedLookAndFeel); |
| | | } catch (UnsupportedLookAndFeelException ed) { |
| | | ed.printStackTrace(); |
| | | } |
| | | |
| | | int result = fileChooser.showOpenDialog(frame); |
| | | if (result == JFileChooser.FILES_ONLY) { |
| | | selectedFiles = fileChooser.getSelectedFile(); |
| | | |
| | | Integer oldNum = model.getRowCount(); |
| | | String[][] data = new String[oldNum + 1][2]; |
| | | for (int i = 0; i < oldNum; i++) { |
| | | data[i][0] = model.getValueAt(i, 0).toString(); |
| | | } |
| | | |
| | | String suffix = selectedFiles.getName().substring(selectedFiles.getName().lastIndexOf(".")); |
| | | if (suffix.equals(".xlsx") || suffix.equals(".xls")) { |
| | | data[oldNum][0] = selectedFiles.getPath(); |
| | | } else { |
| | | flag = false; |
| | | |
| | | } |
| | | |
| | | if (!flag) { |
| | | JOptionPane.showMessageDialog(null, "åªè½ä¸ä¼ .xlsxæ.xlsçæä»¶ï¼ä¸ä¸è¶
è¿2G", "æç¤º", JOptionPane.WARNING_MESSAGE); |
| | | return; |
| | | } |
| | | |
| | | model.setDataVector(data, columnIdentifiers); |
| | | table.setModel(model); |
| | | table.getColumnModel().getColumn(0).setPreferredWidth(600); |
| | | table.getColumnModel().getColumn(1).setPreferredWidth(100); |
| | | |
| | | |
| | | table.getColumnModel().getColumn(0).setCellRenderer(new TableViewRenderer()); |
| | | table.getColumnModel().getColumn(1).setCellRenderer(new TableCellRendererButton()); |
| | | table.getColumnModel().getColumn(1).setCellEditor(new TableCellEditorButton(null, null)); |
| | | |
| | | } else { |
| | | Object[] options = {"OK ", "CANCEL "}; |
| | | JOptionPane.showOptionDialog(null, "éæ©çæä»¶ä¸æ£ç¡® ", "æç¤º", JOptionPane.DEFAULT_OPTION, |
| | | JOptionPane.WARNING_MESSAGE, null, options, options[0]); |
| | | } |
| | | } |
| | | }); |
| | | uploadButton.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | // å建æè½¬çå¾
æ¡çå®ä¾ï¼å设WaitUtilæ¯ä¸ä¸ªèªå®ä¹çSwingç»ä»¶ï¼ |
| | | final WaitUtil waitUtil = new WaitUtil(imgPath, "æä»¶æ£å¨å¯¼å
¥ï¼è¯·ç¨å"); |
| | | |
| | | // å¼å§ä¸ä¼ æä»¶ç弿¥ä»»å¡ |
| | | SwingWorker<String, Void> sw = new SwingWorker<String, Void>() { |
| | | @Override |
| | | protected String doInBackground() throws Exception { |
| | | // ä¸ä¼ æä»¶çé»è¾ |
| | | StringBuilder result = new StringBuilder(); |
| | | |
| | | // ä»ç¬¬ä¸åï¼ç´¢å¼ä¸º0ï¼è·åæ°æ® |
| | | String data = model.getValueAt(0, 0).toString(); |
| | | // å°æ°æ®åæ¢è¡ç¬¦æ¼æ¥å°StringBuilderä¸ |
| | | result.append(data); |
| | | |
| | | |
| | | String filePath = result.toString(); |
| | | String flag = djJdgzDismantTrackService.importExcel(filePath); |
| | | return flag; |
| | | } |
| | | |
| | | @Override |
| | | protected void done() { |
| | | try { |
| | | // è·åä¸ä¼ ç»æï¼å¨è¿ä¸ªä¾åä¸ï¼æä»¬å设ä¸ä¼ æ¹æ³è¿åBooleanç±»åï¼ |
| | | String uploadSucceeded = get(); |
| | | |
| | | // å·æ°è¡¨æ ¼æ°æ®ï¼å¦æä¸ä¼ æåï¼ |
| | | if (uploadSucceeded.equals("true")) { |
| | | waitUtil.dispose(); |
| | | frame.dispose(); |
| | | addOrUpdate.refreshTable(level3Id, jFrame); |
| | | System.out.println("导å
¥æåæ¶é´" + new Date()); |
| | | } else { |
| | | waitUtil.dispose(); |
| | | JOptionPane.showMessageDialog(null, uploadSucceeded, "æç¤º", JOptionPane.ERROR_MESSAGE); |
| | | } |
| | | |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | waitUtil.dispose(); |
| | | } |
| | | } |
| | | }; |
| | | // æ§è¡å¼æ¥ä»»å¡ |
| | | sw.execute(); |
| | | waitUtil.setVisible(true); |
| | | } |
| | | }); |
| | | |
| | | scrolltable.setTransferHandler(new TransferHandler() { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Override |
| | | public boolean importData(JComponent comp, Transferable t) { |
| | | try { |
| | | Boolean flag = true; |
| | | Object o = t.getTransferData(DataFlavor.javaFileListFlavor); |
| | | String filepath = o.toString(); |
| | | if (filepath.startsWith("[")) { |
| | | filepath = filepath.substring(1); |
| | | } |
| | | if (filepath.endsWith("]")) { |
| | | filepath = filepath.substring(0, filepath.length() - 1); |
| | | } |
| | | String[] filepathArr = filepath.split(", "); |
| | | Integer oldNum = model.getRowCount(); |
| | | String[][] data = new String[oldNum + filepathArr.length][2]; |
| | | for (int i = 0; i < oldNum; i++) { |
| | | data[i][0] = model.getValueAt(i, 0).toString(); |
| | | } |
| | | for (int i = 0; i < filepathArr.length; i++) { |
| | | if (filepathArr[i].contains(".xlsx") || filepathArr[i].contains(".xls")) { |
| | | data[i + oldNum][0] = filepathArr[i]; |
| | | } else { |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | if (!flag) { |
| | | JOptionPane.showMessageDialog(null, "åªè½ä¸ä¼ .xlsxæ.xlsçæä»¶ï¼ä¸ä¸è¶
è¿2G\"", "æç¤º", JOptionPane.WARNING_MESSAGE); |
| | | return flag; |
| | | } |
| | | model.setDataVector(data, columnIdentifiers); |
| | | table.setModel(model); |
| | | table.getColumnModel().getColumn(0).setPreferredWidth(650); |
| | | table.getColumnModel().getColumn(1).setPreferredWidth(80); |
| | | |
| | | table.getColumnModel().getColumn(0).setCellRenderer(new TableViewRenderer()); |
| | | table.getColumnModel().getColumn(1).setCellRenderer(new TableCellRendererButton()); |
| | | table.getColumnModel().getColumn(1).setCellEditor(new TableCellEditorButton(null, null)); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public boolean canImport(JComponent comp, DataFlavor[] flavors) { |
| | | for (int i = 0; i < flavors.length; i++) { |
| | | if (DataFlavor.javaFileListFlavor.equals(flavors[i])) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | frame.dispose(); |
| | | List<DjJdgzNetworkLevel2List> list = level2ListService.getList(netWorkId); |
| | | CommonTable.refreshTable(list,columnDto,subTable); |
| | | level2ListService.save(netWorkId,jPanel,graph); |
| | | level2ListService.saveDiagram(netWorkId,jPanel,graph); |
| | | System.out.println("导å
¥æåæ¶é´" + new Date()); |
| | | } else { |
| | | waitUtil.dispose(); |
| | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.utils.*; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel2List; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.service.*; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import com.example.server.utils.DownLoadTmpFile; |
| | | import com.mxgraph.view.mxGraph; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | | import javax.swing.event.ChangeEvent; |
| | | import javax.swing.table.DefaultTableModel; |
| | | import javax.swing.table.TableCellRenderer; |
| | | import java.awt.*; |
| | | import java.awt.datatransfer.DataFlavor; |
| | | import java.awt.datatransfer.Transferable; |
| | |
| | | @Autowired |
| | | private DjJdgzNetworkLevel2Service level2Service; |
| | | @Autowired |
| | | private DjJdgzNetworkLevel1ListService level1ListService; |
| | | private SysTeamGroupClassService sysTeamGroupClassService; |
| | | @Autowired |
| | | private CabinService cabinService; |
| | | @Autowired |
| | | private DjJdgzNetworkLevel1Service level1Service; |
| | | @Value("${data.tmp-path}") |
| | | private String tmpPath; |
| | | |
| | | public void FileUpload(List<ColumnDto> columnDto, JTable subTable,JFrame jFrame) { |
| | | public void FileUpload(List<ColumnDto> columnDto, JTable subTable, JFrame jFrame) { |
| | | frame = new JFrame("导å
¥"); |
| | | frame.setSize(900, 600); |
| | | frame.setResizable(true); |
| | |
| | | downloadbtn.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | DownLoadTmpFile.down("ä¸çº§ç½ç»å¾å¯¼å
¥æ¨¡æ¿.xlsx",frame); |
| | | DownLoadTmpFile.down(tmpPath + "ä¸çº§ç½ç»å¾å¯¼å
¥æ¨¡æ¿.xlsx", frame); |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | table.getColumnModel().getColumn(0).setCellRenderer(new TableViewRenderer()); |
| | | table.getColumnModel().getColumn(1).setCellRenderer(new TableCellRendererButton()); |
| | | table.getColumnModel().getColumn(1).setCellEditor(new TableCellEditorButton(null,null)); |
| | | table.getColumnModel().getColumn(1).setCellEditor(new TableCellEditorButton(null, null)); |
| | | |
| | | } else { |
| | | Object[] options = {"OK ", "CANCEL "}; |
| | |
| | | |
| | | |
| | | String filePath = result.toString(); |
| | | String flag = level3Service.importDiagramFromExcel(filePath,level1Id[0],level2Id[0],level2NodeId[0] ); |
| | | String flag = level3Service.importDiagramFromExcel(filePath, level1Id[0], level2Id[0], level2NodeId[0]); |
| | | return flag; |
| | | } |
| | | |
| | |
| | | if (uploadSucceeded.equals("true")) { |
| | | waitUtil.dispose(); |
| | | frame.dispose(); |
| | | List<DjJdgzNetworkLevel3> list = level3Service.getList(null); |
| | | CommonTable.refreshTable(list,columnDto,subTable); |
| | | level3ManageService.tableModelListener(list,subTable,jFrame); |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | String[] typeList = new String[]{ |
| | | "æ¹è£
", "å è£
", "æ¢è£
", "æ¹è¿æ§ä¿®ç" |
| | | }; |
| | | List<DjJdgzNetworkLevel3> list = level3Service.getList(null, deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null); |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | level3ManageService.tableModelListener(list, subTable, jFrame); |
| | | System.out.println("导å
¥æåæ¶é´" + new Date()); |
| | | } else { |
| | | waitUtil.dispose(); |
| | |
| | | |
| | | table.getColumnModel().getColumn(0).setCellRenderer(new TableViewRenderer()); |
| | | table.getColumnModel().getColumn(1).setCellRenderer(new TableCellRendererButton()); |
| | | table.getColumnModel().getColumn(1).setCellEditor(new TableCellEditorButton(null,null)); |
| | | table.getColumnModel().getColumn(1).setCellEditor(new TableCellEditorButton(null, null)); |
| | | return true; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | if (newValue.equals("del")) { |
| | | DefaultTableModel model = (DefaultTableModel) subTable.getModel(); |
| | | model.removeRow(row); |
| | | DjJdgzNetworkLevel1List djJdgzNetworkLevel1List = list.get(row); |
| | | level1ListService.deleteLogic(djJdgzNetworkLevel1List.getId()); |
| | | list.remove(row); |
| | | } else { |
| | | |
| | |
| | | JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(timeSpinner, "yyyy-MM-dd"); |
| | | timeSpinner.setEditor(timeEditor); |
| | | |
| | | /* JButton btnInsert = new JButton("æ°å¢");*/ |
| | | JButton btnInsert = new JButton("æ°å¢"); |
| | | JButton btnImport = new JButton("导å
¥æ°æ®"); |
| | | JButton btnSave= new JButton("ä¿å"); |
| | | |
| | | JLabel label1 = new JLabel("èµ·å§æ¶é´"); |
| | | /* JLabel label1 = new JLabel("èµ·å§æ¶é´"); |
| | | JXDatePicker beginDate = new JXDatePicker(); |
| | | beginDate.setPreferredSize(new Dimension(180, 28)); |
| | | SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | |
| | | lineNum.setText(String.valueOf(data.getLineNodeNum())); |
| | | }else{ |
| | | lineNum.setText("10"); |
| | | } |
| | | }*/ |
| | | |
| | | topJpanel.add(btnImport, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(label1, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(beginDate, new GBC(2, 0, 2, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | topJpanel.add(label2, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(diagramWidth, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | topJpanel.add(label3, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | topJpanel.add(lineNum, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | topJpanel.add(btnInsert, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(btnImport, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(btnSave, new GBC(2, 0, 2, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | // å建åè¡¨æ ¼ |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | |
| | | |
| | | /* List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("del", "å é¤"));*/ |
| | | |
| | | List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("del", "å é¤")); |
| | | |
| | | columnDto.add(new ColumnDto("åºå·", "", 50, "autoCreate", false, null,null)); |
| | | columnDto.add(new ColumnDto("å·¥ç¨ä¸ä¸", "majorName", 180, null, false, null,null)); |
| | | //columnDto.add(new ColumnDto("å·¥ç¨ä¸ä¸", "majorName", 180, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("èç¹åç§°", "ProcessName", 160, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("è¦æ±å®ææ¶é´", "requiredCompletionTime", 120, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("æä½", "", 85, "", true, buttonList,null)); |
| | | |
| | | JTable subTable = CommonTable.createCommonTable(list, columnDto); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); |
| | | |
| | | subTable.getModel().addTableModelListener(e -> { |
| | | // æ£æ¥äºä»¶ç±»å |
| | | if (e.getType() == TableModelEvent.UPDATE) { |
| | | // è·åååçè¡åå |
| | | int row = e.getFirstRow(); |
| | | int column = e.getColumn(); |
| | | |
| | | // è·åæ°çå¼ |
| | | Object newValue = subTable.getModel().getValueAt(row, column); |
| | | // è¾åºååä¿¡æ¯ |
| | | if (newValue.equals("del")) { |
| | | DefaultTableModel model = (DefaultTableModel) subTable.getModel(); |
| | | model.removeRow(row); |
| | | DjJdgzNetworkLevel2List djJdgzNetworkLevel2List = list.get(row); |
| | | level2ListService.deleteLogic(djJdgzNetworkLevel2List.getId()); |
| | | list.remove(row); |
| | | } else { |
| | | |
| | | } |
| | | System.out.println("åå
æ ¼åå: è¡=" + row + ", å=" + column + ", æ°å¼=" + newValue); |
| | | } |
| | | }); |
| | | |
| | | JScrollPane scrollTable = new JScrollPane(subTable); |
| | | jLeft.add(topJpanel, BorderLayout.NORTH); |
| | |
| | | } |
| | | }); |
| | | |
| | | btnInsert.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | TableModel model = subTable.getModel(); |
| | | DefaultTableModel defaultModel = (DefaultTableModel) model; |
| | | int columnCount = subTable.getColumnCount(); |
| | | Object[] emptyRow = new Object[columnCount]; |
| | | defaultModel.addRow(emptyRow); |
| | | list.add(new DjJdgzNetworkLevel2List()); |
| | | } |
| | | }); |
| | | |
| | | mxGraph finalGraph1 = graph; |
| | | btnSave.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | CommonTable.saveTableList(list,subTable,columnDto); |
| | | level2ListService.save(list,data.getId(),diagram, finalGraph); |
| | | } |
| | | }); |
| | | |
| | | btnImport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | importService.FileUpload(data.getId(),columnDto,subTable,diagram,finalGraph1); |
| | | importService.FileUpload(data.getId(),columnDto,subTable,diagram,finalGraph); |
| | | } |
| | | }); |
| | | } |
| | |
| | | import com.example.server.utils.DownLoadTmpFile; |
| | | import org.jdesktop.swingx.JXDatePicker; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | |
| | | private List<DjJdgzNetworkLevel2> list; |
| | | private Map<String, Long> shipMap = new HashMap<>(); |
| | | private List<ColumnDto> columnDto; |
| | | @Value("${data.tmp-path}") |
| | | private String tmpPath; |
| | | |
| | | |
| | | public JPanel createTable(Integer width, Integer height, JFrame jFrame) { |
| | |
| | | |
| | | columnDto = new ArrayList<>(); |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | columnDto.add(new ColumnDto("åºå·", "", (width - 10) / 4, "autoCreate", false, null,null)); |
| | | columnDto.add(new ColumnDto("å·¥ç¨", "ProjectName", (width - 10) / 4, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("ä¸çº§ç½ç»å¾èç¹åç§°", "processName", (width - 10) / 4, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("æä½", "", (width - 10) / 4, "", true, buttonList,null)); |
| | | columnDto.add(new ColumnDto("åºå·", "", (width - 10) / 4, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("å·¥ç¨", "ProjectName", (width - 10) / 4, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("ä¸çº§ç½ç»å¾èç¹åç§°", "processName", (width - 10) / 4, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("æä½", "", (width - 10) / 4, "", true, buttonList, null)); |
| | | |
| | | table = CommonTable.createCommonTable(list, columnDto); |
| | | table.setRowHeight(25); |
| | |
| | | Long shipId = shipMap.get(content); |
| | | list = level2Service.getList(shipId); |
| | | if (!isFirstLoadData[0]) { |
| | | CommonTable.refreshTable(list, columnDto,table); |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | tableModelListener(table,jFrame); |
| | | }else{ |
| | | tableModelListener(table, jFrame); |
| | | } else { |
| | | isFirstLoadData[0] = false; |
| | | } |
| | | } |
| | |
| | | } |
| | | comboBox.setSelectedItem(shipList.get(0).getShipNo()); |
| | | |
| | | tableModelListener(table,jFrame); |
| | | tableModelListener(table, jFrame); |
| | | |
| | | btnInsert.addActionListener(new ActionListener() { |
| | | @Override |
| | |
| | | btnDown.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | DownLoadTmpFile.down("äºçº§ç½ç»å¾å¯¼å
¥æ¨¡æ¿.xlsx",jFrame); |
| | | DownLoadTmpFile.down(tmpPath + "äºçº§ç½ç»å¾å¯¼å
¥æ¨¡æ¿.xlsx", jFrame); |
| | | } |
| | | }); |
| | | |
| | |
| | | |
| | | JButton btnSave = new JButton("ä¿å"); |
| | | |
| | | frame1.add(JLabel1, new GBC(0, 0,1,1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(JLabel1, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox0, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel2, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | |
| | | data.setLevel1NodeId(level1Node.getId()); |
| | | level2Service.insert(data); |
| | | list = level2Service.getList(level1Data.getShipId()); |
| | | CommonTable.refreshTable(list,columnDto,table); |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(table,jFrame); |
| | | tableModelListener(table, jFrame); |
| | | frame1.dispose(); |
| | | jFrame.setEnabled(true);//å°ä¸»çé¢åè®¾ç½®ä¸ºå¯æä½ç |
| | | }); |
| | | } |
| | | |
| | | public void tableModelListener(JTable table,JFrame jFrame){ |
| | | public void tableModelListener(JTable table, JFrame jFrame) { |
| | | table.getModel().addTableModelListener(e -> { |
| | | // æ£æ¥äºä»¶ç±»å |
| | | if (e.getType() == TableModelEvent.UPDATE) { |
| | |
| | | // è·åæ°çå¼ |
| | | Object newValue = table.getModel().getValueAt(row, column); |
| | | // è¾åºååä¿¡æ¯ |
| | | if (newValue.equals("edit")){ |
| | | if (newValue.equals("edit")) { |
| | | DjJdgzNetworkLevel2 data = list.get(row); |
| | | addOrUpdate.openDialog(data,jFrame); |
| | | addOrUpdate.openDialog(data, jFrame); |
| | | jFrame.setEnabled(false); |
| | | }else if(newValue.equals("del")) { |
| | | } else if (newValue.equals("del")) { |
| | | int n = JOptionPane.showConfirmDialog(null, "æ¯å¦å é¤?", "æç¤º", JOptionPane.YES_NO_OPTION); |
| | | if (n == 0) { |
| | | DefaultTableModel model = (DefaultTableModel) table.getModel(); |
| | |
| | | import com.example.client.utils.CellComboBoxEditor; |
| | | import com.example.client.utils.CellComboBoxRenderer; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel2List; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3List; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3ListService; |
| | |
| | | if (newValue.equals("del")) { |
| | | DefaultTableModel model = (DefaultTableModel) subTable.getModel(); |
| | | model.removeRow(row); |
| | | DjJdgzNetworkLevel3List djJdgzNetworkLevel3List = finalList.get(row); |
| | | level3ListService.deleteLogic(djJdgzNetworkLevel3List.getId()); |
| | | finalList.remove(row); |
| | | } else { |
| | | /* if (column == 1 && newValue instanceof Integer) { |
| | |
| | | public JPanel createTable(Integer width, Integer height, JFrame jFrame) { |
| | | JPanel panel = new JPanel(); |
| | | |
| | | JPanel topJpanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| | | topJpanel.setPreferredSize(new Dimension(width, 37)); |
| | | JPanel topJpanel = new JPanel(); |
| | | GridBagLayout layout = new GridBagLayout(); |
| | | topJpanel.setLayout(layout); |
| | | topJpanel.setPreferredSize(new Dimension(width, 100)); |
| | | topJpanel.setBackground(Color.WHITE); |
| | | |
| | | JPanel centerJpanel = new JPanel(); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100)); |
| | | centerJpanel.setBackground(Color.WHITE); |
| | |
| | | panel.add(centerJpanel, BorderLayout.CENTER); |
| | | |
| | | List<DjJdgzShip> shipList = djJdgzShipService.getList(); |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | | String[] typeList = new String[]{ |
| | | "æ¹è£
", "å è£
", "æ¢è£
", "æ¹è¿æ§ä¿®ç" |
| | | }; |
| | | |
| | | JLabel JLabel0 = new JLabel("å·¥ç¨"); |
| | | JComboBox comboBox = new JComboBox(); |
| | | comboBox.setPreferredSize(new Dimension(185, 28)); |
| | | |
| | | JLabel JLabel1 = new JLabel("é¨é¨"); |
| | | JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(deptList); |
| | | comboBox1.setPreferredSize(new Dimension(185, 28)); |
| | | |
| | | JComboBoxItem[] teamList1 = sysTeamGroupClassService.getTeamList(deptList[0].getId()); |
| | | |
| | | JLabel JLabel2 = new JLabel("ä¸ä¸"); |
| | | JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>(teamList1); |
| | | comboBox2.setPreferredSize(new Dimension(185, 28)); |
| | | |
| | | JLabel JLabel3 = new JLabel("è±å®¤"); |
| | | JComboBox<JComboBoxItem> comboBox3 = new JComboBox<>(cabinList); |
| | | comboBox3.setPreferredSize(new Dimension(185, 28)); |
| | | |
| | | JLabel JLabel4 = new JLabel("ç±»å«"); |
| | | JComboBox<String> comboBox4 = new JComboBox<>(typeList); |
| | | comboBox4.setPreferredSize(new Dimension(185, 28)); |
| | | |
| | | JTextField sb = new JTextField(16); |
| | | JButton query = new JButton("æ¥è¯¢"); |
| | | |
| | | JButton btnInsert = new JButton("æ°å¢"); |
| | | JButton btnImport = new JButton("导å
¥"); |
| | | |
| | | topJpanel.add(comboBox); |
| | | topJpanel.add(btnInsert); |
| | | topJpanel.add(btnImport); |
| | | topJpanel.add(JLabel0, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(comboBox, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | topJpanel.add(JLabel1, new GBC(2, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(comboBox1, new GBC(3, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | topJpanel.add(JLabel2, new GBC(4, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(comboBox2, new GBC(5, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | topJpanel.add(JLabel3, new GBC(6, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(comboBox3, new GBC(7, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | topJpanel.add(JLabel4, new GBC(8, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(comboBox4, new GBC(9, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | comboBox.setPreferredSize(new Dimension(300, 28)); |
| | | topJpanel.add(sb, new GBC(0, 1, 2, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(query, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | topJpanel.add(btnInsert, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | topJpanel.add(btnImport, new GBC(4, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | list = level3Service.getList(shipList.get(0).getId()); |
| | | list = level3Service.getList(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null); |
| | | List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("edit", "ç¼è¾")); |
| | | buttonList.add(new TableButton("del", "å é¤")); |
| | | |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | | |
| | | columnDto = new ArrayList<>(); |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | |
| | | columnDto.add(new ColumnDto("å·¥ç¨", "ProjectName", (width - 10) / 10, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("é¨é¨", "deptId", (width - 10) / 10, "dict", false, null, deptList)); |
| | | columnDto.add(new ColumnDto("ä¸ä¸", "teamgroupId", (width - 10) / 10, "dict", false, null, teamList)); |
| | | columnDto.add(new ColumnDto("è±å®¤", "cabinId", (width - 10) / 10, "dicts", false, null, cabinList)); |
| | | columnDto.add(new ColumnDto("è±å®¤", "cabinId", (width - 10) / 10, "dict", false, null, cabinList)); |
| | | columnDto.add(new ColumnDto("ç±»å«", "type", (width - 10) / 10, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("ä¸çº§ç½ç»å¾èç¹åç§°", "level1NodeName", (width - 10) / 10, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("äºçº§ç½ç»å¾èç¹åç§°", "level2NodeName", (width - 10) / 10, null, false, null, null)); |
| | |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | final Boolean[] isFirstLoadData = {true}; |
| | | comboBox.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId); |
| | | if (!isFirstLoadData[0]) { |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | tableModelListener(list, table, jFrame); |
| | | } else { |
| | | isFirstLoadData[0] = false; |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | | }); |
| | | comboBox1.addItemListener(new ItemListener() { |
| | | @Override |
| | | public void itemStateChanged(ItemEvent e) { |
| | | if (e.getStateChange() == ItemEvent.SELECTED) { |
| | | JComboBoxItem selectedItem = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | if (selectedItem != null) { |
| | | long selectedId = selectedItem.getId(); |
| | | |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(selectedId); |
| | | comboBox2.setModel(new DefaultComboBoxModel<>(teamList)); |
| | | comboBox2.setSelectedIndex(0); |
| | | |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | comboBox2.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | | }); |
| | | comboBox3.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | | }); |
| | | comboBox4.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | | }); |
| | | |
| | | query.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | list = level3Service.getList(null, null, null, null, null,sb.getText()); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(list, table, jFrame); |
| | | } |
| | | }); |
| | | |
| | |
| | | JComboBoxItem[] projectList = level1Service.getProjectList(); |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); |
| | | String[] typeList = new String[]{ |
| | | "æ¹è£
","å è£
","æ¢è£
","æ¹è¿æ§ä¿®ç" |
| | | "æ¹è£
", "å è£
", "æ¢è£
", "æ¹è¿æ§ä¿®ç" |
| | | }; |
| | | |
| | | JLabel JLabel1 = new JLabel("å·¥ç¨"); |
| | |
| | | data.setCabinId(String.valueOf(selectedIds)); |
| | | data.setType(comboBox6.getSelectedItem().toString()); |
| | | level3Service.insert(data); |
| | | list = level3Service.getList(level1Data.getShipId()); |
| | | list = level3Service.getList(level1Data.getShipId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null); |
| | | CommonTable.refreshTable(list, columnDto, table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.server.progressTrack.Dto.NetworkNodeStatusDto; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel2; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel2Service; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3Service; |
| | | import com.example.server.progressTrack.service.NetWorkDiagramService; |
| | | import com.mxgraph.swing.mxGraphComponent; |
| | |
| | | |
| | | // å建åè¡¨æ ¼ |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | | List<DjJdgzNetworkLevel3> list = level3Service.getList(null); |
| | | List<DjJdgzNetworkLevel3> list = level3Service.getList(null, null, null, null, null,null); |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | |
| | | |
| | |
| | | private DataSyncManageService dataSyncManageService; |
| | | @Autowired |
| | | private UserManageService userManageService; |
| | | @Autowired |
| | | private DismantTrackService dismantTrackService; |
| | | @Autowired |
| | | private SubunitService subunitService; |
| | | @Autowired |
| | | private TeamGroupManageService teamGroupManageService; |
| | | |
| | | @Autowired |
| | | private Main main; |
| | |
| | | } else if (nodeName.equals("ç¨æ·ç®¡ç")) { |
| | | JPanel user = userManageService.createTable(width, height, frame); |
| | | main.showTab("ç¨æ·ç®¡ç", user, tree); |
| | | } else if (nodeName.equals("æå¸è¿åº¦è¡¨")) { |
| | | JPanel dismantTrack = dismantTrackService.createTable(width, height, frame); |
| | | main.showTab("æå¸è¿åº¦è¡¨", dismantTrack, tree); |
| | | }else if (nodeName.equals("åé¨ä»¶é
ç½®")) { |
| | | JPanel subunit = subunitService.createTable(width, height, frame); |
| | | main.showTab("åé¨ä»¶é
ç½®", subunit, tree); |
| | | }else if (nodeName.equals("ä¸ä¸ç®¡ç")) { |
| | | JPanel teamGroup = teamGroupManageService.createTable(width, height, frame); |
| | | main.showTab("åé¨ä»¶é
ç½®", teamGroup, tree); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.example.client.service; |
| | | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.utils.ComplexTable; |
| | | import com.example.server.progressTrack.Dto.StatistDismantDto; |
| | | import com.example.server.progressTrack.Dto.StatistReportsDto; |
| | | import com.example.server.progressTrack.service.DjJdgzDismantTrackService; |
| | | import com.example.server.progressTrack.service.DjJdgzTrackRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | | import java.awt.event.WindowAdapter; |
| | | import java.awt.event.WindowEvent; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class StatisDismantService { |
| | | @Autowired |
| | | private DjJdgzDismantTrackService djJdgzDismantTrackService; |
| | | |
| | | public void createTable(JFrame jFrame,Long level1Id) { |
| | | JFrame frame1 = new JFrame("ç»è®¡æ¥è¡¨"); |
| | | frame1.setSize(1200, 700); |
| | | frame1.setResizable(false); |
| | | frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| | | frame1.setLocationRelativeTo(null); |
| | | frame1.setVisible(true); |
| | | frame1.addWindowListener(new WindowAdapter() { |
| | | //æ·»å 第äºä¸ªçé¢çå
³éäºä»¶: |
| | | public void windowClosing(WindowEvent e) { |
| | | //æ·»å äºä»¶: |
| | | jFrame.setEnabled(true);//å°ä¸»çé¢åè®¾ç½®ä¸ºå¯æä½ç |
| | | } |
| | | }); |
| | | |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | | List<StatistDismantDto> list = djJdgzDismantTrackService.getStatist(level1Id); |
| | | |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | /* columnDto.add(new ColumnDto("çç»ä¸ä¸", "TeamGroupName", 280, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("é¡¹ç®æ»æ°", "AllNum", 150, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("è¿è¡ä¸", "JxzNum", 150, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("临æ", "LqNum", 150, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("龿", "YqNum", 150, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("æ£å¸¸å®æ", "ZcwcNum", 150, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("è¶
æå®æ", "CqwcNum", 150, null, false, null,null)); |
| | | |
| | | |
| | | table = CommonTable.createCommonTable(list, columnDto); |
| | | |
| | | |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | JScrollPane scrollTable = new JScrollPane(table);*/ |
| | | //frame1.add(scrollTable); |
| | | |
| | | |
| | | |
| | | Object[][] headerRows = new Object[2][9]; |
| | | headerRows[0] = new Object[]{"é¨é¨/ä¸ä¸","æ»æ°",ComplexTable.mergeCellX,"æå¸è¿åº¦å®æ",ComplexTable.mergeCellX,"åé¨ä»¶",ComplexTable.mergeCellX,ComplexTable.mergeCellX,ComplexTable.mergeCellX,}; |
| | | //æ¤å¤2-5æ¯ä¸ä¼æ¾ç¤ºåºæ¥çï¼å 为1-4åä¸åå¹¶äºä¸è¡ + åå³åå¹¶äºä¸å ï¼ è2-5被è¿ä¸ªç©å½¢èå´å
æ¬äº |
| | | headerRows[1] = new Object[]{ComplexTable.mergeCellY, "设å¤","åé¨ä»¶","设å¤","åé¨ä»¶","å·²æå¸","å·²åºè±","å·²éé","å·²å
¥åº"}; |
| | | |
| | | String[][] body = new String[list.size()][9]; |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | StatistDismantDto data =list.get(i); |
| | | body[i][0] = data.getName(); |
| | | body[i][1] = String.valueOf(data.getSbsl()); |
| | | body[i][2] = String.valueOf(data.getZbjsl()); |
| | | body[i][3] = String.valueOf(data.getSbcxsl()); |
| | | body[i][4] = String.valueOf(data.getZbjcxsl()); |
| | | body[i][5] = String.valueOf(data.getDismantsl()); |
| | | body[i][6] = String.valueOf(data.getExitsl()); |
| | | body[i][7] = String.valueOf(data.getReturnsl()); |
| | | body[i][8] = String.valueOf(data.getWarehousesl()); |
| | | } |
| | | |
| | | JScrollPane scrollTable = new JScrollPane(new ComplexTable(headerRows , body,130)); |
| | | frame1.add(scrollTable); |
| | | frame1.setVisible(true); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | Object[][] headerRows = new Object[list.size()][7]; |
| | | Object[][] headerRows = new Object[2][7]; |
| | | headerRows[0] = new Object[]{"çç»ä¸ä¸","é¡¹ç®æ»æ°","æªå®æ",ComplexTable.mergeCellX,ComplexTable.mergeCellX,"已宿",ComplexTable.mergeCellX}; |
| | | //æ¤å¤2-5æ¯ä¸ä¼æ¾ç¤ºåºæ¥çï¼å 为1-4åä¸åå¹¶äºä¸è¡ + åå³åå¹¶äºä¸å ï¼ è2-5被è¿ä¸ªç©å½¢èå´å
æ¬äº |
| | | headerRows[1] = new Object[]{ComplexTable.mergeCellY, ComplexTable.mergeCellY ,"è¿è¡ä¸","临æ","龿","æ£å¸¸å®æ","è¶
æå®æ"}; |
| | |
| | | body[i][5] = String.valueOf(data.getZcwcNum()); |
| | | body[i][6] = String.valueOf(data.getCqwcNum()); |
| | | } |
| | | JScrollPane scrollTable = new JScrollPane(new ComplexTable(headerRows , body)); |
| | | |
| | | JScrollPane scrollTable = new JScrollPane(new ComplexTable(headerRows , body,171)); |
| | | frame1.add(scrollTable); |
| | | frame1.setVisible(true); |
| | | } |
New file |
| | |
| | | package com.example.client.service; |
| | | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.model.TableButton; |
| | | import com.example.client.utils.BoxIteUtils; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.GBC; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.model.DjJdgzDismantTrack; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.service.DjJdgzDismantTrackService; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3Service; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import com.example.server.user.model.SysUser; |
| | | import com.example.server.utils.CacheUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | | import javax.swing.event.TableModelEvent; |
| | | import javax.swing.table.DefaultTableModel; |
| | | import java.awt.*; |
| | | import java.awt.event.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class SubunitAddOrUpdate { |
| | | @Autowired |
| | | private DjJdgzNetworkLevel3Service level3Service; |
| | | @Autowired |
| | | private SysTeamGroupClassService sysTeamGroupClassService; |
| | | @Autowired |
| | | private DjJdgzDismantTrackService djJdgzDismantTrackService; |
| | | @Autowired |
| | | private ImportDismantTrackService importDismantTrackService; |
| | | @Autowired |
| | | private CabinService cabinService; |
| | | private List<ColumnDto> columnDto; |
| | | private JTable trackTable; |
| | | |
| | | public JPanel createTrack(Integer width, Integer height, DjJdgzNetworkLevel3 djJdgzNetworkLevel3,JFrame frame) { |
| | | JPanel panel = new JPanel(); |
| | | panel.setPreferredSize(new Dimension(width, height)); |
| | | JPanel topJpanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| | | topJpanel.setPreferredSize(new Dimension(width - 10, 37)); |
| | | |
| | | JPanel centerJpanel = new JPanel(); |
| | | centerJpanel.setPreferredSize(new Dimension(width - 20, height - 100)); |
| | | panel.add(topJpanel, BorderLayout.NORTH); |
| | | panel.add(centerJpanel, BorderLayout.CENTER); |
| | | |
| | | JButton btnInsert = new JButton("æ°å¢"); |
| | | |
| | | |
| | | topJpanel.add(btnInsert); |
| | | |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | List<DjJdgzDismantTrack> list = djJdgzDismantTrackService.getList(djJdgzNetworkLevel3.getId(), null); |
| | | List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("edit", "ç¼è¾")); |
| | | buttonList.add(new TableButton("del", "å é¤")); |
| | | |
| | | // åå»ºå·¦ä¾§è¡¨æ ¼ |
| | | columnDto = new ArrayList<>(); |
| | | |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | columnDto.add(new ColumnDto("åºå·", "", 200, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("è±å®¤", "cabinId", 200, "dict", false, null, cabinList)); |
| | | columnDto.add(new ColumnDto("é¨ä»¶åç§°", "name", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("æä½", "", 200, "", true, buttonList, null)); |
| | | |
| | | trackTable = CommonTable.createCommonTable(list, columnDto); |
| | | trackTable.setPreferredSize(new Dimension(width , height)); |
| | | trackTable.setRowHeight(25); |
| | | trackTable.setAutoCreateRowSorter(true); |
| | | trackTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | tableModelListener(trackTable, frame,list,columnDto); |
| | | |
| | | btnInsert.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | SysUser user = (SysUser) CacheUtils.get("user", "user"); |
| | | if (user.getTeamgroup()==null||user.getTeamgroup().equals(djJdgzNetworkLevel3.getTeamgroupId())) { |
| | | DjJdgzDismantTrack djJdgzDismantTrack = new DjJdgzDismantTrack(); |
| | | djJdgzDismantTrack.setLevel3NetworkId(djJdgzNetworkLevel3.getId()); |
| | | insert(frame,djJdgzDismantTrack); |
| | | }else{ |
| | | JOptionPane.showMessageDialog(null, "ä¸å¯æä½å
¶ä»ä¸ä¸æ°æ®", "æç¤º", JOptionPane.WARNING_MESSAGE); |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | |
| | | |
| | | JScrollPane scrollPane = new JScrollPane(trackTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | scrollPane.setViewportView(trackTable); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, height - 130)); |
| | | centerJpanel.add(scrollPane); |
| | | |
| | | return panel; |
| | | } |
| | | |
| | | private void insert(JFrame jFrame, DjJdgzDismantTrack data) { |
| | | if (data.getLevel3NetworkId()==null){ |
| | | JOptionPane.showMessageDialog(null, "没æéæ©è®¾å¤", "æç¤º", JOptionPane.WARNING_MESSAGE); |
| | | return; |
| | | } |
| | | JFrame frame1 = new JFrame("æ°å¢åé¨ä»¶"); |
| | | frame1.setSize(470, 430); |
| | | frame1.setResizable(true); |
| | | frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| | | frame1.setLocationRelativeTo(null); |
| | | frame1.setVisible(true); |
| | | frame1.addWindowListener(new WindowAdapter() { |
| | | //æ·»å 第äºä¸ªçé¢çå
³éäºä»¶: |
| | | public void windowClosing(WindowEvent e) { |
| | | //æ·»å äºä»¶: |
| | | jFrame.setEnabled(true);//å°ä¸»çé¢åè®¾ç½®ä¸ºå¯æä½ç |
| | | } |
| | | }); |
| | | GridBagLayout layout = new GridBagLayout(); |
| | | frame1.setLayout(layout); |
| | | |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | |
| | | JLabel JLabel1 = new JLabel("è±å®¤"); |
| | | JComboBox<JComboBoxItem> comboBox0 = new JComboBox<>(cabinList); |
| | | comboBox0.setPreferredSize(new Dimension(185, 28)); |
| | | comboBox0.setSelectedIndex(-1); |
| | | if(data.getCabinId()!=null){ |
| | | comboBox0.setSelectedItem(BoxIteUtils.GetSelectItemById(cabinList, data.getCabinId())); |
| | | } |
| | | |
| | | JLabel JLabel8 = new JLabel("åé¨ä»¶åç§°"); |
| | | JTextField subunitName = new JTextField(16); |
| | | if (StringUtils.isNotBlank(data.getName())) { |
| | | subunitName.setText(data.getName()); |
| | | } |
| | | |
| | | |
| | | JButton btnSave = new JButton("ç¡®å®"); |
| | | |
| | | frame1.add(JLabel1, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox0, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel8, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(subunitName, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(btnSave, new GBC(0, 2, 2, 1).setWeight(1, 0)); |
| | | |
| | | btnSave.addActionListener((e) -> { |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox0.getSelectedItem(); |
| | | |
| | | String name = subunitName.getText(); |
| | | data.setCabinId(cabin.getId()); |
| | | data.setName(name); |
| | | List<DjJdgzDismantTrack> list = new ArrayList<>(); |
| | | list.add(data); |
| | | djJdgzDismantTrackService.save(list); |
| | | |
| | | frame1.dispose(); |
| | | jFrame.setEnabled(true);//å°ä¸»çé¢åè®¾ç½®ä¸ºå¯æä½ç |
| | | }); |
| | | } |
| | | public void refreshTable(Long level3Id,JFrame jFrame){ |
| | | List<DjJdgzDismantTrack> list = djJdgzDismantTrackService.getList(level3Id, null); |
| | | CommonTable.refreshTable(list, columnDto, trackTable); |
| | | trackTable.setRowHeight(25); |
| | | trackTable.setAutoCreateRowSorter(true); |
| | | trackTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(trackTable, jFrame,list,columnDto); |
| | | } |
| | | |
| | | public void tableModelListener(JTable table,JFrame jFrame,List<DjJdgzDismantTrack> list,List<ColumnDto> columnDto){ |
| | | table.getModel().addTableModelListener(e -> { |
| | | // æ£æ¥äºä»¶ç±»å |
| | | if (e.getType() == TableModelEvent.UPDATE) { |
| | | // è·åååçè¡åå |
| | | int row = e.getFirstRow(); |
| | | int column = e.getColumn(); |
| | | |
| | | // è·åæ°çå¼ |
| | | Object newValue = table.getModel().getValueAt(row, column); |
| | | // è¾åºååä¿¡æ¯ |
| | | if (newValue.equals("edit")){ |
| | | DjJdgzDismantTrack data = list.get(row); |
| | | insert(jFrame,data); |
| | | jFrame.setEnabled(false); |
| | | }else if(newValue.equals("del")) { |
| | | int n = JOptionPane.showConfirmDialog(null, "æ¯å¦å é¤?", "æç¤º", JOptionPane.YES_NO_OPTION); |
| | | if (n == 0) { |
| | | DefaultTableModel model = (DefaultTableModel) table.getModel(); |
| | | DjJdgzDismantTrack data = list.get(row); |
| | | djJdgzDismantTrackService.deleteLogic(data.getId()); |
| | | list.remove(row); |
| | | model.removeRow(row); |
| | | } |
| | | } |
| | | System.out.println("åå
æ ¼åå: è¡=" + row + ", å=" + column + ", æ°å¼=" + newValue); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.example.client.service; |
| | | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.GBC; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.model.DjJdgzShip; |
| | | import com.example.server.progressTrack.service.DjJdgzDismantTrackService; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3Service; |
| | | import com.example.server.progressTrack.service.DjJdgzShipService; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | | import java.awt.*; |
| | | import java.awt.event.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class SubunitService { |
| | | @Autowired |
| | | private DjJdgzNetworkLevel3Service level3Service; |
| | | @Autowired |
| | | private SysTeamGroupClassService sysTeamGroupClassService; |
| | | @Autowired |
| | | private DjJdgzDismantTrackService djJdgzDismantTrackService; |
| | | @Autowired |
| | | private CabinService cabinService; |
| | | @Autowired |
| | | private DjJdgzShipService djJdgzShipService; |
| | | @Autowired |
| | | private SubunitAddOrUpdate addOrUpdate; |
| | | |
| | | private List<DjJdgzNetworkLevel3> list; |
| | | |
| | | public JPanel createTable(Integer width, Integer height, JFrame frame) { |
| | | JPanel panel = new JPanel(); |
| | | panel.setPreferredSize(new Dimension(width, height)); |
| | | |
| | | JPanel jLeft = new JPanel(new BorderLayout()); |
| | | |
| | | JPanel top = new JPanel(); |
| | | GridBagLayout layout = new GridBagLayout(); |
| | | top.setLayout(layout); |
| | | |
| | | jLeft.setPreferredSize(new Dimension(width / 2 - 20, height)); |
| | | top.setPreferredSize(new Dimension(width / 2 - 20, 100)); |
| | | |
| | | // åå»ºå·¦ä¾§è¡¨æ ¼ |
| | | |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList(); |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); |
| | | JComboBoxItem[] cabinList = cabinService.getList(); |
| | | String[] typeList = new String[]{ |
| | | "æ¹è£
", "å è£
", "æ¢è£
", "æ¹è¿æ§ä¿®ç" |
| | | }; |
| | | List<DjJdgzShip> shipList = djJdgzShipService.getList(); |
| | | Map<String, Long> shipMap = new HashMap<>(); |
| | | |
| | | JLabel JLabel0 = new JLabel("å·¥ç¨"); |
| | | JComboBox comboBox = new JComboBox(); |
| | | |
| | | comboBox.setPreferredSize(new Dimension(160, 28)); |
| | | for (int i = 0; i < shipList.size(); i++) { |
| | | shipMap.put(shipList.get(i).getShipNo(), shipList.get(i).getId()); |
| | | comboBox.addItem(shipList.get(i).getShipNo()); |
| | | } |
| | | comboBox.setSelectedItem(shipList.get(0).getShipNo()); |
| | | |
| | | JLabel JLabel1 = new JLabel("é¨é¨"); |
| | | JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(deptList); |
| | | comboBox1.setPreferredSize(new Dimension(160, 28)); |
| | | |
| | | JComboBoxItem[] teamList1 = sysTeamGroupClassService.getTeamList(deptList[0].getId()); |
| | | |
| | | JLabel JLabel2 = new JLabel("ä¸ä¸"); |
| | | JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>(teamList1); |
| | | comboBox2.setPreferredSize(new Dimension(170, 28)); |
| | | |
| | | JLabel JLabel3 = new JLabel("è±å®¤"); |
| | | JComboBox<JComboBoxItem> comboBox3 = new JComboBox<>(cabinList); |
| | | comboBox3.setPreferredSize(new Dimension(160, 28)); |
| | | |
| | | JLabel JLabel4 = new JLabel("ç±»å«"); |
| | | JComboBox<String> comboBox4 = new JComboBox<>(typeList); |
| | | comboBox4.setPreferredSize(new Dimension(160, 28)); |
| | | |
| | | JTextField sb = new JTextField(12); |
| | | JButton query = new JButton("æ¥è¯¢"); |
| | | |
| | | top.add(JLabel0, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(JLabel1, new GBC(2, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox1, new GBC(3, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(JLabel2, new GBC(4, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox2, new GBC(5, 0, 2, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | top.add(JLabel3, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox3, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(JLabel4, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | top.add(comboBox4, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(sb, new GBC(4, 1, 2, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | top.add(query, new GBC(6, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | |
| | | jLeft.add(top, BorderLayout.NORTH); |
| | | |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | | list = level3Service.getList(null, deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0],null); |
| | | |
| | | columnDto.add(new ColumnDto("åºå·", "", 60, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("设å¤åç§°", "name", 180, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("é¨é¨", "deptId", 180, "dict", false, null, deptList)); |
| | | columnDto.add(new ColumnDto("ä¸ä¸", "teamgroupId", 180, "dict", false, null, teamList)); |
| | | columnDto.add(new ColumnDto("è±å®¤", "cabinId", 180, "dict", false, null, cabinList)); |
| | | columnDto.add(new ColumnDto("ç±»å«", "type", 180, null, false, null, null)); |
| | | |
| | | JTable subTable = CommonTable.createCommonTable(list, columnDto); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); |
| | | |
| | | comboBox.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId(),frame); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | comboBox1.addItemListener(new ItemListener() { |
| | | @Override |
| | | public void itemStateChanged(ItemEvent e) { |
| | | if (e.getStateChange() == ItemEvent.SELECTED) { |
| | | JComboBoxItem selectedItem = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | if (selectedItem != null) { |
| | | long selectedId = selectedItem.getId(); |
| | | |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(selectedId); |
| | | comboBox2.setModel(new DefaultComboBoxModel<>(teamList)); |
| | | comboBox2.setSelectedIndex(0); |
| | | |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId(),frame); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | comboBox2.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId(),frame); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | comboBox3.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId(),frame); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | comboBox4.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | JComboBoxItem cabin = (JComboBoxItem) comboBox3.getSelectedItem(); |
| | | String type = comboBox4.getSelectedItem().toString(); |
| | | |
| | | Long shipId = shipMap.get(content); |
| | | list = level3Service.getList(shipId, dept.getId(), team.getId(), cabin.getId(), type,null); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId(),frame); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | query.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | list = level3Service.getList(null, null, null, null, null,sb.getText()); |
| | | |
| | | CommonTable.refreshTable(list, columnDto, subTable); |
| | | subTable.setRowHeight(25); |
| | | subTable.setAutoCreateRowSorter(true); |
| | | subTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId(),frame); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | JScrollPane scrollTable = new JScrollPane(subTable); |
| | | jLeft.add(scrollTable, BorderLayout.CENTER); |
| | | |
| | | JPanel track = addOrUpdate.createTrack(width / 2, height, list.get(0), frame); |
| | | |
| | | |
| | | // å建水平åå²é¢æ¿ |
| | | JSplitPane hSplitPane = new JSplitPane( |
| | | JSplitPane.HORIZONTAL_SPLIT, |
| | | jLeft, |
| | | track |
| | | ); |
| | | hSplitPane.setDividerLocation(width / 2); |
| | | hSplitPane.setDividerSize(10); |
| | | hSplitPane.setOneTouchExpandable(true); |
| | | hSplitPane.setContinuousLayout(true); |
| | | panel.add(hSplitPane,BorderLayout.CENTER); |
| | | |
| | | subTable.addMouseListener(new MouseAdapter() { |
| | | public void mouseClicked(MouseEvent e) { |
| | | // ä»
å½é¼ æ å·¦é®å廿¶ååº |
| | | if (e.getButton() == MouseEvent.BUTTON1) { |
| | | // å¾å°éä¸çè¡åçç´¢å¼å¼ |
| | | int r = subTable.getSelectedRow(); |
| | | DjJdgzNetworkLevel3 data = list.get(r); |
| | | addOrUpdate.refreshTable(data.getId(),frame); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return panel; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.model.TableButton; |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.GBC; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel1; |
| | | import com.example.server.progressTrack.model.DjJdgzShip; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel1Service; |
| | | import com.example.server.progressTrack.service.DjJdgzShipService; |
| | | import org.jdesktop.swingx.JXDatePicker; |
| | | import com.example.server.boatFleet.service.BoatFleetService; |
| | | import com.example.server.teamGroup.model.SysTeamGroupClass; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import com.example.server.user.model.SysUser; |
| | | import com.example.server.user.service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | | import javax.swing.event.TableModelEvent; |
| | | import javax.swing.table.DefaultTableModel; |
| | | import javax.swing.table.TableCellEditor; |
| | | import java.awt.*; |
| | | import java.awt.event.*; |
| | | import java.text.SimpleDateFormat; |
| | | import java.awt.event.ActionEvent; |
| | | import java.awt.event.ActionListener; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class TeamGroupManageService { |
| | | @Autowired |
| | | private DjJdgzNetworkLevel1Service level1Service; |
| | | @Autowired |
| | | private DjJdgzShipService djJdgzShipService; |
| | | @Autowired |
| | | private Level1AddOrUpdate addOrUpdate; // 注å
¥ AddOrupdate å®ä¾ |
| | | private SysTeamGroupClassService sysTeamGroupClassService; |
| | | |
| | | private JTable table; |
| | | private List<DjJdgzNetworkLevel1> list; |
| | | private Map<String, Long> shipMap = new HashMap<>(); |
| | | private List<ColumnDto> columnDto; |
| | | |
| | | public JPanel createTable(Integer width, Integer height, JFrame jFrame) { |
| | | JPanel panel = new JPanel(); |
| | | |
| | | List<SysTeamGroupClass> list; |
| | | JPanel topJpanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); |
| | | topJpanel.setPreferredSize(new Dimension(width, 37)); |
| | | topJpanel.setBackground(Color.WHITE); |
| | |
| | | panel.add(topJpanel, BorderLayout.NORTH); |
| | | panel.add(centerJpanel, BorderLayout.CENTER); |
| | | |
| | | List<DjJdgzShip> shipList = djJdgzShipService.getList(); |
| | | JComboBox comboBox = new JComboBox(); |
| | | JButton btnInsert = new JButton("æ°å¢"); |
| | | |
| | | topJpanel.add(comboBox); |
| | | topJpanel.add(btnInsert); |
| | | |
| | | comboBox.setPreferredSize(new Dimension(300, 28)); |
| | | |
| | | list = level1Service.getList(shipList.get(0).getId()); |
| | | List<TableButton> buttonList = new ArrayList<>(); |
| | | buttonList.add(new TableButton("edit", "ç¼è¾")); |
| | | buttonList.add(new TableButton("del", "å é¤")); |
| | | list = sysTeamGroupClassService.getListByTree(); |
| | | |
| | | columnDto = new ArrayList<>(); |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | columnDto.add(new ColumnDto("åºå·", "", (width - 10) / 4, "autoCreate", false, null,null)); |
| | | columnDto.add(new ColumnDto("å·¥ç¨", "ProjectName", (width - 10) / 4, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("èµ·å§æ¶é´", "StartDate", (width - 10) / 4, "selectDate", false, null,null)); |
| | | columnDto.add(new ColumnDto("æä½", "", (width - 10) / 4, "", true, buttonList,null)); |
| | | columnDto.add(new ColumnDto("åºå·", "", (width - 10) / 3, "autoCreate", false, null,null)); |
| | | columnDto.add(new ColumnDto("é¨é¨/ä¸ä¸", "name", (width - 3) / 3, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("æä½", "", (width - 10) / 3, "", true, buttonList,null)); |
| | | |
| | | table = CommonTable.createCommonTable(list, columnDto); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | | final Boolean[] isFirstLoadData = {true}; |
| | | comboBox.addItemListener(new ItemListener() { |
| | | public void itemStateChanged(final ItemEvent event) { |
| | | String content = comboBox.getSelectedItem().toString(); |
| | | Long shipId = shipMap.get(content); |
| | | list = level1Service.getList(shipId); |
| | | if (!isFirstLoadData[0]) { |
| | | CommonTable.refreshTable(list, columnDto,table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | //tableModelListener(table,jFrame,list); |
| | | |
| | | tableModelListener(table,jFrame); |
| | | }else{ |
| | | isFirstLoadData[0] = false; |
| | | } |
| | | } |
| | | }); |
| | | |
| | | for (int i = 0; i < shipList.size(); i++) { |
| | | shipMap.put(shipList.get(i).getShipNo(), shipList.get(i).getId()); |
| | | comboBox.addItem(shipList.get(i).getShipNo()); |
| | | } |
| | | comboBox.setSelectedItem(shipList.get(0).getShipNo()); |
| | | |
| | | tableModelListener(table,jFrame); |
| | | |
| | | btnInsert.addActionListener(new ActionListener() { |
| | | /* btnInsert.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | SysUser data = new SysUser(); |
| | | addOrUpdate.openDialog(data,jFrame, columnDto,table); |
| | | jFrame.setEnabled(false); |
| | | insert(jFrame); |
| | | } |
| | | }); |
| | | });*/ |
| | | |
| | | JScrollPane scrollPane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
| | | scrollPane.setViewportView(table); |
| | |
| | | return panel; |
| | | } |
| | | |
| | | private void insert(JFrame jFrame) { |
| | | JFrame frame1 = new JFrame("æ°å¢ä¸çº§ç½ç»å¾"); |
| | | frame1.setSize(350, 400); |
| | | frame1.setResizable(true); |
| | | frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); |
| | | frame1.setLocationRelativeTo(null); |
| | | frame1.setVisible(true); |
| | | frame1.addWindowListener(new WindowAdapter() { |
| | | //æ·»å 第äºä¸ªçé¢çå
³éäºä»¶: |
| | | public void windowClosing(WindowEvent e) { |
| | | //æ·»å äºä»¶: |
| | | jFrame.setEnabled(true);//å°ä¸»çé¢åè®¾ç½®ä¸ºå¯æä½ç |
| | | } |
| | | }); |
| | | GridBagLayout layout = new GridBagLayout(); |
| | | frame1.setLayout(layout); |
| | | JComboBoxItem[] shipList = djJdgzShipService.getListByItem(); |
| | | JComboBoxItem[] levelList = { |
| | | new JComboBoxItem(1, "ä¸çº§"), |
| | | new JComboBoxItem(2, "äºçº§"), |
| | | new JComboBoxItem(3, "ä¸çº§"), |
| | | }; |
| | | |
| | | JLabel JLabel1 = new JLabel("çå·"); |
| | | JComboBox<JComboBoxItem> comboBox0 = new JComboBox<>(shipList); |
| | | comboBox0.setPreferredSize(new Dimension(185, 28)); |
| | | |
| | | JLabel JLabel2 = new JLabel("ä¿®çç级"); |
| | | JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(levelList); |
| | | comboBox1.setPreferredSize(new Dimension(185, 28)); |
| | | |
| | | |
| | | JLabel JLabel3 = new JLabel("年份"); |
| | | JSpinner yearPicker = new JSpinner(new SpinnerNumberModel(2024, 1900, 2100, 1)); // å½å年份为2024ï¼èå´ä¸º1900-2100ï¼æ¥é¿ä¸º1 |
| | | yearPicker.setPreferredSize(new Dimension(185, 28)); |
| | | Font font = new Font("å®ä½", Font.BOLD, 23); |
| | | yearPicker.setFont(font); |
| | | JSpinner.NumberEditor editor1 = new JSpinner.NumberEditor(yearPicker, "#"); |
| | | JTextField textField = editor1.getTextField(); |
| | | textField.setHorizontalAlignment(JTextField.LEFT); // æåå±
å³ |
| | | textField.setFont(font); // 设置åä½ |
| | | yearPicker.setEditor(editor1); |
| | | |
| | | |
| | | JLabel JLabel4 = new JLabel("èµ·å§æ¶é´"); |
| | | JXDatePicker beginDate = new JXDatePicker(); |
| | | beginDate.setPreferredSize(new Dimension(185, 28)); |
| | | SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | beginDate.setFormats(sdFormat); |
| | | beginDate.setDate(null); |
| | | beginDate.addActionListener(e -> { |
| | | // 忢åå
æ ¼ç¼è¾ï¼å
³éå¼¹åºçªå£ |
| | | TableCellEditor editor = table.getCellEditor(); |
| | | if (editor != null) { |
| | | editor.stopCellEditing(); |
| | | } |
| | | }); |
| | | |
| | | JButton btnSave = new JButton("ä¿å"); |
| | | |
| | | frame1.add(JLabel1, new GBC(0, 0,1,1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox0, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel2, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox1, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel3, new GBC(0, 2,1,1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(yearPicker, new GBC(1, 2, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel4, new GBC(0, 3,1,1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(beginDate, new GBC(1, 3, 1, 1).setAnchor(GBC.NORTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(btnSave, new GBC(0, 4, 2, 1).setWeight(1, 0)); |
| | | |
| | | btnSave.addActionListener((e) -> { |
| | | JComboBoxItem ship = (JComboBoxItem) comboBox0.getSelectedItem(); |
| | | JComboBoxItem level = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | DjJdgzNetworkLevel1 data = new DjJdgzNetworkLevel1(); |
| | | data.setShipId(ship.getId()); |
| | | data.setMaintainLevel(Math.toIntExact(level.getId())); |
| | | data.setStartDate(sdFormat.format(beginDate.getDate())); |
| | | data.setYear((Integer) yearPicker.getValue()); |
| | | data.setAdventDay(7); |
| | | data.setProjectName(ship.getName()+"-"+yearPicker.getValue() + "-" + level.getName()); |
| | | level1Service.insert(data); |
| | | list = level1Service.getList(ship.getId()); |
| | | CommonTable.refreshTable(list,columnDto,table); |
| | | table.setRowHeight(25); |
| | | table.setAutoCreateRowSorter(true); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | tableModelListener(table,jFrame); |
| | | frame1.dispose(); |
| | | jFrame.setEnabled(true);//å°ä¸»çé¢åè®¾ç½®ä¸ºå¯æä½ç |
| | | }); |
| | | } |
| | | |
| | | public void tableModelListener(JTable table,JFrame jFrame){ |
| | | /* public void tableModelListener(JTable table,JFrame jFrame,List<SysUser> list){ |
| | | table.getModel().addTableModelListener(e -> { |
| | | // æ£æ¥äºä»¶ç±»å |
| | | if (e.getType() == TableModelEvent.UPDATE) { |
| | |
| | | Object newValue = table.getModel().getValueAt(row, column); |
| | | // è¾åºååä¿¡æ¯ |
| | | if (newValue.equals("edit")){ |
| | | DjJdgzNetworkLevel1 data = list.get(row); |
| | | addOrUpdate.openDialog(data,jFrame); |
| | | SysUser data = list.get(row); |
| | | addOrUpdate.openDialog(data,jFrame, columnDto,table); |
| | | jFrame.setEnabled(false); |
| | | }else if(newValue.equals("del")) { |
| | | int n = JOptionPane.showConfirmDialog(null, "æ¯å¦å é¤?", "æç¤º", JOptionPane.YES_NO_OPTION); |
| | | if (n == 0) { |
| | | DefaultTableModel model = (DefaultTableModel) table.getModel(); |
| | | DjJdgzNetworkLevel1 data = list.get(row); |
| | | level1Service.deleteLevel1(data.getId()); |
| | | SysUser data = list.get(row); |
| | | userService.deleteLogic(data.getId()); |
| | | list.remove(row); |
| | | model.removeRow(row); |
| | | } |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | */ |
| | | |
| | | } |
| | | |
| | |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3List; |
| | | import com.example.server.progressTrack.model.DjJdgzTrackRecord; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3ListService; |
| | | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3Service; |
| | | import com.example.server.progressTrack.service.DjJdgzTrackRecordService; |
| | | import com.example.server.progressTrack.service.NetWorkDiagramService; |
| | | import com.example.server.sysOss.model.SysOss; |
| | | import com.example.server.teamGroup.service.SysTeamGroupClassService; |
| | | import com.example.server.user.model.SysUser; |
| | | import com.example.server.utils.CacheUtils; |
| | | import com.mxgraph.swing.mxGraphComponent; |
| | | import com.mxgraph.view.mxGraph; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | public class TrackRecordAddOrUpdate { |
| | | @Autowired |
| | | private DjJdgzTrackRecordService djJdgzTrackRecordService; |
| | | @Autowired |
| | | private DjJdgzNetworkLevel3Service djJdgzNetworkLevel3Service; |
| | | @Autowired |
| | | private TrackRecordManageService trackRecordManageService; |
| | | @Autowired |
| | |
| | | saveButton.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | SysUser user = (SysUser) CacheUtils.get("user", "user"); |
| | | DjJdgzNetworkLevel3 level3 = djJdgzNetworkLevel3Service.get(data.getLevel3NetworkId()); |
| | | if (user.getTeamgroup()!=null && !user.getTeamgroup().equals(level3.getTeamgroupId())){ |
| | | JOptionPane.showMessageDialog(null, "ä¸å¯æä½å
¶ä»ä¸ä¸æ°æ®", "æç¤º", JOptionPane.WARNING_MESSAGE); |
| | | return; |
| | | } |
| | | |
| | | JComboBoxItem trackMethod = (JComboBoxItem) comboBox0.getSelectedItem(); |
| | | JComboBoxItem currentStatus = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem hasDelayRisk = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | |
| | | columnDto.add(new ColumnDto("æ»æ¿ä¿®åä½", "generalRepair", 180, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("åæ¿ä¿®åä½", "repair", 180, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("è·è¸ªè®°å½", "", 100, "", true, buttonList, null)); |
| | | columnDto.add(new ColumnDto("åå²è®°å½", "trackNum", 50, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("åå²è®°å½", "trackNum", 100, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("宿æ¶é´", "actualCompletion", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("éä»¶", "fileName", 200, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("夿³¨", "remark", 120, null, false, null, null)); |
| | |
| | | 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(width - 20, height - 120)); |
| | | scrollPane.setPreferredSize(new Dimension(width - 20, height - 130)); |
| | | centerJpanel.add(scrollPane); |
| | | |
| | | return panel; |
| | |
| | | passWord.setText(data.getPassword()); |
| | | } |
| | | |
| | | JLabel JLabel3 = new JLabel("æå±Té"); |
| | | /* JLabel JLabel3 = new JLabel("æå±Té"); |
| | | JComboBox<JComboBoxItem> comboBox = new JComboBox<>(boatList); |
| | | if(StringUtils.isNotBlank(data.getBoatfleet())){ |
| | | comboBox.setSelectedItem(BoxIteUtils.GetSelectItemById(boatList, data.getBoatFleetId())); |
| | | } |
| | | |
| | | */ |
| | | JLabel JLabel4 = new JLabel("æå±é¨é¨"); |
| | | JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(deptList); |
| | | if(StringUtils.isNotBlank(data.getDept())){ |
| | |
| | | frame1.add(JLabel2, new GBC(0, 2, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(passWord, new GBC(1, 2, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel3, new GBC(0, 3, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | /*frame1.add(JLabel3, new GBC(0, 3, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox, new GBC(1, 3, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | */ |
| | | frame1.add(JLabel4, new GBC(0, 3, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox1, new GBC(1, 3, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel4, new GBC(0, 4, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox1, new GBC(1, 4, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | frame1.add(JLabel5, new GBC(0, 4, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox2, new GBC(1, 4, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(JLabel5, new GBC(0, 5, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); |
| | | frame1.add(comboBox2, new GBC(1, 5, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); |
| | | |
| | | frame1.add(saveButton, new GBC(0, 6, 1, 1).setWeight(0, 0)); |
| | | frame1.add(saveButton, new GBC(0, 5, 1, 1).setWeight(0, 0)); |
| | | |
| | | saveButton.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | JComboBoxItem boat = (JComboBoxItem) comboBox.getSelectedItem(); |
| | | JComboBoxItem dept = (JComboBoxItem) comboBox1.getSelectedItem(); |
| | | JComboBoxItem team = (JComboBoxItem) comboBox2.getSelectedItem(); |
| | | |
| | | data.setDept(String.valueOf(dept.getId())); |
| | | data.setTeamgroup(String.valueOf(team.getId())); |
| | | data.setBoatfleet(String.valueOf(boat.getId())); |
| | | //data.setBoatfleet(String.valueOf(boat.getId())); |
| | | data.setUsername(userName.getText()); |
| | | data.setNickName(nickName.getText()); |
| | | data.setPassword(passWord.getText()); |
| | |
| | | |
| | | columnDto = new ArrayList<>(); |
| | | //columnDto.add(new ColumnDto("ID", "id", -1, null,false)); |
| | | columnDto.add(new ColumnDto("åºå·", "", (width - 10) / 8, "autoCreate", false, null,null)); |
| | | columnDto.add(new ColumnDto("ç¨æ·å", "username", (width - 10) / 8, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("æµç§°", "nickName", (width - 10) / 8, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("å¯ç ", "password", (width - 10) / 8, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("æå±Té", "boatFleetId", (width - 10) / 8, "dict", true, null,boatList)); |
| | | columnDto.add(new ColumnDto("æå±é¨é¨", "deptId", (width - 10) / 8, "dict", true, null,deptList)); |
| | | columnDto.add(new ColumnDto("æå±ä¸ä¸", "teamgroupId", (width - 10) / 8, "dict", true, null,teamList)); |
| | | columnDto.add(new ColumnDto("æä½", "", (width - 10) / 8, "", true, buttonList,null)); |
| | | columnDto.add(new ColumnDto("åºå·", "", (width - 10) / 7, "autoCreate", false, null,null)); |
| | | columnDto.add(new ColumnDto("ç¨æ·å", "username", (width - 10) / 7, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("æµç§°", "nickName", (width - 10) / 7, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("å¯ç ", "password", (width - 10) / 7, null, false, null,null)); |
| | | //columnDto.add(new ColumnDto("æå±Té", "boatFleetId", (width - 10) / 8, "dict", true, null,boatList)); |
| | | columnDto.add(new ColumnDto("æå±é¨é¨", "deptId", (width - 10) / 7, "dict", true, null,deptList)); |
| | | columnDto.add(new ColumnDto("æå±ä¸ä¸", "teamgroupId", (width - 10) / 7, "dict", true, null,teamList)); |
| | | columnDto.add(new ColumnDto("æä½", "", (width - 10) / 7, "", true, buttonList,null)); |
| | | |
| | | table = CommonTable.createCommonTable(list, columnDto); |
| | | table.setRowHeight(25); |
| | |
| | | } |
| | | }; |
| | | table.setModel(dataModel); |
| | | setColumnType(dtoList,table); |
| | | setColumnType(dtoList, table); |
| | | |
| | | return table; |
| | | } |
| | |
| | | table.getColumnModel().getColumn(j).setCellRenderer(new CellComboBoxRenderer(itemMap)); |
| | | table.getColumnModel().getColumn(j).setCellEditor(new CellComboBoxEditor(comboBox, itemMap)); |
| | | } |
| | | if ("dicts".equals(dtoList.get(j).getColumnType())) { |
| | | Map<Long, JComboBoxItem> itemMap = new HashMap<>(); |
| | | JComboBoxItem[] dictList = dtoList.get(j).getDictList(); |
| | | for (JComboBoxItem item : dictList) { |
| | | itemMap.put(item.getId(), item); |
| | | } |
| | | |
| | | // å建 JComboBox å¹¶æ·»å Item 对象 |
| | | JComboBox<JComboBoxItem> comboBox = new JComboBox<>(dictList); |
| | | |
| | | // 设置èªå®ä¹æ¸²æå¨ |
| | | comboBox.setRenderer(new BasicComboBoxRenderer() { |
| | | @Override |
| | | public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
| | | super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
| | | if (value instanceof JComboBoxItem) { |
| | | JComboBoxItem item = (JComboBoxItem) value; |
| | | setText(item.getName()); // æ¾ç¤º name |
| | | } |
| | | return this; |
| | | } |
| | | }); |
| | | table.getColumnModel().getColumn(j).setCellRenderer(new CellComboBoxRenderer(itemMap)); |
| | | table.getColumnModel().getColumn(j).setCellEditor(new CellComboBoxEditor(comboBox, itemMap)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void refreshTable(List<?> list, List<ColumnDto> dtoList, JTable table) { |
| | | TableModel dataModel = createCommonTableModel(list, dtoList); |
| | | table.setModel(dataModel); |
| | | setColumnType(dtoList,table); |
| | | setColumnType(dtoList, table); |
| | | } |
| | | |
| | | public static TableModel createCommonTableModel(List<?> list, List<ColumnDto> dtoList) { |
| | | public static String[][] getRowData(List<?> list, List<ColumnDto> dtoList) { |
| | | String[][] rowData = new String[list.size()][dtoList.size()]; |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | |
| | | rowData[i][j] = valueStr; |
| | | } else if (dtoList.get(j).getColumnType().equals("dict")) { |
| | | rowData[i][j] = valueStr; |
| | | } else if (dtoList.get(j).getColumnType().equals("dicts")) { |
| | | rowData[i][j] = valueStr; |
| | | } else if (dtoList.get(j).getColumnType().equals("autoCreate")) { |
| | | rowData[i][j] = "" + (i + 1); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | return rowData; |
| | | } |
| | | |
| | | public static TableModel createCommonTableModel(List<?> list, List<ColumnDto> dtoList) { |
| | | String[][] rowData = getRowData(list, dtoList); |
| | | String[] columnNames = new String[dtoList.size()]; |
| | | for (int j = 0; j < dtoList.size(); j++) { |
| | | columnNames[j] = dtoList.get(j).getColumnDesc(); |
| | |
| | | public final static Object mergeCellX = "mergeCellX";//æ è¯åå
æ ¼æ¯å¦è¦è¢«æ¨ªååå¹¶ |
| | | public final static Object mergeCellY = "mergeCellY";//æ è¯åå
æ ¼æ¯å¦è¦è¢«çºµååå¹¶ |
| | | |
| | | public ComplexTable(Object[][] headerRows, Object[][] body) { |
| | | super(new DefaultTableModel(body, headerRows[0])); |
| | | public ComplexTable(Object[][] headerRows, Object[][] body,Integer width) { |
| | | super(new DefaultTableModel(body, headerRows[1])); |
| | | // super( 0 , headerRows[0].length ); |
| | | this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | this.setEnabled(false); |
| | | |
| | | //设置tableå
容å±
ä¸ |
| | | DefaultTableCellRenderer tcr = new DefaultTableCellRenderer(); |
| | | tcr.setHorizontalAlignment(JLabel.CENTER);// è¿å¥åä¸å¥ä½ç¨ä¸æ · |
| | | this.setDefaultRenderer(Object.class, tcr); |
| | | for (int i = 0; i < 7; i++) { |
| | | this.getColumnModel().getColumn(i).setPreferredWidth(171); |
| | | for (int i = 0; i < headerRows[1].length; i++) { |
| | | this.getColumnModel().getColumn(i).setPreferredWidth(width); |
| | | } |
| | | this.setRowHeight(25); |
| | | //设置表头UI |
| | |
| | | * @author é·é |
| | | * @Date 2019å¹´5æ27æ¥ |
| | | */ |
| | | import javax.swing.*; |
| | | import javax.swing.table.TableCellRenderer; |
| | | import javax.swing.table.TableColumnModel; |
| | | import java.awt.*; |
| | | import java.awt.event.MouseEvent; |
| | | |
| | | public class ComplexTableUI extends BasicTableUI { |
| | | private Object[][] headerRows; |
| | | private Object[][] headerRows; // è¡¨å¤´æ°æ®ï¼ç¨äºå¤æåå¹¶é»è¾ |
| | | private JTable table; |
| | | private int singleRowHeight; |
| | | public ComplexTableUI(Object[][] headerRows,JTable table){ |
| | | private int singleRowHeight; // æ¯è¡çé«åº¦ |
| | | private int headerHeight; // è¡¨å¤´çæ»é«åº¦ |
| | | |
| | | public ComplexTableUI(Object[][] headerRows, JTable table) { |
| | | this.headerRows = headerRows; |
| | | this.table = table; |
| | | //è·ååè¡çé«åº¦ï¼ä¸è½ä½¿ç¨header.getHeight()è·åé«åº¦ï¼å ä¸ºæ¤æ¶è¡¨å¤´è¿æ²¡åå§å宿¯ï¼è·ååºæ¥çé«åº¦æ¯0 |
| | | this.singleRowHeight = table.getRowHeight(); |
| | | // System.out.println(table.getRowHeight()); |
| | | |
| | | JTableHeader tableHeader = table.getTableHeader(); |
| | | //设置表头ä¸å
许æå¨ ãç±äºåå¹¶äºåå
æ ¼ï¼æå¨ä¹åä¼ä¹± |
| | | tableHeader.setReorderingAllowed(false); |
| | | //设置表头æ´ä½é«åº¦ã宽度 |
| | | tableHeader.setPreferredSize(new Dimension(table.getWidth(), singleRowHeight * headerRows.length )); |
| | | this.singleRowHeight = table.getRowHeight(); // è·ååè¡é«åº¦ |
| | | this.headerHeight = singleRowHeight * headerRows.length; // 计ç®è¡¨å¤´æ»é«åº¦ |
| | | } |
| | | |
| | | /** |
| | | * éåBasicTableHeaderUI.paintçæ¹æ³æ¯æéè¦çé¨å |
| | | */ |
| | | @Override |
| | | public void installUI(JComponent c) { |
| | | super.installUI(c); |
| | | // ç¦ç¨åçæå¨ï¼å 为åå¹¶åå
æ ¼å¯è½å¯¼è´å¸å±æ··ä¹± |
| | | table.getTableHeader().setReorderingAllowed(false); |
| | | } |
| | | |
| | | @Override |
| | | public void paint(Graphics g, JComponent c) { |
| | | for( int row = 0 ; row < headerRows.length ; row++ ){ |
| | | Object[] headerRow = headerRows[row]; |
| | | for( int col = 0 ; col < headerRow.length ; col++ ){ |
| | | Object cell = headerRow[col]; |
| | | //妿åå
æ ¼ä¸ºåå¹¶ç±»åå
æ ¼ãè·åå
¶ä¸æ¹æ¯Xåå¹¶ç±»åå
æ ¼ + 左边æ¯Yåå¹¶ç±»åå
æ ¼ï¼é£ä¹è¯¥åå
æ ¼ä¸éè¦å¨çªå£å±ç¤º |
| | | if( cell == ComplexTable.mergeCellX || cell == ComplexTable.mergeCellY || ( col > 0 && row > 0 && headerRow[col - 1] == ComplexTable.mergeCellY && headerRows[row-1][col] == ComplexTable.mergeCellX ) ) |
| | | continue; |
| | | Rectangle rect = this.getCellRect(row, col); |
| | | String text = cell == null ? "" : cell.toString(); |
| | | super.paint(g, c); // ç»å¶é»è®¤çè¡¨æ ¼å
容 |
| | | |
| | | // éåè¡¨æ ¼ä¸»ä½çæ¯ä¸è¡åæ¯ä¸å |
| | | for (int row = 0; row < table.getRowCount(); row++) { |
| | | for (int col = 0; col < table.getColumnCount(); col++) { |
| | | if (isMergedCell(row, col)) { |
| | | continue; // è·³è¿è¢«åå¹¶çåå
æ ¼ |
| | | } |
| | | |
| | | // è·ååå
æ ¼çç»å¶åºå |
| | | Rectangle rect = getCellRect(row, col); |
| | | // è·ååå
æ ¼å
容 |
| | | Object value = table.getValueAt(row, col); |
| | | String text = value == null ? "" : value.toString(); |
| | | |
| | | // ç»å¶åå
æ ¼ |
| | | paintCell(g, rect, text); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * è·åå½ååå
æ ¼éè¦å å¤å°ä¸ªåä½ï¼æ¯å¦æ¤æ¶çrow+1è¡colåçå¼=mergeCellï¼é£ä¹è¯´æå½ååå
æ ¼éè¦å 2è¡ |
| | | * @param row |
| | | * @param col |
| | | * @return |
| | | * 夿åå
æ ¼æ¯å¦è¢«åå¹¶ |
| | | */ |
| | | private Rectangle getCellRect(int row , int col){ |
| | | int mergeRowNum = 1; |
| | | int nextRow = row; |
| | | //夿åºyè½´æ¹ååå¹¶äºå è¡ |
| | | while( ++nextRow < headerRows.length ){ |
| | | Object nextRowCell = headerRows[nextRow][col]; |
| | | if( nextRowCell == ComplexTable.mergeCellY ) |
| | | mergeRowNum++; |
| | | else |
| | | break; |
| | | } |
| | | int mergeCellNum = 1; |
| | | int nextCol = col; |
| | | Object[] headerRow = headerRows[row]; |
| | | //夿xè½´æ¹ååå¹¶äºå å |
| | | while( ++nextCol < headerRow.length ){ |
| | | Object nextCell = headerRow[nextCol]; |
| | | if( nextCell == ComplexTable.mergeCellX ) |
| | | mergeCellNum++; |
| | | else |
| | | break; |
| | | private boolean isMergedCell(int row, int col) { |
| | | // 示ä¾ï¼å设åå¹¶é»è¾åºäºè¡¨æ ¼ä¸»ä½æ°æ® |
| | | Object cellValue = table.getValueAt(row, col); |
| | | return cellValue == ComplexTable.mergeCellX || cellValue == ComplexTable.mergeCellY; |
| | | } |
| | | |
| | | /** |
| | | * è·ååå
æ ¼çç»å¶åºå |
| | | */ |
| | | private Rectangle getCellRect(int row, int col) { |
| | | // è·åé»è®¤åå
æ ¼åºå |
| | | Rectangle rect = table.getCellRect(row, col, false); |
| | | |
| | | // è°æ´ y åæ ï¼èè表头é«åº¦ |
| | | rect.y += headerHeight; |
| | | |
| | | // 妿éè¦åå¹¶åå
æ ¼ï¼è°æ´åºåå¤§å° |
| | | if (isMergedCell(row, col)) { |
| | | int mergeRowNum = getMergeRowNum(row, col); |
| | | int mergeColNum = getMergeColNum(row, col); |
| | | rect.height = getCellHeight(mergeRowNum); |
| | | rect.width = getCellWidth(col, mergeColNum); |
| | | } |
| | | |
| | | //å¾å°ä¸ä¸ªåå
æ ¼ï¼èµ·ç¹åæ ã宽度ãé«åº¦ |
| | | Rectangle rect = new Rectangle(); |
| | | rect.height = this.getCellHeight(mergeRowNum); |
| | | rect.width = this.getCellWidth( col , mergeCellNum); |
| | | rect.y = this.getCellY(row); |
| | | rect.x = this.getCellX( col ); |
| | | return rect; |
| | | } |
| | | |
| | | //æ ¹æ®åå¹¶è¡æ°å¾å°åå
æ ¼çé«åº¦ |
| | | private int getCellHeight( int mergeRowNum ){ |
| | | int height = 0; |
| | | for( int i = 0 ; i < mergeRowNum ; i++ ) |
| | | height += singleRowHeight; |
| | | return height; |
| | | } |
| | | //æ ¹æ®åå¹¶åæ°å¾å°åå
æ ¼å®½åº¦ |
| | | private int getCellWidth( int column , int mergeCellNum ){ |
| | | int width = 0; |
| | | TableColumnModel colModel = table.getColumnModel(); |
| | | for( int i = 0 ; i < mergeCellNum ; i++ ){ |
| | | width += colModel.getColumn( column + i ).getWidth(); |
| | | /** |
| | | * è·ååå¹¶çè¡æ° |
| | | */ |
| | | private int getMergeRowNum(int row, int col) { |
| | | int mergeRowNum = 1; |
| | | for (int nextRow = row + 1; nextRow < table.getRowCount(); nextRow++) { |
| | | Object nextRowCell = table.getValueAt(nextRow, col); |
| | | if (nextRowCell == ComplexTable.mergeCellY) { |
| | | mergeRowNum++; |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | return width; |
| | | } |
| | | //æ ¹æ®åå
æ ¼æå¨åå¾å°xè½´åæ |
| | | private int getCellX( int column ){ |
| | | int width = 0; |
| | | TableColumnModel colModel = table.getColumnModel(); |
| | | for( int i = 0 ; i < column ; i++ ){ |
| | | width += colModel.getColumn( i ).getWidth(); |
| | | } |
| | | return width; |
| | | } |
| | | //æ ¹æ®åå
æ ¼æå¨è¡å¾å°yè½´åæ |
| | | private int getCellY( int row ){ |
| | | int height = 0; |
| | | for( int i = 0 ; i < row ; i++ ){ |
| | | height += singleRowHeight; |
| | | } |
| | | return height; |
| | | return mergeRowNum; |
| | | } |
| | | |
| | | //å¾å°å
·ææå®ææ¬çæ ç¾ |
| | | private JLabel getComponent(String text){ |
| | | /** |
| | | * è·ååå¹¶çåæ° |
| | | */ |
| | | private int getMergeColNum(int row, int col) { |
| | | int mergeColNum = 1; |
| | | for (int nextCol = col + 1; nextCol < table.getColumnCount(); nextCol++) { |
| | | Object nextCell = table.getValueAt(row, nextCol); |
| | | if (nextCell == ComplexTable.mergeCellX) { |
| | | mergeColNum++; |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | return mergeColNum; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå¹¶è¡æ°è®¡ç®åå
æ ¼é«åº¦ |
| | | */ |
| | | private int getCellHeight(int mergeRowNum) { |
| | | return mergeRowNum * singleRowHeight; |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åå¹¶åæ°è®¡ç®åå
æ ¼å®½åº¦ |
| | | */ |
| | | private int getCellWidth(int col, int mergeColNum) { |
| | | TableColumnModel colModel = table.getColumnModel(); |
| | | int width = 0; |
| | | for (int i = 0; i < mergeColNum; i++) { |
| | | width += colModel.getColumn(col + i).getWidth(); |
| | | } |
| | | return width; |
| | | } |
| | | |
| | | /** |
| | | * ç»å¶åå
æ ¼ |
| | | */ |
| | | private void paintCell(Graphics g, Rectangle rect, String text) { |
| | | Component component = getComponent(text); |
| | | rendererPane.paintComponent(g, component, table, rect.x, rect.y, |
| | | rect.width, rect.height, true); |
| | | } |
| | | |
| | | /** |
| | | * å建ç¨äºç»å¶çç»ä»¶ |
| | | */ |
| | | private JLabel getComponent(String text) { |
| | | JLabel label = new JLabel(text, JLabel.CENTER); |
| | | Font font = new Font("å®ä½", Font.BOLD, 23); |
| | | Font font = new Font("å®ä½", Font.PLAIN, 16); |
| | | label.setFont(font); |
| | | label.setBorder(UIManager.getBorder("TableHeader.cellBorder")); |
| | | label.setBorder(UIManager.getBorder("Table.cellBorder")); |
| | | return label; |
| | | } |
| | | |
| | | private void paintCell(Graphics g, Rectangle cellRect , String text) { |
| | | Component component = this.getComponent(text); |
| | | rendererPane.paintComponent(g, component, table, cellRect.x, cellRect.y, |
| | | cellRect.width, cellRect.height, true); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | syncTable("dj_jdgz_network_level3_list"); |
| | | syncTable("dj_jdgz_track_record"); |
| | | syncTable("dj_sys_oss"); |
| | | syncTable("dj_jdgz_dismant_track"); |
| | | } else if ("TD".equals(mySite)) { |
| | | if ("TD".equals(otherSite)) { |
| | | syncTable("dj_jdgz_network_level3"); |
| | | syncTable("dj_jdgz_network_level3_list"); |
| | | syncTable("dj_jdgz_track_record"); |
| | | syncTable("dj_sys_oss"); |
| | | syncTable("dj_jdgz_dismant_track"); |
| | | } else if ("å·¥ä½ç»".equals(otherSite)) { |
| | | syncTable("dj_jdgz_handover"); |
| | | syncTable("dj_jdgz_network_level1"); |
| | |
| | | syncTable("dj_jdgz_network_level3_list"); |
| | | syncTable("dj_jdgz_track_record"); |
| | | syncTable("dj_sys_oss"); |
| | | syncTable("dj_jdgz_dismant_track"); |
| | | } |
| | | } else if ("åå®¶".equals(mySite)) { |
| | | syncTable("dj_jdgz_handover"); |
| | |
| | | syncTable("dj_jdgz_network_level3_list"); |
| | | syncTable("dj_jdgz_track_record"); |
| | | syncTable("dj_sys_oss"); |
| | | syncTable("dj_jdgz_dismant_track"); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.example.client.entity.PlatformEntity; |
| | | import com.example.client.entity.PlatformLogEntity; |
| | | import com.example.client.entity.TenantEntity; |
| | | import com.example.server.progressTrack.model.TeamEntity; |
| | | import com.example.server.user.model.SysUser; |
| | | import com.example.server.utils.CacheUtils; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | // å°å½åæ¥ææ ¼å¼å为å符串 |
| | | String date = currentDate.format(formatter); |
| | | |
| | | if (object instanceof TeamEntity) { |
| | | TeamEntity entity = (TeamEntity) object; |
| | | entity.setCreateTeam(user.getBoatfleet());// å建è
|
| | | entity.setUpdateTeam(user.getBoatfleet());// å建è
|
| | | } |
| | | |
| | | if (object instanceof PlatformLogEntity) { |
| | | PlatformLogEntity entity = (PlatformLogEntity) object; |
| | |
| | | entity.setUpdateDate(date);// æ´æ°æ¶é´ |
| | | } |
| | | |
| | | if (object instanceof TeamEntity) { |
| | | TeamEntity entity = (TeamEntity) object; |
| | | entity.setUpdateTeam(user.getBoatfleet());// å建è
|
| | | } |
| | | } |
| | | |
| | | private boolean isEmpty(Long value) { |
New file |
| | |
| | | package com.example.server.progressTrack.Dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author 14539 |
| | | */ |
| | | @Data |
| | | public class StatistDismantDto { |
| | | private String name; |
| | | private Integer sbsl; |
| | | private Integer zbjsl; |
| | | private Integer zbjcxsl; |
| | | private Integer sbcxsl; |
| | | private Integer dismantsl; |
| | | private Integer exitsl; |
| | | private Integer returnsl; |
| | | private Integer warehousesl; |
| | | } |
| | |
| | | |
| | | |
| | | import com.example.server.dao.BaseDao; |
| | | import com.example.server.progressTrack.Dto.StatistDismantDto; |
| | | import com.example.server.progressTrack.model.DjJdgzDismantTrack; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | |
| | | |
| | | |
| | | List<DjJdgzDismantTrack> getList(Long level3Id, Long cabinId); |
| | | |
| | | void deleteByName(String name); |
| | | |
| | | List<DjJdgzDismantTrack> getdata(Long deptId, Long teamGroupId, Long level1NetworkId, Long level3NetworkId, Integer status); |
| | | |
| | | List<StatistDismantDto> getStatist(Long level1Id); |
| | | } |
| | |
| | | import com.example.server.dao.BaseDao; |
| | | import com.example.server.progressTrack.Dto.DiagramMajorDto; |
| | | import com.example.server.progressTrack.Dto.DiagramNode2Dto; |
| | | import com.example.server.progressTrack.Dto.DiagramNodeDto; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel2List; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | |
| | | |
| | | List<DjJdgzNetworkLevel2List> getByLevel1Node(Long level1NodeId); |
| | | |
| | | List<DiagramNode2Dto> getNodeList(Long networkId); |
| | | List<DiagramNodeDto> getNodeList(Long networkId); |
| | | |
| | | List<DiagramMajorDto> getMajorList(Long networkId); |
| | | |
| | |
| | | @Mapper |
| | | public interface DjJdgzNetworkLevel3Dao extends BaseDao<DjJdgzNetworkLevel3> { |
| | | |
| | | List<DjJdgzNetworkLevel3> getList(Long shipId); |
| | | List<DjJdgzNetworkLevel3> getList(Long shipId, Long deptId, Long teamId, Long cabinId, String type,String name); |
| | | List<NetworkNodeStatusDto> getNodeStatusData(Long id); |
| | | |
| | | void deleteLevel3(Long id); |
| | |
| | | JComboBoxItem[] getListByLevel1(Long level1NetworkId); |
| | | |
| | | void deleteByTeamGroup(Long teamGroupId, String name); |
| | | |
| | | JComboBoxItem[] getListByExport(Long projectId, Long deptId, Long teamId); |
| | | } |
| | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | @TableName("dj_jdgz_dismant_track") |
| | | public class DjJdgzDismantTrack extends PlatformEntity { |
| | | public class DjJdgzDismantTrack extends TeamEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "ä¸çº§ç½ç»å¾ID") |
| | |
| | | @ApiModelProperty(value = "å
¥åºäººå") |
| | | private String warehouseStaff; |
| | | |
| | | @ApiModelProperty(value = "å
¥åºä½ç½®") |
| | | @ApiModelProperty(value = "å½åä½ç½®") |
| | | private String currentLocation; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ") |
| | | private Integer status; |
| | | |
| | | @TableField(exist = false) |
| | | private String cabinName; |
| | | |
| | | @TableField(exist = false) |
| | | private String deptName; |
| | | @TableField(exist = false) |
| | | private String teamGroupName; |
| | | @TableField(exist = false) |
| | | private String Level1NodeName; |
| | | @TableField(exist = false) |
| | | private String Level2NodeName; |
| | | @TableField(exist = false) |
| | | private String Level3NetworkName; |
| | | |
| | | @TableField(exist = false) |
| | | private Long deptId; |
| | |
| | | @TableField(exist = false) |
| | | private Long teamgroupId; |
| | | |
| | | @TableField(exist = false) |
| | | private String currStatus; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "ç½ç»å¾ID") |
| | | private Long networkId; |
| | | |
| | | @ApiModelProperty(value = "å·¥ç¨ä¸ä¸ID") |
| | | private Long majorId; |
| | | |
| | | @ApiModelProperty(value = "å·¥ç¨ä¸ä¸åç§°") |
| | | private String majorName; |
| | | |
| | | @ApiModelProperty(value = "è¿ç¨åç§°") |
| | | private String processName; |
| | | |
| | |
| | | @Data |
| | | @EqualsAndHashCode(callSuper=false) |
| | | @TableName("dj_jdgz_track_record") |
| | | public class DjJdgzTrackRecord extends BusiEntity { |
| | | public class DjJdgzTrackRecord extends TeamEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "ä¸çº§ç½ç»å¾ID") |
New file |
| | |
| | | package com.example.server.progressTrack.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.example.client.entity.CompanyEntity; |
| | | import com.example.client.entity.IBusiLevel; |
| | | import com.example.server.entity.BusiEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * ä¸å¡ç±»ï¼å°é¨é¨å±çº§ |
| | | */ |
| | | @Data |
| | | public class TeamEntity extends BusiEntity { |
| | | |
| | | @ApiModelProperty(value = "æ´æ°Té") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String updateTeam; |
| | | |
| | | @ApiModelProperty(value = "å建Té") |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private String createTeam; |
| | | } |
| | |
| | | package com.example.server.progressTrack.service; |
| | | |
| | | import com.example.client.dto.ColumnDto; |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.service.BaseService; |
| | | import com.example.client.utils.UUIDUtil; |
| | | 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.StatistDismantDto; |
| | | import com.example.server.progressTrack.dao.DjJdgzDismantTrackDao; |
| | | import com.example.server.progressTrack.dao.DjJdgzHandoverDao; |
| | | import com.example.server.progressTrack.model.DjJdgzDismantTrack; |
| | | import com.example.server.progressTrack.model.DjJdgzHandover; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | | import com.example.server.progressTrack.model.DjJdgzTrackRecord; |
| | | import com.example.server.utils.FileUtils; |
| | | import com.example.server.utils.ImportUtil; |
| | | import com.example.server.utils.TreeFieldUtils; |
| | | 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; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * dj_jdgz_track_record |
| | | * |
| | | * @author zt generator |
| | | * @author zt generator |
| | | * @since 1.0.0 2024-12-17 |
| | | */ |
| | | @Service |
| | | public class DjJdgzDismantTrackService extends BaseService<DjJdgzDismantTrackDao, DjJdgzDismantTrack> { |
| | | @Autowired |
| | | DjJdgzNetworkLevel3Service djJdgzNetworkLevel3Service; |
| | | @Autowired |
| | | CabinService cabinService; |
| | | |
| | | public List<DjJdgzDismantTrack> getList(Long level3Id, Long cabinId) { |
| | | return baseDao.getList(level3Id,cabinId); |
| | | return baseDao.getList(level3Id, cabinId); |
| | | } |
| | | |
| | | public void save(List<DjJdgzDismantTrack> list) { |
| | | for (DjJdgzDismantTrack data : list) { |
| | | if (data.getId() != null) { |
| | | this.update(data); |
| | | } else { |
| | | this.insert(data); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | public String importExcel(String path) { |
| | | String result = "true"; |
| | | Integer sum = 0; // æ»å
±çæ¡æ° |
| | | Integer suc = 0; // æåçæ¡æ° |
| | | Integer err = 0; // å¤±è´¥çæ¡æ° |
| | | Map<String, Object> errMap = new HashMap<>(); |
| | | MultipartFile mutFile = null; |
| | | try { |
| | | mutFile = FileUtils.convertFileToMultipartFile(path); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | String sheetName = null; |
| | | int row1 = 0; |
| | | try { |
| | | // è·å导å
¥æä»¶çåç¼å |
| | | String fileName = mutFile.getOriginalFilename(); |
| | | Workbook workbook = null; |
| | | //è§£å³excelçæ¬é®é¢ |
| | | if (fileName != null && fileName.endsWith(".xls")) { |
| | | workbook = new HSSFWorkbook(mutFile.getInputStream()); |
| | | } else if (fileName != null && fileName.endsWith(".xlsx")) { |
| | | workbook = new XSSFWorkbook(mutFile.getInputStream()); |
| | | } |
| | | assert workbook != null; //æè¨å¦æ[boolean表达å¼]为trueï¼åç¨åºç»§ç»æ§è¡ã å¦æä¸ºfalseï¼åç¨åºæåºAssertionErrorï¼å¹¶ç»æ¢æ§è¡ã |
| | | |
| | | Sheet sheet = workbook.getSheetAt(0); |
| | | int num = sheet.getLastRowNum(); // ä¸å
±æå¤å°è¡ |
| | | sheetName = sheet.getSheetName(); //è·åå½åsheetåç§° |
| | | sum = sum + num; |
| | | |
| | | List<DjJdgzNetworkLevel3> list = djJdgzNetworkLevel3Service.getList(null, null, null, null, null,null); |
| | | JComboBoxItem[] list1 = cabinService.getList(); |
| | | |
| | | |
| | | Map<String, Long> level3Map = new HashMap<>(); |
| | | Map<String, Long> cabinMap = new HashMap<>(); |
| | | Map<String, Integer> statusMap = new HashMap<>(); |
| | | statusMap.put("è¿è¡ä¸",0); |
| | | statusMap.put("已宿",1); |
| | | |
| | | for (DjJdgzNetworkLevel3 level3 : list) { |
| | | level3Map.put(level3.getName(), level3.getId()); |
| | | } |
| | | for (JComboBoxItem item : list1) { |
| | | cabinMap.put(item.getName(), item.getId()); |
| | | } |
| | | |
| | | String curSbName = ""; |
| | | Long curSbId = null; |
| | | |
| | | for (int j = 1; j <= num; j++) { |
| | | DjJdgzDismantTrack data = new DjJdgzDismantTrack(); |
| | | |
| | | boolean isErr = false; |
| | | row1 = j + 1; |
| | | String pattern = "yyyy-MM-dd"; |
| | | Row row = sheet.getRow(j); |
| | | |
| | | String sbName = ImportUtil.getCellValue(row, 0, pattern); |
| | | String name = ImportUtil.getCellValue(row, 1, pattern); |
| | | String cabin = ImportUtil.getCellValue(row, 2, pattern); |
| | | String cxTime = ImportUtil.getCellValue(row, 3, pattern); |
| | | String cxUnit = ImportUtil.getCellValue(row, 4, pattern); |
| | | String cxStaff = ImportUtil.getCellValue(row, 5, pattern); |
| | | String cxAssis = ImportUtil.getCellValue(row, 6, pattern); |
| | | String ccTime = ImportUtil.getCellValue(row, 7, pattern); |
| | | String ccUnit = ImportUtil.getCellValue(row, 8, pattern); |
| | | String ccStaff = ImportUtil.getCellValue(row, 9, pattern); |
| | | String ccAssis = ImportUtil.getCellValue(row, 10, pattern); |
| | | String tzTime = ImportUtil.getCellValue(row, 11, pattern); |
| | | String czr = ImportUtil.getCellValue(row, 12, pattern); |
| | | String tzWeight = ImportUtil.getCellValue(row, 13, pattern); |
| | | String tzAssis = ImportUtil.getCellValue(row, 14, pattern); |
| | | String rkTime = ImportUtil.getCellValue(row, 15, pattern); |
| | | String rkStaff = ImportUtil.getCellValue(row, 16, pattern); |
| | | String local = ImportUtil.getCellValue(row, 17, pattern); |
| | | String statusStr = ImportUtil.getCellValue(row, 18, pattern); |
| | | |
| | | if (StringUtils.isBlank(sbName)) { |
| | | if (StringUtils.isBlank(curSbName)) { |
| | | result = "第" + j + "è¡" + "设å¤ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | } else { |
| | | sbName = curSbName; |
| | | curSbId = level3Map.get(sbName); |
| | | } |
| | | } else { |
| | | if (StringUtils.isBlank(curSbName) || !sbName.equals(curSbName)) { |
| | | curSbName = sbName; |
| | | if (level3Map.get(curSbName) == null) { |
| | | result = "第" + j + "è¡" + "设å¤ä¸åå¨"; |
| | | isErr = true; |
| | | } else { |
| | | curSbId = level3Map.get(curSbName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | Long id = UUIDUtil.generateId(); |
| | | if (StringUtils.isEmpty(name)) { |
| | | result = "第" + j + "è¡" + "åé¨ä»¶åç§°ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | } else { |
| | | data.setId(id); |
| | | data.setName(name); |
| | | data.setLevel3NetworkId(curSbId); |
| | | baseDao.deleteByName(name); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(cabin)) { |
| | | result = "第" + j + "è¡" + "è±å®¤ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | } else { |
| | | if (cabinMap.get(cabin) == null) { |
| | | result = "第" + j + "è¡" + "è±å®¤ä¸åå¨"; |
| | | isErr = true; |
| | | } else { |
| | | Long cabinId = cabinMap.get(cabin); |
| | | data.setCabinId(cabinId); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(cxTime)) { |
| | | if (cxTime.matches("[0-9/]+")) { |
| | | cxTime = cxTime.replace("/", "-"); |
| | | data.setDismantTime(cxTime); |
| | | } else if (cxTime.matches("[0-9.]+")) { |
| | | cxTime = cxTime.replace(".", "-"); |
| | | data.setDismantTime(cxTime); |
| | | } else if (cxTime.matches("[0-9-]+")) { |
| | | data.setDismantTime(cxTime); |
| | | } else { |
| | | result = "第" + j + "è¡" + "æå¸æ¶é´æ¥ææ ¼å¼ä¸è§è"; |
| | | isErr = true; |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(cxUnit)) { |
| | | data.setDismantUnit(cxUnit); |
| | | } |
| | | if (StringUtils.isNotBlank(cxStaff)) { |
| | | data.setDismantStaff(cxStaff); |
| | | } |
| | | if (StringUtils.isNotBlank(cxAssis)) { |
| | | data.setDismantAssistant(cxAssis); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(ccTime)) { |
| | | if (ccTime.matches("[0-9/]+")) { |
| | | ccTime = ccTime.replace("/", "-"); |
| | | data.setExitTime(ccTime); |
| | | } else if (ccTime.matches("[0-9.]+")) { |
| | | ccTime = ccTime.replace(".", "-"); |
| | | data.setExitTime(ccTime); |
| | | } else if (ccTime.matches("[0-9-]+")) { |
| | | data.setExitTime(ccTime); |
| | | } else { |
| | | result = "第" + j + "è¡" + "åºè±æ¶é´æ¥ææ ¼å¼ä¸è§è"; |
| | | isErr = true; |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(ccUnit)) { |
| | | data.setExitUnit(ccUnit); |
| | | } |
| | | if (StringUtils.isNotBlank(ccStaff)) { |
| | | data.setExitStaff(ccStaff); |
| | | } |
| | | if (StringUtils.isNotBlank(ccAssis)) { |
| | | data.setExitAssistant(ccAssis); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(tzTime)) { |
| | | if (tzTime.matches("[0-9/]+")) { |
| | | tzTime = tzTime.replace("/", "-"); |
| | | data.setReturnWeightTime(tzTime); |
| | | } else if (tzTime.matches("[0-9.]+")) { |
| | | tzTime = tzTime.replace(".", "-"); |
| | | data.setReturnWeightTime(tzTime); |
| | | } else if (tzTime.matches("[0-9-]+")) { |
| | | data.setReturnWeightTime(tzTime); |
| | | } else { |
| | | result = "第" + j + "è¡" + "ééæ¶é´æ¥ææ ¼å¼ä¸è§è"; |
| | | isErr = true; |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(czr)) { |
| | | data.setWeigher(czr); |
| | | } |
| | | if (StringUtils.isNotBlank(tzWeight)) { |
| | | data.setReturnWeight(tzWeight); |
| | | } |
| | | if (StringUtils.isNotBlank(tzAssis)) { |
| | | data.setReturnWeightAssistant(tzAssis); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(rkTime)) { |
| | | if (rkTime.matches("[0-9/]+")) { |
| | | rkTime = rkTime.replace("/", "-"); |
| | | data.setWarehouseTime(rkTime); |
| | | } else if (rkTime.matches("[0-9.]+")) { |
| | | rkTime = rkTime.replace(".", "-"); |
| | | data.setWarehouseTime(rkTime); |
| | | } else if (rkTime.matches("[0-9-]+")) { |
| | | data.setWarehouseTime(rkTime); |
| | | } else { |
| | | result = "第" + j + "è¡" + "å
¥åºæ¶é´æ¥ææ ¼å¼ä¸è§è"; |
| | | isErr = true; |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(rkStaff)) { |
| | | data.setWarehouseStaff(rkStaff); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(local)) { |
| | | data.setCurrentLocation(local); |
| | | } |
| | | if (StringUtils.isNotBlank(statusStr)) { |
| | | data.setStatus(statusMap.get(statusStr)); |
| | | } |
| | | |
| | | if (!isErr) { |
| | | this.insert(data); |
| | | } |
| | | if (isErr) { |
| | | err++; |
| | | continue; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | result = "导å
¥" + row1 + "è¡æ°æ®æ¶æ£æµå°å¼å¸¸ï¼ä¸æå¯¼å
¥æä½ã"; |
| | | } |
| | | |
| | | suc = sum - err; |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public void exportExcel(String filePath, Long deptId, Long teamGroupId, Long level1NetworkId, Long level3NetworkId, Integer status) { |
| | | List<ExprotExcelDto> dtos = new ArrayList<>(); |
| | | |
| | | Map<Integer, String> statusMap = new HashMap<>(); |
| | | statusMap.put(0, "è¿è¡ä¸"); |
| | | statusMap.put(1, "已宿"); |
| | | |
| | | ExprotExcelDto dto = new ExprotExcelDto(); |
| | | dto.setSheetName("æå¸è¿åº¦æç»"); |
| | | List<ExcelColumnDto> columnDto = new ArrayList<>(); |
| | | |
| | | columnDto.add(new ExcelColumnDto("ä¸çº§èç¹", "Level1NodeName", 20, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("äºçº§èç¹", "Level2NodeName", 20, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("设å¤åç§°", "Level3NetworkName", 20, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("é¨é¨", "deptName", 20, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("ä¸ä¸", "teamGroupName", 20, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("è±å®¤", "cabinName", 10, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("åé¨ä»¶åç§°", "name", 25, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("æå¸æ¶é´", "dismantTime", 15, HorizontalAlignment.CENTER)); |
| | | columnDto.add(new ExcelColumnDto("æå¸åä½", "dismantUnit", 25, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("æå¸äººå", "dismantStaff", 15, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("æå¸å©ä¿®èå", "dismantAssistant", 10, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("åºè±æ¶é´", "exitTime", 10, HorizontalAlignment.CENTER)); |
| | | columnDto.add(new ExcelColumnDto("åºè±åä½", "exitUnit", 10, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("åºè±äººå", "exitStaff", 15, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("åºè±å©ä¿®èå", "exitAssistant", 20, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("ééæ¶é´", "returnWeightTime", 20, HorizontalAlignment.CENTER)); |
| | | columnDto.add(new ExcelColumnDto("ç§°éå", "weigher", 15, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("éééé", "returnWeight", 15, HorizontalAlignment.RIGHT)); |
| | | columnDto.add(new ExcelColumnDto("ééå©ä¿®èå", "returnWeightAssistant", 20, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("å
¥åºæ¶é´", "warehouseTime", 15, HorizontalAlignment.CENTER)); |
| | | columnDto.add(new ExcelColumnDto("å
¥åºäººå", "warehouseStaff", 15, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("å½ååæ¾ä½ç½®", "currentLocation", 15, HorizontalAlignment.LEFT)); |
| | | columnDto.add(new ExcelColumnDto("ç¶æ", "currStatus", 10, HorizontalAlignment.CENTER)); |
| | | |
| | | List<DjJdgzDismantTrack> list = baseDao.getdata(deptId,teamGroupId, level1NetworkId, level3NetworkId, status); |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | DjJdgzDismantTrack data = list.get(i); |
| | | |
| | | if (data.getStatus() != null) { |
| | | data.setCurrStatus(statusMap.get(data.getStatus())); |
| | | } |
| | | } |
| | | String[] filed = {"Level1NodeName", "Level2NodeName", "Level3NetworkName"}; |
| | | TreeFieldUtils.build(list, filed); |
| | | dto.setColumnDto(columnDto); |
| | | //dto.setValues(content); |
| | | dto.setDataList(list); |
| | | |
| | | |
| | | /* ExprotExcelDto dto2 = new ExprotExcelDto(); |
| | | dto2.setSheetName("èç¹æ±æ»"); |
| | | List<ExcelColumnDto> columnDto2 = new ArrayList<>(); |
| | | List<DjJdgzTrackRecord> list2 = baseDao.getSummaryData(teamgroupId, level1NetworkId, level3NetworkId, level3NodeId, status, beginDate, endDate, istq); |
| | | |
| | | |
| | | columnDto2.add(new ExcelColumnDto("ä¸çº§èç¹", "Level1NodeName", 25, HorizontalAlignment.LEFT)); |
| | | columnDto2.add(new ExcelColumnDto("äºçº§èç¹", "Level2NodeName", 25, HorizontalAlignment.LEFT)); |
| | | columnDto2.add(new ExcelColumnDto("ä¸çº§ç½ç»åç§°\n" + "ï¼è®¾å¤åç§°ï¼", "Level3NetworkName", 25, HorizontalAlignment.LEFT)); |
| | | columnDto2.add(new ExcelColumnDto("ä¸çº§èç¹", "Level3NodeName", 15, HorizontalAlignment.LEFT)); |
| | | columnDto2.add(new ExcelColumnDto("计å\n" + "宿æ¶é´", "RequiredCompletionTime", 12, HorizontalAlignment.CENTER)); |
| | | columnDto2.add(new ExcelColumnDto("æ¯å¦è±æ", "Istq", 5, HorizontalAlignment.CENTER)); |
| | | columnDto2.add(new ExcelColumnDto("è±ææ¬¡æ°", "Tqcs", 5, HorizontalAlignment.RIGHT)); |
| | | columnDto2.add(new ExcelColumnDto("æå¤§é¢è®¡\n" + "宿æ¶é´", "Maxtime", 12, HorizontalAlignment.CENTER)); |
| | | columnDto2.add(new ExcelColumnDto("æå¤§è±æå¤©æ°", "MaxDay", 10, HorizontalAlignment.RIGHT)); |
| | | columnDto2.add(new ExcelColumnDto("ææ°é¢è®¡\n" + "宿æ¶é´", "Zxtime", 12, HorizontalAlignment.CENTER)); |
| | | columnDto2.add(new ExcelColumnDto("ææ°è±æå¤©æ°", "ZxDay", 10, HorizontalAlignment.RIGHT)); |
| | | |
| | | TreeFieldUtils.build(list2, filed); |
| | | dto2.setColumnDto(columnDto2); |
| | | //dto2.setValues(content2); |
| | | dto2.setDataList(list2);*/ |
| | | |
| | | dtos.add(dto); |
| | | //dtos.add(dto2); |
| | | try { |
| | | ExcelExport.getHSSFWorkbook(filePath, dtos); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | public List<StatistDismantDto> getStatist(Long level1Id) { |
| | | return baseDao.getStatist(level1Id); |
| | | } |
| | | } |
| | |
| | | import com.example.server.major.service.SysMajorService; |
| | | import com.example.server.progressTrack.Dto.DiagramMajorDto; |
| | | import com.example.server.progressTrack.Dto.DiagramNode2Dto; |
| | | import com.example.server.progressTrack.Dto.DiagramNodeDto; |
| | | import com.example.server.progressTrack.dao.DjJdgzNetworkLevel2ListDao; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel1; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel1List; |
| | |
| | | baseDao.updateData(djJdgzNetworkLevel2List.getId(), djJdgzNetworkLevel2List.getExpireSituation()); |
| | | } |
| | | |
| | | public void save(Long networkId, JPanel jPanel, mxGraph graph) { |
| | | public void saveDiagram(Long networkId, JPanel jPanel, mxGraph graph) { |
| | | List<DiagramNodeDto> list2 = baseDao.getNodeList(networkId); |
| | | String simpleDiagram = netWorkDiagramService.createSimpleDiagram(list2); |
| | | DjJdgzNetworkLevel2 level2 = djJdgzNetworkLevel2Service.get(networkId); |
| | | DjJdgzNetworkLevel1 level1 = djJdgzNetworkLevel1Service.get(level2.getLevel1NetworkId()); |
| | | |
| | | List<DiagramMajorDto> majorList = baseDao.getMajorList(networkId); |
| | | List<DiagramNode2Dto> node2List = baseDao.getNodeList(networkId); |
| | | String simpleDiagram = netWorkDiagramService.createDiagram(majorList,node2List,level1.getStartDate(),5000,10); |
| | | |
| | | level2.setContent(simpleDiagram); |
| | | djJdgzNetworkLevel2Service.update(level2); |
| | | netWorkDiagramService.getCsDiagram(graph,simpleDiagram,null,jPanel.getWidth(),jPanel.getHeight()); |
| | |
| | | sheetName = sheet.getSheetName(); //è·åå½åsheetåç§° |
| | | sum = sum + num; |
| | | |
| | | Map<String, Long> mapMajors = new HashMap<>(); |
| | | for (int j = 1; j < num; j++) { |
| | | DjJdgzNetworkLevel2List data = new DjJdgzNetworkLevel2List(); |
| | | data.setNetworkId(projectId); |
| | |
| | | row1 = j + 1; |
| | | String pattern = "yyyy-MM-dd"; |
| | | Row row = sheet.getRow(j); |
| | | Map<String, String> mapMajor = sysMajorService.getMapMajor(false, String.valueOf(20000), null, ""); |
| | | |
| | | |
| | | String majorName = ImportUtil.getCellValue(row, 0, pattern); //å·¥ç¨ä¸ä¸ |
| | | String processName = ImportUtil.getCellValue(row, 1, pattern); // è¿ç¨åç§° |
| | | String requiredCompletionTime = ImportUtil.getCellValue(row, 2, pattern); // è¦æ±å®ææ¶é´ |
| | | |
| | | |
| | | if (StringUtils.isEmpty(majorName)) { |
| | | isErr = true; |
| | | result = "第"+j+"è¡"+"ä¸ä¸ä¸è½ä¸ºç©º"; |
| | | } else { |
| | | String majorIdStr = mapMajor.get(majorName); |
| | | if (majorIdStr == null) { |
| | | isErr = true; |
| | | result = "第"+j+"è¡"+"ä¸ä¸ä¸åå¨"; |
| | | } else { |
| | | data.setMajorId(Convert.toLong(majorIdStr)); |
| | | } |
| | | |
| | | } |
| | | data.setMajorName(majorName); |
| | | String processName = ImportUtil.getCellValue(row, 0, pattern); // è¿ç¨åç§° |
| | | String requiredCompletionTime = ImportUtil.getCellValue(row, 1, pattern); // è¦æ±å®ææ¶é´ |
| | | |
| | | if (StringUtils.isEmpty(processName)) { |
| | | isErr = true; |
| | |
| | | return baseDao.getNode(networkId); |
| | | } |
| | | |
| | | public void save(List<DjJdgzNetworkLevel2List> list, Long networkId, JPanel jPanel, mxGraph finalGraph) { |
| | | for (DjJdgzNetworkLevel2List data : list){ |
| | | data.setNetworkId(networkId); |
| | | if (data.getId()!=null){ |
| | | this.update(data); |
| | | }else{ |
| | | this.insert(data); |
| | | } |
| | | } |
| | | this.saveDiagram(networkId,jPanel,finalGraph); |
| | | } |
| | | |
| | | /* public String getDiagram(Long networkId, Date startDate, Integer diagramWidth, Integer lineNodeNum) { |
| | | List<DiagramMajorDto> majorList = baseDao.getMajorList(networkId); |
| | | List<DiagramNode2Dto> node2List = baseDao.getNodeList(networkId); |
| | |
| | | |
| | | import com.example.client.dto.JComboBoxItem; |
| | | import com.example.client.service.BaseService; |
| | | import com.example.server.cabin.service.CabinService; |
| | | import com.example.server.progressTrack.Dto.NetworkNodeStatusDto; |
| | | import com.example.server.progressTrack.dao.DjJdgzNetworkLevel3Dao; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; |
| | |
| | | DjJdgzNetworkLevel3ListService DjJdgzNetworkLevel3ListService; |
| | | @Autowired |
| | | SysTeamGroupClassService sysTeamGroupClassService; |
| | | @Autowired |
| | | CabinService cabinService; |
| | | |
| | | |
| | | @Value("${zt.oss.local-path}") |
| | | private String path; |
| | | |
| | | public List<DjJdgzNetworkLevel3> getList(Long shipId) { |
| | | List<DjJdgzNetworkLevel3> list = baseDao.getList(shipId); |
| | | 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); |
| | | return list; |
| | | } |
| | | |
| | |
| | | sum = sum + num; |
| | | |
| | | Map<Integer, String> mapProcessName = new HashMap<>(); |
| | | mapProcessName.put(1,"è®¾å¤æå¸åºè±"); |
| | | mapProcessName.put(2,"设å¤å交"); |
| | | mapProcessName.put(3,"ææ£é´å®"); |
| | | mapProcessName.put(4,"设å¤è¿å"); |
| | | mapProcessName.put(5,"åè£
"); |
| | | 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(); |
| | | JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(null); |
| | | |
| | | Map<String, Long> cabinMap = new HashMap<>(); |
| | | Map<String, Long> deptMap = new HashMap<>(); |
| | | Map<String, Long> teamMap = new HashMap<>(); |
| | | |
| | | for (JComboBoxItem item : cabinList) { |
| | | cabinMap.put(item.getName(), item.getId()); |
| | | } |
| | | for (JComboBoxItem item : deptList) { |
| | | deptMap.put(item.getName(), item.getId()); |
| | | } |
| | | for (JComboBoxItem item : teamList) { |
| | | teamMap.put(item.getName(), item.getId()); |
| | | } |
| | | |
| | | for (int j = 1; j <= num; j++) { |
| | | int sort = 0; |
| | | DjJdgzNetworkLevel3 data = new DjJdgzNetworkLevel3(); |
| | | DjJdgzNetworkLevel3List node = new DjJdgzNetworkLevel3List(); |
| | | |
| | |
| | | Row row = sheet.getRow(j); |
| | | |
| | | String name = ImportUtil.getCellValue(row, 0, pattern); |
| | | String teamGroup = ImportUtil.getCellValue(row, 1, pattern); |
| | | String time1 = ImportUtil.getCellValue(row, 2, pattern); |
| | | String time2 = ImportUtil.getCellValue(row, 3, pattern); |
| | | String time3 = ImportUtil.getCellValue(row, 4, pattern); |
| | | String time4 = ImportUtil.getCellValue(row, 5, pattern); |
| | | String time5 = ImportUtil.getCellValue(row, 6, pattern); |
| | | String repairUnit = ImportUtil.getCellValue(row, 7, pattern); |
| | | String repairUnitDirector = ImportUtil.getCellValue(row, 8, pattern); |
| | | String repairUnitContact = ImportUtil.getCellValue(row, 9, pattern); |
| | | String generalRepairUnit = ImportUtil.getCellValue(row, 10, pattern); |
| | | String generalRepairUnitDirector = ImportUtil.getCellValue(row, 11, pattern); |
| | | String generalRepairUnitContact = ImportUtil.getCellValue(row, 12, 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); |
| | | |
| | | Long id = UUIDUtil.generateId(); |
| | | if (StringUtils.isEmpty(name)) { |
| | | result = "第"+j+"è¡"+"设å¤åç§°ä¸è½ä¸ºç©º"; |
| | | result = "第" + j + "è¡" + "设å¤åç§°ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | continue; |
| | | } else { |
| | | data.setId(id); |
| | | node.setNetworkId(id); |
| | | data.setName(name); |
| | | data.setLevel1NetworkId(level1NetworkId); |
| | | data.setLevel2NetworkId(level2NetworkId); |
| | | data.setLevel2NodeId(level2NodeId); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(teamGroup)) { |
| | | result = "第"+j+"è¡"+"ä¸ä¸ä¸è½ä¸ºç©º"; |
| | | if (StringUtils.isEmpty(deptStr)) { |
| | | result = "第" + j + "è¡" + "é¨é¨ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | continue; |
| | | } else { |
| | | Long teamGroupId = Long.valueOf(mapTeamGroup.get(teamGroup)); |
| | | //å 餿°æ®åºä¸ç¸åä¸ä¸åç¸åä¸çº§ç½ç»å¾æ°æ® |
| | | baseDao.deleteByTeamGroup(teamGroupId, name); |
| | | |
| | | node.setTeamgroupId(teamGroupId); |
| | | node.setTeamgroupName(teamGroup); |
| | | node.setNetworkId(id); |
| | | if (deptMap.get(deptStr) == null) { |
| | | result = "第" + j + "è¡" + "é¨é¨ä¸åå¨"; |
| | | isErr = true; |
| | | continue; |
| | | } else { |
| | | Long deptId = deptMap.get(deptStr); |
| | | data.setDeptId(deptId); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(time1)) { |
| | | result = "第"+j+"è¡"+"第"+1+"个"+"èç¹æ¶é´ä¸è½ä¸ºç©º"; |
| | | if (StringUtils.isEmpty(teamGroupStr)) { |
| | | result = "第" + j + "è¡" + "ä¸ä¸ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | continue; |
| | | } else { |
| | | if (teamMap.get(teamGroupStr) == null) { |
| | | result = "第" + j + "è¡" + "ä¸ä¸ä¸åå¨"; |
| | | isErr = true; |
| | | continue; |
| | | } else { |
| | | Long teamId = teamMap.get(teamGroupStr); |
| | | data.setTeamgroupId(teamId); |
| | | data.setTeamgroupName(teamGroupStr); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(cabinStr)) { |
| | | result = "第" + j + "è¡" + "è±å®¤ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | continue; |
| | | } else { |
| | | String[] cabins = cabinStr.split(","); |
| | | |
| | | // ç¨äºå卿¼æ¥åç id |
| | | StringBuilder idBuilder = new StringBuilder(); |
| | | |
| | | // éåæ¯ä¸ªé® |
| | | for (String key : cabins) { |
| | | key = key.trim(); // å»é¤å¯è½çç©ºæ ¼ |
| | | Long cabinId = cabinMap.get(key); |
| | | // 妿é®å¨ Map ä¸åå¨ |
| | | if (cabinId != null) { |
| | | if (idBuilder.length() > 0) { |
| | | idBuilder.append(","); // æ·»å åé符 |
| | | } |
| | | idBuilder.append(cabinId); // æ·»å id |
| | | } else { |
| | | result = "第" + j + "è¡" + "è±å®¤ä¸åå¨"; |
| | | isErr = true; |
| | | continue; |
| | | } |
| | | } |
| | | data.setCabinId(idBuilder.toString()); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(time1)) { |
| | | if (time1.matches("[0-9/]+")) { |
| | | time1 = time1.replace("/", "-"); |
| | | node.setRequiredCompletionTime(time1); |
| | | node.setProcessName(mapProcessName.get(1)); |
| | | node.setSort(1); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time1.matches("[0-9.]+")) { |
| | | time1 = time1.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time1); |
| | | node.setProcessName(mapProcessName.get(1)); |
| | | node.setSort(1); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time1.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time1); |
| | | node.setProcessName(mapProcessName.get(1)); |
| | | node.setSort(1); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | | result = "第"+j+"è¡"+"第"+1+"个"+"èç¹æ¶é´æ¥ææ ¼å¼ä¸è§è"; |
| | | result = "第" + j + "è¡" + "第" + 1 + "个" + "èç¹æ¶é´æ¥ææ ¼å¼ä¸è§è"; |
| | | isErr = true; |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(time2)) { |
| | | result = "第"+j+"è¡"+"第"+2+"个"+"èç¹æ¶é´ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | } else { |
| | | if (node.getId()!=null){ |
| | | if (StringUtils.isNotBlank(time2)) { |
| | | if (node.getId() != null) { |
| | | node.setId(null); |
| | | } |
| | | if (time2.matches("[0-9/]+")) { |
| | | node.setRequiredCompletionTime(time2); |
| | | node.setProcessName(mapProcessName.get(2)); |
| | | node.setSort(2); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time2.matches("[0-9.]+")) { |
| | | time2 = time2.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time2); |
| | | node.setProcessName(mapProcessName.get(2)); |
| | | node.setSort(2); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time2.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time2); |
| | | node.setProcessName(mapProcessName.get(2)); |
| | | node.setSort(2); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | | result = "第"+j+"è¡"+"第"+2+"个"+"èç¹æ¶é´çæ¥ææ ¼å¼ä¸è§è"; |
| | | result = "第" + j + "è¡" + "第" + 2 + "个" + "èç¹æ¶é´çæ¥ææ ¼å¼ä¸è§è"; |
| | | isErr = true; |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(time3)) { |
| | | result = "第"+j+"è¡"+"第"+3+"个"+"èç¹æ¶é´ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | } else { |
| | | if (node.getId()!=null){ |
| | | if (StringUtils.isNotBlank(time3)) { |
| | | if (node.getId() != null) { |
| | | node.setId(null); |
| | | } |
| | | if (time3.matches("[0-9/]+")) { |
| | | time3 = time3.replace("/", "-"); |
| | | node.setRequiredCompletionTime(time3); |
| | | node.setProcessName(mapProcessName.get(3)); |
| | | node.setSort(3); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time3.matches("[0-9.]+")) { |
| | | time3 = time3.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time3); |
| | | node.setProcessName(mapProcessName.get(3)); |
| | | node.setSort(3); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time3.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time3); |
| | | node.setProcessName(mapProcessName.get(3)); |
| | | node.setSort(3); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | | result = "第"+j+"è¡"+"第"+3+"个"+"èç¹æ¶é´çæ¥ææ ¼å¼ä¸è§è"; |
| | | result = "第" + j + "è¡" + "第" + 3 + "个" + "èç¹æ¶é´çæ¥ææ ¼å¼ä¸è§è"; |
| | | isErr = true; |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(time4)) { |
| | | result = "第"+j+"è¡"+"第"+4+"个"+"èç¹æ¶é´ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | } else { |
| | | if (node.getId()!=null){ |
| | | if (StringUtils.isNotBlank(time4)) { |
| | | if (node.getId() != null) { |
| | | node.setId(null); |
| | | } |
| | | if (time4.matches("[0-9/]+")) { |
| | | time4 = time4.replace("/", "-"); |
| | | node.setRequiredCompletionTime(time4); |
| | | node.setProcessName(mapProcessName.get(4)); |
| | | node.setSort(4); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time4.matches("[0-9.]+")) { |
| | | time4 = time4.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time4); |
| | | node.setProcessName(mapProcessName.get(4)); |
| | | node.setSort(4); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time4.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time4); |
| | | node.setProcessName(mapProcessName.get(4)); |
| | | node.setSort(4); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | | result = "第"+j+"è¡"+"第"+4+"个"+"èç¹æ¶é´çæ¥ææ ¼å¼ä¸è§è"; |
| | | result = "第" + j + "è¡" + "第" + 4 + "个" + "èç¹æ¶é´çæ¥ææ ¼å¼ä¸è§è"; |
| | | isErr = true; |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(time5)) { |
| | | result = "第"+j+"è¡"+"第"+5+"个"+"èç¹æ¶é´ä¸è½ä¸ºç©º"; |
| | | isErr = true; |
| | | } else { |
| | | if (node.getId()!=null){ |
| | | if (StringUtils.isNotBlank(time5)) { |
| | | if (node.getId() != null) { |
| | | node.setId(null); |
| | | } |
| | | if (time5.matches("[0-9/]+")) { |
| | | time5 = time5.replace("/", "-"); |
| | | node.setRequiredCompletionTime(time5); |
| | | node.setProcessName(mapProcessName.get(5)); |
| | | node.setSort(5); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time5.matches("[0-9.]+")) { |
| | | time5 = time5.replace(".", "-"); |
| | | node.setRequiredCompletionTime(time5); |
| | | node.setProcessName(mapProcessName.get(5)); |
| | | node.setSort(5); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else if (time5.matches("[0-9-]+")) { |
| | | node.setRequiredCompletionTime(time5); |
| | | node.setProcessName(mapProcessName.get(5)); |
| | | node.setSort(5); |
| | | node.setSort(sort + 1); |
| | | DjJdgzNetworkLevel3ListService.insert(node); |
| | | } else { |
| | | result = "第"+j+"è¡"+"第"+5+"个"+"è¦æ±å®ææ¶é´çæ¥ææ ¼å¼ä¸è§è"; |
| | | result = "第" + j + "è¡" + "第" + 5 + "个" + "è¦æ±å®ææ¶é´çæ¥ææ ¼å¼ä¸è§è"; |
| | | isErr = true; |
| | | } |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(generalRepairUnit)){ |
| | | |
| | | if (StringUtils.isNotBlank(typeStr)) { |
| | | data.setType(typeStr); |
| | | } |
| | | if (StringUtils.isNotBlank(generalRepairUnit)) { |
| | | data.setGeneralRepairUnit(generalRepairUnit); |
| | | } |
| | | if(StringUtils.isNotBlank(generalRepairUnitContact)){ |
| | | if (StringUtils.isNotBlank(generalRepairUnitContact)) { |
| | | data.setGeneralRepairUnitContact(generalRepairUnitContact); |
| | | } |
| | | if(StringUtils.isNotBlank(generalRepairUnitDirector)){ |
| | | if (StringUtils.isNotBlank(generalRepairUnitDirector)) { |
| | | data.setGeneralRepairUnitDirector(generalRepairUnitDirector); |
| | | } |
| | | if(StringUtils.isNotBlank(generalRepairUnit)){ |
| | | if (StringUtils.isNotBlank(generalRepairUnit)) { |
| | | data.setRepairUnit(repairUnit); |
| | | } |
| | | if(StringUtils.isNotBlank(generalRepairUnit)){ |
| | | if (StringUtils.isNotBlank(generalRepairUnit)) { |
| | | data.setRepairUnitContact(repairUnitContact); |
| | | } |
| | | if(StringUtils.isNotBlank(generalRepairUnit)){ |
| | | if (StringUtils.isNotBlank(generalRepairUnit)) { |
| | | data.setRepairUnitDirector(repairUnitDirector); |
| | | } |
| | | |
| | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | result = "导å
¥"+row1+"è¡æ°æ®æ¶æ£æµå°å¼å¸¸ï¼ä¸æå¯¼å
¥æä½ã"; |
| | | result = "导å
¥" + row1 + "è¡æ°æ®æ¶æ£æµå°å¼å¸¸ï¼ä¸æå¯¼å
¥æä½ã"; |
| | | } |
| | | |
| | | suc = sum - err; |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public JComboBoxItem[] getListByExport(Long projectId, Long deptId, Long teamId) { |
| | | JComboBoxItem[] list = baseDao.getListByExport(projectId, deptId, teamId); |
| | | return list; |
| | | } |
| | | /* public void exportExcelTemplate(HttpServletResponse response, HttpServletRequest request) throws IOException { |
| | | String excelName="ä¸çº§ç½ç»å¾æ¹é模ç"; |
| | | String excelPath = path + "template/jx-model/" + excelName + ".xlsx"; //模æ¿è·¯å¾ |
| | |
| | | |
| | | public Object createInsertVertex(mxGraph graph, JSONObject jsonObject, Integer defX, Integer defY, StatusEnum status) { |
| | | Object parent = graph.getDefaultParent(); |
| | | |
| | | String shapeValue = jsonObject.get("shape").toString(); |
| | | Object graphObject = null; |
| | | switch (shapeValue) { |
| | | case "custom-circle": |
| | | case "custom-circle1": |
| | | String text = (String) JsonUtils2.getJsonValueByPath(jsonObject, "attrs/text/text".split("/")); |
| | | String title = (String) JsonUtils2.getJsonValueByPath(jsonObject, "attrs/title/text".split("/")); |
| | | //String title = (String) JsonUtils2.getJsonValueByPath(jsonObject, "attrs/title/text".split("/")); |
| | | String idValue = jsonObject.get("id").toString(); |
| | | |
| | | Integer x = (Integer) JsonUtils2.getJsonValueByPath(jsonObject, "position/x".split("/")) + defX; |
| | |
| | | JComboBoxItem[] getTeamList(Long pid); |
| | | |
| | | JComboBoxItem[] getDeptList(); |
| | | |
| | | List<SysTeamGroupClass> getListByTree(); |
| | | } |
| | |
| | | public JComboBoxItem[] getDeptList() { |
| | | return baseDao.getDeptList(); |
| | | } |
| | | |
| | | public List<SysTeamGroupClass> getListByTree() { |
| | | return baseDao.getListByTree(); |
| | | } |
| | | } |
| | |
| | | package com.example.server.utils; |
| | | |
| | | import com.example.Application; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | |
| | | import javax.swing.*; |
| | | import java.io.*; |
| | |
| | | |
| | | public class DownLoadTmpFile { |
| | | public static void down(String name,JFrame frame1){ |
| | | name = "templateFile/" + name; |
| | | InputStream inputStream = Application.class.getClassLoader().getResourceAsStream(name); |
| | | |
| | | if (inputStream == null) { |
| | |
| | | line-nodes: 10 |
| | | area-width: 5000 |
| | | configPath: config.properties |
| | | tmp-path: templateFile/ |
| | | |
| | | spring: |
| | | profiles: |
| | |
| | | userName=root |
| | | password=root |
| | | site=å·¥ä½ç» |
| | | team=1TD |
| | | teamGroup=null |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.example.server.progressTrack.dao.DjJdgzDismantTrackDao"> |
| | | <delete id="deleteByName"> |
| | | update dj_jdgz_dismant_track set is_delete=1 where name = #{name} |
| | | </delete> |
| | | |
| | | <select id="getList" resultType="com.example.server.progressTrack.model.DjJdgzDismantTrack"> |
| | | select * |
| | |
| | | and cabin_id = ${cabinId} |
| | | </if> |
| | | </select> |
| | | <select id="getdata" resultType="com.example.server.progressTrack.model.DjJdgzDismantTrack"> |
| | | SELECT |
| | | a.*, |
| | | k.name as cabinName, |
| | | h.name as teamGroupName, |
| | | b.name as deptName, |
| | | c.`NAME` as level3NetworkName, |
| | | d.PROCESS_NAME AS level2NodeName, |
| | | f.PROCESS_NAME AS level1NodeName |
| | | FROM |
| | | dj_jdgz_dismant_track a |
| | | LEFT JOIN dj_jdgz_network_level3 c ON c.id = a.LEVEL3_NETWORK_ID |
| | | LEFT JOIN dj_jdgz_network_level2_list d ON d.id = c.LEVEL2_NODE_ID |
| | | LEFT JOIN dj_jdgz_network_level2 e ON e.id = d.NETWORK_ID |
| | | LEFT JOIN dj_jdgz_network_level1_list f ON f.id = e.LEVEL1_NODE_ID |
| | | LEFT JOIN dj_jdgz_network_level1 g ON g.id = c.LEVEL1_NETWORK_ID |
| | | LEFT JOIN dj_sys_teamgroup_class h ON h.id = c.TEAMGROUP_ID |
| | | LEFT JOIN dj_sys_teamgroup_class b ON b.id = c.dept_id |
| | | LEFT JOIN cabin k ON k.id = a.cabin_id |
| | | WHERE |
| | | a.IS_DELETE = 0 |
| | | <if test="deptId!=null and deptId!=''"> |
| | | AND c.dept_id = ${deptId} |
| | | </if> |
| | | <if test="teamGroupId!=null and teamGroupId!=''"> |
| | | AND c.TEAMGROUP_ID = ${teamGroupId} |
| | | </if> |
| | | <if test="level3NetworkId!=null"> |
| | | AND a.LEVEL3_NETWORK_ID = ${level3NetworkId} |
| | | </if> |
| | | |
| | | <if test="status==1"> |
| | | AND a.CURRENT_STATUS = 1 |
| | | </if> |
| | | <if test="status==0"> |
| | | and (a.CURRENT_STATUS IS null OR a.CURRENT_STATUS = 0) |
| | | </if> |
| | | AND c.IS_DELETE = 0 |
| | | AND d.IS_DELETE = 0 |
| | | AND e.IS_DELETE = 0 |
| | | AND f.IS_DELETE = 0 |
| | | AND g.IS_DELETE = 0 |
| | | AND k.IS_DELETE = 0 |
| | | AND g.id = ${level1NetworkId} |
| | | ORDER BY |
| | | f.SORT, |
| | | d.SORT, |
| | | b.UPDATE_DATE |
| | | </select> |
| | | <select id="getStatist" resultType="com.example.server.progressTrack.Dto.StatistDismantDto"> |
| | | select a.*, |
| | | sum(case when c.status=1 then 1 else 0 end) as sbcxsl |
| | | from ( |
| | | select a.id, |
| | | case when a.pid=0 then a.NAME else ' '|| a.NAME end as name, |
| | | case when a.pid=0 then '' || a.id else ''|| a.pid || a.SORT end as sort, |
| | | count(DISTINCT b.LEVEL3_NETWORK_ID) as sbsl, |
| | | count(DISTINCT b.dismant_id) as zbjsl, |
| | | sum(case when b.status=1 then 1 else 0 end) as zbjcxsl, |
| | | sum( CASE WHEN dismant_time IS NULL THEN 0 ELSE 1 END ) AS dismantsl, |
| | | sum( CASE WHEN exit_time IS NULL THEN 0 ELSE 1 END ) AS exitsl, |
| | | sum( CASE WHEN return_weight_time IS NULL THEN 0 ELSE 1 END ) AS returnsl, |
| | | sum( CASE WHEN warehouse_time IS NULL THEN 0 ELSE 1 END ) AS warehousesl |
| | | from dj_sys_teamgroup_class a |
| | | left join ( |
| | | select a.id as id2 ,a.pid as pid2 ,c.LEVEL3_NETWORK_ID, |
| | | c.id as dismant_id,c.status, |
| | | c.dismant_time, |
| | | c.exit_time, |
| | | c.return_weight_time, |
| | | c.warehouse_time |
| | | from dj_sys_teamgroup_class a,dj_jdgz_network_level3 b,dj_jdgz_dismant_track c |
| | | where a.IS_DELETE= 0 and b.IS_DELETE = 0 and c.is_delete = 0 |
| | | and a.AREA = 'hld' |
| | | and b.TEAMGROUP_ID = a.id |
| | | and c.LEVEL3_NETWORK_ID = b.id |
| | | and b.LEVEL1_NETWORK_ID = ${level1Id} |
| | | ) b on a.id=b.id2 or a.id = b.pid2 |
| | | where a.AREA = 'hld' and a.IS_DELETE = 0 |
| | | group by a.id,a.NAME |
| | | ) a |
| | | left join ( |
| | | select a.id as id2 ,a.pid as pid2, |
| | | case when EXISTS(select 1 from dj_jdgz_dismant_track c where c.LEVEL3_NETWORK_ID=b.id |
| | | and (status=0 or status is null) and is_delete = 0) or not |
| | | EXISTS(select 1 from dj_jdgz_dismant_track c where c.LEVEL3_NETWORK_ID=b.id |
| | | and status=1 and is_delete = 0)then 0 else 1 end as status |
| | | from dj_sys_teamgroup_class a ,dj_jdgz_network_level3 b |
| | | where a.IS_DELETE= 0 and b.IS_DELETE = 0 |
| | | and a.AREA = 'hld' |
| | | and b.TEAMGROUP_ID = a.id |
| | | and b.LEVEL1_NETWORK_ID = ${level1Id} |
| | | ) c on a.id=c.id2 or a.id = c.pid2 |
| | | group by a.id,a.NAME |
| | | order by sort |
| | | </select> |
| | | </mapper> |
| | |
| | | and b.is_delete = 0 |
| | | and a.level1_node_id = ${level1NodeId} |
| | | </select> |
| | | <select id="getNodeList" resultType="com.example.server.progressTrack.Dto.DiagramNode2Dto"> |
| | | <select id="getNodeList" resultType="com.example.server.progressTrack.Dto.DiagramNodeDto"> |
| | | select a.* |
| | | from dj_jdgz_network_level2_list a |
| | | where |
| | |
| | | <if test="shipId!=null"> |
| | | and c.ship_id = ${shipId} |
| | | </if> |
| | | <if test="deptId!=null"> |
| | | and a.dept_id = ${deptId} |
| | | </if> |
| | | <if test="teamId!=null"> |
| | | and a.TEAMGROUP_ID = ${teamId} |
| | | </if> |
| | | <if test="cabinId!=null"> |
| | | and a.cabin_id LIKE '%${cabinId}%' |
| | | </if> |
| | | <if test="type!=null and type!=''"> |
| | | and a.type = #{type} |
| | | </if> |
| | | <if test="name!=null and name!=''"> |
| | | and a.name LIKE '%${name}%' |
| | | </if> |
| | | group by a.id |
| | | </select> |
| | | |
| | |
| | | where is_delete = 0 |
| | | and LEVEL1_network_id = ${level1NetworkId} |
| | | </select> |
| | | <select id="getListByExport" resultType="com.example.client.dto.JComboBoxItem"> |
| | | SELECT |
| | | a.* |
| | | FROM `dj_jdgz_network_level3` a |
| | | where |
| | | a.is_delete = 0 |
| | | <if test="projectId!=null"> |
| | | and a.LEVEL1_network_id = ${projectId} |
| | | </if> |
| | | <if test="deptId!=null"> |
| | | and a.dept_id = ${deptId} |
| | | </if> |
| | | <if test="teamId!=null"> |
| | | and a.TEAMGROUP_ID = ${teamId} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | ORDER BY |
| | | a.sort; |
| | | </select> |
| | | <select id="getListByTree" resultType="com.example.server.teamGroup.model.SysTeamGroupClass"> |
| | | SELECT |
| | | a.id, |
| | | CASE |
| | | WHEN a.pid = 0 THEN |
| | | a.NAME ELSE ' ' || a.NAME |
| | | END AS name, |
| | | CASE |
| | | |
| | | WHEN a.pid = 0 THEN |
| | | '' || a.id ELSE '' || a.pid || a.SORT |
| | | END AS sort2 |
| | | FROM |
| | | dj_sys_teamgroup_class a |
| | | WHERE |
| | | a.AREA = 'hld' |
| | | AND a.IS_DELETE = 0 |
| | | ORDER BY sort2 |
| | | </select> |
| | | </mapper> |