| | |
| | | import com.example.client.utils.CommonTable; |
| | | import com.example.client.utils.GBC; |
| | | import com.example.client.utils.WaitUtil; |
| | | import com.example.server.DataSync.dto.DataExportDto; |
| | | import com.example.server.DataSync.dto.DataImportDto; |
| | | import com.example.server.DataSync.service.DataSyncService; |
| | | import com.example.server.progressTrack.model.DjJdgzNetworkLevel2List; |
| | | import com.example.server.progressTrack.dao.ImportRecordDao; |
| | | import com.example.server.progressTrack.model.ExportRecord; |
| | | import com.example.server.progressTrack.model.ImportRecord; |
| | | import com.example.server.user.model.SysUser; |
| | | import com.example.server.utils.CacheUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | @Autowired |
| | | DataSyncService dataSyncService; |
| | | @Autowired |
| | | ImportRecordDao importRecordDao; |
| | | @Autowired |
| | | ImportDataService importDataService; |
| | | private List<ColumnDto> columnDto; |
| | | private JTable table; |
| | | |
| | | public JPanel createTable(Integer width, Integer height, JFrame jFrame) { |
| | | SysUser user = (SysUser) CacheUtils.get("user","user"); |
| | | if (user==null){ |
| | | JOptionPane.showMessageDialog(null, "用户失效请退出并重新登录", "提示", JOptionPane.WARNING_MESSAGE); |
| | | return null; |
| | | } |
| | | JPanel panel = new JPanel(new BorderLayout()); |
| | | panel.setPreferredSize(new Dimension(width-10,height)); |
| | | |
| | |
| | | JPanel center = new JPanel(); // 为 left 设置布局 |
| | | GridBagLayout layout = new GridBagLayout(); |
| | | center.setLayout(layout); |
| | | center.setPreferredSize(new Dimension((width - 10) / 2, (height-50)/2)); |
| | | center.setPreferredSize(new Dimension((width - 10) / 2, (height-50)/3)); |
| | | |
| | | JPanel south = new JPanel(new BorderLayout()); // 为 left 设置布局 |
| | | south.setPreferredSize(new Dimension((width - 10) / 2, (height-50)/2)); |
| | | south.setPreferredSize(new Dimension((width - 10) / 2, (height-50)/3*2)); |
| | | |
| | | |
| | | String site = (String) CacheUtils.get("site", "site"); |
| | |
| | | JLabel label1 = new JLabel("提示信息"); |
| | | JTextArea tips = new JTextArea(7, 30); |
| | | tips.setEnabled(false); |
| | | tips.setForeground(Color.BLACK); // 设置为黑色 |
| | | tips.setDisabledTextColor(Color.BLACK); |
| | | tips.setLineWrap(true); |
| | | south.add(label1,BorderLayout.NORTH); |
| | | south.add(tips,BorderLayout.CENTER); |
| | |
| | | SwingWorker<String, Void> sw = new SwingWorker<String, Void>() { |
| | | @Override |
| | | protected String doInBackground() throws Exception { |
| | | String flag = importDataService.UnzipFile(); |
| | | String flag = importDataService.UnzipFile(tips); |
| | | return flag; |
| | | } |
| | | |
| | |
| | | // 刷新表格数据(如果上传成功) |
| | | if (uploadSucceeded.equals("true")) { |
| | | waitUtil.dispose(); |
| | | System.out.println("导入成功时间" + new Date()); |
| | | tips.setText("导入成功"+new Date()); |
| | | } else { |
| | | waitUtil.dispose(); |
| | | tips.setText("导入失败"+new Date()); |
| | | JOptionPane.showMessageDialog(null, uploadSucceeded, "提示", JOptionPane.ERROR_MESSAGE); |
| | | } |
| | | |
| | |
| | | left.add(south,BorderLayout.SOUTH); |
| | | |
| | | JLabel label2 = new JLabel("导入记录"); |
| | | List<DataImportDto> list = new ArrayList<>(); |
| | | List<ImportRecord> list = importRecordDao.getList(); |
| | | |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | | 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("数据源", "importLocal", 200, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("导入时间", "importDate", 200, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("操作人", "importStaff", 200, null, false, null,null)); |
| | | JTable table = CommonTable.createCommonTable(list, columnDto); |
| | | columnDto.add(new ColumnDto("数据源", "importSite", 200, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("导入时间", "createDate", 200, null, false, null,null)); |
| | | columnDto.add(new ColumnDto("操作人", "userName", 200, null, false, null,null)); |
| | | table = CommonTable.createCommonTable(list, columnDto); |
| | | table.setRowHeight(25); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | |
| | | |
| | | return panel; |
| | | } |
| | | |
| | | public void refresh(List<ImportRecord> list){ |
| | | CommonTable.refreshTable(list, columnDto,table); |
| | | } |
| | | } |
| | | |
| | | |