|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.example.client.dto.ColumnDto; | 
|---|
|  |  |  | import com.example.client.dto.JComboBoxItem; | 
|---|
|  |  |  | import com.example.client.model.TableButton; | 
|---|
|  |  |  | import com.example.client.utils.CommonTable; | 
|---|
|  |  |  | import com.example.client.utils.GBC; | 
|---|
|  |  |  | import com.example.client.utils.UploadFile; | 
|---|
|  |  |  | import com.example.server.progressTrack.model.DjJdgzDismantTrack; | 
|---|
|  |  |  | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3; | 
|---|
|  |  |  | import com.example.server.progressTrack.model.DjJdgzNetworkLevel3List; | 
|---|
|  |  |  | import com.example.server.progressTrack.model.DjJdgzTrackRecord; | 
|---|
|  |  |  | import com.example.server.progressTrack.service.DjJdgzNetworkLevel3ListService; | 
|---|
|  |  |  | import com.example.server.progressTrack.service.DjJdgzTrackRecordService; | 
|---|
|  |  |  | import com.example.server.progressTrack.service.NetWorkDiagramService; | 
|---|
|  |  |  | import com.example.server.progressTrack.service.*; | 
|---|
|  |  |  | import com.example.server.sysOss.model.SysOss; | 
|---|
|  |  |  | import com.example.server.teamGroup.service.SysTeamGroupClassService; | 
|---|
|  |  |  | import com.mxgraph.swing.mxGraphComponent; | 
|---|
|  |  |  | import com.mxgraph.view.mxGraph; | 
|---|
|  |  |  | import com.example.server.user.model.SysUser; | 
|---|
|  |  |  | import com.example.server.utils.UserAndSiteUtils; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.jdesktop.swingx.JXDatePicker; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.swing.*; | 
|---|
|  |  |  | import javax.swing.event.TableModelEvent; | 
|---|
|  |  |  | import javax.swing.table.DefaultTableModel; | 
|---|
|  |  |  | import javax.swing.table.TableModel; | 
|---|
|  |  |  | import java.awt.*; | 
|---|
|  |  |  | import java.awt.event.*; | 
|---|
|  |  |  | import java.text.ParseException; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DjJdgzTrackRecordService djJdgzTrackRecordService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DjJdgzNetworkLevel3Service djJdgzNetworkLevel3Service; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private TrackRecordManageService trackRecordManageService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private UploadFile uploadFile; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DjJdgzDismantTrackService djJdgzDismantTrackService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void openDialog(DjJdgzTrackRecord data, JFrame jFrame, Long level1Id, List<ColumnDto> columnDto, JTable table) { | 
|---|
|  |  |  | JFrame frame1 = new JFrame("跟踪记录"); | 
|---|
|  |  |  | JFrame frame1 = new JFrame(data.getLevel3NetworkName() + "跟踪记录"); | 
|---|
|  |  |  | frame1.setSize(1200, 800); | 
|---|
|  |  |  | frame1.setResizable(false); | 
|---|
|  |  |  | frame1.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); | 
|---|
|  |  |  | 
|---|
|  |  |  | hasDelayRiskMap.put(0, "无"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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, "有"), | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JLabel JLabel0 = new JLabel("当前节点"); | 
|---|
|  |  |  | 
|---|
|  |  |  | trackLocatDesc.setText(data.getTrackLocation()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JLabel JLabel3 = new JLabel("跟踪人(艇方)"); | 
|---|
|  |  |  | JLabel JLabel3 = new JLabel("跟踪人(T方)"); | 
|---|
|  |  |  | JTextField trackPersonDesc = new JTextField(16); | 
|---|
|  |  |  | if (StringUtils.isNotBlank(data.getTrackPerson())) { | 
|---|
|  |  |  | trackPersonDesc.setText(data.getTrackPerson()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JLabel JLabel34 = new JLabel("T方单位"); | 
|---|
|  |  |  | JTextField trackPersonUnitDesc = new JTextField(16); | 
|---|
|  |  |  | if (StringUtils.isNotBlank(data.getTrackPersonUnit())) { | 
|---|
|  |  |  | trackPersonUnitDesc.setText(data.getTrackPersonUnit()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JLabel JLabel4 = new JLabel("联系方式"); | 
|---|
|  |  |  | 
|---|
|  |  |  | JTextField trackedPersonDesc = new JTextField(16); | 
|---|
|  |  |  | if (StringUtils.isNotBlank(data.getTrackedPerson())) { | 
|---|
|  |  |  | trackedPersonDesc.setText(data.getTrackedPerson()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JLabel JLabel56 = new JLabel("厂方单位"); | 
|---|
|  |  |  | JTextField trackedPersonUnitDesc = new JTextField(16); | 
|---|
|  |  |  | if (StringUtils.isNotBlank(data.getTrackedPersonUnit())) { | 
|---|
|  |  |  | trackedPersonUnitDesc.setText(data.getTrackedPersonUnit()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JLabel JLabel6 = new JLabel("联系方式"); | 
|---|
|  |  |  | 
|---|
|  |  |  | JComboBox<JComboBoxItem> comboBox1 = new JComboBox<>(statusList); | 
|---|
|  |  |  | comboBox1.setPreferredSize(new Dimension(185, 28)); | 
|---|
|  |  |  | if (data.getCurrentStatus() != null) { | 
|---|
|  |  |  | comboBox0.setSelectedItem(new JComboBoxItem(data.getCurrentStatus(), statusMap.get(data.getCurrentStatus()))); | 
|---|
|  |  |  | comboBox0.setSelectedItem(new JComboBoxItem(data.getCurrentStatus().longValue(), statusMap.get(data.getCurrentStatus()))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | JComboBox<JComboBoxItem> comboBox2 = new JComboBox<>(hasDelayRiskList); | 
|---|
|  |  |  | comboBox2.setPreferredSize(new Dimension(185, 28)); | 
|---|
|  |  |  | if (data.getHasDelayRisk() != null) { | 
|---|
|  |  |  | comboBox0.setSelectedItem(new JComboBoxItem(data.getHasDelayRisk(), hasDelayRiskMap.get(data.getHasDelayRisk()))); | 
|---|
|  |  |  | comboBox0.setSelectedItem(new JComboBoxItem(data.getHasDelayRisk().longValue(), hasDelayRiskMap.get(data.getHasDelayRisk()))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | JLabel JLabel19 = new JLabel("附件"); | 
|---|
|  |  |  | SysOss oss = new SysOss(); | 
|---|
|  |  |  | if (data.getId()!=null){ | 
|---|
|  |  |  | if (data.getId() != null) { | 
|---|
|  |  |  | oss.setBusiId(data.getId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oss.setBusiType("ProjectProgressFileUpload"); | 
|---|
|  |  |  | 
|---|
|  |  |  | oss.setBusiFieldName("项目进度文件"); | 
|---|
|  |  |  | oss.setStatus(1); | 
|---|
|  |  |  | oss.setChannel("local"); | 
|---|
|  |  |  | JPanel jPanel = uploadFile.uploadFile(jFrame,500,220,oss); | 
|---|
|  |  |  | JPanel jPanel = uploadFile.uploadFile(jFrame, 500, 220, oss); | 
|---|
|  |  |  | JButton saveButton = new JButton("保存"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | frame1.add(JLabel0, new GBC(0, 0, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | frame1.add(JLabel3, new GBC(0, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(trackPersonDesc, new GBC(1, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(JLabel4, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(trackPersonContactDesc, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(JLabel34, new GBC(2, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(trackPersonUnitDesc, new GBC(3, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(JLabel4, new GBC(4, 1, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(trackPersonContactDesc, new GBC(5, 1, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | frame1.add(JLabel5, new GBC(0, 2, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(trackedPersonDesc, new GBC(1, 2, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(JLabel6, new GBC(2, 2, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(trackedPersonContactDesc, new GBC(3, 2, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(JLabel56, new GBC(2, 2, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(trackedPersonUnitDesc, new GBC(3, 2, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(JLabel6, new GBC(4, 2, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(trackedPersonContactDesc, new GBC(5, 2, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | frame1.add(JLabel7, new GBC(0, 3, 1, 1).setAnchor(GBC.SOUTHEAST).setInsets(5)); | 
|---|
|  |  |  | frame1.add(generalRepairUnitDesc, new GBC(1, 3, 1, 1).setAnchor(GBC.SOUTHWEST).setInsets(5)); | 
|---|
|  |  |  | 
|---|
|  |  |  | saveButton.addActionListener(new ActionListener() { | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void actionPerformed(ActionEvent e) { | 
|---|
|  |  |  | SysUser user = (SysUser) UserAndSiteUtils.get("user", "user"); | 
|---|
|  |  |  | if (user == null) { | 
|---|
|  |  |  | JOptionPane.showMessageDialog(null, "当前用户已失效请重新登录", "提示", JOptionPane.WARNING_MESSAGE); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DjJdgzNetworkLevel3 level3 = djJdgzNetworkLevel3Service.get(data.getLevel3NetworkId()); | 
|---|
|  |  |  | if (user.getTeamgroup() != null && !user.getTeamgroup().equals(level3.getTeamgroupId().toString())) { | 
|---|
|  |  |  | JOptionPane.showMessageDialog(null, "当前用户不可操作其他专业数据", "提示", JOptionPane.WARNING_MESSAGE); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | JComboBoxItem trackMethod = (JComboBoxItem) comboBox0.getSelectedItem(); | 
|---|
|  |  |  | JComboBoxItem currentStatus = (JComboBoxItem) comboBox1.getSelectedItem(); | 
|---|
|  |  |  | JComboBoxItem hasDelayRisk = (JComboBoxItem) comboBox2.getSelectedItem(); | 
|---|
|  |  |  | List<DjJdgzDismantTrack> list1 = djJdgzDismantTrackService.getList(data.getLevel3NetworkId(), null); | 
|---|
|  |  |  | if (data.getProcessName().equals("设备拆卸出舱") && currentStatus.getId() == 1 && list1 != null && list1.size() > 0) { | 
|---|
|  |  |  | Boolean status = djJdgzDismantTrackService.getStatus(data.getLevel3NetworkId()); | 
|---|
|  |  |  | if (!status) { | 
|---|
|  |  |  | JOptionPane.showMessageDialog(null, "有未完成的子部件", "提示", JOptionPane.WARNING_MESSAGE); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.setTrackMethod(Math.toIntExact(trackMethod.getId())); | 
|---|
|  |  |  | data.setProcessName(data.getLevel3NodeName()); | 
|---|
|  |  |  | data.setTrackLocation(trackLocatDesc.getText()); | 
|---|
|  |  |  | data.setTrackPerson(trackPersonDesc.getText()); | 
|---|
|  |  |  | data.setTrackPersonContact(trackPersonContactDesc.getText()); | 
|---|
|  |  |  | data.setTrackPersonUnit(trackPersonUnitDesc.getText()); | 
|---|
|  |  |  | data.setTrackedPersonUnit(trackedPersonUnitDesc.getText()); | 
|---|
|  |  |  | data.setTrackedPerson(trackedPersonDesc.getText()); | 
|---|
|  |  |  | data.setTrackedPersonContact(trackedPersonContactDesc.getText()); | 
|---|
|  |  |  | data.setGeneralRepairUnit(generalRepairUnitDesc.getText()); | 
|---|
|  |  |  | 
|---|
|  |  |  | data.setRemark(remark.getText()); | 
|---|
|  |  |  | Long id = djJdgzTrackRecordService.save(data); | 
|---|
|  |  |  | uploadFile.save(id); | 
|---|
|  |  |  | List<DjJdgzTrackRecord> list = djJdgzTrackRecordService.getList(level1Id,0); | 
|---|
|  |  |  | CommonTable.refreshTable(list,columnDto,table); | 
|---|
|  |  |  | trackRecordManageService.tableModelListener(table,jFrame); | 
|---|
|  |  |  | List<DjJdgzTrackRecord> list = djJdgzTrackRecordService.getList(level1Id, level3.getDeptId(), null, null, level3.getType(), 0,0, null); | 
|---|
|  |  |  | CommonTable.refreshTable(list, columnDto, table); | 
|---|
|  |  |  | trackRecordManageService.tableModelListener(table, jFrame, list); | 
|---|
|  |  |  | frame1.dispose(); | 
|---|
|  |  |  | jFrame.setEnabled(true);//将主界面再设置为可操作的 | 
|---|
|  |  |  | JOptionPane.showMessageDialog(null, "保存成功", "提示", JOptionPane.WARNING_MESSAGE); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|