jinlin
2025-04-01 a80b4a7eb099390bb53c967126fa97b30568e1a3
src/main/java/com/example/client/service/DataExportManageService.java
@@ -3,13 +3,12 @@
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.progressTrack.dao.ExportRecordDao;
import com.example.server.progressTrack.model.ExportRecord;
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;
import org.springframework.stereotype.Service;
import javax.swing.*;
@@ -24,7 +23,12 @@
    @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
@@ -43,6 +47,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);
        JPanel center = new JPanel(new BorderLayout()); // 为 left 设置布局
@@ -54,12 +60,12 @@
        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);
@@ -72,10 +78,18 @@
        btnExport.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                dataSyncService.export();
                SysUser user = (SysUser) CacheUtils.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);
    }
}