jar
jinlin
2025-03-10 f0aae4b39afbcbb18fb5a0b32e3ca689662c5ca7
src/main/java/com/example/client/service/TrackRecordManageService.java
@@ -4,11 +4,13 @@
import com.example.client.dto.JComboBoxItem;
import com.example.client.model.TableButton;
import com.example.client.utils.CommonTable;
import com.example.server.cabin.service.CabinService;
import com.example.server.progressTrack.model.*;
import com.example.server.progressTrack.service.DjJdgzNetworkLevel1Service;
import com.example.server.progressTrack.service.DjJdgzNetworkLevel3Service;
import com.example.server.progressTrack.service.DjJdgzShipService;
import com.example.server.progressTrack.service.DjJdgzTrackRecordService;
import com.example.server.teamGroup.service.SysTeamGroupClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -37,7 +39,13 @@
    @Autowired
    private ExportTrackRecordService exportTrackRecordService;
    @Autowired
    private ImportTrackRecordService importTrackRecordService;
    @Autowired
    private TrackRecordAddOrUpdate addOrUpdate; // 注入 AddOrupdate 实例
    @Autowired
    private SysTeamGroupClassService sysTeamGroupClassService;
    @Autowired
    private CabinService cabinService;
    private JTable table;
    private List<DjJdgzTrackRecord> list;
@@ -57,14 +65,18 @@
        panel.add(centerJpanel, BorderLayout.CENTER);
        JComboBoxItem[] projectList = level1Service.getProjectList();
        JComboBoxItem[] cabinList = cabinService.getList();
        JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList();
        JComboBoxItem[] statusList = {
                new JComboBoxItem(0, "进行中"),
                new JComboBoxItem(1, "已完成")
                new JComboBoxItem(0L, "进行中"),
                new JComboBoxItem(1L, "已完成")
        };
        JButton btnTj = new JButton("统计报表");
        JButton btnJc = new JButton("周进度检查表");
        JButton btnExport = new JButton("导出跟踪报表");
        JButton btnImport = new JButton("导入跟踪报表");
        JComboBox<JComboBoxItem> comboBox = new JComboBox<>(projectList);
        JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>(statusList);
        JComboBoxItem selectedItem = (JComboBoxItem) comboBox.getSelectedItem();
@@ -80,10 +92,9 @@
                list = djJdgzTrackRecordService.getList(level1Id, Math.toIntExact(Status));
                CommonTable.refreshTable(list, columnDto, table);
                table.setRowHeight(25);
                table.setAutoCreateRowSorter(true);
                table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                tableModelListener(table, jFrame);
                tableModelListener(table, jFrame,list);
            }
        });
@@ -97,16 +108,24 @@
                list = djJdgzTrackRecordService.getList(level1Id, Math.toIntExact(Status));
                CommonTable.refreshTable(list, columnDto, table);
                table.setRowHeight(25);
                table.setAutoCreateRowSorter(true);
                table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                tableModelListener(table, jFrame);
                tableModelListener(table, jFrame,list);
            }
        });
        btnImport.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                JComboBoxItem selectedItemNow = (JComboBoxItem) comboBox.getSelectedItem();
                importTrackRecordService.FileUpload(columnDto,table,jFrame);
            }
        });
        topJpanel.add(btnTj);
        topJpanel.add(btnJc);
        topJpanel.add(btnExport);
        topJpanel.add(btnImport);
        topJpanel.add(comboBox);
        topJpanel.add(comboBox2);
@@ -120,23 +139,25 @@
        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("工程名称", "ProjectName", 180, null, false, null, null));
        columnDto.add(new ColumnDto("部门", "deptId", 120, "dict", false, null, deptList));
        columnDto.add(new ColumnDto("专业", "teamgroupName", 120, null, false, null, null));
        columnDto.add(new ColumnDto("舱室", "cabinId", 100, "dict", false, null, cabinList));
        columnDto.add(new ColumnDto("类别", "type", 100, null, false, null, null));
        columnDto.add(new ColumnDto("一级节点", "level1NodeName", 120, null, false, null, null));
        columnDto.add(new ColumnDto("二级节点", "level2NodeName", 120, null, false, null, null));
        columnDto.add(new ColumnDto("项目名称", "level3NetworkName", 120, null, false, null, null));
        columnDto.add(new ColumnDto("设备名称", "level3NetworkName", 120, null, false, null, null));
        columnDto.add(new ColumnDto("当前节点", "level3NodeName", 120, null, false, null, null));
        columnDto.add(new ColumnDto("计划完成时间", "requiredCompletionTime", 200, null, false, null, null));
        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));
        table = CommonTable.createCommonTable(list, columnDto);
        table.setRowHeight(25);
        table.setAutoCreateRowSorter(true);
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.addMouseListener(new MouseAdapter() {
@@ -149,7 +170,7 @@
                // 检查是否点击了有效单元格
                if (row >= 0 && column >= 0) {
                    if (column == 10) { // 列索引从0开始
                    if (column == 13) { // 列索引从0开始
                        // 获取该单元格的值
                        Object cellValue = table.getValueAt(row, column);
                        Integer value = Integer.parseInt(cellValue.toString());
@@ -182,12 +203,12 @@
                exportTrackRecordService.openDialog(jFrame);
            }
        });
        tableModelListener(table, jFrame);
        tableModelListener(table, jFrame,list);
        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;
@@ -211,17 +232,17 @@
        List<ColumnDto> columnDto = new ArrayList<>();
        List<DjJdgzTrackRecord> list = djJdgzTrackRecordService.getHistory(level3NodeId);
        JComboBoxItem[] trackList = {
                new JComboBoxItem(0, "线下"),
                new JComboBoxItem(1, "电话"),
                new JComboBoxItem(0L, "线下"),
                new JComboBoxItem(1L, "电话"),
        };
        JComboBoxItem[] statusList = {
                new JComboBoxItem(0, "进行中"),
                new JComboBoxItem(1, "已完成"),
                new JComboBoxItem(0L, "进行中"),
                new JComboBoxItem(1L, "已完成"),
        };
        JComboBoxItem[] hasDelayRiskList = {
                new JComboBoxItem(0, "无"),
                new JComboBoxItem(1, "有"),
                new JComboBoxItem(0L, "无"),
                new JComboBoxItem(1L, "有"),
        };
        columnDto.add(new ColumnDto("序号", "", 50, "autoCreate", false, null, null));
@@ -251,7 +272,7 @@
    }
    public void tableModelListener(JTable table, JFrame jFrame) {
    public void tableModelListener(JTable table, JFrame jFrame,List<DjJdgzTrackRecord> recordList) {
        table.getModel().addTableModelListener(e -> {
            // 检查事件类型
            if (e.getType() == TableModelEvent.UPDATE) {
@@ -263,7 +284,7 @@
                Object newValue = table.getModel().getValueAt(row, column);
                // 输出变化信息
                if (newValue.equals("edit")) {
                    DjJdgzTrackRecord data = list.get(row);
                    DjJdgzTrackRecord data = recordList.get(row);
                    Long level1Id = data.getLevel1NetworkId();
                    data.setProcessName(data.getLevel3NodeName());
                    Boolean isUpdate = data.getIsUpdate();