feat(客户评估): 实现客户评估表单的搜索和显示功能
添加客户评估表单文件的搜索功能,支持按公司ID和搜索文本查询 新增CompanyCustomerEvaluationFormFileStringConverter用于文件显示转换 优化自动完成功能,支持自定义搜索逻辑 移除不必要的文件路径属性绑定 重构客户评估表单窗口控制器继承结构
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.service.CompanyCustomerEvaluationFormFileService;
|
||||
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||
import com.ecep.contract.vo.CustomerFileVo;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
/**
|
||||
* CompanyCustomerEvaluationFormFileVo的StringConverter实现,用于JavaFX控件中的显示和转换
|
||||
*/
|
||||
public class CompanyCustomerEvaluationFormFileStringConverter
|
||||
extends StringConverter<CompanyCustomerEvaluationFormFileVo> {
|
||||
private final CompanyCustomerEvaluationFormFileService service;
|
||||
private CompanyCustomerFileService customerFileService;
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
*
|
||||
* @param service CompanyCustomerEvaluationFormFileService实例
|
||||
*/
|
||||
public CompanyCustomerEvaluationFormFileStringConverter(CompanyCustomerEvaluationFormFileService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
private CompanyCustomerFileService getCustomerFileService() {
|
||||
if (customerFileService == null) {
|
||||
customerFileService = SpringApp.getBean(CompanyCustomerFileService.class);
|
||||
}
|
||||
return customerFileService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将CompanyCustomerEvaluationFormFileVo对象转换为字符串
|
||||
*
|
||||
* @param formFile CompanyCustomerEvaluationFormFileVo对象
|
||||
* @return 转换后的字符串
|
||||
*/
|
||||
@Override
|
||||
public String toString(CompanyCustomerEvaluationFormFileVo formFile) {
|
||||
if (formFile == null || formFile.getCustomerFile() == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
CustomerFileVo customerFile = getCustomerFileService().findById(formFile.getCustomerFile());
|
||||
if (customerFile == null || !StringUtils.hasText(customerFile.getFilePath())) {
|
||||
return "#" + formFile.getCustomerFile();
|
||||
}
|
||||
File file = new File(customerFile.getFilePath());
|
||||
return file.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串转换为CompanyCustomerEvaluationFormFileVo对象
|
||||
*
|
||||
* @param string 字符串
|
||||
* @return 转换后的CompanyCustomerEvaluationFormFileVo对象
|
||||
*/
|
||||
@Override
|
||||
public CompanyCustomerEvaluationFormFileVo fromString(String string) {
|
||||
// 由于文件名称可能不唯一,这里返回null
|
||||
// 实际使用时应该通过ID或其他唯一标识来查找
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user