From 66f0597bf6a1e79540c6bc51dedf561c22f3bdb5 Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期二, 13 五月 2025 17:49:26 +0800 Subject: [PATCH] 修改 --- src/main/java/com/example/client/service/DataImportManageService.java | 47 ++++++++++++++++++++++++++++++++--------------- 1 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/example/client/service/DataImportManageService.java b/src/main/java/com/example/client/service/DataImportManageService.java index 4d3b099..8053049 100644 --- a/src/main/java/com/example/client/service/DataImportManageService.java +++ b/src/main/java/com/example/client/service/DataImportManageService.java @@ -5,11 +5,12 @@ 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.utils.CacheUtils; +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.UserAndSiteUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -30,9 +31,18 @@ @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) UserAndSiteUtils.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)); @@ -48,13 +58,13 @@ 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"); + String site = (String) UserAndSiteUtils.get("site", "site"); JLabel label = new JLabel(site + "鏈哄櫒"); top.add(label); @@ -67,6 +77,8 @@ 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); @@ -82,7 +94,7 @@ 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; } @@ -95,9 +107,10 @@ // 鍒锋柊琛ㄦ牸鏁版嵁锛堝鏋滀笂浼犳垚鍔燂級 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); } @@ -118,15 +131,15 @@ 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); @@ -138,6 +151,10 @@ return panel; } + + public void refresh(List<ImportRecord> list){ + CommonTable.refreshTable(list, columnDto,table); + } } -- Gitblit v1.9.1