diff --git a/client/pom.xml b/client/pom.xml
index 0f67b65..8128207 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -6,12 +6,12 @@
com.ecep.contract
Contract-Manager
- 0.0.84-SNAPSHOT
+ 0.0.86-SNAPSHOT
com.ecep.contract
client
- 0.0.84-SNAPSHOT
+ 0.0.86-SNAPSHOT
${java.version}
@@ -22,7 +22,7 @@
com.ecep.contract
common
- 0.0.84-SNAPSHOT
+ 0.0.86-SNAPSHOT
org.springframework.boot
diff --git a/client/src/main/java/com/ecep/contract/WebSocketClientSession.java b/client/src/main/java/com/ecep/contract/WebSocketClientSession.java
index 5cee132..ffecd10 100644
--- a/client/src/main/java/com/ecep/contract/WebSocketClientSession.java
+++ b/client/src/main/java/com/ecep/contract/WebSocketClientSession.java
@@ -96,17 +96,14 @@ public class WebSocketClientSession {
Object value = args.get(1);
try {
PropertyDescriptor descriptor = BeanUtils.getPropertyDescriptor(tasker.getClass(), name);
- System.out.println("descriptor = " + descriptor);
- System.out.println("descriptor.getPropertyType() = " + descriptor.getPropertyType());
+ if (descriptor == null) {
+ tasker.updateMessage(java.util.logging.Level.SEVERE, "属性 " + name + " 不存在");
+ return;
+ }
Object object = webSocketService.getObjectMapper().convertValue(value, descriptor.getPropertyType());
- System.out.println("object = " + object);
- System.out.println("descriptor.getWriteMethod() = " + descriptor.getWriteMethod());
-
if (descriptor.getWriteMethod() == null) {
tasker.updateMessage(java.util.logging.Level.SEVERE, "属性 " + name + " 不可写");
} else {
- System.out.println("descriptor.getWriteMethod().getParameterTypes() = "
- + descriptor.getWriteMethod().getParameterTypes());
descriptor.getWriteMethod().invoke(tasker, object);
}
} catch (Exception e) {
@@ -123,7 +120,7 @@ public class WebSocketClientSession {
private void handleAsMessage(JsonNode args) {
String level = args.get(0).asText();
String message = args.get(1).asText();
- updateMessage(java.util.logging.Level.parse(level), message);
+ updateMessage(java.util.logging.Level.parse(level), "[R] "+message);
}
public void updateMessage(Level level, String message) {
diff --git a/client/src/main/java/com/ecep/contract/WebSocketClientTasker.java b/client/src/main/java/com/ecep/contract/WebSocketClientTasker.java
index 7d3aabb..e950cdd 100644
--- a/client/src/main/java/com/ecep/contract/WebSocketClientTasker.java
+++ b/client/src/main/java/com/ecep/contract/WebSocketClientTasker.java
@@ -1,8 +1,6 @@
package com.ecep.contract;
import com.fasterxml.jackson.core.JsonProcessingException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.Locale;
import java.util.UUID;
diff --git a/client/src/main/java/com/ecep/contract/controller/contract/ContractTabSkinExtendVendorInfo.java b/client/src/main/java/com/ecep/contract/controller/contract/ContractTabSkinExtendVendorInfo.java
index ba2c32e..8932541 100644
--- a/client/src/main/java/com/ecep/contract/controller/contract/ContractTabSkinExtendVendorInfo.java
+++ b/client/src/main/java/com/ecep/contract/controller/contract/ContractTabSkinExtendVendorInfo.java
@@ -115,6 +115,9 @@ public class ContractTabSkinExtendVendorInfo extends AbstContractBasedTabSkin {
assignedProviderField.selectedProperty().bindBidirectional(viewModel.getAssignedProvider());
assignedProviderField.disableProperty().bind(Bindings.createBooleanBinding(() -> {
Integer groupId = viewModel.getGroup().get();
+ if (groupId == null) {
+ return false;
+ }
VendorGroupVo group = getVendorGroupService().findById(groupId);
if (group == null) {
return false;
diff --git a/client/src/main/java/com/ecep/contract/controller/customer/CompanyCustomerTabSkinBase.java b/client/src/main/java/com/ecep/contract/controller/customer/CompanyCustomerTabSkinBase.java
index 7667f56..bd90641 100644
--- a/client/src/main/java/com/ecep/contract/controller/customer/CompanyCustomerTabSkinBase.java
+++ b/client/src/main/java/com/ecep/contract/controller/customer/CompanyCustomerTabSkinBase.java
@@ -1,29 +1,29 @@
package com.ecep.contract.controller.customer;
+import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
+import org.springframework.util.StringUtils;
+
import com.ecep.contract.MyDateTimeUtils;
-import com.ecep.contract.SpringApp;
import com.ecep.contract.controller.company.CompanyWindowController;
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
import com.ecep.contract.controller.tab.TabSkin;
-import com.ecep.contract.converter.CompanyStringConverter;
-import com.ecep.contract.converter.EntityStringConverter;
-import com.ecep.contract.vo.CompanyVo;
-import com.ecep.contract.vo.CompanyContactVo;
-import com.ecep.contract.vo.CompanyCustomerVo;
import com.ecep.contract.service.CompanyContactService;
import com.ecep.contract.service.CompanyCustomerService;
import com.ecep.contract.service.CompanyService;
import com.ecep.contract.util.UITools;
import com.ecep.contract.vm.CompanyCustomerViewModel;
+import com.ecep.contract.vo.CompanyCustomerVo;
+import com.ecep.contract.vo.CompanyVo;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleObjectProperty;
import javafx.event.ActionEvent;
import javafx.scene.control.Tab;
import javafx.scene.control.TextField;
+import javafx.stage.DirectoryChooser;
import javafx.util.converter.LocalDateStringConverter;
public class CompanyCustomerTabSkinBase
@@ -102,7 +102,33 @@ public class CompanyCustomerTabSkinBase
}
public void onCompanyCustomerChangePathAction(ActionEvent event) {
- setStatus("未实现");
+ DirectoryChooser chooser = new DirectoryChooser();
+ CompanyCustomerVo entity = getEntity();
+ String path = entity.getPath();
+ File initialDirectory = null;
+
+ // 如果当前已经设置了目录并且路径有效,则设置初始目录为该目录
+ if (StringUtils.hasText(path)) {
+ File dir = new File(path);
+ if (dir.exists()) {
+ initialDirectory = dir;
+ }
+ }
+
+ // 如果没有有效的初始目录,则使用基础路径
+ if (initialDirectory == null) {
+ initialDirectory = getCompanyCustomerService().getBasePath();
+ }
+
+ if (initialDirectory != null) {
+ chooser.setInitialDirectory(initialDirectory);
+ }
+
+ File newDirectory = chooser.showDialog(getTab().getContent().getScene().getWindow());
+ if (newDirectory != null) {
+ entity.setPath(newDirectory.getAbsolutePath());
+ save(entity);
+ }
}
public void onCompanyCustomerPathSameAsNameAction(ActionEvent event) {
diff --git a/client/src/main/java/com/ecep/contract/controller/customer/CustomerTabSkinFile.java b/client/src/main/java/com/ecep/contract/controller/customer/CustomerTabSkinFile.java
index 58b139f..f55a876 100644
--- a/client/src/main/java/com/ecep/contract/controller/customer/CustomerTabSkinFile.java
+++ b/client/src/main/java/com/ecep/contract/controller/customer/CustomerTabSkinFile.java
@@ -23,6 +23,8 @@ import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
import com.ecep.contract.service.CompanyCustomerFileService;
import com.ecep.contract.service.CompanyCustomerFileTypeService;
import com.ecep.contract.service.CompanyCustomerService;
+import com.ecep.contract.service.CompanyService;
+import com.ecep.contract.task.CustomerFileMoveTasker;
import com.ecep.contract.util.FileUtils;
import com.ecep.contract.util.FxmlPath;
import com.ecep.contract.util.ParamUtils;
@@ -246,7 +248,6 @@ public class CustomerTabSkinFile
public void onFileReBuildingAction(ActionEvent event) {
-
CompanyCustomerService customerService = getCompanyCustomerService();
try {
CompanyCustomerVo companyCustomer = customerService.findById(viewModel.getId().get());
@@ -279,6 +280,12 @@ public class CustomerTabSkinFile
}
public void onFileTableMoveToCompanyPathAction(ActionEvent event) {
+ CompanyCustomerFileViewModel selectedItem = getSelectedItem();
+ if (selectedItem == null) {
+ return;
+ }
+
+ // 检查公司目录设置
Integer companyId = viewModel.getCompany().get();
CompanyVo company = getCompanyService().findById(companyId);
@@ -289,41 +296,17 @@ public class CustomerTabSkinFile
File companyPath = new File(company.getPath());
if (!companyPath.exists()) {
- setStatus("公司目录设置设置异常,无法访问");
+ setStatus("公司目录设置异常,无法访问");
return;
}
- CompanyCustomerFileViewModel selectedItem = getSelectedItem();
- if (selectedItem == null) {
- return;
- }
- String filePath = selectedItem.getFilePath().get();
- String editFilePath = selectedItem.getEditFilePath().get();
+ // 创建并启动任务
+ CustomerFileMoveTasker task = new CustomerFileMoveTasker();
+ task.setFileId(selectedItem.getId().get());
+ UITools.showTaskDialogAndWait("移动文件到公司目录", task, null);
- if (StringUtils.hasText(filePath)) {
- File file = new File(filePath);
- if (file.exists()) {
- File dest = new File(companyPath, file.getName());
- if (file.renameTo(dest)) {
- setStatus(file.getAbsolutePath() + " -> " + dest.getAbsolutePath());
- }
- }
- }
-
- if (StringUtils.hasText(editFilePath)) {
- File file = new File(editFilePath);
- if (file.exists()) {
- File dest = new File(companyPath, file.getName());
- if (file.renameTo(dest)) {
- setStatus(file.getAbsolutePath() + " -> " + dest.getAbsolutePath());
- }
- }
- }
-
- deleteRow(selectedItem);
-
- // getCompanyCustomerService().deleteFileById(selectedItem.getId().get());
- // dataSet.remove(selectedItem);
+ // 刷新表格数据
+ loadTableDataSet();
}
private void initializeTask(Task