| | |
| | | |
| | | import com.example.client.dto.ColumnDto; |
| | | 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.service.DataSyncService; |
| | | import com.example.server.utils.CacheUtils; |
| | | import com.example.server.progressTrack.dao.ExportRecordDao; |
| | | import com.example.server.progressTrack.model.ExportRecord; |
| | | import com.example.server.user.model.SysUser; |
| | | import com.example.server.utils.UserAndSiteUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.swing.*; |
| | |
| | | @Autowired |
| | | DataSyncService dataSyncService; |
| | | @Autowired |
| | | ExportRecordDao exportRecordDao; |
| | | @Autowired |
| | | ImportDataService importDataService; |
| | | |
| | | private List<ColumnDto> columnDto; |
| | | private JTable table; |
| | | |
| | | public JPanel createTable(Integer width, Integer height, JFrame jFrame) { |
| | | JPanel panel = new JPanel(new BorderLayout()); // 使用 BorderLayout |
| | |
| | | JLabel label1 = new JLabel("提示信息"); |
| | | JTextArea tips = new JTextArea(7, 30); |
| | | tips.setEnabled(false); |
| | | tips.setForeground(Color.BLACK); // 设置为黑色 |
| | | tips.setDisabledTextColor(Color.BLACK); |
| | | tips.setLineWrap(true); |
| | | |
| | | JPanel center = new JPanel(new BorderLayout()); // 为 left 设置布局 |
| | |
| | | left.add(center, BorderLayout.CENTER); |
| | | |
| | | JLabel label2 = new JLabel("导出记录"); |
| | | List<DataExportDto> list = new ArrayList<>(); |
| | | List<ColumnDto> columnDto = new ArrayList<>(); |
| | | List<ExportRecord> list = exportRecordDao.getList(); |
| | | columnDto = new ArrayList<>(); |
| | | columnDto.add(new ColumnDto("序号", "", 265, "autoCreate", false, null, null)); |
| | | columnDto.add(new ColumnDto("导出时间", "exportDate", 265, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("导出人", "importStaff", 265, null, false, null, null)); |
| | | JTable table = CommonTable.createCommonTable(list, columnDto); |
| | | columnDto.add(new ColumnDto("导出时间", "createDate", 265, null, false, null, null)); |
| | | columnDto.add(new ColumnDto("操作人", "userName", 265, null, false, null, null)); |
| | | table = CommonTable.createCommonTable(list, columnDto); |
| | | table.setRowHeight(25); |
| | | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
| | | |
| | |
| | | btnExport.addActionListener(new ActionListener() { |
| | | @Override |
| | | public void actionPerformed(ActionEvent e) { |
| | | dataSyncService.export(); |
| | | SysUser user = (SysUser) UserAndSiteUtils.get("user","user"); |
| | | if (user==null){ |
| | | JOptionPane.showMessageDialog(null, "用户失效请退出并重新登录", "提示", JOptionPane.WARNING_MESSAGE); |
| | | return; |
| | | } |
| | | dataSyncService.export(tips); |
| | | } |
| | | }); |
| | | |
| | | return panel; |
| | | } |
| | | public void refresh(List<ExportRecord> list){ |
| | | CommonTable.refreshTable(list, columnDto,table); |
| | | } |
| | | } |