From bf5b01b14dc7bfc214e646425a62f5593890d7e3 Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期六, 08 十一月 2025 22:05:37 +0800
Subject: [PATCH] 清洗数据库日期错误,并且导入日期通用化处理
---
src/main/java/com/example/client/service/Level3View2Service.java | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 218 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/example/client/service/Level3View2Service.java b/src/main/java/com/example/client/service/Level3View2Service.java
index 803e1c5..154c509 100644
--- a/src/main/java/com/example/client/service/Level3View2Service.java
+++ b/src/main/java/com/example/client/service/Level3View2Service.java
@@ -3,9 +3,11 @@
import com.example.client.dto.ColumnDto;
import com.example.client.dto.JComboBoxItem;
import com.example.client.utils.*;
+import com.example.server.ExportExcel.dto.ExcelColumnDto;
import com.example.server.cabin.service.CabinService;
import com.example.server.progressTrack.Dto.TableNodeDto;
import com.example.server.progressTrack.model.DjJdgzShip;
+import com.example.server.progressTrack.model.DjJdgzTrackRecord;
import com.example.server.progressTrack.service.*;
import com.example.server.teamGroup.service.SysTeamGroupClassService;
import org.apache.commons.lang3.StringUtils;
@@ -15,6 +17,7 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
+import java.io.File;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@@ -27,6 +30,8 @@
@Autowired
private DjJdgzShipService djJdgzShipService;
@Autowired
+ private DjJdgzTrackRecordService djJdgzTrackRecordService;
+ @Autowired
private SysTeamGroupClassService sysTeamGroupClassService;
@Autowired
private CabinService cabinService;
@@ -37,6 +42,8 @@
private List<TableNodeDto> list;
private Map<String, Long> shipMap = new HashMap<>();
private List<ColumnDto> columnDto;
+ @Autowired
+ private DjJdgzNetworkLevel1Service djJdgzNetworkLevel1Service;
public JPanel createTable(Integer width, Integer height, JFrame frame) {
@@ -124,6 +131,7 @@
// 鍒涘缓涓嬫媺妗�
ColorDescriptionComboBox comboBox5 = new ColorDescriptionComboBox(colorDescriptions);
JButton btnTjz = new JButton("璁惧杩涘害缁熻鎬昏〃");
+ JButton btnExport = new JButton("瀵煎嚭");
topJpanel2.add(JLabel0, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
topJpanel2.add(comboBox, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
@@ -143,7 +151,9 @@
topJpanel2.add(sb, new GBC(4, 1, 2, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
topJpanel2.add(query, new GBC(6, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
topJpanel2.add(comboBox5, new GBC(7, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+ topJpanel2.add(btnExport, new GBC(8, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
topJpanel2.add(btnTjz, new GBC(9, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+
list = level3Service.getNodeList(shipList.get(0).getId(), deptList[0].getId(), teamList[0].getId(), cabinList[0].getId(), typeList[0], Math.toIntExact(isealCabin[0].getId()), Math.toIntExact(isealCabin[0].getId()), null);
@@ -158,8 +168,8 @@
MouseMotionListener mouseMotionListener = new MouseMotionListener() {
@Override
public void mouseDragged(MouseEvent e) {
- // 涓嶉渶瑕佸鐞嗛紶鏍囨嫋鍔ㄤ簨浠�
}
+
@Override
public void mouseMoved(MouseEvent e) {
@@ -194,8 +204,26 @@
}
}
};
+ MouseAdapter mouseAdapter = new MouseAdapter(){
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ // if (historyCalled[0]) return;
+ // 鑾峰彇鐐瑰嚮鐨勮鍜屽垪
+ int row = table.rowAtPoint(e.getPoint());
+
+ // 妫�鏌ユ槸鍚︾偣鍑讳簡鏈夋晥鍗曞厓鏍�
+ if (row >= 0) {
+ Long id = list.get(row).getNetworkId();
+ if (id != null) {
+ getRecordById(frame,id);
+ }
+ }
+ }
+
+ };
table.addMouseMotionListener(mouseMotionListener);
+ table.addMouseListener(mouseAdapter);
comboBox.addItemListener(new ItemListener() {
public void itemStateChanged(final ItemEvent event) {
@@ -390,6 +418,13 @@
statisProductService.createTable(frame, shipId, type);
}
});
+ btnExport.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ frame.setEnabled(false);
+ export(frame);
+ }
+ });
comboBox5.addItemListener(new ItemListener() {
@Override
@@ -445,6 +480,188 @@
return panel;
}
+
+ private void getRecordById(JFrame jFrame, Long id) {
+ jFrame.setEnabled(false);
+ JFrame frame1 = new JFrame("璺熻釜璁板綍");
+ frame1.setSize(2000, 800);
+ frame1.setResizable(true);
+ frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ frame1.setLocationRelativeTo(null);
+ frame1.addWindowListener(new WindowAdapter() {
+ //娣诲姞绗簩涓晫闈㈢殑鍏抽棴浜嬩欢:
+ public void windowClosing(WindowEvent e) {
+ //娣诲姞浜嬩欢:
+ jFrame.setEnabled(true);//灏嗕富鐣岄潰鍐嶈缃负鍙搷浣滅殑
+ }
+ });
+
+ List<ColumnDto> columnDto = new ArrayList<>();
+ List<DjJdgzTrackRecord> list = djJdgzTrackRecordService.getRecordById(id);
+ JComboBoxItem[] trackList = {
+ new JComboBoxItem(0L, "绾夸笅"),
+ new JComboBoxItem(1L, "鐢佃瘽"),
+ };
+
+ JComboBoxItem[] statusList = {
+ new JComboBoxItem(0L, "杩涜涓�"),
+ new JComboBoxItem(1L, "宸插畬鎴�"),
+ };
+ JComboBoxItem[] hasDelayRiskList = {
+ new JComboBoxItem(0L, "鏃�"),
+ new JComboBoxItem(1L, "鏈�"),
+ };
+
+ columnDto.add(new ColumnDto("搴忓彿", "", 80, "autoCreate", false, null, null));
+ columnDto.add(new ColumnDto("鑺傜偣鍚嶇О", "processName", 120, null, false, null, null));
+ columnDto.add(new ColumnDto("璺熻釜鏂瑰紡", "trackMethod", 120, "dict", false, null, trackList));
+ columnDto.add(new ColumnDto("璺熻釜鍦扮偣", "trackLocation", 120, null, false, null, null));
+ columnDto.add(new ColumnDto("鍔╀慨浜�", "trackPerson", 180, null, false, null, null));
+ columnDto.add(new ColumnDto("鍘傛柟", "trackedPerson", 180, 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("鑺傜偣杩涘睍", "currentStatus", 120, "dict", false, null, statusList));
+ columnDto.add(new ColumnDto("鑴辨湡椋庨櫓", "hasDelayRisk", 120, "dict", false, null, hasDelayRiskList));
+ columnDto.add(new ColumnDto("棰勮瀹屾垚鏃堕棿", "estimatedCompletionTime", 200, "selectDate", false, null, null));
+ columnDto.add(new ColumnDto("瀛樺湪闂", "problem", 160, null, false, null, null));
+ columnDto.add(new ColumnDto("鍚庣画璁″垝", "followupPlan", 160, null, false, null, null));
+ columnDto.add(new ColumnDto("澶囨敞", "remark", 160, null, false, null, null));
+
+ JTable subTable = CommonTable.createCommonTable(list, columnDto);
+ subTable.setRowHeight(25);
+ subTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
+ JScrollPane scrollPane = new JScrollPane(subTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ scrollPane.setViewportView(subTable);
+ scrollPane.getViewport().setBackground(Color.WHITE);
+ //scrollPane.setPreferredSize(new Dimension(width - 20, height - 100));
+
+ frame1.add(scrollPane);
+ frame1.setVisible(true);
+
+ }
+
+ private void export(JFrame jFrame) {
+ JFrame frame1 = new JFrame("瀵煎嚭涓夌骇缃戠粶鍥剧姸鎬�");
+ frame1.setSize(300, 400);
+ frame1.setResizable(true);
+ frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+ frame1.setLocationRelativeTo(null);
+ frame1.setVisible(true);
+ frame1.addWindowListener(new WindowAdapter() {
+ //娣诲姞绗簩涓晫闈㈢殑鍏抽棴浜嬩欢:
+ public void windowClosing(WindowEvent e) {
+ //娣诲姞浜嬩欢:
+ jFrame.setEnabled(true);//灏嗕富鐣岄潰鍐嶈缃负鍙搷浣滅殑
+ }
+ });
+ GridBagLayout layout = new GridBagLayout();
+ frame1.setLayout(layout);
+
+ JComboBoxItem[] projectList = djJdgzNetworkLevel1Service.getProjectList();
+ JComboBoxItem[] deptList = sysTeamGroupClassService.getDeptList();
+
+ String[] typeList = new String[]{
+ "","杩涜涓�","涓存湡","閫炬湡","姝e父瀹屾垚","瓒呮湡瀹屾垚"
+ };
+
+ JLabel JLabel1 = new JLabel("宸ョ▼");
+ JComboBox<JComboBoxItem> comboBox0 = new JComboBox<>(projectList);
+ comboBox0.setPreferredSize(new Dimension(200, 28));
+ comboBox0.setSelectedIndex(-1);
+
+ JLabel JLabel4 = new JLabel("閮ㄩ棬");
+ JComboBox<JComboBoxItem> comboBox3 = new JComboBox<>(deptList);
+ comboBox3.setPreferredSize(new Dimension(200, 28));
+
+ JComboBoxItem[] teamList1 = sysTeamGroupClassService.getTeamList(deptList[0].getId());
+
+ JLabel JLabel5 = new JLabel("涓撲笟");
+ JComboBox<JComboBoxItem> comboBox4 = new JComboBox<>(teamList1);
+ comboBox4.setPreferredSize(new Dimension(200, 28));
+
+ JLabel JLabel7 = new JLabel("鐘舵��");
+ JComboBox<String> comboBox6 = new JComboBox<>(typeList);
+ comboBox6.setPreferredSize(new Dimension(200, 28));
+
+ comboBox3.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ JComboBoxItem selectedItem = (JComboBoxItem) comboBox3.getSelectedItem();
+ if (selectedItem != null) {
+ long selectedId = selectedItem.getId();
+
+ JComboBoxItem[] teamList = sysTeamGroupClassService.getTeamList(selectedId);
+ comboBox4.setModel(new DefaultComboBoxModel<>(teamList));
+ comboBox4.setSelectedIndex(-1);
+ }
+ }
+ }
+ });
+
+ JButton btnExport = new JButton("瀵煎嚭");
+
+ frame1.add(JLabel1, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+ frame1.add(comboBox0, new GBC(1, 0, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+
+ frame1.add(JLabel4, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+ frame1.add(comboBox3, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+
+ frame1.add(JLabel5, new GBC(0, 2, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+ frame1.add(comboBox4, new GBC(1, 2, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+
+ frame1.add(JLabel7, new GBC(0, 3, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5));
+ frame1.add(comboBox6, new GBC(1, 3, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5));
+
+ frame1.add(btnExport, new GBC(0, 4, 2, 1).setWeight(1, 0));
+
+ btnExport.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JComboBoxItem projectItem = (JComboBoxItem) comboBox0.getSelectedItem();
+ JComboBoxItem deptItem = (JComboBoxItem) comboBox3.getSelectedItem();
+ JComboBoxItem teamGroupItem = (JComboBoxItem) comboBox4.getSelectedItem();
+ String statusItem = comboBox6.getSelectedItem().toString();
+
+ Long level1NetworkId = null;
+ Long deptId = null;
+ Long teamGroupId = null;
+ String status = null;
+
+ if (projectItem != null) {
+ level1NetworkId = projectItem.getId();
+ } else {
+ JOptionPane.showMessageDialog(null, "娌℃湁閫夋嫨宸ョ▼", "鎻愮ず", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
+ if (deptId != null) {
+ deptId = deptItem.getId();
+ }
+ if (teamGroupItem != null) {
+ teamGroupId = teamGroupItem.getId();
+ }
+
+ if (StringUtils.isNotBlank(statusItem)) {
+ status = statusItem;
+ }
+
+ String fileName = "涓夌骇缃戠粶鍥剧姸鎬�.xlsx";
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setSelectedFile(new File(fileName));
+ int result = fileChooser.showSaveDialog(frame1);
+
+ if (result == JFileChooser.APPROVE_OPTION) {
+ File selectedFile = fileChooser.getSelectedFile();
+ level3Service.exportExcel(selectedFile.getPath(), level1NetworkId,deptId, teamGroupId, status);
+ JOptionPane.showMessageDialog(frame1, "鏂囦欢瀵煎嚭鎴愬姛");
+ } else {
+ JOptionPane.showMessageDialog(frame1, "鏂囦欢瀵煎嚭鍙栨秷");
+ }
+ }
+ });
+
+ }
+
private JComboBoxItem[] createIsealCabinItems() {
return new JComboBoxItem[]{
new JComboBoxItem(10000L, ""),
--
Gitblit v1.9.1