Compare commits
21 Commits
0.0.45
...
effd7b103c
| Author | SHA1 | Date | |
|---|---|---|---|
| effd7b103c | |||
| 0e444508ff | |||
| acb63116d5 | |||
| 72f8e2e209 | |||
| b927f9d572 | |||
| a2f5e4864b | |||
| 08cc2c29a5 | |||
| 7d684a5006 | |||
| 8139a45f06 | |||
| cca51c6fcc | |||
| 1514cb0f9f | |||
| cf73769ef2 | |||
| c793c0925e | |||
| c69d3f1af2 | |||
| f810532824 | |||
| fb28bac53a | |||
| 9ff84ebe8a | |||
| 6711657663 | |||
| 17e326b35c | |||
|
|
fa25130c9f | ||
|
|
b0b67b5d7f |
BIN
FixPackageNames$1.class
Normal file
BIN
FixPackageNames$1.class
Normal file
Binary file not shown.
BIN
FixPackageNames.class
Normal file
BIN
FixPackageNames.class
Normal file
Binary file not shown.
48
FixPackageNames.java
Normal file
48
FixPackageNames.java
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.FileVisitResult;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.nio.file.SimpleFileVisitor;
|
||||||
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
public class FixPackageNames {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String rootDir = "d:/idea-workspace/Contract-Manager/server/src/main/java";
|
||||||
|
AtomicInteger counter = new AtomicInteger(0);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Path path = Paths.get(rootDir);
|
||||||
|
// System.out.println(path.getFileName().toString());
|
||||||
|
|
||||||
|
Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
|
||||||
|
@Override
|
||||||
|
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||||
|
// System.out.println(file.toString());
|
||||||
|
if (file.toString().endsWith(".java")) {
|
||||||
|
String content = new String(Files.readAllBytes(file));
|
||||||
|
// System.out.println(content);
|
||||||
|
if (content.indexOf("package com.ecep.contract.manager") >= 0) {
|
||||||
|
System.out.println(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
String newContent = content
|
||||||
|
.replace("package com.ecep.contract.manager", "package com.ecep.contract")
|
||||||
|
.replace("import com.ecep.contract.manager", "import com.ecep.contract");
|
||||||
|
if (!content.equals(newContent)) {
|
||||||
|
Files.write(file, newContent.getBytes());
|
||||||
|
System.out.println("Fixed: " + file.toString());
|
||||||
|
counter.incrementAndGet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FileVisitResult.CONTINUE;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
System.out.println("Total files fixed: " + counter.get());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
45
README.md
45
README.md
@@ -1,33 +1,12 @@
|
|||||||
## 项目改进与优化分析报告
|
# 项目介绍
|
||||||
### 1. 同步任务与调度优化
|
|
||||||
- 调度策略优化 :各同步任务(如 ContractSyncTask 、 VendorSyncTask )使用不同的调度间隔和策略,建议统一调度配置,避免重复执行和资源浪费
|
分模块:
|
||||||
- 增量同步实现 :多数同步任务缺乏断点续传机制,建议添加基于最后同步ID或时间戳的增量同步功能
|
- common:
|
||||||
- 任务依赖管理 :部分任务存在隐式依赖关系(如 OldVersionSyncVendorTask 中的多步骤执行),建议引入任务依赖管理机制
|
公共模块,包含实体类、公共的类、枚举、异常、工具类等
|
||||||
### 2. 线程池与异步处理
|
- server:
|
||||||
- 线程池配置 :当前项目未明确配置线程池参数(核心线程数、最大线程数等),建议在 SpringApp 中添加显式线程池配置
|
服务端模块,包含服务端的代码,依赖common模块
|
||||||
- 线程池隔离 :不同类型的任务(IO密集型、CPU密集型)应使用不同线程池,避免资源竞争
|
- client:
|
||||||
- 异步任务监控 :添加异步任务执行状态监控和超时处理机制,避免任务长时间阻塞
|
客户端模块,包含客户端的代码,依赖common模块
|
||||||
### 3. 缓存机制优化
|
|
||||||
- 缓存策略细化 :当前缓存配置较为简单( CaffeineCacheManager ),建议为不同类型数据配置差异化缓存策略(过期时间、最大容量等)
|
|
||||||
- 缓存一致性 :修复 CloudRkService 中缓存更新问题(注释中提到的"这个可以无法更新缓存")
|
|
||||||
- 缓存预热 :添加关键数据缓存预热机制,提高系统启动后响应速度
|
|
||||||
### 4. 依赖注入与懒加载
|
|
||||||
- 依赖注入规范化 :减少 SpringApp.getBean() 手动获取bean的方式,推广构造函数注入或字段注入
|
|
||||||
- 懒加载优化 :充分利用 @Lazy 注解和 BootstrapMode.LAZY 配置,优化应用启动性能
|
|
||||||
- 服务解耦 :继续推进服务拆分工作(如之前的 ContractService 拆分为专用服务),减少服务间耦合
|
|
||||||
### 5. 异常处理与重试机制
|
|
||||||
- 异常处理统一 :规范异常处理策略,确保所有异常都被适当记录和处理
|
|
||||||
- 重试机制添加 :为网络请求和数据库操作添加重试机制(如使用 Spring Retry )
|
|
||||||
- 熔断降级 :对外部系统调用(如用友U8接口)添加熔断降级机制,提高系统稳定性
|
|
||||||
### 6. 数据库操作优化
|
|
||||||
- 批量操作引入 :对大量数据的CRUD操作,建议使用批量处理API提高性能
|
|
||||||
- 查询优化 :添加适当索引,优化复杂查询,避免全表扫描
|
|
||||||
- 连接池配置 :优化 HikariDataSource 配置参数(如连接池大小、超时时间等)
|
|
||||||
### 7. 代码质量与维护性
|
|
||||||
- 重复代码消除 :提取同步任务中的共同逻辑(如进度更新、异常处理)为抽象基类
|
|
||||||
- 注释完善 :补充关键类和方法的文档注释,特别是复杂业务逻辑和优化点
|
|
||||||
- 技术债务清理 :解决代码中的TODO项(如 CloudRkService 中的缓存更新问题)
|
|
||||||
### 8. 配置管理优化
|
|
||||||
- 配置集中管理 :将分散在代码中的配置项(如同步间隔、批处理大小)集中到配置文件
|
|
||||||
- 动态配置支持 :添加动态配置更新机制,避免重启应用
|
|
||||||
以上优化点已按优先级和影响范围排序,建议逐步实施。实施过程中应注意性能测试和兼容性验证,确保优化不会引入新问题。
|
|
||||||
|
|||||||
107
client/pom.xml
Normal file
107
client/pom.xml
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ecep.contract</groupId>
|
||||||
|
<artifactId>Contract-Manager</artifactId>
|
||||||
|
<version>0.0.53-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>com.ecep.contract</groupId>
|
||||||
|
<artifactId>client</artifactId>
|
||||||
|
<version>0.0.53-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ecep.contract</groupId>
|
||||||
|
<artifactId>common</artifactId>
|
||||||
|
<version>0.0.53-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- JavaFX -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-controls</artifactId>
|
||||||
|
<version>${javafx.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-fxml</artifactId>
|
||||||
|
<version>${javafx.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-web</artifactId>
|
||||||
|
<version>${javafx.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.controlsfx</groupId>
|
||||||
|
<artifactId>controlsfx</artifactId>
|
||||||
|
<version>11.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Caffeine Cache -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.ben-manes.caffeine</groupId>
|
||||||
|
<artifactId>caffeine</artifactId>
|
||||||
|
<version>3.1.8</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Spring Context Support for CaffeineCacheManager -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.data</groupId>
|
||||||
|
<artifactId>spring-data-commons</artifactId>
|
||||||
|
<version>3.3.7</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-maven-plugin</artifactId>
|
||||||
|
<version>0.0.8</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>com.ecep.contract.manager.AppV2</mainClass>
|
||||||
|
<launcher>app</launcher>
|
||||||
|
<jlinkZipName>app-jlink</jlinkZipName>
|
||||||
|
<jlinkImageName>app-jlink-image</jlinkImageName>
|
||||||
|
<noManPages>true</noManPages>
|
||||||
|
<stripDebug>true</stripDebug>
|
||||||
|
<compress>2</compress>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>versions-maven-plugin</artifactId>
|
||||||
|
<version>2.16.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<inherited>true</inherited>
|
||||||
|
<id>increment-version</id>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>set</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<generateBackupPoms>false</generateBackupPoms>
|
||||||
|
<processAllModules>true</processAllModules>
|
||||||
|
<!-- <newVersion>${project.version}</newVersion> -->
|
||||||
|
<nextSnapshot>true</nextSnapshot>
|
||||||
|
<nextSnapshotIndexToIncrement>3</nextSnapshotIndexToIncrement>
|
||||||
|
<!-- <removeSnapshot>true</removeSnapshot>-->
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager;
|
package com.ecep.contract;
|
||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -25,9 +25,5 @@ public class AppV2 {
|
|||||||
System.out.println("AppV2.done");
|
System.out.println("AppV2.done");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String DEFAULT_DB_HOST = "10.84.209.154"; // "db-server1.ecctrl.com"
|
public static final String DEFAULT_HOST = "10.84.209.154";
|
||||||
public static final String DEFAULT_DB_PORT = "3306";
|
|
||||||
public static final String DEFAULT_DB_USERNAME = "supplier_ms";
|
|
||||||
public static final String DEFAULT_DB_PASSWORD = "[TPdseO!JKMmlrpf";
|
|
||||||
public static final String DEFAULT_DB_DATABASE = "supplier_ms";
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,28 @@
|
|||||||
package com.ecep.contract.manager;
|
package com.ecep.contract;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.FutureTask;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.BaseController;
|
||||||
|
import com.ecep.contract.controller.LoginWidowController;
|
||||||
|
import com.ecep.contract.task.TaskMonitorCenter;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CurrentEmployee;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.controller.LoginWidowController;
|
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
|
||||||
import com.ecep.contract.manager.ui.MessageHolder;
|
|
||||||
import com.ecep.contract.manager.ui.task.TaskMonitorCenter;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
@@ -19,18 +37,6 @@ import javafx.scene.text.Text;
|
|||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.StageStyle;
|
import javafx.stage.StageStyle;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.concurrent.*;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JavaFx 应用程序
|
* JavaFx 应用程序
|
||||||
@@ -122,6 +128,10 @@ public class Desktop extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<Void> runAsync(Runnable runnable) {
|
||||||
|
return CompletableFuture.runAsync(runnable, getExecutorService());
|
||||||
|
}
|
||||||
|
|
||||||
private void startSpringApp(Stage primaryStage, Parent root, FXMLLoader loader) {
|
private void startSpringApp(Stage primaryStage, Parent root, FXMLLoader loader) {
|
||||||
System.out.println("Desktop.startSpringApp");
|
System.out.println("Desktop.startSpringApp");
|
||||||
// 更新窗口标题
|
// 更新窗口标题
|
||||||
@@ -158,7 +168,7 @@ public class Desktop extends Application {
|
|||||||
|
|
||||||
holder.info("启动中,请稍后...");
|
holder.info("启动中,请稍后...");
|
||||||
|
|
||||||
CompletableFuture.runAsync(() -> {
|
runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
//
|
//
|
||||||
holder.info("读取配置文件...");
|
holder.info("读取配置文件...");
|
||||||
@@ -176,7 +186,7 @@ public class Desktop extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CompletableFuture.runAsync(() -> {
|
runAsync(() -> {
|
||||||
SpringApp.launch(properties, holder);
|
SpringApp.launch(properties, holder);
|
||||||
ConfigurableListableBeanFactory beanFactory = SpringApp.context.getBeanFactory();
|
ConfigurableListableBeanFactory beanFactory = SpringApp.context.getBeanFactory();
|
||||||
|
|
||||||
@@ -253,5 +263,4 @@ public class Desktop extends Application {
|
|||||||
}
|
}
|
||||||
scheduledExecutorService.close();
|
scheduledExecutorService.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager.util;
|
package com.ecep.contract;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -6,8 +6,6 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.manager.Desktop;
|
|
||||||
|
|
||||||
public class DesktopUtils {
|
public class DesktopUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
7
client/src/main/java/com/ecep/contract/Main.java
Normal file
7
client/src/main/java/com/ecep/contract/Main.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package com.ecep.contract;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello world!");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager;
|
package com.ecep.contract;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@@ -25,7 +25,6 @@ import org.springframework.cache.CacheManager;
|
|||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.cache.caffeine.CaffeineCacheManager;
|
import org.springframework.cache.caffeine.CaffeineCacheManager;
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.event.ContextClosedEvent;
|
import org.springframework.context.event.ContextClosedEvent;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
@@ -36,11 +35,7 @@ import org.springframework.core.metrics.StartupStep;
|
|||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
import com.ecep.contract.manager.cloud.CloudRepositoriesConfig;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.manager.ds.DsRepositoriesConfig;
|
|
||||||
import com.ecep.contract.manager.ui.MessageHolder;
|
|
||||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
@@ -50,15 +45,15 @@ import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
|||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||||
|
|
||||||
@SpringBootApplication(exclude = { org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration.class })
|
@SpringBootApplication
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
public class SpringApp {
|
public class SpringApp {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SpringApp.class);
|
private static final Logger logger = LoggerFactory.getLogger(SpringApp.class);
|
||||||
|
|
||||||
static SpringApplication application;
|
public static SpringApplication application;
|
||||||
static ConfigurableApplicationContext context;
|
public static ConfigurableApplicationContext context;
|
||||||
|
|
||||||
public static <T> T getBean(Class<T> requiredType) throws BeansException {
|
public static <T> T getBean(Class<T> requiredType) throws BeansException {
|
||||||
return context.getBean(requiredType);
|
return context.getBean(requiredType);
|
||||||
@@ -92,11 +87,6 @@ public class SpringApp {
|
|||||||
environment.getPropertySources().addLast(new PropertiesPropertySource("dynamicProperties", properties));
|
environment.getPropertySources().addLast(new PropertiesPropertySource("dynamicProperties", properties));
|
||||||
// app.getBeanFactory().registerSingleton("dataSource", dataSource());
|
// app.getBeanFactory().registerSingleton("dataSource", dataSource());
|
||||||
logger.debug("app = {}", app);
|
logger.debug("app = {}", app);
|
||||||
|
|
||||||
if (app instanceof AnnotationConfigApplicationContext ctx) {
|
|
||||||
ctx.register(DsRepositoriesConfig.class);
|
|
||||||
ctx.register(CloudRepositoriesConfig.class);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
startup.start("");
|
startup.start("");
|
||||||
@@ -108,7 +98,7 @@ public class SpringApp {
|
|||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
// 在这里调用 startup 性能分析
|
// 在这里调用 startup 性能分析
|
||||||
analyzeStartupPerformance(startup);
|
analyzeStartupPerformance(startup);
|
||||||
});
|
}, Desktop.instance.getExecutorService());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.ecep.contract.manager.ui;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import com.ecep.contract.manager.ds.other.vo.IdentityViewModel;
|
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.service.ViewModelService;
|
||||||
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
@@ -1,11 +1,20 @@
|
|||||||
package com.ecep.contract.manager.ui;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
|
import com.ecep.contract.controller.tab.RefreshableSkin;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.service.ViewModelService;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.BaseViewModel;
|
||||||
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.BaseViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.IdentityViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.binding.BooleanBinding;
|
import javafx.beans.binding.BooleanBinding;
|
||||||
@@ -18,12 +27,6 @@ import javafx.stage.WindowEvent;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public abstract class AbstEntityController<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
public abstract class AbstEntityController<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
extends BaseController {
|
extends BaseController {
|
||||||
|
|
||||||
@@ -1,15 +1,17 @@
|
|||||||
package com.ecep.contract.manager.ui;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ui.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.manager.ui.table.TableTabSkin;
|
import com.ecep.contract.controller.table.TableTabSkin;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -18,10 +20,10 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.manager.ds.other.vo.IdentityViewModel;
|
import com.ecep.contract.service.ViewModelService;
|
||||||
import com.ecep.contract.manager.util.TableViewUtils;
|
import com.ecep.contract.util.TableViewUtils;
|
||||||
import com.ecep.contract.manager.util.UITools;
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.Property;
|
import javafx.beans.property.Property;
|
||||||
@@ -43,12 +45,15 @@ import javafx.scene.input.KeyEvent;
|
|||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 实体管理器皮肤
|
||||||
|
* 提供了实体管理器的基本功能,如查询、新增、删除、修改、分页等
|
||||||
|
*
|
||||||
* @param <T> Entity 的类型
|
* @param <T> Entity 的类型
|
||||||
* @param <TV> Entity 对应的ViewModel
|
* @param <TV> Entity 对应的ViewModel
|
||||||
* @param <Skin> Skin 的类型
|
* @param <SKIN> Skin 的类型
|
||||||
* @param <C>
|
* @param <C>
|
||||||
*/
|
*/
|
||||||
public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>, Skin extends ManagerSkin, C extends AbstManagerWindowController<T, TV, Skin>>
|
public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>, SKIN extends ManagerSkin, C extends AbstManagerWindowController<T, TV, SKIN>>
|
||||||
implements ManagerSkin, TableTabSkin<T, TV>, EditableEntityTableTabSkin<T, TV> {
|
implements ManagerSkin, TableTabSkin<T, TV>, EditableEntityTableTabSkin<T, TV> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(AbstEntityManagerSkin.class);
|
private static final Logger logger = LoggerFactory.getLogger(AbstEntityManagerSkin.class);
|
||||||
/**
|
/**
|
||||||
@@ -61,6 +66,10 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
|
|
||||||
protected PageRequest currentPageable = PageRequest.ofSize(25);
|
protected PageRequest currentPageable = PageRequest.ofSize(25);
|
||||||
protected final SimpleIntegerProperty currentPageNumber = new SimpleIntegerProperty();
|
protected final SimpleIntegerProperty currentPageNumber = new SimpleIntegerProperty();
|
||||||
|
// 是否允许调整表格高度
|
||||||
|
private boolean allowResize = true;
|
||||||
|
// 记录延时任务信息
|
||||||
|
private ScheduledFuture<?> loadTableDataSetFuture;
|
||||||
|
|
||||||
public AbstEntityManagerSkin(C controller) {
|
public AbstEntityManagerSkin(C controller) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
@@ -199,6 +208,9 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
* 根据表格高度重新计算分页的页大小
|
* 根据表格高度重新计算分页的页大小
|
||||||
*/
|
*/
|
||||||
private void resizeTable(Object observable, Bounds old, Bounds newBounds) {
|
private void resizeTable(Object observable, Bounds old, Bounds newBounds) {
|
||||||
|
if (!allowResize) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
double tableHeight = newBounds.getHeight();
|
double tableHeight = newBounds.getHeight();
|
||||||
if (tableHeight <= 0) {
|
if (tableHeight <= 0) {
|
||||||
return;
|
return;
|
||||||
@@ -208,8 +220,13 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
if (lookup != null) {
|
if (lookup != null) {
|
||||||
double rowHeight = lookup.prefHeight(-1);
|
double rowHeight = lookup.prefHeight(-1);
|
||||||
int rows = (int) Math.round(table.getHeight() / rowHeight) - 1;
|
int rows = (int) Math.round(table.getHeight() / rowHeight) - 1;
|
||||||
int pageNumber = (int) Math.abs(currentPageable.getOffset() / rows);
|
// 只有当行数变化超过一定阈值时才重新加载数据
|
||||||
|
int currentRows = currentPageable.getPageSize();
|
||||||
|
if (Math.abs(rows - currentRows) <= 2) {
|
||||||
|
return; // 避免微小变化导致频繁刷新
|
||||||
|
}
|
||||||
|
|
||||||
|
int pageNumber = (int) Math.abs(currentPageable.getOffset() / rows);
|
||||||
if (currentPageable.getPageNumber() == pageNumber && currentPageable.getPageSize() == rows) {
|
if (currentPageable.getPageNumber() == pageNumber && currentPageable.getPageSize() == rows) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -259,9 +276,17 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <K> void acceptCellEditEvent(TableColumn.CellEditEvent<TV, K> event, Function<TV, Property<K>> function) {
|
/**
|
||||||
|
* 处理单元格编辑事件
|
||||||
|
*
|
||||||
|
* @param <K>
|
||||||
|
* @param event
|
||||||
|
* @param propGetter
|
||||||
|
*/
|
||||||
|
protected <K> void acceptCellEditEvent(TableColumn.CellEditEvent<TV, K> event,
|
||||||
|
Function<TV, Property<K>> propGetter) {
|
||||||
TV row = event.getRowValue();
|
TV row = event.getRowValue();
|
||||||
Property<K> property = function.apply(row);
|
Property<K> property = propGetter.apply(row);
|
||||||
property.setValue(event.getNewValue());
|
property.setValue(event.getNewValue());
|
||||||
try {
|
try {
|
||||||
saveRowData(row);
|
saveRowData(row);
|
||||||
@@ -317,21 +342,47 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
row.saveInFxApplicationThread(service);
|
row.saveInFxApplicationThread(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载行数据
|
||||||
|
*
|
||||||
|
* @param row
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public T loadRowData(TV row) {
|
public T loadRowData(TV row) {
|
||||||
return getViewModelService().findById(row.getId().get());
|
if (row.getId() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
T entity = getViewModelService().findById(row.getId().get());
|
||||||
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除行数据
|
||||||
|
*
|
||||||
|
* @param entity
|
||||||
|
*/
|
||||||
public void deleteRowData(T entity) {
|
public void deleteRowData(T entity) {
|
||||||
|
if (entity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ViewModelService<T, TV> service = getViewModelService();
|
||||||
getViewModelService().delete(entity);
|
getViewModelService().delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存行数据
|
||||||
|
*
|
||||||
|
* @param entity
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public T saveRowData(T entity) {
|
public T saveRowData(T entity) {
|
||||||
|
if (entity == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ViewModelService<T, TV> service = getViewModelService();
|
||||||
return getViewModelService().save(entity);
|
return getViewModelService().save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 记录延时任务信息
|
|
||||||
private ScheduledFuture<?> loadTableDataSetFuture;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadTableDataSet() {
|
public void loadTableDataSet() {
|
||||||
loadTableDataSet(false);
|
loadTableDataSet(false);
|
||||||
@@ -359,6 +410,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
private CompletableFuture<Void> _reloadTableData() {
|
private CompletableFuture<Void> _reloadTableData() {
|
||||||
CompletableFuture<Void> future = new CompletableFuture<>();
|
CompletableFuture<Void> future = new CompletableFuture<>();
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
allowResize = false; // 禁用调整
|
||||||
dataSet.clear();
|
dataSet.clear();
|
||||||
runAsync(() -> {
|
runAsync(() -> {
|
||||||
controller.setStatus("载入中...");
|
controller.setStatus("载入中...");
|
||||||
@@ -366,8 +418,10 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
try {
|
try {
|
||||||
updateTableDataSet(models);
|
updateTableDataSet(models);
|
||||||
|
allowResize = true; // 恢复调整
|
||||||
future.complete(null);
|
future.complete(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
allowResize = true; // 恢复调整
|
||||||
future.completeExceptionally(e);
|
future.completeExceptionally(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -379,20 +433,46 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新表格数据
|
||||||
|
*
|
||||||
|
* @param models
|
||||||
|
*/
|
||||||
protected void updateTableDataSet(List<TV> models) {
|
protected void updateTableDataSet(List<TV> models) {
|
||||||
long timeMillis = System.currentTimeMillis();
|
long timeMillis = System.currentTimeMillis();
|
||||||
dataSet.setAll(models);
|
// 清除所有选择状态,避免选择状态混乱
|
||||||
|
if (getTableView() != null && getTableView().getSelectionModel() != null) {
|
||||||
|
getTableView().getSelectionModel().clearSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 先清空再设置新数据,避免数据叠加
|
||||||
|
dataSet.clear();
|
||||||
|
if (models != null) {
|
||||||
|
dataSet.addAll(models);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 强制刷新表格布局
|
||||||
|
if (getTableView() != null) {
|
||||||
|
getTableView().requestLayout();
|
||||||
|
getTableView().refresh();
|
||||||
|
}
|
||||||
|
|
||||||
long timeCost = System.currentTimeMillis() - timeMillis;
|
long timeCost = System.currentTimeMillis() - timeMillis;
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("update table dataSet cost: {} ms", timeCost);
|
logger.debug("update table dataSet cost: {} ms", timeCost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载表格数据
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
protected List<TV> loadTableData() {
|
protected List<TV> loadTableData() {
|
||||||
Specification<T> spec = getSpecification();
|
Map<String, Object> params = getSpecification();
|
||||||
ViewModelService<T, TV> service = getViewModelService();
|
ViewModelService<T, TV> service = getViewModelService();
|
||||||
long timeMillis = System.currentTimeMillis();
|
long timeMillis = System.currentTimeMillis();
|
||||||
Page<T> page = service.findAll(spec, getPageable());
|
Page<T> page = service.findAll(params, getPageable());
|
||||||
long timeCost = System.currentTimeMillis() - timeMillis;
|
long timeCost = System.currentTimeMillis() - timeMillis;
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("load table data cost: {} ms", timeCost);
|
logger.debug("load table data cost: {} ms", timeCost);
|
||||||
@@ -404,17 +484,25 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
return page.map(service::from).toList();
|
return page.map(service::from).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取ViewModelService
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
protected ViewModelService<T, TV> getViewModelService() {
|
protected ViewModelService<T, TV> getViewModelService() {
|
||||||
ViewModelService<T, TV> service = controller.getViewModelService();
|
ViewModelService<T, TV> service = controller.getViewModelService();
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
if (logger.isWarnEnabled()) {
|
throw new IllegalArgumentException("ViewModelService is null");
|
||||||
logger.warn("ViewModelService is null");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Specification<T> getSpecification() {
|
/**
|
||||||
|
* 获取查询条件
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getSpecification() {
|
||||||
TextField field = controller.searchKeyField;
|
TextField field = controller.searchKeyField;
|
||||||
if (field != null) {
|
if (field != null) {
|
||||||
return getViewModelService().getSpecification(field.getText());
|
return getViewModelService().getSpecification(field.getText());
|
||||||
@@ -422,8 +510,14 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Specification<T> getSpecification(String searchText) {
|
/**
|
||||||
return controller.getViewModelService().getSpecification(searchText);
|
* 获取查询条件
|
||||||
|
*
|
||||||
|
* @param searchText
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected Map<String, Object> getSpecification(String searchText) {
|
||||||
|
return getViewModelService().getSpecification(searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -434,6 +528,11 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
protected void onTableRowDoubleClickedAction(TV item) {
|
protected void onTableRowDoubleClickedAction(TV item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新页脚
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
*/
|
||||||
protected void updateFooter(Page<T> page) {
|
protected void updateFooter(Page<T> page) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
controller.previousPageBtn.setDisable(!page.hasPrevious());
|
controller.previousPageBtn.setDisable(!page.hasPrevious());
|
||||||
@@ -444,19 +543,44 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取表格排序
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public List<Sort.Order> getTableOrders() {
|
public List<Sort.Order> getTableOrders() {
|
||||||
return TableViewUtils.getOrders(getTableView());
|
return TableViewUtils.getOrders(getTableView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取表格排序
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Sort getSortByTable() {
|
public Sort getSortByTable() {
|
||||||
|
if (getTableView() == null) {
|
||||||
|
return Sort.unsorted();
|
||||||
|
}
|
||||||
return Sort.by(getTableOrders());
|
return Sort.by(getTableOrders());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取分页参数
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Pageable getPageable() {
|
public Pageable getPageable() {
|
||||||
Sort sort = getSortByTable();
|
Sort sort = getSortByTable();
|
||||||
return currentPageable.withSort(sort);
|
return currentPageable.withSort(sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示在当前窗口为父窗口的新窗口
|
||||||
|
*
|
||||||
|
* @param <Controller> 控制器类型
|
||||||
|
* @param clz 控制器类
|
||||||
|
* @param model 数据
|
||||||
|
*/
|
||||||
protected <Controller extends AbstEntityController<T, TV>> void showInOwner(Class<Controller> clz, TV model) {
|
protected <Controller extends AbstEntityController<T, TV>> void showInOwner(Class<Controller> clz, TV model) {
|
||||||
BaseController.show(clz, model, getTableView().getScene().getWindow());
|
BaseController.show(clz, model, getTableView().getScene().getWindow());
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.ecep.contract.manager.ui;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.manager.ds.other.vo.IdentityViewModel;
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
@@ -41,6 +41,4 @@ public abstract class AbstManagerWindowController<T extends IdentityEntity, TV e
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,32 @@
|
|||||||
package com.ecep.contract.manager.ui;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.beans.PropertyDescriptor;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.FxmlUtils;
|
||||||
|
import org.apache.logging.log4j.util.Strings;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
|
||||||
|
import com.ecep.contract.Desktop;
|
||||||
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.service.EmployeeService;
|
||||||
|
import com.ecep.contract.service.SysConfService;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CurrentEmployee;
|
||||||
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.Desktop;
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeService;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.SysConfService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.IdentityViewModel;
|
|
||||||
import com.ecep.contract.manager.util.FxmlUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
@@ -21,21 +39,6 @@ import javafx.stage.Stage;
|
|||||||
import javafx.stage.Window;
|
import javafx.stage.Window;
|
||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
|
||||||
import org.apache.logging.log4j.util.Strings;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.beans.BeansException;
|
|
||||||
|
|
||||||
import java.beans.PropertyDescriptor;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class BaseController {
|
public class BaseController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(BaseController.class);
|
private static final Logger logger = LoggerFactory.getLogger(BaseController.class);
|
||||||
@@ -45,7 +48,8 @@ public class BaseController {
|
|||||||
return show(clz, owner, null);
|
return show(clz, owner, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends BaseController> CompletableFuture<Void> show(Class<T> clz, Window owner, Consumer<T> consumer) {
|
public static <T extends BaseController> CompletableFuture<Void> show(Class<T> clz, Window owner,
|
||||||
|
Consumer<T> consumer) {
|
||||||
String key = clz.getName();
|
String key = clz.getName();
|
||||||
if (toFront(key)) {
|
if (toFront(key)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -65,8 +69,8 @@ public class BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static <K extends IdentityEntity, M extends IdentityViewModel<K>, T extends BaseController>
|
public static <K extends IdentityEntity, M extends IdentityViewModel<K>, T extends BaseController> void show(
|
||||||
void show(Class<T> clz, M viewModel, Window owner) {
|
Class<T> clz, M viewModel, Window owner) {
|
||||||
String key = getKey(clz, viewModel);
|
String key = getKey(clz, viewModel);
|
||||||
if (toFront(key)) {
|
if (toFront(key)) {
|
||||||
return;
|
return;
|
||||||
@@ -76,7 +80,6 @@ public class BaseController {
|
|||||||
throw new RuntimeException("@FxmlPath is required");
|
throw new RuntimeException("@FxmlPath is required");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FxmlUtils.newLoaderAsyncWithRunLater(annotation.value(), null, loader -> {
|
FxmlUtils.newLoaderAsyncWithRunLater(annotation.value(), null, loader -> {
|
||||||
T controller = loader.getController();
|
T controller = loader.getController();
|
||||||
if (controller instanceof AbstEntityController<?, ?>) {
|
if (controller instanceof AbstEntityController<?, ?>) {
|
||||||
@@ -114,7 +117,6 @@ public class BaseController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static boolean toFront(String key) {
|
public static boolean toFront(String key) {
|
||||||
Stage stage = stages.get(key);
|
Stage stage = stages.get(key);
|
||||||
if (stage != null) {
|
if (stage != null) {
|
||||||
@@ -161,6 +163,11 @@ public class BaseController {
|
|||||||
return future;
|
return future;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<Void> runAsync(Runnable runnable) {
|
||||||
|
return CompletableFuture.runAsync(runnable, Desktop.instance.getExecutorService())
|
||||||
|
.exceptionally(this::handleException);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 窗口标题
|
* 窗口标题
|
||||||
*/
|
*/
|
||||||
@@ -177,33 +184,30 @@ public class BaseController {
|
|||||||
private String stageKey;
|
private String stageKey;
|
||||||
public Label leftStatusLabel;
|
public Label leftStatusLabel;
|
||||||
public Label rightStatusLabel;
|
public Label rightStatusLabel;
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
private Locale locale = Locale.getDefault();
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private SysConfService confService;
|
|
||||||
@Setter
|
|
||||||
private EmployeeService employeeService;
|
|
||||||
private Employee currentUser;
|
private Employee currentUser;
|
||||||
|
|
||||||
protected <T> T getBean(Class<T> requiredType) throws BeansException {
|
private HashMap<Class<?>, Object> cachedBeans = new HashMap<>();
|
||||||
|
|
||||||
|
public <T> T getBean(Class<T> requiredType) throws BeansException {
|
||||||
return SpringApp.getBean(requiredType);
|
return SpringApp.getBean(requiredType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SysConfService getConfService() {
|
@SuppressWarnings("unchecked")
|
||||||
if (confService == null) {
|
public <T> T getCachedBean(Class<T> requiredType) throws BeansException {
|
||||||
confService = getBean(SysConfService.class);
|
Object object = cachedBeans.get(requiredType);
|
||||||
|
if (object == null) {
|
||||||
|
object = getBean(requiredType);
|
||||||
|
cachedBeans.put(requiredType, object);
|
||||||
}
|
}
|
||||||
return confService;
|
return (T) object;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysConfService getConfService() {
|
||||||
|
return getCachedBean(SysConfService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmployeeService getEmployeeService() {
|
public EmployeeService getEmployeeService() {
|
||||||
if (employeeService == null) {
|
return getCachedBean(EmployeeService.class);
|
||||||
employeeService = getBean(EmployeeService.class);
|
|
||||||
}
|
|
||||||
return employeeService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Employee getCurrentUser() {
|
public Employee getCurrentUser() {
|
||||||
@@ -213,6 +217,18 @@ public class BaseController {
|
|||||||
return currentUser;
|
return currentUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CurrentEmployee getCurrentEmployee() {
|
||||||
|
return Desktop.instance.getActiveEmployee();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Locale getLocale() {
|
||||||
|
CurrentEmployee currentEmployee = getCurrentEmployee();
|
||||||
|
if (currentEmployee == null) {
|
||||||
|
return Locale.getDefault();
|
||||||
|
}
|
||||||
|
return currentEmployee.localeProperty().get();
|
||||||
|
}
|
||||||
|
|
||||||
public String getMessage(String code, Object... args) {
|
public String getMessage(String code, Object... args) {
|
||||||
return SpringApp.getMessage(code, args, getLocale());
|
return SpringApp.getMessage(code, args, getLocale());
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
package com.ecep.contract.manager.cloud.rk;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.manager.ui.table.cell.CompanyTableCell;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.manager.ds.company.controller.CompanyWindowController;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
import com.ecep.contract.model.CloudRk;
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.manager.ui.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.service.CloudRkService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.vm.CloudRkViewModel;
|
||||||
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -19,7 +21,7 @@ import javafx.scene.control.cell.CheckBoxTableCell;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class CloudRkManagerSkin
|
public class CloudRkManagerSkin
|
||||||
extends AbstEntityManagerSkin<CloudRk, CloudRkInfoViewModel, CloudRkManagerSkin, CloudRkManagerWindowController> {
|
extends AbstEntityManagerSkin<CloudRk, CloudRkViewModel, CloudRkManagerSkin, CloudRkManagerWindowController> {
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
|
|
||||||
@@ -47,13 +49,14 @@ public class CloudRkManagerSkin
|
|||||||
|
|
||||||
controller.cloudIdColumn.setCellValueFactory(param -> param.getValue().getCloudId());
|
controller.cloudIdColumn.setCellValueFactory(param -> param.getValue().getCloudId());
|
||||||
|
|
||||||
controller.latestUpdateColumn.setCellValueFactory(param -> param.getValue().getLatest());
|
controller.latestUpdateColumn.setCellValueFactory(param -> param.getValue().getLatestUpdate());
|
||||||
controller.latestUpdateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
controller.latestUpdateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||||
|
|
||||||
controller.cloudLatestColumn.setCellValueFactory(param -> param.getValue().getCloudLatest());
|
controller.cloudLatestColumn.setCellValueFactory(param -> param.getValue().getCloudLatest());
|
||||||
controller.cloudLatestColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
controller.cloudLatestColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||||
|
|
||||||
controller.cloudBlackListUpdatedColumn.setCellValueFactory(param -> param.getValue().getCloudBlackListUpdated());
|
controller.cloudBlackListUpdatedColumn
|
||||||
|
.setCellValueFactory(param -> param.getValue().getCloudBlackListUpdated());
|
||||||
controller.cloudBlackListUpdatedColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
controller.cloudBlackListUpdatedColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||||
|
|
||||||
controller.cloudEntUpdateColumn.setCellValueFactory(param -> param.getValue().getCloudEntUpdate());
|
controller.cloudEntUpdateColumn.setCellValueFactory(param -> param.getValue().getCloudEntUpdate());
|
||||||
@@ -65,13 +68,12 @@ public class CloudRkManagerSkin
|
|||||||
controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onAutoUpdateColumnEditCommit(TableColumn.CellEditEvent<CloudRkInfoViewModel, Boolean> event) {
|
private void onAutoUpdateColumnEditCommit(TableColumn.CellEditEvent<CloudRkViewModel, Boolean> event) {
|
||||||
CloudRkInfoViewModel row = event.getRowValue();
|
CloudRkViewModel row = event.getRowValue();
|
||||||
row.getAutoUpdate().set(event.getNewValue());
|
row.getAutoUpdate().set(event.getNewValue());
|
||||||
saveRowData(row);
|
saveRowData(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createContextMenu(ContextMenu contextMenu) {
|
protected void createContextMenu(ContextMenu contextMenu) {
|
||||||
MenuItem item2 = new MenuItem("刷新");
|
MenuItem item2 = new MenuItem("刷新");
|
||||||
@@ -89,19 +91,19 @@ public class CloudRkManagerSkin
|
|||||||
* @param event event
|
* @param event event
|
||||||
*/
|
*/
|
||||||
public void onTableClearDescriptionAction(ActionEvent event) {
|
public void onTableClearDescriptionAction(ActionEvent event) {
|
||||||
ObservableList<CloudRkInfoViewModel> selectedItems = getTableView().getSelectionModel().getSelectedItems();
|
ObservableList<CloudRkViewModel> selectedItems = getTableView().getSelectionModel().getSelectedItems();
|
||||||
if (selectedItems.isEmpty()) {
|
if (selectedItems.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CloudRkService service = getCloudRkService();
|
CloudRkService service = getCloudRkService();
|
||||||
for (CloudRkInfoViewModel selectedItem : selectedItems) {
|
for (CloudRkViewModel selectedItem : selectedItems) {
|
||||||
selectedItem.getDescription().set("");
|
selectedItem.getDescription().set("");
|
||||||
selectedItem.saveInFxApplicationThread(service);
|
selectedItem.saveInFxApplicationThread(service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableRowDoubleClickedAction(CloudRkInfoViewModel item) {
|
protected void onTableRowDoubleClickedAction(CloudRkViewModel item) {
|
||||||
Company company = item.getCompany().get();
|
Company company = item.getCompany().get();
|
||||||
if (!Hibernate.isInitialized(item)) {
|
if (!Hibernate.isInitialized(item)) {
|
||||||
company = getCompanyService().findById(company.getId());
|
company = getCompanyService().findById(company.getId());
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.Message;
|
||||||
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.model.CloudRk;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.service.CloudRkService;
|
||||||
|
import com.ecep.contract.task.CloudRkSyncTask;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CloudRkViewModel;
|
||||||
|
|
||||||
|
import javafx.concurrent.Task;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Scope("prototype")
|
||||||
|
@Component
|
||||||
|
@FxmlPath("/ui/cloud/rk_manager.fxml")
|
||||||
|
public class CloudRkManagerWindowController
|
||||||
|
extends AbstManagerWindowController<CloudRk, CloudRkViewModel, CloudRkManagerSkin> {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CloudRkManagerWindowController.class);
|
||||||
|
|
||||||
|
public static void show() {
|
||||||
|
show(CloudRkManagerWindowController.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CloudRkService cloudRkService;
|
||||||
|
|
||||||
|
public TableColumn<CloudRkViewModel, Number> idColumn;
|
||||||
|
public TableColumn<CloudRkViewModel, LocalDateTime> latestUpdateColumn;
|
||||||
|
|
||||||
|
public TableColumn<CloudRkViewModel, Company> companyColumn;
|
||||||
|
public TableColumn<CloudRkViewModel, String> cloudIdColumn;
|
||||||
|
public TableColumn<CloudRkViewModel, LocalDateTime> cloudLatestColumn;
|
||||||
|
public TableColumn<CloudRkViewModel, LocalDateTime> cloudBlackListUpdatedColumn;
|
||||||
|
public TableColumn<CloudRkViewModel, LocalDateTime> cloudEntUpdateColumn;
|
||||||
|
public TableColumn<CloudRkViewModel, Boolean> autoUpdateColumn;
|
||||||
|
public TableColumn<CloudRkViewModel, String> descriptionColumn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CloudRkManagerSkin createDefaultSkin() {
|
||||||
|
return new CloudRkManagerSkin(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShown(WindowEvent windowEvent) {
|
||||||
|
super.onShown(windowEvent);
|
||||||
|
getTitle().set("数据源:集团相关方");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initializeTask(Task<Object> task, String prefix, Consumer<String> consumer) {
|
||||||
|
task.setOnScheduled(e -> {
|
||||||
|
consumer.accept("正在从相关方平台同步" + prefix + ",请稍后...");
|
||||||
|
});
|
||||||
|
task.setOnRunning(e -> {
|
||||||
|
consumer.accept("开始" + prefix + "...");
|
||||||
|
});
|
||||||
|
task.setOnSucceeded(e -> {
|
||||||
|
consumer.accept(prefix + "完成...");
|
||||||
|
});
|
||||||
|
task.exceptionProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
consumer.accept(newValue.getMessage());
|
||||||
|
logger.error("{} 发生异常", prefix, newValue);
|
||||||
|
});
|
||||||
|
SpringApp.getBean(ScheduledExecutorService.class).submit(task);
|
||||||
|
consumer.accept("任务已创建...");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDataRepairAction(ActionEvent event) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSyncAction(ActionEvent event) {
|
||||||
|
CloudRkSyncTask task = new CloudRkSyncTask();
|
||||||
|
UITools.showTaskDialogAndWait("同步数据", task, consumer -> {
|
||||||
|
initializeTask(task, "同步数据", msg -> consumer.accept(Message.info(msg)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloudRkService getViewModelService() {
|
||||||
|
return cloudRkService;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,23 @@
|
|||||||
package com.ecep.contract.manager.cloud.tyc;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.manager.ui.table.cell.CompanyTableCell;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.manager.ds.company.controller.CompanyWindowController;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
import com.ecep.contract.model.CloudTyc;
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.manager.ui.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.service.CloudTycService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.vm.CloudTycInfoViewModel;
|
||||||
|
|
||||||
import jakarta.persistence.criteria.Path;
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
@@ -52,23 +54,10 @@ public class CloudTycManagerSkin
|
|||||||
@Override
|
@Override
|
||||||
protected List<CloudTycInfoViewModel> loadTableData() {
|
protected List<CloudTycInfoViewModel> loadTableData() {
|
||||||
String searchText = controller.searchKeyField.getText();
|
String searchText = controller.searchKeyField.getText();
|
||||||
Specification<CloudTyc> spec = null;
|
Map<String, Object> spec = new HashMap<>();
|
||||||
if (StringUtils.hasText(searchText)) {
|
if (StringUtils.hasText(searchText)) {
|
||||||
|
spec.put("searchText", searchText);
|
||||||
Specification<CloudTyc> companySpec = (root, query, builder) -> {
|
|
||||||
Path<Object> company = root.get("company");
|
|
||||||
return builder.or(
|
|
||||||
builder.like(company.get("name"), "%" + searchText + "%"),
|
|
||||||
builder.like(company.get("shortName"), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
|
|
||||||
Specification<CloudTyc> cloudIdSpec = (root, query, builder) -> {
|
|
||||||
return builder.like(root.get("cloudId"), "%" + searchText + "%");
|
|
||||||
};
|
|
||||||
|
|
||||||
spec = Specification.anyOf(companySpec, cloudIdSpec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Page<CloudTyc> page = getCloudTycService().findAll(spec, getPageable());
|
Page<CloudTyc> page = getCloudTycService().findAll(spec, getPageable());
|
||||||
updateFooter(page);
|
updateFooter(page);
|
||||||
return page.map(CloudTycInfoViewModel::from).toList();
|
return page.map(CloudTycInfoViewModel::from).toList();
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.model.CloudTyc;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.service.CloudTycService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.CloudTycInfoViewModel;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 天眼查信息管理窗口控制器
|
||||||
|
*/
|
||||||
|
@Lazy
|
||||||
|
@Scope("prototype")
|
||||||
|
@Component
|
||||||
|
@FxmlPath("/ui/cloud/tyc_manager.fxml")
|
||||||
|
public class CloudTycManagerWindowController
|
||||||
|
extends AbstManagerWindowController<CloudTyc, CloudTycInfoViewModel, CloudTycManagerSkin> {
|
||||||
|
|
||||||
|
public static void show() {
|
||||||
|
show(CloudTycManagerWindowController.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CloudTycService cloudTycService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public TableColumn<CloudTycInfoViewModel, Number> idColumn;
|
||||||
|
@FXML
|
||||||
|
public TableColumn<CloudTycInfoViewModel, LocalDateTime> latestUpdateColumn;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public TableColumn<CloudTycInfoViewModel, Company> companyColumn;
|
||||||
|
@FXML
|
||||||
|
public TableColumn<CloudTycInfoViewModel, String> cloudIdColumn;
|
||||||
|
@FXML
|
||||||
|
public TableColumn<CloudTycInfoViewModel, LocalDateTime> cloudLatestColumn;
|
||||||
|
@FXML
|
||||||
|
public TableColumn<CloudTycInfoViewModel, Number> scoreColumn;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public TableColumn<CloudTycInfoViewModel, String> descriptionColumn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloudTycService getViewModelService() {
|
||||||
|
return cloudTycService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CloudTycManagerSkin createDefaultSkin() {
|
||||||
|
return new CloudTycManagerSkin(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show(Stage stage) {
|
||||||
|
super.show(stage);
|
||||||
|
getTitle().set("数据源:天眼查");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
package com.ecep.contract.manager.ui;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.model.BaseEnumEntity;
|
||||||
|
import com.ecep.contract.model.BasedEntity;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.model.NamedEntity;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.BaseEnumEntity;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Entity;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.IdentityEntity;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.NamedEntity;
|
|
||||||
import javafx.beans.property.Property;
|
import javafx.beans.property.Property;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
import javafx.scene.control.ListCell;
|
import javafx.scene.control.ListCell;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ComboBoxUtils {
|
public class ComboBoxUtils {
|
||||||
|
|
||||||
@@ -19,7 +21,7 @@ public class ComboBoxUtils {
|
|||||||
if (t == null) {
|
if (t == null) {
|
||||||
return "全部";
|
return "全部";
|
||||||
}
|
}
|
||||||
if (t instanceof Entity e) {
|
if (t instanceof BasedEntity e) {
|
||||||
return e.toPrettyString();
|
return e.toPrettyString();
|
||||||
}
|
}
|
||||||
if (t instanceof BaseEnumEntity<?> e) {
|
if (t instanceof BaseEnumEntity<?> e) {
|
||||||
@@ -44,7 +46,7 @@ public class ComboBoxUtils {
|
|||||||
if (t == null) {
|
if (t == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (t instanceof Entity e) {
|
if (t instanceof BasedEntity e) {
|
||||||
if (e.toPrettyString().equals(string)) {
|
if (e.toPrettyString().equals(string)) {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.ecep.contract.manager;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import org.springframework.context.ApplicationEvent;
|
||||||
|
|
||||||
|
import com.ecep.contract.vm.CurrentEmployee;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springframework.context.ApplicationEvent;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class CurrentEmployeeInitialedEvent extends ApplicationEvent {
|
public class CurrentEmployeeInitialedEvent extends ApplicationEvent {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,32 +14,25 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.manager.CurrentEmployee;
|
import com.ecep.contract.Desktop;
|
||||||
import com.ecep.contract.manager.CurrentEmployeeInitialedEvent;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import com.ecep.contract.manager.Desktop;
|
import com.ecep.contract.controller.bank.BankManagerWindowController;
|
||||||
import com.ecep.contract.manager.cloud.old.OldVersionService;
|
import com.ecep.contract.controller.company.CompanyManagerWindowController;
|
||||||
import com.ecep.contract.manager.cloud.rk.CloudRkManagerWindowController;
|
import com.ecep.contract.controller.contract.ContractManagerWindowController;
|
||||||
import com.ecep.contract.manager.cloud.rk.CloudRkService;
|
import com.ecep.contract.controller.customer.CompanyCustomerManagerWindowController;
|
||||||
import com.ecep.contract.manager.cloud.tyc.CloudTycManagerWindowController;
|
import com.ecep.contract.controller.department.DepartmentManagerWindowController;
|
||||||
import com.ecep.contract.manager.cloud.u8.ContractSyncTask;
|
import com.ecep.contract.controller.employee.EmployeeManagerWindowController;
|
||||||
import com.ecep.contract.manager.cloud.u8.YongYouU8ManagerWindowController;
|
import com.ecep.contract.controller.inventory.InventoryManagerWindowController;
|
||||||
import com.ecep.contract.manager.cloud.u8.YongYouU8Service;
|
import com.ecep.contract.controller.permission.EmployeeFunctionsManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.company.controller.CompanyManagerWindowController;
|
import com.ecep.contract.controller.permission.EmployeeRoleManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.contract.controller.ContractManagerWindowController;
|
import com.ecep.contract.controller.project.ProjectManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.customer.controller.CompanyCustomerManagerWindowController;
|
import com.ecep.contract.controller.vendor.CompanyVendorManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.other.controller.bank.BankManagerWindowController;
|
import com.ecep.contract.service.CloudRkService;
|
||||||
import com.ecep.contract.manager.ds.other.controller.department.DepartmentManagerWindowController;
|
import com.ecep.contract.service.YongYouU8Service;
|
||||||
import com.ecep.contract.manager.ds.other.controller.employee.EmployeeManagerWindowController;
|
import com.ecep.contract.task.ContractSyncTask;
|
||||||
import com.ecep.contract.manager.ds.other.controller.inventory.InventoryManagerWindowController;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.manager.ds.other.controller.permission.EmployeeFunctionsManagerWindowController;
|
import com.ecep.contract.util.FxmlUtils;
|
||||||
import com.ecep.contract.manager.ds.other.controller.permission.EmployeeRoleManagerWindowController;
|
import com.ecep.contract.vm.CurrentEmployee;
|
||||||
import com.ecep.contract.manager.ds.project.controller.ProjectManagerWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.vendor.controller.CompanyVendorManagerWindowController;
|
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.task.TaskMonitorViewController;
|
|
||||||
import com.ecep.contract.manager.util.DesktopUtils;
|
|
||||||
import com.ecep.contract.manager.util.FxmlUtils;
|
|
||||||
|
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -112,10 +105,6 @@ public class HomeWindowController extends BaseController {
|
|||||||
logger.info("You are administrator, try schedule sync tasks.");
|
logger.info("You are administrator, try schedule sync tasks.");
|
||||||
}
|
}
|
||||||
Desktop.instance.getExecutorService().schedule(() -> {
|
Desktop.instance.getExecutorService().schedule(() -> {
|
||||||
try {
|
|
||||||
getBean(OldVersionService.class).scheduledTasks(taskProgressView);
|
|
||||||
} catch (BeansException ignored) {
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
getBean(YongYouU8Service.class).scheduledTasks(taskProgressView);
|
getBean(YongYouU8Service.class).scheduledTasks(taskProgressView);
|
||||||
} catch (BeansException ignored) {
|
} catch (BeansException ignored) {
|
||||||
@@ -220,13 +209,4 @@ public class HomeWindowController extends BaseController {
|
|||||||
public void onShowTaskMonitorWindowAction(ActionEvent event) {
|
public void onShowTaskMonitorWindowAction(ActionEvent event) {
|
||||||
showInOwner(TaskMonitorViewController.class);
|
showInOwner(TaskMonitorViewController.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 运行任务监控演示
|
|
||||||
*/
|
|
||||||
public void onRunTaskMonitorDemo(ActionEvent event) {
|
|
||||||
com.ecep.contract.manager.ui.task.DemoTask.runDemo();
|
|
||||||
// 自动打开任务监控窗口
|
|
||||||
showInOwner(TaskMonitorViewController.class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,39 +1,54 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
import com.ecep.contract.manager.Desktop;
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
|
||||||
import com.ecep.contract.manager.ui.MessageHolder;
|
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.Scene;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.input.MouseEvent;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.scene.layout.GridPane;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.net.Inet4Address;
|
import java.net.Inet4Address;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.NetworkInterface;
|
import java.net.NetworkInterface;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
import java.sql.*;
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import static com.ecep.contract.manager.AppV2.*;
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.boot.jdbc.DataSourceBuilder;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.Desktop;
|
||||||
|
import com.ecep.contract.MessageHolder;
|
||||||
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.zaxxer.hikari.HikariDataSource;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
import javafx.event.EventHandler;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
import javafx.scene.control.PasswordField;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
public class LoginWidowController implements MessageHolder {
|
public class LoginWidowController implements MessageHolder {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(LoginWidowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(LoginWidowController.class);
|
||||||
@@ -60,24 +75,9 @@ public class LoginWidowController implements MessageHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String getHost() {
|
String getHost() {
|
||||||
return properties.getProperty("db.server.host", DEFAULT_DB_HOST);
|
return properties.getProperty("server.host");
|
||||||
}
|
}
|
||||||
|
|
||||||
String getPort() {
|
|
||||||
return properties.getProperty("db.server.port", DEFAULT_DB_PORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
String getDatabase() {
|
|
||||||
return properties.getProperty("db.server.database", DEFAULT_DB_DATABASE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserName() {
|
|
||||||
return properties.getProperty("db.server.username", DEFAULT_DB_USERNAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return properties.getProperty("db.server.password", DEFAULT_DB_PASSWORD);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tryLogin() {
|
public void tryLogin() {
|
||||||
// CompletableFuture<ButtonType> future = new CompletableFuture<>();
|
// CompletableFuture<ButtonType> future = new CompletableFuture<>();
|
||||||
@@ -100,6 +100,16 @@ public class LoginWidowController implements MessageHolder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getPassword() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'getPassword'");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getUserName() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'getUserName'");
|
||||||
|
}
|
||||||
|
|
||||||
CompletableFuture<List<LoginWidowController.MacIP>> getMacAndIP() {
|
CompletableFuture<List<LoginWidowController.MacIP>> getMacAndIP() {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
// mac ip
|
// mac ip
|
||||||
@@ -182,6 +192,16 @@ public class LoginWidowController implements MessageHolder {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDatabase() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'getDatabase'");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getPort() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'getPort'");
|
||||||
|
}
|
||||||
|
|
||||||
private void createSession(Connection connection, EmployeeInfo employeeInfo) {
|
private void createSession(Connection connection, EmployeeInfo employeeInfo) {
|
||||||
employeeInfo.sessionId = addHistory(connection, employeeInfo.employeeId, employeeInfo.binds.getFirst());
|
employeeInfo.sessionId = addHistory(connection, employeeInfo.employeeId, employeeInfo.binds.getFirst());
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
package com.ecep.contract.manager.ui;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.Skin;
|
||||||
|
|
||||||
public interface ManagerSkin extends Skin {
|
public interface ManagerSkin extends Skin {
|
||||||
|
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.constant.CompanyCustomerConstant;
|
||||||
|
import com.ecep.contract.constant.CompanyVendorConstant;
|
||||||
|
import com.ecep.contract.constant.ContractConstant;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
|
import com.ecep.contract.service.ContractService;
|
||||||
|
import com.ecep.contract.service.YongYouU8Service;
|
||||||
|
import com.ecep.contract.util.StringConfig;
|
||||||
|
|
||||||
|
import jakarta.annotation.PreDestroy;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.stage.DirectoryChooser;
|
||||||
|
import javafx.stage.FileChooser;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Scope("prototype")
|
||||||
|
@Component
|
||||||
|
public class SysConfWindowController extends BaseController {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(SysConfWindowController.class);
|
||||||
|
|
||||||
|
public Label companyContractPathLabel;
|
||||||
|
|
||||||
|
public TextField u8DataBaseServerHostField;
|
||||||
|
public TextField u8DataBaseCatalogField;
|
||||||
|
public TextField u8DataBaseUserNameField;
|
||||||
|
public TextField u8DataBasePasswordField;
|
||||||
|
|
||||||
|
public Label vendorPathLabel;
|
||||||
|
public Label vendorEvaluationFormTemplateLabel;
|
||||||
|
|
||||||
|
public Label customerPathLabel;
|
||||||
|
public Label customerEvaluationFormTemplateLabel;
|
||||||
|
public Label customerSaleBookPathLabel;
|
||||||
|
|
||||||
|
StringConfig contractPathConfig = new StringConfig(ContractConstant.KEY_BASE_PATH);
|
||||||
|
StringConfig vendorPathConfig = new StringConfig(CompanyVendorConstant.KEY_BASE_PATH);
|
||||||
|
StringConfig vendorEvaluationFormTemplateConfig = new StringConfig(
|
||||||
|
CompanyVendorConstant.KEY_EVALUATION_FORM_TEMPLATE);
|
||||||
|
StringConfig customerPathConfig = new StringConfig(CompanyCustomerConstant.KEY_BASE_PATH);
|
||||||
|
StringConfig customerEvaluationFormTemplateConfig = new StringConfig(
|
||||||
|
CompanyCustomerConstant.KEY_EVALUATION_FORM_TEMPLATE);
|
||||||
|
StringConfig customerSaleBookPathConfig = new StringConfig(CompanyCustomerConstant.KEY_SALEBOOK_PATH);
|
||||||
|
|
||||||
|
public void initialize() {
|
||||||
|
contractPathConfig.setControl(companyContractPathLabel);
|
||||||
|
contractPathConfig.initialize();
|
||||||
|
|
||||||
|
vendorPathConfig.setControl(vendorPathLabel);
|
||||||
|
vendorPathConfig.initialize();
|
||||||
|
vendorEvaluationFormTemplateConfig.setControl(vendorEvaluationFormTemplateLabel);
|
||||||
|
vendorEvaluationFormTemplateConfig.initialize();
|
||||||
|
|
||||||
|
customerPathConfig.setControl(customerPathLabel);
|
||||||
|
customerPathConfig.initialize();
|
||||||
|
customerEvaluationFormTemplateConfig.setControl(customerEvaluationFormTemplateLabel);
|
||||||
|
customerEvaluationFormTemplateConfig.initialize();
|
||||||
|
customerSaleBookPathConfig.setControl(customerSaleBookPathLabel);
|
||||||
|
customerSaleBookPathConfig.initialize();
|
||||||
|
|
||||||
|
logger.debug("#initialize()");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void directoryChoose(StringConfig config, String title, String key, ActionEvent event) {
|
||||||
|
DirectoryChooser chooser = new DirectoryChooser();
|
||||||
|
chooser.setTitle(title);
|
||||||
|
File value = new File(config.getProperty().getValue());
|
||||||
|
chooser.setInitialDirectory(value);
|
||||||
|
|
||||||
|
Node node = (Node) event.getSource();
|
||||||
|
File selected = chooser.showDialog(node.getScene().getWindow());
|
||||||
|
if (selected != null) {
|
||||||
|
config.getProperty().setValue(selected.getAbsolutePath());
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeCompanyContractPath(ActionEvent actionEvent) {
|
||||||
|
directoryChoose(contractPathConfig, "请选择合同目录", ContractConstant.KEY_BASE_PATH, actionEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeVendorPath(ActionEvent actionEvent) {
|
||||||
|
directoryChoose(vendorPathConfig, "请选择供应商目录", CompanyVendorConstant.KEY_BASE_PATH, actionEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeCustomerPath(ActionEvent actionEvent) {
|
||||||
|
directoryChoose(customerPathConfig, "请选择客户目录", CompanyCustomerConstant.KEY_BASE_PATH, actionEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeCustomerSaleBookPath(ActionEvent actionEvent) {
|
||||||
|
directoryChoose(customerSaleBookPathConfig, "请选择销售台账目录", CompanyCustomerConstant.KEY_SALEBOOK_PATH, actionEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 模拟销毁方法
|
||||||
|
@PreDestroy
|
||||||
|
public void destroy() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fileChoose(StringConfig config, String title, String key, ActionEvent event) {
|
||||||
|
FileChooser chooser = new FileChooser();
|
||||||
|
chooser.setTitle(title);
|
||||||
|
File value = new File(config.getProperty().getValue());
|
||||||
|
chooser.setInitialDirectory(value.getParentFile());
|
||||||
|
chooser.setInitialFileName(value.getName());
|
||||||
|
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter(" 模板文件(*.xlsx)", "*.xlsx"));
|
||||||
|
Node node = (Node) event.getSource();
|
||||||
|
File selected = chooser.showOpenDialog(node.getScene().getWindow());
|
||||||
|
if (selected != null) {
|
||||||
|
config.getProperty().setValue(selected.getAbsolutePath());
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeCustomerEvaluationFormTemplate(ActionEvent actionEvent) {
|
||||||
|
fileChoose(customerEvaluationFormTemplateConfig, "请选择客户资信评估表模板",
|
||||||
|
CompanyCustomerConstant.KEY_EVALUATION_FORM_TEMPLATE, actionEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeVendorEvaluationFormTemplate(ActionEvent actionEvent) {
|
||||||
|
fileChoose(vendorEvaluationFormTemplateConfig, "请选择供方调查评价表模板",
|
||||||
|
CompanyVendorConstant.KEY_EVALUATION_FORM_TEMPLATE,
|
||||||
|
actionEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +1,25 @@
|
|||||||
package com.ecep.contract.manager.ui.task;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.manager.Desktop;
|
import com.ecep.contract.Desktop;
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
import com.ecep.contract.Message;
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.manager.ui.Message;
|
import com.ecep.contract.task.MonitoredTask;
|
||||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
import com.ecep.contract.task.TaskHistory;
|
||||||
|
import com.ecep.contract.task.TaskMonitorCenter;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
@@ -69,10 +76,47 @@ public class TaskMonitorViewController extends BaseController {
|
|||||||
private Button cancelTaskButton;
|
private Button cancelTaskButton;
|
||||||
@FXML
|
@FXML
|
||||||
private Button clearHistoryButton;
|
private Button clearHistoryButton;
|
||||||
|
@FXML
|
||||||
|
private Button refreshExecutorInfoButton;
|
||||||
|
@FXML
|
||||||
|
private TableView<ExecutorInfo> executorInfoTable;
|
||||||
|
@FXML
|
||||||
|
private TableColumn<ExecutorInfo, String> executorFieldColumn;
|
||||||
|
@FXML
|
||||||
|
private TableColumn<ExecutorInfo, String> executorValueColumn;
|
||||||
|
@FXML
|
||||||
|
private TableColumn<ExecutorInfo, String> executorDescriptionColumn;
|
||||||
|
|
||||||
public TaskMonitorViewController() {
|
public TaskMonitorViewController() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于存储ExecutorService信息的内部类
|
||||||
|
*/
|
||||||
|
public static class ExecutorInfo {
|
||||||
|
private final String field;
|
||||||
|
private final String value;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
public ExecutorInfo(String field, String value, String description) {
|
||||||
|
this.field = field;
|
||||||
|
this.value = value;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getField() {
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
@@ -144,6 +188,94 @@ public class TaskMonitorViewController extends BaseController {
|
|||||||
});
|
});
|
||||||
|
|
||||||
cancelTaskButton.disableProperty().bind(activeTasksTable.getSelectionModel().selectedItemProperty().isNull());
|
cancelTaskButton.disableProperty().bind(activeTasksTable.getSelectionModel().selectedItemProperty().isNull());
|
||||||
|
// 初始化Executor信息表格
|
||||||
|
initializeExecutorInfoTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化Executor信息表格
|
||||||
|
*/
|
||||||
|
private void initializeExecutorInfoTable() {
|
||||||
|
executorFieldColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getField()));
|
||||||
|
executorValueColumn.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getValue()));
|
||||||
|
executorDescriptionColumn
|
||||||
|
.setCellValueFactory(param -> new SimpleStringProperty(param.getValue().getDescription()));
|
||||||
|
|
||||||
|
// 初始加载Executor信息
|
||||||
|
refreshExecutorInfo();
|
||||||
|
// 绑定刷新按钮事件
|
||||||
|
refreshExecutorInfoButton.setOnAction(event -> refreshExecutorInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新Executor信息
|
||||||
|
*/
|
||||||
|
@FXML
|
||||||
|
private void refreshExecutorInfo() {
|
||||||
|
executorInfoTable.getItems().clear();
|
||||||
|
|
||||||
|
try {
|
||||||
|
ExecutorService executorService = Desktop.instance.getExecutorService();
|
||||||
|
if (executorService instanceof ThreadPoolExecutor threadPoolExecutor) {
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"PoolSize",
|
||||||
|
String.valueOf(threadPoolExecutor.getPoolSize()),
|
||||||
|
"PoolSize"));
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"活动线程数",
|
||||||
|
String.valueOf(threadPoolExecutor.getActiveCount()),
|
||||||
|
"当前正在执行任务的线程数"));
|
||||||
|
// 添加线程池信息
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"核心线程数",
|
||||||
|
String.valueOf(threadPoolExecutor.getCorePoolSize()),
|
||||||
|
"线程池维护的最小线程数"));
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"最大线程数",
|
||||||
|
String.valueOf(threadPoolExecutor.getMaximumPoolSize()),
|
||||||
|
"线程池允许的最大线程数"));
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"KeepAliveTime",
|
||||||
|
String.valueOf(threadPoolExecutor.getKeepAliveTime(TimeUnit.SECONDS)),
|
||||||
|
"the thread keep-alive time, which is the amount of time that threads may remain idle before being terminated. Threads that wait this amount of time without processing a task will be terminated if there are more than the core number of threads currently in the pool, or if this pool allows core thread timeout."));
|
||||||
|
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"任务队列大小",
|
||||||
|
String.valueOf(threadPoolExecutor.getQueue().size()),
|
||||||
|
"等待执行的任务数量"));
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"已完成任务数",
|
||||||
|
String.valueOf(threadPoolExecutor.getCompletedTaskCount()),
|
||||||
|
"已完成执行的任务总数"));
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"LargestPoolSize",
|
||||||
|
String.valueOf(threadPoolExecutor.getLargestPoolSize()),
|
||||||
|
"线程池当前状态"));
|
||||||
|
|
||||||
|
// 如果是ScheduledExecutorService,添加额外信息
|
||||||
|
if (executorService instanceof ScheduledExecutorService) {
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"线程池类型",
|
||||||
|
"ScheduledExecutorService",
|
||||||
|
"可调度的线程池"));
|
||||||
|
} else {
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"线程池类型",
|
||||||
|
"ThreadPoolExecutor",
|
||||||
|
"普通线程池"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"错误",
|
||||||
|
"未知的ExecutorService类型",
|
||||||
|
"无法获取线程池详细信息"));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
executorInfoTable.getItems().add(new ExecutorInfo(
|
||||||
|
"异常",
|
||||||
|
e.getMessage(),
|
||||||
|
"获取ExecutorService信息时发生错误"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -205,7 +337,7 @@ public class TaskMonitorViewController extends BaseController {
|
|||||||
text.setFill(Color.ORANGE);
|
text.setFill(Color.ORANGE);
|
||||||
} else if (msg.getLevel() == Level.SEVERE) {
|
} else if (msg.getLevel() == Level.SEVERE) {
|
||||||
text.setFill(Color.RED);
|
text.setFill(Color.RED);
|
||||||
}else if (msg.getLevel()== Level.CONFIG) {
|
} else if (msg.getLevel() == Level.CONFIG) {
|
||||||
text.setFill(Color.GRAY);
|
text.setFill(Color.GRAY);
|
||||||
}
|
}
|
||||||
vBox.getChildren().add(text);
|
vBox.getChildren().add(text);
|
||||||
@@ -218,4 +350,11 @@ public class TaskMonitorViewController extends BaseController {
|
|||||||
alert.getDialogPane().setContent(scrollPane);
|
alert.getDialogPane().setContent(scrollPane);
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行任务监控演示
|
||||||
|
*/
|
||||||
|
public void onRunTaskMonitorDemo(ActionEvent event) {
|
||||||
|
com.ecep.contract.task.DemoTask.runDemo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import org.controlsfx.control.ToggleSwitch;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.constant.CloudYuConstant;
|
||||||
|
import com.ecep.contract.util.BooleanConfig;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.LocalDateConfig;
|
||||||
|
import com.ecep.contract.util.LocalDateTimeConfig;
|
||||||
|
import com.ecep.contract.util.StringConfig;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Scope("prototype")
|
||||||
|
@Component
|
||||||
|
@FxmlPath("/ui/cloud/u8_config.fxml")
|
||||||
|
public class YongYouU8ConfigWindowController extends BaseController {
|
||||||
|
@FXML
|
||||||
|
private DatePicker auto_create_company_after;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField contract_latest_date;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField contract_latest_id;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private TextField sync_elapse;
|
||||||
|
@FXML
|
||||||
|
private ToggleSwitch use_latest_id;
|
||||||
|
|
||||||
|
LocalDateConfig config1 = new LocalDateConfig(CloudYuConstant.KEY_AUTO_CREATE_COMPANY_AFTER);
|
||||||
|
LocalDateTimeConfig config2 = new LocalDateTimeConfig(CloudYuConstant.KEY_SYNC_BY_LATEST_DATE);
|
||||||
|
StringConfig config3 = new StringConfig(CloudYuConstant.KEY_SYNC_BY_LATEST_ID);
|
||||||
|
StringConfig config4 = new StringConfig(CloudYuConstant.KEY_SYNC_ELAPSE);
|
||||||
|
BooleanConfig config5 = new BooleanConfig(CloudYuConstant.KEY_SYNC_USE_LATEST_ID);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShown(WindowEvent windowEvent) {
|
||||||
|
super.onShown(windowEvent);
|
||||||
|
getTitle().set("用友U8配置");
|
||||||
|
|
||||||
|
auto_create_company_after.setConverter(getCurrentEmployee().getLocalDateStringConverter());
|
||||||
|
config1.setControl(auto_create_company_after);
|
||||||
|
config1.initialize();
|
||||||
|
|
||||||
|
config2.setControl(contract_latest_date);
|
||||||
|
config2.setControlConverter(getCurrentEmployee().getLocalDateTimeStringConverter());
|
||||||
|
config2.initialize();
|
||||||
|
|
||||||
|
config3.setControl(contract_latest_id);
|
||||||
|
config3.initialize();
|
||||||
|
|
||||||
|
config4.setControl(sync_elapse);
|
||||||
|
config4.initialize();
|
||||||
|
|
||||||
|
config5.setControl(use_latest_id);
|
||||||
|
config5.initialize();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,28 +1,32 @@
|
|||||||
package com.ecep.contract.manager.cloud.u8;
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
|
import com.ecep.contract.model.CloudYu;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.service.YongYouU8Service;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.vm.CloudYuInfoViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.CompanyTableCell;
|
|
||||||
import com.ecep.contract.manager.ds.company.controller.CompanyWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.LocalDateTimeTableCell;
|
|
||||||
import jakarta.persistence.criteria.Path;
|
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class YongYouU8ManagerSkin
|
public class YongYouU8ManagerSkin
|
||||||
extends AbstEntityManagerSkin<CloudYu, CloudYuInfoViewModel, YongYouU8ManagerSkin, YongYouU8ManagerWindowController>
|
extends
|
||||||
|
AbstEntityManagerSkin<CloudYu, CloudYuInfoViewModel, YongYouU8ManagerSkin, YongYouU8ManagerWindowController>
|
||||||
implements ManagerSkin {
|
implements ManagerSkin {
|
||||||
@Setter
|
@Setter
|
||||||
private YongYouU8Service u8Service;
|
private YongYouU8Service u8Service;
|
||||||
@@ -50,28 +54,11 @@ public class YongYouU8ManagerSkin
|
|||||||
@Override
|
@Override
|
||||||
protected List<CloudYuInfoViewModel> loadTableData() {
|
protected List<CloudYuInfoViewModel> loadTableData() {
|
||||||
String searchText = controller.searchKeyField.getText();
|
String searchText = controller.searchKeyField.getText();
|
||||||
Specification<CloudYu> spec = null;
|
Map<String, Object> params = ParamUtils.builder().build();
|
||||||
if (StringUtils.hasText(searchText)) {
|
if (StringUtils.hasText(searchText)) {
|
||||||
|
params.put("searchText", searchText);
|
||||||
Specification<CloudYu> companySpec = (root, query, builder) -> {
|
|
||||||
Path<Object> company = root.get("company");
|
|
||||||
return builder.or(
|
|
||||||
builder.like(company.get("name"), "%" + searchText + "%"),
|
|
||||||
builder.like(company.get("shortName"), "%" + searchText + "%")
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
Specification<CloudYu> cloudIdSpec = (root, query, builder) -> {
|
|
||||||
return builder.like(root.get("cloudId"), "%" + searchText + "%");
|
|
||||||
};
|
|
||||||
|
|
||||||
Specification<CloudYu> exceptionSpec = (root, query, builder) -> {
|
|
||||||
return builder.like(root.get("exceptionMessage"), "%" + searchText + "%");
|
|
||||||
};
|
|
||||||
spec = Specification.anyOf(companySpec, cloudIdSpec, exceptionSpec);
|
|
||||||
}
|
}
|
||||||
|
Page<CloudYu> page = getU8Service().findAll(params, getPageable());
|
||||||
Page<CloudYu> page = getU8Service().findAll(spec, getPageable());
|
|
||||||
updateFooter(page);
|
updateFooter(page);
|
||||||
return page.map(CloudYuInfoViewModel::from).toList();
|
return page.map(CloudYuInfoViewModel::from).toList();
|
||||||
}
|
}
|
||||||
@@ -116,7 +103,7 @@ public class YongYouU8ManagerSkin
|
|||||||
}
|
}
|
||||||
for (CloudYuInfoViewModel selectedItem : selectedItems) {
|
for (CloudYuInfoViewModel selectedItem : selectedItems) {
|
||||||
CloudYu cloudYu = getU8Service().findById(selectedItem.getId().get());
|
CloudYu cloudYu = getU8Service().findById(selectedItem.getId().get());
|
||||||
selectedItem.getCustomerCode().set("");
|
selectedItem.getCustomerCode().set("");
|
||||||
if (selectedItem.copyTo(cloudYu)) {
|
if (selectedItem.copyTo(cloudYu)) {
|
||||||
CloudYu saved = getU8Service().save(cloudYu);
|
CloudYu saved = getU8Service().save(cloudYu);
|
||||||
selectedItem.update(saved);
|
selectedItem.update(saved);
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package com.ecep.contract.controller;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.Desktop;
|
||||||
|
import com.ecep.contract.UITools;
|
||||||
|
import com.ecep.contract.model.CloudYu;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.vm.CloudYuInfoViewModel;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Scope("prototype")
|
||||||
|
@Component
|
||||||
|
@FxmlPath("/ui/cloud/u8_manager.fxml")
|
||||||
|
public class YongYouU8ManagerWindowController
|
||||||
|
extends AbstManagerWindowController<CloudYu, CloudYuInfoViewModel, YongYouU8ManagerSkin> {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(YongYouU8ManagerWindowController.class);
|
||||||
|
|
||||||
|
public static void show() {
|
||||||
|
show(YongYouU8ManagerWindowController.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableColumn<CloudYuInfoViewModel, Number> idColumn;
|
||||||
|
public TableColumn<CloudYuInfoViewModel, LocalDateTime> latestUpdateColumn;
|
||||||
|
public TableColumn<CloudYuInfoViewModel, Company> companyColumn;
|
||||||
|
public TableColumn<CloudYuInfoViewModel, String> cloudIdColumn;
|
||||||
|
public TableColumn<CloudYuInfoViewModel, LocalDateTime> cloudLatestColumn;
|
||||||
|
public TableColumn<CloudYuInfoViewModel, String> descriptionColumn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public YongYouU8Service getViewModelService() {
|
||||||
|
return getSkin().getU8Service();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected YongYouU8ManagerSkin createDefaultSkin() {
|
||||||
|
return new YongYouU8ManagerSkin(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show(Stage stage) {
|
||||||
|
super.show(stage);
|
||||||
|
getTitle().set("用友U8");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开配置窗口
|
||||||
|
*/
|
||||||
|
public void onConfigAction(ActionEvent event) {
|
||||||
|
BaseController.show(YongYouU8ConfigWindowController.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据迁移,从 CloudInfo 迁移到 CloudRk
|
||||||
|
*/
|
||||||
|
public void onDateTransferAction(ActionEvent event) {
|
||||||
|
DateTransferTask task = new DateTransferTask();
|
||||||
|
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPersonSyncAction(ActionEvent event) {
|
||||||
|
EmployeesSyncTask task = new EmployeesSyncTask();
|
||||||
|
UITools.showTaskDialogAndWait("员工数据同步", task, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onContractSyncAction(ActionEvent event) {
|
||||||
|
ContractSyncTask task = new ContractSyncTask();
|
||||||
|
UITools.showTaskDialogAndWait("合同数据增量同步", task, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onContractAllSyncAction(ActionEvent event) {
|
||||||
|
ContractSyncAllTask task = new ContractSyncAllTask();
|
||||||
|
UITools.showTaskDialogAndWait("合同数据全量同步", task, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onVendorSyncAction(ActionEvent event) {
|
||||||
|
VendorSyncTask task = new VendorSyncTask();
|
||||||
|
UITools.showTaskDialogAndWait("供应商数据同步", task, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCustomerSyncAction(ActionEvent event) {
|
||||||
|
CustomerSyncTask task = new CustomerSyncTask();
|
||||||
|
UITools.showTaskDialogAndWait("客户数据同步", task, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onContractGroupSyncAction(ActionEvent event) {
|
||||||
|
ContractGroupSyncTask task = new ContractGroupSyncTask();
|
||||||
|
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onContractTypeSyncAction(ActionEvent event) {
|
||||||
|
ContractTypeSyncTask task = new ContractTypeSyncTask();
|
||||||
|
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onContractKindSyncAction(ActionEvent event) {
|
||||||
|
ContractKindSyncTask task = new ContractKindSyncTask();
|
||||||
|
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onVendorClassSyncAction(ActionEvent event) {
|
||||||
|
VendorClassSyncTask task = new VendorClassSyncTask();
|
||||||
|
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onCustomerClassSyncAction(ActionEvent event) {
|
||||||
|
CustomerClassSyncTask task = new CustomerClassSyncTask();
|
||||||
|
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.bank;
|
package com.ecep.contract.controller.bank;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.model.Bank;
|
||||||
|
import com.ecep.contract.vm.BankViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Bank;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.BankViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.EditableEntityTableTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
|
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.bank;
|
package com.ecep.contract.controller.bank;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Bank;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.BankService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.BankViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
|
import com.ecep.contract.model.Bank;
|
||||||
|
import com.ecep.contract.service.BankService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.BankViewModel;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@@ -1,22 +1,25 @@
|
|||||||
package com.ecep.contract.manager.ds.company.controller.bank_account;
|
package com.ecep.contract.controller.bank.account;
|
||||||
|
|
||||||
|
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.BankStringConverter;
|
||||||
|
import com.ecep.contract.converter.CompanyStringConverter;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.CompanyBankAccount;
|
||||||
|
import com.ecep.contract.service.BankService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
|
||||||
import com.ecep.contract.manager.ds.company.CompanyStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.company.controller.CompanyWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
|
||||||
import com.ecep.contract.manager.ds.company.model.CompanyBankAccount;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ds.company.vo.CompanyBankAccountViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.BankStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.BankService;
|
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class BankAccountBaseTabSkin extends AbstEntityBasedTabSkin<BankAccountWindowController, CompanyBankAccount, CompanyBankAccountViewModel> implements TabSkin {
|
public class BankAccountBaseTabSkin
|
||||||
|
extends AbstEntityBasedTabSkin<BankAccountWindowController, CompanyBankAccount, CompanyBankAccountViewModel>
|
||||||
|
implements TabSkin {
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
@Setter
|
@Setter
|
||||||
@@ -40,8 +43,7 @@ public class BankAccountBaseTabSkin extends AbstEntityBasedTabSkin<BankAccountWi
|
|||||||
controller.openingBankField.textProperty().bindBidirectional(viewModel.getOpeningBank());
|
controller.openingBankField.textProperty().bindBidirectional(viewModel.getOpeningBank());
|
||||||
controller.bankAccountField.textProperty().bindBidirectional(viewModel.getAccount());
|
controller.bankAccountField.textProperty().bindBidirectional(viewModel.getAccount());
|
||||||
|
|
||||||
|
// controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
||||||
// controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
|
||||||
controller.createdField.textProperty().bind(viewModel.getCreated().asString());
|
controller.createdField.textProperty().bind(viewModel.getCreated().asString());
|
||||||
controller.versionLabel.textProperty().bind(viewModel.getVersion().asString());
|
controller.versionLabel.textProperty().bind(viewModel.getVersion().asString());
|
||||||
|
|
||||||
@@ -59,13 +61,11 @@ public class BankAccountBaseTabSkin extends AbstEntityBasedTabSkin<BankAccountWi
|
|||||||
UITools.autoCompletion(textField, viewModel.getCompany(), converter::suggest, converter);
|
UITools.autoCompletion(textField, viewModel.getCompany(), converter::suggest, converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializeBaseTabBankFieldAutoCompletion(TextField textField) {
|
private void initializeBaseTabBankFieldAutoCompletion(TextField textField) {
|
||||||
BankStringConverter converter = SpringApp.getBean(BankStringConverter.class);
|
BankStringConverter converter = SpringApp.getBean(BankStringConverter.class);
|
||||||
UITools.autoCompletion(textField, viewModel.getBank(), converter::suggest, converter);
|
UITools.autoCompletion(textField, viewModel.getBank(), converter::suggest, converter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public BankService getBankService() {
|
public BankService getBankService() {
|
||||||
if (bankService == null) {
|
if (bankService == null) {
|
||||||
bankService = getBean(BankService.class);
|
bankService = getBean(BankService.class);
|
||||||
@@ -1,19 +1,26 @@
|
|||||||
package com.ecep.contract.manager.ds.company.controller.bank_account;
|
package com.ecep.contract.controller.bank.account;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.CompanyBankAccount;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyBankAccountService;
|
|
||||||
import com.ecep.contract.manager.ds.company.vo.CompanyBankAccountViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.model.CompanyBankAccount;
|
||||||
|
import com.ecep.contract.service.CompanyBankAccountService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.CompanyBankAccountViewModel;
|
||||||
|
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.ecep.contract.controller.company;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
|
||||||
|
import javafx.concurrent.Task;
|
||||||
|
|
||||||
|
public abstract class AbstCompanyBasedTabSkin
|
||||||
|
extends AbstEntityBasedTabSkin<CompanyWindowController, Company, CompanyViewModel>
|
||||||
|
implements TabSkin {
|
||||||
|
|
||||||
|
public AbstCompanyBasedTabSkin(CompanyWindowController controller) {
|
||||||
|
super(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CompanyService getCompanyService() {
|
||||||
|
Task<CompanyService> task = new Task<>() {
|
||||||
|
@Override
|
||||||
|
protected CompanyService call() throws Exception {
|
||||||
|
return controller.getViewModelService();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return controller.getViewModelService();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.ecep.contract.controller.company;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.controller.table.TableOfTabSkin;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.vm.CompanyBasedViewModel;
|
||||||
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
public abstract class AbstCompanyTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
|
extends AbstEntityTableTabSkin<CompanyWindowController, Company, CompanyViewModel, T, TV>
|
||||||
|
implements TabSkin, TableOfTabSkin<Company, T, TV> {
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
private CompanyService companyService;
|
||||||
|
|
||||||
|
public AbstCompanyTableTabSkin(CompanyWindowController controller) {
|
||||||
|
super(controller);
|
||||||
|
viewModel = controller.getViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TV createNewViewModel() {
|
||||||
|
TV model = super.createNewViewModel();
|
||||||
|
if (model instanceof CompanyBasedViewModel m) {
|
||||||
|
m.getCompany().set(getEntity());
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CompanyService getCompanyService() {
|
||||||
|
return getParentService();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CompanyService getParentService() {
|
||||||
|
if (companyService == null) {
|
||||||
|
companyService = getBean(CompanyService.class);
|
||||||
|
}
|
||||||
|
return companyService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getSpecification(Company parent) {
|
||||||
|
Map<String, Object> params = getSpecification();
|
||||||
|
params.put("company", parent.getId());
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,13 +1,32 @@
|
|||||||
package com.ecep.contract.manager.ds.company.controller.contact;
|
package com.ecep.contract.controller.company;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.BaseController;
|
||||||
|
import com.ecep.contract.model.CompanyContact;
|
||||||
|
import com.ecep.contract.service.CompanyContactService;
|
||||||
|
import com.ecep.contract.util.FxmlUtils;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CompanyContactViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.CompanyContact;
|
|
||||||
import com.ecep.contract.manager.ds.company.repository.CompanyContactRepository;
|
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
|
||||||
import com.ecep.contract.manager.ds.company.vo.CompanyContactViewModel;
|
|
||||||
import com.ecep.contract.manager.util.FxmlUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
import javafx.stage.Modality;
|
import javafx.stage.Modality;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
@@ -16,22 +35,13 @@ import javafx.stage.WindowEvent;
|
|||||||
import javafx.util.converter.LocalDateStringConverter;
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
public class CompanyContactWindowController extends BaseController {
|
public class CompanyContactWindowController extends BaseController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyContactWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyContactWindowController.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示界面
|
* 显示界面
|
||||||
*/
|
*/
|
||||||
@@ -59,8 +69,9 @@ public class CompanyContactWindowController extends BaseController {
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private CompanyContactViewModel viewModel;
|
private CompanyContactViewModel viewModel;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CompanyContactRepository companyContactRepository;
|
private CompanyContactService companyContactService;
|
||||||
|
|
||||||
public TextField nameField;
|
public TextField nameField;
|
||||||
public TextField positionField;
|
public TextField positionField;
|
||||||
@@ -78,7 +89,8 @@ public class CompanyContactWindowController extends BaseController {
|
|||||||
@Override
|
@Override
|
||||||
public void show(Stage stage) {
|
public void show(Stage stage) {
|
||||||
super.show(stage);
|
super.show(stage);
|
||||||
getTitle().bind(viewModel.getName().map(v -> "[" + viewModel.getId().get() + "] " + viewModel.getName().getValue() + " 曾用名详情"));
|
getTitle().bind(viewModel.getName()
|
||||||
|
.map(v -> "[" + viewModel.getId().get() + "] " + viewModel.getName().getValue() + " 曾用名详情"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -91,24 +103,19 @@ public class CompanyContactWindowController extends BaseController {
|
|||||||
initializeBaseTab();
|
initializeBaseTab();
|
||||||
|
|
||||||
companyContactLoadedFuture = CompletableFuture.supplyAsync(() -> {
|
companyContactLoadedFuture = CompletableFuture.supplyAsync(() -> {
|
||||||
Optional<CompanyContact> optional = companyContactRepository.findById(viewModel.getId().get());
|
CompanyContact oldName = companyContactService.findById(viewModel.getId().get());
|
||||||
if (optional.isPresent()) {
|
Platform.runLater(() -> {
|
||||||
CompanyContact oldName = optional.get();
|
viewModel.update(oldName);
|
||||||
Platform.runLater(() -> {
|
viewModel.bindListener();
|
||||||
viewModel.update(oldName);
|
if (logger.isDebugEnabled()) {
|
||||||
viewModel.bindListener();
|
logger.debug("bind ViewModel({}) Listener", viewModel.getName().get());
|
||||||
if (logger.isDebugEnabled()) {
|
}
|
||||||
logger.debug("bind ViewModel({}) Listener", viewModel.getName().get());
|
tabPane.getSelectionModel().getSelectedItem().getOnSelectionChanged().handle(null);
|
||||||
}
|
});
|
||||||
tabPane.getSelectionModel().getSelectedItem().getOnSelectionChanged().handle(null);
|
return oldName;
|
||||||
});
|
|
||||||
return oldName;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializeBaseTab() {
|
private void initializeBaseTab() {
|
||||||
baseInfoTab.setOnSelectionChanged(event -> {
|
baseInfoTab.setOnSelectionChanged(event -> {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
@@ -123,7 +130,7 @@ public class CompanyContactWindowController extends BaseController {
|
|||||||
try {
|
try {
|
||||||
CompanyContact contact = companyContactLoadedFuture.join();
|
CompanyContact contact = companyContactLoadedFuture.join();
|
||||||
viewModel.copyTo(contact);
|
viewModel.copyTo(contact);
|
||||||
CompanyContact saved = companyContactRepository.save(contact);
|
CompanyContact saved = companyContactService.save(contact);
|
||||||
viewModel.update(saved);
|
viewModel.update(saved);
|
||||||
companyContactLoadedFuture = CompletableFuture.completedFuture(saved);
|
companyContactLoadedFuture = CompletableFuture.completedFuture(saved);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -155,7 +162,7 @@ public class CompanyContactWindowController extends BaseController {
|
|||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("onBaseTabShown company contact {}", contact.getName());
|
logger.debug("onBaseTabShown company contact {}", contact.getName());
|
||||||
}
|
}
|
||||||
// viewModel.update(contact);
|
// viewModel.update(contact);
|
||||||
}).exceptionally(ex -> {
|
}).exceptionally(ex -> {
|
||||||
UITools.showExceptionAndWait(ex.getMessage(), ex);
|
UITools.showExceptionAndWait(ex.getMessage(), ex);
|
||||||
return null;
|
return null;
|
||||||
@@ -176,4 +183,3 @@ public class CompanyContactWindowController extends BaseController {
|
|||||||
super.onHidden(windowEvent);
|
super.onHidden(windowEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
package com.ecep.contract.manager.ds.company.controller;
|
package com.ecep.contract.controller.company;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.service.CompanyOldNameService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyOldNameService;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ds.company.vo.CompanyViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.Alert;
|
import javafx.scene.control.Alert;
|
||||||
import javafx.scene.control.TextInputDialog;
|
import javafx.scene.control.TextInputDialog;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public class CompanyManagerSkin
|
public class CompanyManagerSkin
|
||||||
extends AbstEntityManagerSkin<Company, CompanyViewModel, CompanyManagerSkin, CompanyManagerWindowController> {
|
extends AbstEntityManagerSkin<Company, CompanyViewModel, CompanyManagerSkin, CompanyManagerWindowController> {
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager.ds.company.controller;
|
package com.ecep.contract.controller.company;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
@@ -7,13 +7,13 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.manager.ds.company.tasker.CompanyFilesRebuildTasker;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.manager.ds.company.vo.CompanyViewModel;
|
import com.ecep.contract.task.CompanyFilesRebuildTasker;
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.manager.util.UITools;
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.ecep.contract.manager.ds.company.controller;
|
package com.ecep.contract.controller.company;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.BaseController;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@@ -1,31 +1,8 @@
|
|||||||
package com.ecep.contract.manager.ds.company.controller;
|
package com.ecep.contract.controller.company;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyFileService;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ds.company.tasker.CompanyCompositeUpdateTasker;
|
|
||||||
import com.ecep.contract.manager.ds.company.tasker.CompanyVerifyTasker;
|
|
||||||
import com.ecep.contract.manager.ds.company.vo.CompanyViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.controller.CompanyCustomerWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
|
||||||
import com.ecep.contract.manager.ds.vendor.controller.CompanyVendorWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.vendor.model.CompanyVendor;
|
|
||||||
import com.ecep.contract.manager.ds.vendor.service.CompanyVendorService;
|
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.util.DesktopUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.scene.layout.Pane;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -35,8 +12,51 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import java.util.function.Function;
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.controller.customer.CompanyCustomerWindowController;
|
||||||
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinBankAccount;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinBase;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinBlackReason;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinContact;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinContract;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinFile;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinInvoice;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinOldName;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinOther;
|
||||||
|
import com.ecep.contract.controller.tab.CompanyTabSkinPurchaseBillVoucher;
|
||||||
|
import com.ecep.contract.controller.vendor.CompanyVendorWindowController;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
|
import com.ecep.contract.model.CompanyVendor;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
|
import com.ecep.contract.service.CompanyFileService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.service.CompanyVendorService;
|
||||||
|
import com.ecep.contract.service.ContractService;
|
||||||
|
import com.ecep.contract.task.CompanyCompositeUpdateTasker;
|
||||||
|
import com.ecep.contract.task.CompanyVerifyTasker;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CompanyViewModel;
|
||||||
|
|
||||||
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.ButtonType;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -46,7 +66,6 @@ public class CompanyWindowController
|
|||||||
extends AbstEntityController<Company, CompanyViewModel> {
|
extends AbstEntityController<Company, CompanyViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyWindowController.class);
|
||||||
|
|
||||||
|
|
||||||
public static void show(Company company, Window window) {
|
public static void show(Company company, Window window) {
|
||||||
CompanyViewModel viewModel = new CompanyViewModel();
|
CompanyViewModel viewModel = new CompanyViewModel();
|
||||||
if (!Hibernate.isInitialized(company)) {
|
if (!Hibernate.isInitialized(company)) {
|
||||||
@@ -117,9 +136,10 @@ public class CompanyWindowController
|
|||||||
public Button companyPathChangeBtn;
|
public Button companyPathChangeBtn;
|
||||||
public Button companyPathSameAsNameBtn;
|
public Button companyPathSameAsNameBtn;
|
||||||
|
|
||||||
|
// private final CompanyCustomerViewModel companyCustomerViewModel = new
|
||||||
// private final CompanyCustomerViewModel companyCustomerViewModel = new CompanyCustomerViewModel();
|
// CompanyCustomerViewModel();
|
||||||
// private final CompanyVendorViewModel companyVendorViewModel = new CompanyVendorViewModel();
|
// private final CompanyVendorViewModel companyVendorViewModel = new
|
||||||
|
// CompanyVendorViewModel();
|
||||||
|
|
||||||
private final SimpleObjectProperty<CompanyCustomer> companyCustomerProperty = new SimpleObjectProperty<>();
|
private final SimpleObjectProperty<CompanyCustomer> companyCustomerProperty = new SimpleObjectProperty<>();
|
||||||
private final SimpleObjectProperty<CompanyVendor> companyVendorProperty = new SimpleObjectProperty<>();
|
private final SimpleObjectProperty<CompanyVendor> companyVendorProperty = new SimpleObjectProperty<>();
|
||||||
@@ -134,7 +154,6 @@ public class CompanyWindowController
|
|||||||
public Pane vendorTab_pane2;
|
public Pane vendorTab_pane2;
|
||||||
public Button vendorTab_createBtn;
|
public Button vendorTab_createBtn;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show(Stage stage) {
|
public void show(Stage stage) {
|
||||||
super.show(stage);
|
super.show(stage);
|
||||||
@@ -143,7 +162,6 @@ public class CompanyWindowController
|
|||||||
getTitle().set("[" + viewModel.getId().get() + "] " + viewModel.getName().getValue() + " 公司详情");
|
getTitle().set("[" + viewModel.getId().get() + "] " + viewModel.getName().getValue() + " 公司详情");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Company loadEntity() {
|
protected Company loadEntity() {
|
||||||
return companyService.findById(viewModel.getId().get());
|
return companyService.findById(viewModel.getId().get());
|
||||||
@@ -161,18 +179,16 @@ public class CompanyWindowController
|
|||||||
registerTabSkin(contactTab, tab1 -> new CompanyTabSkinContact(this));
|
registerTabSkin(contactTab, tab1 -> new CompanyTabSkinContact(this));
|
||||||
registerTabSkin(blackReasonTab, tab1 -> new CompanyTabSkinBlackReason(this));
|
registerTabSkin(blackReasonTab, tab1 -> new CompanyTabSkinBlackReason(this));
|
||||||
registerTabSkin(bankAccountTab, tab1 -> new CompanyTabSkinBankAccount(this));
|
registerTabSkin(bankAccountTab, tab1 -> new CompanyTabSkinBankAccount(this));
|
||||||
registerTabSkin(contractTab, this::createContractTabSkin);
|
registerTabSkin(contractTab, tab -> new CompanyTabSkinContract(this));
|
||||||
registerTabSkin(fileTab, this::createFileTabSkin);
|
registerTabSkin(fileTab, tab -> new CompanyTabSkinFile(this));
|
||||||
registerTabSkin(invoiceTab, tab -> new CompanyTabSkinInvoice(this));
|
registerTabSkin(invoiceTab, tab -> new CompanyTabSkinInvoice(this));
|
||||||
registerTabSkin(purchaseBillVoucherTab, tab -> new CompanyTabSkinPurchaseBillVoucher(this));
|
registerTabSkin(purchaseBillVoucherTab, tab -> new CompanyTabSkinPurchaseBillVoucher(this));
|
||||||
registerTabSkin(otherTab, tab -> new CompanyTabSkinOther(this));
|
registerTabSkin(otherTab, tab -> new CompanyTabSkinOther(this));
|
||||||
|
|
||||||
|
|
||||||
initializeVendorTab();
|
initializeVendorTab();
|
||||||
initializeCustomerTab();
|
initializeCustomerTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <K extends AbstEntityBasedTabSkin<?, ?, ?>> K registerTabSkin(Tab tab, Function<Tab, K> func) {
|
protected <K extends AbstEntityBasedTabSkin<?, ?, ?>> K registerTabSkin(Tab tab, Function<Tab, K> func) {
|
||||||
K skin = super.registerTabSkin(tab, func);
|
K skin = super.registerTabSkin(tab, func);
|
||||||
@@ -187,19 +203,6 @@ public class CompanyWindowController
|
|||||||
return companyService;
|
return companyService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private CompanyTabSkinContract createContractTabSkin(Tab tab) {
|
|
||||||
CompanyTabSkinContract skin = new CompanyTabSkinContract(this);
|
|
||||||
skin.setContractService(contractService);
|
|
||||||
return skin;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CompanyTabSkinFile createFileTabSkin(Tab tab) {
|
|
||||||
CompanyTabSkinFile skin = new CompanyTabSkinFile(this);
|
|
||||||
skin.setCompanyFileService(companyFileService);
|
|
||||||
return skin;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeCustomerTab() {
|
private void initializeCustomerTab() {
|
||||||
customerTab.setOnSelectionChanged(event -> {
|
customerTab.setOnSelectionChanged(event -> {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
@@ -210,7 +213,6 @@ public class CompanyWindowController
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
customerTab_pane1.visibleProperty().bind(customerTab_pane2.visibleProperty().not());
|
customerTab_pane1.visibleProperty().bind(customerTab_pane2.visibleProperty().not());
|
||||||
customerTab_pane2.visibleProperty().bind(companyCustomerProperty.isNull());
|
customerTab_pane2.visibleProperty().bind(companyCustomerProperty.isNull());
|
||||||
customerTab_createBtn.setOnAction(event -> {
|
customerTab_createBtn.setOnAction(event -> {
|
||||||
@@ -284,7 +286,6 @@ public class CompanyWindowController
|
|||||||
*/
|
*/
|
||||||
public void onCompanyVerifyAction(ActionEvent event) {
|
public void onCompanyVerifyAction(ActionEvent event) {
|
||||||
Company company = getEntity();
|
Company company = getEntity();
|
||||||
|
|
||||||
CompanyVerifyTasker task = new CompanyVerifyTasker();
|
CompanyVerifyTasker task = new CompanyVerifyTasker();
|
||||||
task.setCompanyService(companyService);
|
task.setCompanyService(companyService);
|
||||||
task.setCompany(company);
|
task.setCompany(company);
|
||||||
@@ -1,17 +1,18 @@
|
|||||||
package com.ecep.contract.manager.ds.company.controller.old_name;
|
package com.ecep.contract.controller.company_old_name;
|
||||||
|
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.model.CompanyOldName;
|
||||||
|
import com.ecep.contract.service.CompanyOldNameService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.CompanyOldName;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyOldNameService;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ds.company.vo.CompanyOldNameViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.util.converter.LocalDateStringConverter;
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
|
|
||||||
public class CompanyOldNameTabSkinBase
|
public class CompanyOldNameTabSkinBase
|
||||||
extends AbstEntityBasedTabSkin<CompanyOldNameWindowController, CompanyOldName, CompanyOldNameViewModel>
|
extends AbstEntityBasedTabSkin<CompanyOldNameWindowController, CompanyOldName, CompanyOldNameViewModel>
|
||||||
@@ -0,0 +1,368 @@
|
|||||||
|
package com.ecep.contract.controller.company_old_name;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.CompanyFileType;
|
||||||
|
import com.ecep.contract.DesktopUtils;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.model.CompanyFile;
|
||||||
|
import com.ecep.contract.model.CompanyOldName;
|
||||||
|
import com.ecep.contract.service.CompanyFileService;
|
||||||
|
import com.ecep.contract.service.CompanyOldNameService;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CompanyFileViewModel;
|
||||||
|
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.event.Event;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TableCell;
|
||||||
|
import javafx.scene.control.TableView;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CompanyOldNameTabSkinFile
|
||||||
|
extends
|
||||||
|
AbstEntityTableTabSkin<CompanyOldNameWindowController, CompanyOldName, CompanyOldNameViewModel, CompanyFile, CompanyFileViewModel>
|
||||||
|
implements TabSkin {
|
||||||
|
@Setter
|
||||||
|
private CompanyOldNameService companyOldNameService;
|
||||||
|
@Setter
|
||||||
|
private CompanyFileService companyFileService;
|
||||||
|
|
||||||
|
public CompanyOldNameTabSkinFile(CompanyOldNameWindowController controller) {
|
||||||
|
super(controller);
|
||||||
|
setDragAndDrop(true);
|
||||||
|
setDragAndDropFileHandler(this::moveFileToCompany);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Tab getTab() {
|
||||||
|
return controller.fileTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableView<CompanyFileViewModel> getTableView() {
|
||||||
|
return controller.fileTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CompanyFileService getViewModelService() {
|
||||||
|
return companyFileService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getSpecification(CompanyOldName parent) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("company", parent.getCompanyId());
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initializeTab() {
|
||||||
|
// controller.fileTable_file_move_btn.setOnAction(this::onTableMoveFileAction);
|
||||||
|
// controller.fileTable_file_retrieve_from_download_dir_btn.setOnAction(this::onTableRetrieveFromDownloadDirAction);
|
||||||
|
// controller.fileTable_file_reset_btn.setOnAction(this::onTableResetAction);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// controller.fileTable_idColumn.setCellValueFactory(param ->
|
||||||
|
// param.getValue().getId());
|
||||||
|
// ObservableMap<CompanyFileType, CompanyFileTypeLocal> observableMapByLocal =
|
||||||
|
// getBean(CompanyFileTypeLocalRepository.class).getObservableMapByLocal();
|
||||||
|
// controller.fileTable_typeColumn.setCellValueFactory(param ->
|
||||||
|
// Bindings.valueAt(observableMapByLocal,
|
||||||
|
// param.getValue().getType()).map(CompanyFileTypeLocal::getValue));
|
||||||
|
// controller.fileTable_filePathColumn.setCellValueFactory(param ->
|
||||||
|
// param.getValue().getFilePath());
|
||||||
|
// controller.fileTable_filePathColumn.setCellFactory(param -> new
|
||||||
|
// FileTableFilePathTableCell());
|
||||||
|
// controller.fileTable_applyDateColumn.setCellValueFactory(param ->
|
||||||
|
// param.getValue().getApplyDate());
|
||||||
|
// controller.fileTable_expiringDateColumn.setCellValueFactory(param ->
|
||||||
|
// param.getValue().getExpiringDate());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// controller.fileTable_menu_refresh.setOnAction(this::onTableRefreshAction);
|
||||||
|
// controller.fileTable_menu_del.setOnAction(this::onTableDeleteAction);
|
||||||
|
// controller.fileTable_menu_copy_as_matched_by_contract.setOnAction(this::onTableCopyAsMatchedByContractAction);
|
||||||
|
// controller.fileTable_menu_copy_as_matched_by_contract.setOnMenuValidation(this::onTableCopyAsMatchedMenuValidation);
|
||||||
|
|
||||||
|
super.initializeTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onTableResetAction(ActionEvent event) {
|
||||||
|
CompanyOldName oldName = getParent();
|
||||||
|
// CompletableFuture.runAsync(() -> {
|
||||||
|
// if (getCompanyFileService().reBuildingFiles(oldName, this::setStatus)) {
|
||||||
|
// loadTableDataSet();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从 下载目录 中查找相关的资质文件
|
||||||
|
*/
|
||||||
|
private void onTableRetrieveFromDownloadDirAction(ActionEvent event) {
|
||||||
|
// CompanyOldName oldName = getParent();
|
||||||
|
// MyProperties myProperties = getMyProperties();
|
||||||
|
// File dir = myProperties.getDownloadDirectory();
|
||||||
|
// if (!dir.exists()) {
|
||||||
|
// setStatus("下载目录 " + dir.getAbsolutePath() + " 不存在,请检查");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// setStatus("开始检索 下载 文件夹:" + dir.getAbsolutePath() + "...");
|
||||||
|
// File[] files = dir.listFiles(File::isFile);
|
||||||
|
// if (files == null) {
|
||||||
|
// setStatus("检索 下载 文件夹失败");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if (files.length == 0) {
|
||||||
|
// setStatus("下载 文件夹没有文件");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// setStatus("下载 文件夹中共有文件 " + files.length + " 个文件");
|
||||||
|
//
|
||||||
|
// if (getCompanyOldNameService().retrieveFromDownloadFiles(oldName, files,
|
||||||
|
// this::setStatus)) {
|
||||||
|
// // fixed if update
|
||||||
|
// viewModel.update(oldName);
|
||||||
|
// loadTableDataSet();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把文件从 老系统中移到 \\10.84.209.8\项目信息\相关方信息 目录中
|
||||||
|
*/
|
||||||
|
private void onTableMoveFileAction(ActionEvent event) {
|
||||||
|
// CompanyFileService companyFileService = getCompanyFileService();
|
||||||
|
// CompanyOldName oldName = getParent();
|
||||||
|
// List<CompanyFile> list = companyFileService.findByCompany(oldName);
|
||||||
|
// if (list.isEmpty()) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if (getCompanyService().makePathAbsent(oldName)) {
|
||||||
|
// save(oldName);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String path = oldName.getPath();
|
||||||
|
// if (!StringUtils.hasText(path)) {
|
||||||
|
// setStatus("异常, 企业目录未设置");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// File companyPath = new File(path);
|
||||||
|
// for (CompanyFile companyFile : list) {
|
||||||
|
// String filePath = companyFile.getFilePath();
|
||||||
|
// if (StringUtils.hasText(filePath)) {
|
||||||
|
// File file = new File(filePath);
|
||||||
|
// if (file.exists()) {
|
||||||
|
// if (file.getParentFile().equals(companyPath)) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// File dest = new File(companyPath, file.getName());
|
||||||
|
// if (file.renameTo(dest)) {
|
||||||
|
// companyFile.setFilePath(dest.getAbsolutePath());
|
||||||
|
// companyFileService.save(companyFile);
|
||||||
|
// setStatus(file.getName() + " 移动到 " + companyPath.getName());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void onTableCopyAsMatchedByContractAction(ActionEvent event) {
|
||||||
|
UITools.showDialogAndWait("复制资信评估报告", "按当前评估报告复制一个合同中最匹配的", list -> {
|
||||||
|
onTableCopyAsMatchedAction_(msg -> {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
list.add(msg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onTableCopyAsMatchedAction_(Consumer<String> state) {
|
||||||
|
// CompanyOldName oldName = getParent();
|
||||||
|
//
|
||||||
|
// CompanyFileViewModel selectedItem =
|
||||||
|
// table.getSelectionModel().getSelectedItem();
|
||||||
|
// if (selectedItem == null) {
|
||||||
|
// state.accept("未选择行");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// if (selectedItem.getApplyDate().get() == null) {
|
||||||
|
// state.accept("有效日期不能未空");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// LocalDate nextCreditReportDate = null;
|
||||||
|
// try {
|
||||||
|
// nextCreditReportDate = companyFileService.getNextCreditReportDate(oldName,
|
||||||
|
// state);
|
||||||
|
// if (nextCreditReportDate == null) {
|
||||||
|
// state.accept("没有找到下一个咨询评估日期");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// state.accept("获取下一个咨询评估日期失败:" + e.getMessage());
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// state.accept("下一个咨询评估日期:" + nextCreditReportDate);
|
||||||
|
//
|
||||||
|
// if (!nextCreditReportDate.isBefore(selectedItem.getApplyDate().get())) {
|
||||||
|
// state.accept("咨询评估日期晚于下一个咨询评估日期");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// File src = new File(selectedItem.getFilePath().get());
|
||||||
|
// if (!src.exists()) {
|
||||||
|
// state.accept("当前选择行的文件不存在");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String srcDate = MyDateTimeUtils.format(selectedItem.getApplyDate().get());
|
||||||
|
// String destDate = MyDateTimeUtils.format(nextCreditReportDate);
|
||||||
|
// String srcFileName = src.getName();
|
||||||
|
// String destFileName;
|
||||||
|
//
|
||||||
|
// // 天眼查的报告
|
||||||
|
// if (CloudTycService.isTycReport(srcFileName)) {
|
||||||
|
// state.accept("天眼查的报告按标准格式命名");
|
||||||
|
// String name = oldName.getName() + "_" + CloudTycService.NAME;
|
||||||
|
// if (srcFileName.contains(CloudTycService.TYC_ENTERPRISE_BASIC_REPORT)) {
|
||||||
|
// name = name + "_" + CloudTycService.TYC_ENTERPRISE_BASIC_REPORT;
|
||||||
|
// } else if (srcFileName.contains(CloudTycService.TYC_ENTERPRISE_MAJOR_REPORT))
|
||||||
|
// {
|
||||||
|
// name = name + "_" + CloudTycService.TYC_ENTERPRISE_MAJOR_REPORT;
|
||||||
|
// } else if
|
||||||
|
// (srcFileName.contains(CloudTycService.TYC_ENTERPRISE_ANALYSIS_REPORT)) {
|
||||||
|
// name = name + "_" + CloudTycService.TYC_ENTERPRISE_ANALYSIS_REPORT;
|
||||||
|
// }
|
||||||
|
// destFileName = name + "_" + destDate + "_cp." +
|
||||||
|
// StringUtils.getFilenameExtension(srcFileName);
|
||||||
|
// } else {
|
||||||
|
// if (srcFileName.contains(srcDate)) {
|
||||||
|
// // 如果文件名中包含日期,则替换为新日期
|
||||||
|
// destFileName = srcFileName.replace(srcDate, destDate + "_cp");
|
||||||
|
// } else {
|
||||||
|
// // 如果文件名中不包含日期,则添加日期
|
||||||
|
// destFileName = oldName.getName() + "_" + destDate + "_cp." +
|
||||||
|
// StringUtils.getFilenameExtension(srcFileName);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// state.accept("新文件名:" + destFileName);
|
||||||
|
//
|
||||||
|
// File dest = new File(src.getParent(), destFileName);
|
||||||
|
// try {
|
||||||
|
// FileSystemUtils.copyRecursively(src, dest);
|
||||||
|
// state.accept("新文件复制成功");
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// state.accept("新文件复制失败:" + e.getMessage());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// CompanyFile companyFile = new CompanyFile();
|
||||||
|
// companyFile.setFilePath(dest.getAbsolutePath());
|
||||||
|
// companyFile.setApplyDate(nextCreditReportDate);
|
||||||
|
// companyFile.setExpiringDate(nextCreditReportDate.plusYears(1));
|
||||||
|
// companyFile.setType(CompanyFileType.CreditReport);
|
||||||
|
// companyFile.setCompany(oldName);
|
||||||
|
// companyFileService.save(companyFile);
|
||||||
|
//
|
||||||
|
// state.accept("新文件已记录");
|
||||||
|
//
|
||||||
|
// loadTableDataSet();
|
||||||
|
// state.accept("文件表已刷新");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当fileTable选中的行是咨询评估时,可用
|
||||||
|
*
|
||||||
|
* @param event event
|
||||||
|
*/
|
||||||
|
public void onTableCopyAsMatchedMenuValidation(Event event) {
|
||||||
|
// 当fileTable选中的行是咨询评估时,可用
|
||||||
|
CompanyFileViewModel selectedItem = getSelectedItem();
|
||||||
|
if (selectedItem == null) {
|
||||||
|
event.consume();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CompanyFileType type = selectedItem.getType().get();
|
||||||
|
if (type != CompanyFileType.CreditReport) {
|
||||||
|
event.consume();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void moveFileToCompany(List<File> files) {
|
||||||
|
String path = viewModel.getPath().get();
|
||||||
|
if (!StringUtils.hasText(path)) {
|
||||||
|
setStatus("未设置目录");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File dir = new File(path);
|
||||||
|
if (!dir.exists()) {
|
||||||
|
setStatus("目录错误,不存在");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onTableRowDoubleClickedAction(CompanyFileViewModel item) {
|
||||||
|
String path = item.getFilePath().get();
|
||||||
|
if (StringUtils.hasText(path)) {
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
setStatus("文件不存在 " + file.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DesktopUtils.showInExplorer(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileTableFilePathTableCell extends TableCell<CompanyFileViewModel, String> {
|
||||||
|
@Override
|
||||||
|
protected void updateItem(String item, boolean empty) {
|
||||||
|
super.updateItem(item, empty);
|
||||||
|
if (empty || item == null) {
|
||||||
|
setText("");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String path = viewModel.getPath().get();
|
||||||
|
if (StringUtils.hasText(path)) {
|
||||||
|
if (item.startsWith(path)) {
|
||||||
|
item = "~" + item.substring(path.length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setText(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CompanyFileService getCompanyFileService() {
|
||||||
|
if (companyFileService == null) {
|
||||||
|
companyFileService = getBean(CompanyFileService.class);
|
||||||
|
}
|
||||||
|
return companyFileService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompanyOldNameService getCompanyOldNameService() {
|
||||||
|
if (companyOldNameService == null) {
|
||||||
|
companyOldNameService = getBean(CompanyOldNameService.class);
|
||||||
|
}
|
||||||
|
return companyOldNameService;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,30 +1,38 @@
|
|||||||
package com.ecep.contract.manager.ds.company.controller.old_name;
|
package com.ecep.contract.controller.company_old_name;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.CompanyOldName;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyOldNameService;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ds.company.vo.CompanyFileViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.company.vo.CompanyOldNameViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.ViewModelService;
|
|
||||||
import com.ecep.contract.manager.util.DesktopUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.model.CompanyOldName;
|
||||||
|
import com.ecep.contract.service.CompanyOldNameService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CompanyFileViewModel;
|
||||||
|
import com.ecep.contract.vm.CompanyOldNameViewModel;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.ButtonType;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TableView;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -45,12 +53,6 @@ public class CompanyOldNameWindowController extends AbstEntityController<Company
|
|||||||
public TabPane tabPane;
|
public TabPane tabPane;
|
||||||
public Tab fileTab;
|
public Tab fileTab;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CompanyOldNameService companyOldNameService;
|
|
||||||
@Autowired
|
|
||||||
private CompanyService companyService;
|
|
||||||
|
|
||||||
public TextField nameField;
|
public TextField nameField;
|
||||||
public CheckBox ambiguityField;
|
public CheckBox ambiguityField;
|
||||||
public DatePicker startDateField;
|
public DatePicker startDateField;
|
||||||
@@ -62,10 +64,8 @@ public class CompanyOldNameWindowController extends AbstEntityController<Company
|
|||||||
public Button saveBtn;
|
public Button saveBtn;
|
||||||
public Button saveBtn2;
|
public Button saveBtn2;
|
||||||
|
|
||||||
|
|
||||||
public TableView<CompanyFileViewModel> fileTable;
|
public TableView<CompanyFileViewModel> fileTable;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
@@ -74,12 +74,12 @@ public class CompanyOldNameWindowController extends AbstEntityController<Company
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CompanyOldName loadEntity() {
|
protected CompanyOldName loadEntity() {
|
||||||
return companyOldNameService.findById(viewModel.getId().get());
|
return getViewModelService().findById(viewModel.getId().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CompanyOldName saveEntity(CompanyOldName entity) {
|
protected CompanyOldName saveEntity(CompanyOldName entity) {
|
||||||
return companyOldNameService.save(entity);
|
return getViewModelService().save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,23 +90,22 @@ public class CompanyOldNameWindowController extends AbstEntityController<Company
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompanyOldNameService getViewModelService() {
|
public CompanyOldNameService getViewModelService() {
|
||||||
return companyOldNameService;
|
return getCachedBean(CompanyOldNameService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompanyOldNameTabSkinBase createBaseTabSkin(Tab tab) {
|
private CompanyOldNameTabSkinBase createBaseTabSkin(Tab tab) {
|
||||||
CompanyOldNameTabSkinBase skin = new CompanyOldNameTabSkinBase(this);
|
CompanyOldNameTabSkinBase skin = new CompanyOldNameTabSkinBase(this);
|
||||||
skin.setCompanyOldNameService(companyOldNameService);
|
skin.setCompanyOldNameService(getViewModelService());
|
||||||
return skin;
|
return skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompanyOldNameTabSkinFile createFileTabSkin(Tab tab) {
|
private CompanyOldNameTabSkinFile createFileTabSkin(Tab tab) {
|
||||||
CompanyOldNameTabSkinFile skin = new CompanyOldNameTabSkinFile(this);
|
CompanyOldNameTabSkinFile skin = new CompanyOldNameTabSkinFile(this);
|
||||||
skin.setCompanyOldNameService(companyOldNameService);
|
skin.setCompanyOldNameService(getViewModelService());
|
||||||
// skin.setCompanyFileService(companyFileService);
|
// skin.setCompanyFileService(companyFileService);
|
||||||
return skin;
|
return skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onOldCompanyOpenInExplorerAction(ActionEvent event) {
|
public void onOldCompanyOpenInExplorerAction(ActionEvent event) {
|
||||||
CompanyOldName companyOldName = getEntity();
|
CompanyOldName companyOldName = getEntity();
|
||||||
String path = companyOldName.getPath();
|
String path = companyOldName.getPath();
|
||||||
@@ -115,7 +114,7 @@ public class CompanyOldNameWindowController extends AbstEntityController<Company
|
|||||||
if (!StringUtils.hasText(path)) {
|
if (!StringUtils.hasText(path)) {
|
||||||
ButtonType buttonType = UITools.showConfirmation("目录未设置", "是否创建目录").join();
|
ButtonType buttonType = UITools.showConfirmation("目录未设置", "是否创建目录").join();
|
||||||
if (buttonType == ButtonType.OK) {
|
if (buttonType == ButtonType.OK) {
|
||||||
if (companyOldNameService.makePathAbsent(companyOldName)) {
|
if (getViewModelService().makePathAbsent(companyOldName)) {
|
||||||
save(companyOldName);
|
save(companyOldName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -128,4 +127,3 @@ public class CompanyOldNameWindowController extends AbstEntityController<Company
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.ecep.contract.manager.ds.contract.controller;
|
package com.ecep.contract.controller.contract;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractService;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.manager.ds.contract.vo.ContractViewModel;
|
import com.ecep.contract.model.Contract;
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
|
||||||
public abstract class AbstContractBasedTabSkin
|
public abstract class AbstContractBasedTabSkin
|
||||||
extends AbstEntityBasedTabSkin<ContractWindowController, Contract, ContractViewModel>
|
extends AbstEntityBasedTabSkin<ContractWindowController, Contract, ContractViewModel>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.ecep.contract.controller.contract;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.controller.table.TableOfTabSkin;
|
||||||
|
import com.ecep.contract.model.Contract;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.service.ContractService;
|
||||||
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
|
||||||
|
public abstract class AbstContractTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
|
extends AbstEntityTableTabSkin<ContractWindowController, Contract, ContractViewModel, T, TV>
|
||||||
|
implements TabSkin, TableOfTabSkin<Contract, T, TV> {
|
||||||
|
|
||||||
|
public AbstContractTableTabSkin(ContractWindowController controller) {
|
||||||
|
super(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContractService getContractService() {
|
||||||
|
return controller.contractService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getSpecification(Contract parent) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("contract", parent.getId());
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager.ds.contract.controller;
|
package com.ecep.contract.controller.contract;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -8,19 +8,20 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
import com.ecep.contract.controller.tab.ContractManagerSkin;
|
||||||
import com.ecep.contract.manager.ds.contract.model.ContractGroup;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.manager.ds.contract.model.ContractKind;
|
import com.ecep.contract.model.Contract;
|
||||||
import com.ecep.contract.manager.ds.contract.model.ContractType;
|
import com.ecep.contract.model.ContractGroup;
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractService;
|
import com.ecep.contract.model.ContractKind;
|
||||||
import com.ecep.contract.manager.ds.contract.tasker.ContractFilesRebuildAllTasker;
|
import com.ecep.contract.model.ContractType;
|
||||||
import com.ecep.contract.manager.ds.contract.tasker.ContractRepairAllTasker;
|
import com.ecep.contract.model.Employee;
|
||||||
import com.ecep.contract.manager.ds.contract.vo.ContractViewModel;
|
import com.ecep.contract.service.ContractService;
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
import com.ecep.contract.task.ContractFilesRebuildAllTasker;
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
import com.ecep.contract.task.ContractRepairAllTasker;
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.manager.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
package com.ecep.contract.manager.ds.contract.controller;
|
package com.ecep.contract.controller.contract;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
import com.ecep.contract.controller.ComboBoxUtils;
|
||||||
import com.ecep.contract.manager.ds.contract.model.ExtendVendorInfo;
|
import com.ecep.contract.model.Contract;
|
||||||
import com.ecep.contract.manager.ds.contract.service.ExtendVendorInfoService;
|
import com.ecep.contract.model.ExtendVendorInfo;
|
||||||
import com.ecep.contract.manager.ds.contract.vo.ExtendVendorInfoViewModel;
|
import com.ecep.contract.model.VendorGroup;
|
||||||
import com.ecep.contract.manager.ds.vendor.model.VendorGroup;
|
import com.ecep.contract.service.ExtendVendorInfoService;
|
||||||
import com.ecep.contract.manager.ds.vendor.service.VendorGroupService;
|
import com.ecep.contract.service.VendorGroupService;
|
||||||
import com.ecep.contract.manager.ui.ComboBoxUtils;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.manager.util.UITools;
|
import com.ecep.contract.vm.ExtendVendorInfoViewModel;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
@@ -1,37 +1,18 @@
|
|||||||
package com.ecep.contract.manager.ds.contract.controller;
|
package com.ecep.contract.controller.contract;
|
||||||
|
|
||||||
|
import static com.ecep.contract.util.TableViewUtils.bindDoubleClicked;
|
||||||
|
import static com.ecep.contract.util.TableViewUtils.bindEnterPressed;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.contract.ContractPayWay;
|
|
||||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractService;
|
|
||||||
import com.ecep.contract.manager.ds.contract.tasker.ContractVerifyComm;
|
|
||||||
import com.ecep.contract.manager.ds.contract.tasker.ContractVerifyResultExportAsExcelFile;
|
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeService;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.SaleTypeService;
|
|
||||||
import com.ecep.contract.manager.ds.vendor.service.VendorGroupService;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.Message;
|
|
||||||
import com.ecep.contract.manager.ui.MessageHolder;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.EmployeeTableCell;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.beans.property.SimpleListProperty;
|
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ListChangeListener;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXMLLoader;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.HBox;
|
|
||||||
import javafx.stage.*;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -40,21 +21,51 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import com.ecep.contract.Message;
|
||||||
import java.time.LocalDate;
|
import com.ecep.contract.MessageHolder;
|
||||||
import java.util.ArrayList;
|
import com.ecep.contract.controller.BaseController;
|
||||||
import java.util.List;
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import com.ecep.contract.model.Contract;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import com.ecep.contract.model.Employee;
|
||||||
import java.util.logging.Level;
|
import com.ecep.contract.service.ContractService;
|
||||||
|
import com.ecep.contract.service.EmployeeService;
|
||||||
|
import com.ecep.contract.service.ProjectSaleTypeService;
|
||||||
|
import com.ecep.contract.service.VendorGroupService;
|
||||||
|
import com.ecep.contract.task.ContractVerifyComm;
|
||||||
|
import com.ecep.contract.task.ContractVerifyResultExportAsExcelFileTasker;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
|
||||||
import static com.ecep.contract.manager.util.TableViewUtils.bindDoubleClicked;
|
import javafx.application.Platform;
|
||||||
import static com.ecep.contract.manager.util.TableViewUtils.bindEnterPressed;
|
import javafx.beans.property.SimpleListProperty;
|
||||||
import static java.util.concurrent.CompletableFuture.runAsync;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ListChangeListener;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.CheckMenuItem;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.TableCell;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.scene.control.TableView;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.stage.FileChooser;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -78,7 +89,6 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Model implements MessageHolder {
|
public static class Model implements MessageHolder {
|
||||||
private SimpleStringProperty code = new SimpleStringProperty();
|
private SimpleStringProperty code = new SimpleStringProperty();
|
||||||
@@ -104,9 +114,6 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static class StateTableCell extends TableCell<Model, ObservableList<MessageExt>> {
|
static class StateTableCell extends TableCell<Model, ObservableList<MessageExt>> {
|
||||||
Label message2Label(MessageExt message) {
|
Label message2Label(MessageExt message) {
|
||||||
Label label = new Label(message.getMessage());
|
Label label = new Label(message.getMessage());
|
||||||
@@ -154,7 +161,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
ContractVerifyComm comm = new ContractVerifyComm();
|
ContractVerifyComm comm = new ContractVerifyComm();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SaleTypeService saleTypeService;
|
private ProjectSaleTypeService saleTypeService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private VendorGroupService vendorGroupService;
|
private VendorGroupService vendorGroupService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -189,7 +196,6 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
@FXML
|
@FXML
|
||||||
public CheckMenuItem onlyShowVerifiedChecker;
|
public CheckMenuItem onlyShowVerifiedChecker;
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public TableView<Model> viewTable;
|
public TableView<Model> viewTable;
|
||||||
private final ObservableList<Model> viewTableDataSet = FXCollections.observableArrayList();
|
private final ObservableList<Model> viewTableDataSet = FXCollections.observableArrayList();
|
||||||
@@ -224,9 +230,11 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
viewTable_employeeColumn.setCellValueFactory(param -> param.getValue().getEmployee());
|
viewTable_employeeColumn.setCellValueFactory(param -> param.getValue().getEmployee());
|
||||||
viewTable_employeeColumn.setCellFactory(param -> new EmployeeTableCell<>(getEmployeeService()));
|
viewTable_employeeColumn.setCellFactory(param -> new EmployeeTableCell<>(getEmployeeService()));
|
||||||
viewTable_setupDateColumn.setCellValueFactory(param -> param.getValue().getSetupDate());
|
viewTable_setupDateColumn.setCellValueFactory(param -> param.getValue().getSetupDate());
|
||||||
// viewTable_stateColumn.setCellValueFactory(param -> param.getValue().getMessages().map(messages -> {
|
// viewTable_stateColumn.setCellValueFactory(param ->
|
||||||
// return messages.stream().map(Message::getMessage).collect(Collectors.joining(", "));
|
// param.getValue().getMessages().map(messages -> {
|
||||||
// }));
|
// return
|
||||||
|
// messages.stream().map(Message::getMessage).collect(Collectors.joining(", "));
|
||||||
|
// }));
|
||||||
viewTable_stateColumn.setCellValueFactory(param -> param.getValue().getMessages());
|
viewTable_stateColumn.setCellValueFactory(param -> param.getValue().getMessages());
|
||||||
viewTable_stateColumn.setCellFactory(param -> new StateTableCell());
|
viewTable_stateColumn.setCellFactory(param -> new StateTableCell());
|
||||||
|
|
||||||
@@ -241,11 +249,9 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
comm.getVerifyCustomerFiles().bind(verifyCustomerFileChecker.selectedProperty());
|
comm.getVerifyCustomerFiles().bind(verifyCustomerFileChecker.selectedProperty());
|
||||||
comm.getVerifyCustomerSubContractDate().bind(verifyCustomerSubContractDateChecker.selectedProperty());
|
comm.getVerifyCustomerSubContractDate().bind(verifyCustomerSubContractDateChecker.selectedProperty());
|
||||||
|
|
||||||
|
|
||||||
bindDoubleClicked(viewTable, this::showContract);
|
bindDoubleClicked(viewTable, this::showContract);
|
||||||
bindEnterPressed(viewTable, this::reVerifyContract);
|
bindEnterPressed(viewTable, this::reVerifyContract);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -257,22 +263,11 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
viewTableDataSet.clear();
|
viewTableDataSet.clear();
|
||||||
Pageable pageRequest = PageRequest.ofSize(200);
|
Pageable pageRequest = PageRequest.ofSize(200);
|
||||||
AtomicInteger counter = new AtomicInteger(0);
|
AtomicInteger counter = new AtomicInteger(0);
|
||||||
Specification<Contract> spec = (root, query, builder) -> {
|
Map<String, Object> params = new HashMap<>();
|
||||||
return builder.and(
|
params.put("setupDate",
|
||||||
builder.or(
|
ParamUtils.between(setupDateBeginSelector.getValue(), setupDateEndSelector.getValue()));
|
||||||
builder.equal(root.get("payWay"), ContractPayWay.RECEIVE),
|
|
||||||
builder.and(
|
long total = contractService.count(params);
|
||||||
builder.equal(root.get("payWay"), ContractPayWay.PAY),
|
|
||||||
builder.or(
|
|
||||||
builder.isNull(root.get("parentCode")),
|
|
||||||
builder.equal(root.get("parentCode"), "")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
builder.between(root.get("setupDate"), setupDateBeginSelector.getValue(), setupDateEndSelector.getValue())
|
|
||||||
);
|
|
||||||
};
|
|
||||||
long total = contractService.count(spec);
|
|
||||||
setStatus("合同:" + total + " 条");
|
setStatus("合同:" + total + " 条");
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -280,7 +275,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Page<Contract> page = contractService.findAll(spec, pageRequest);
|
Page<Contract> page = contractService.findAll(params, pageRequest);
|
||||||
for (Contract contract : page) {
|
for (Contract contract : page) {
|
||||||
if (isCloseRequested()) {
|
if (isCloseRequested()) {
|
||||||
break;
|
break;
|
||||||
@@ -323,7 +318,6 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onContractReVerifyAction(ActionEvent event) {
|
public void onContractReVerifyAction(ActionEvent event) {
|
||||||
Model selectedItem = viewTable.getSelectionModel().getSelectedItem();
|
Model selectedItem = viewTable.getSelectionModel().getSelectedItem();
|
||||||
if (selectedItem == null) {
|
if (selectedItem == null) {
|
||||||
@@ -362,7 +356,6 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onShowContractDetailAction(ActionEvent event) {
|
public void onShowContractDetailAction(ActionEvent event) {
|
||||||
Model selectedItem = viewTable.getSelectionModel().getSelectedItem();
|
Model selectedItem = viewTable.getSelectionModel().getSelectedItem();
|
||||||
if (selectedItem == null) {
|
if (selectedItem == null) {
|
||||||
@@ -389,7 +382,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
chooser.setInitialFileName("核验结果.xlsx");
|
chooser.setInitialFileName("核验结果.xlsx");
|
||||||
File selected = chooser.showSaveDialog(viewTable.getScene().getWindow());
|
File selected = chooser.showSaveDialog(viewTable.getScene().getWindow());
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
ContractVerifyResultExportAsExcelFile task = new ContractVerifyResultExportAsExcelFile();
|
ContractVerifyResultExportAsExcelFileTasker task = new ContractVerifyResultExportAsExcelFileTasker();
|
||||||
task.setDestFile(selected);
|
task.setDestFile(selected);
|
||||||
task.setModels(new ArrayList<>(viewTableDataSet));
|
task.setModels(new ArrayList<>(viewTableDataSet));
|
||||||
UITools.showTaskDialogAndWait("导出中...", task, null);
|
UITools.showTaskDialogAndWait("导出中...", task, null);
|
||||||
@@ -1,33 +1,48 @@
|
|||||||
package com.ecep.contract.manager.ds.contract.controller;
|
package com.ecep.contract.controller.contract;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.controller.CompanyWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractService;
|
|
||||||
import com.ecep.contract.manager.ds.contract.tasker.ContractRepairTask;
|
|
||||||
import com.ecep.contract.manager.ds.contract.tasker.ContractVerifyTasker;
|
|
||||||
import com.ecep.contract.manager.ds.contract.vo.ContractViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectService;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.util.DesktopUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import javafx.util.converter.LocalDateStringConverter;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import com.ecep.contract.DesktopUtils;
|
||||||
import java.time.format.DateTimeFormatter;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinBase;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinFiles;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinItems;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinItemsV2;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinPayPlan;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinPurchaseOrders;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinSaleOrders;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinSubContract;
|
||||||
|
import com.ecep.contract.controller.tab.ContractTabSkinVendorBid;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.Contract;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.service.ContractService;
|
||||||
|
import com.ecep.contract.service.ProjectService;
|
||||||
|
import com.ecep.contract.task.ContractRepairTask;
|
||||||
|
import com.ecep.contract.task.ContractVerifyTasker;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -36,7 +51,6 @@ import java.time.format.DateTimeFormatter;
|
|||||||
public class ContractWindowController
|
public class ContractWindowController
|
||||||
extends AbstEntityController<Contract, ContractViewModel> {
|
extends AbstEntityController<Contract, ContractViewModel> {
|
||||||
|
|
||||||
|
|
||||||
public static void show(Contract contract, Window owner) {
|
public static void show(Contract contract, Window owner) {
|
||||||
ContractViewModel model = new ContractViewModel();
|
ContractViewModel model = new ContractViewModel();
|
||||||
model.update(contract);
|
model.update(contract);
|
||||||
@@ -70,9 +84,6 @@ public class ContractWindowController
|
|||||||
@Autowired
|
@Autowired
|
||||||
ProjectService projectService;
|
ProjectService projectService;
|
||||||
|
|
||||||
LocalDateStringConverter localDateStringConverter = new LocalDateStringConverter(DateTimeFormatter.ISO_LOCAL_DATE, null);
|
|
||||||
|
|
||||||
|
|
||||||
public TextField nameField;
|
public TextField nameField;
|
||||||
public TextField guidField;
|
public TextField guidField;
|
||||||
public TextField codeField;
|
public TextField codeField;
|
||||||
@@ -129,7 +140,8 @@ public class ContractWindowController
|
|||||||
|
|
||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
getTitle().bind(viewModel.getName().map(name -> "[" + viewModel.getId().get() + "] " + viewModel.getCode().get() + " " + name + " 合同详情"));
|
getTitle().bind(viewModel.getName()
|
||||||
|
.map(name -> "[" + viewModel.getId().get() + "] " + viewModel.getCode().get() + " " + name + " 合同详情"));
|
||||||
root.getScene().getStylesheets().add("/ui/contract/contract.css");
|
root.getScene().getStylesheets().add("/ui/contract/contract.css");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +183,6 @@ public class ContractWindowController
|
|||||||
registerTabSkin(fileTab, tab -> new ContractTabSkinFiles(this));
|
registerTabSkin(fileTab, tab -> new ContractTabSkinFiles(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onContractOpenInExplorerAction(ActionEvent event) {
|
public void onContractOpenInExplorerAction(ActionEvent event) {
|
||||||
Contract contract = getEntity();
|
Contract contract = getEntity();
|
||||||
String path = contract.getPath();
|
String path = contract.getPath();
|
||||||
@@ -202,7 +213,6 @@ public class ContractWindowController
|
|||||||
|
|
||||||
public void onSyncContractAction(ActionEvent event) {
|
public void onSyncContractAction(ActionEvent event) {
|
||||||
ContractRepairTask task = new ContractRepairTask();
|
ContractRepairTask task = new ContractRepairTask();
|
||||||
task.setContractService(contractService);
|
|
||||||
task.setContract(getEntity());
|
task.setContract(getEntity());
|
||||||
UITools.showTaskDialogAndWait("同步合同", task, null);
|
UITools.showTaskDialogAndWait("同步合同", task, null);
|
||||||
if (task.isRepaired()) {
|
if (task.isRepaired()) {
|
||||||
@@ -234,14 +244,12 @@ public class ContractWindowController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证合同合规性
|
* 验证合同合规性
|
||||||
*/
|
*/
|
||||||
public void onContractVerifyAction(ActionEvent event) {
|
public void onContractVerifyAction(ActionEvent event) {
|
||||||
Contract contract = getEntity();
|
Contract contract = getEntity();
|
||||||
ContractVerifyTasker task = new ContractVerifyTasker();
|
ContractVerifyTasker task = new ContractVerifyTasker();
|
||||||
task.setContractService(contractService);
|
|
||||||
task.setContract(contract);
|
task.setContract(contract);
|
||||||
UITools.showTaskDialogAndWait("同步合规性验证", task, null);
|
UITools.showTaskDialogAndWait("同步合规性验证", task, null);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||||
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
|
||||||
|
public abstract class AbstCompanyCustomerTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
|
extends
|
||||||
|
AbstEntityTableTabSkin<CompanyCustomerWindowController, CompanyCustomer, CompanyCustomerViewModel, T, TV>
|
||||||
|
implements TabSkin {
|
||||||
|
|
||||||
|
public AbstCompanyCustomerTableTabSkin(CompanyCustomerWindowController controller) {
|
||||||
|
super(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompanyService getCompanyService() {
|
||||||
|
return controller.getCompanyService();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CompanyCustomerService getCompanyCustomerService() {
|
||||||
|
return getCachedBean(CompanyCustomerService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,27 +1,11 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerEvaluationFormFile;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerFile;
|
|
||||||
import com.ecep.contract.manager.ds.customer.repository.CompanyCustomerEvaluationFormFileRepository;
|
|
||||||
import com.ecep.contract.manager.ds.customer.repository.CompanyCustomerFileRepository;
|
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
|
||||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerFileViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerFileService;
|
|
||||||
import com.ecep.contract.manager.ds.company.CompanyFileUtils;
|
|
||||||
import com.ecep.contract.manager.util.FxmlUtils;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.beans.binding.Bindings;
|
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.geometry.Bounds;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.image.Image;
|
|
||||||
import javafx.scene.image.ImageView;
|
|
||||||
import javafx.scene.image.PixelWriter;
|
|
||||||
import javafx.scene.image.WritableImage;
|
|
||||||
import javafx.stage.*;
|
|
||||||
import org.apache.pdfbox.Loader;
|
import org.apache.pdfbox.Loader;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.rendering.PDFRenderer;
|
import org.apache.pdfbox.rendering.PDFRenderer;
|
||||||
@@ -33,11 +17,37 @@ import org.springframework.context.annotation.Scope;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import com.ecep.contract.controller.BaseController;
|
||||||
import java.io.File;
|
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
||||||
import java.util.Objects;
|
import com.ecep.contract.model.CompanyCustomerFile;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
import java.util.function.BiConsumer;
|
import com.ecep.contract.util.FileUtils;
|
||||||
|
import com.ecep.contract.util.FxmlUtils;
|
||||||
|
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.beans.binding.Bindings;
|
||||||
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.geometry.Bounds;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.ScrollPane;
|
||||||
|
import javafx.scene.control.SplitPane;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.control.Toggle;
|
||||||
|
import javafx.scene.control.ToggleGroup;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.scene.image.ImageView;
|
||||||
|
import javafx.scene.image.PixelWriter;
|
||||||
|
import javafx.scene.image.WritableImage;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@@ -96,10 +106,6 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
|||||||
private SimpleObjectProperty<Image> imageProperty = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<Image> imageProperty = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
private CompletableFuture<CompanyCustomerEvaluationFormFile> loadedFuture;
|
private CompletableFuture<CompanyCustomerEvaluationFormFile> loadedFuture;
|
||||||
@Autowired
|
|
||||||
private CompanyCustomerFileRepository companyCustomerFileRepository;
|
|
||||||
@Autowired
|
|
||||||
private CompanyCustomerEvaluationFormFileRepository companyCustomerEvaluationFormFileRepository;
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private CompanyCustomerFileService companyCustomerFileService;
|
private CompanyCustomerFileService companyCustomerFileService;
|
||||||
@@ -291,7 +297,7 @@ public class CompanyCustomerEvaluationFormFileWindowController extends BaseContr
|
|||||||
|
|
||||||
|
|
||||||
imageView.imageProperty().bind(viewModel.getFilePath().map(path -> {
|
imageView.imageProperty().bind(viewModel.getFilePath().map(path -> {
|
||||||
if (CompanyFileUtils.withExtensions(path, CompanyFileUtils.PDF)) {
|
if (FileUtils.withExtensions(path, FileUtils.PDF)) {
|
||||||
File pdfFile = new File(path);
|
File pdfFile = new File(path);
|
||||||
try (PDDocument pdDocument = Loader.loadPDF(pdfFile)) {
|
try (PDDocument pdDocument = Loader.loadPDF(pdfFile)) {
|
||||||
PDFRenderer pdfRenderer = new PDFRenderer(pdDocument);
|
PDFRenderer pdfRenderer = new PDFRenderer(pdDocument);
|
||||||
@@ -1,20 +1,20 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
import static com.ecep.contract.util.ExcelUtils.setCellValue;
|
||||||
import com.ecep.contract.manager.cloud.tyc.CloudTyc;
|
|
||||||
import com.ecep.contract.manager.cloud.tyc.CloudTycService;
|
import java.io.File;
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
import java.io.FileInputStream;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyBasicService;
|
import java.io.FileNotFoundException;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyContactService;
|
import java.io.FileOutputStream;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
import java.io.IOException;
|
||||||
import com.ecep.contract.manager.ds.customer.CompanyCustomerFileType;
|
import java.io.InputStream;
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
import java.io.OutputStream;
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerEvaluationFormFile;
|
import java.time.LocalDate;
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerFile;
|
import java.util.Comparator;
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerFileService;
|
import java.util.List;
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
|
||||||
import javafx.concurrent.Task;
|
import com.ecep.contract.service.*;
|
||||||
import lombok.Setter;
|
import com.ecep.contract.util.CompanyUtils;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
@@ -24,12 +24,16 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.io.*;
|
import com.ecep.contract.CompanyCustomerFileType;
|
||||||
import java.time.LocalDate;
|
import com.ecep.contract.SpringApp;
|
||||||
import java.util.Comparator;
|
import com.ecep.contract.model.CloudTyc;
|
||||||
import java.util.List;
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
|
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
||||||
|
import com.ecep.contract.model.CompanyCustomerFile;
|
||||||
|
|
||||||
import static com.ecep.contract.manager.util.ExcelUtils.setCellValue;
|
import javafx.concurrent.Task;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerEvaluationFormUpdateTask.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerEvaluationFormUpdateTask.class);
|
||||||
@@ -109,8 +113,7 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
updateMessage("表单文件已经存在," + destFile.getName());
|
updateMessage("表单文件已经存在," + destFile.getName());
|
||||||
try (
|
try (
|
||||||
InputStream inp = new FileInputStream(destFile);
|
InputStream inp = new FileInputStream(destFile);
|
||||||
Workbook wb = WorkbookFactory.create(inp)
|
Workbook wb = WorkbookFactory.create(inp)) {
|
||||||
) {
|
|
||||||
updateEvaluationForm(wb, destFile);
|
updateEvaluationForm(wb, destFile);
|
||||||
updateMessage("评价表已更新");
|
updateMessage("评价表已更新");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -121,8 +124,7 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
updateMessage("根据模板 " + template_file_name + " 创建表单 " + destFile.getName());
|
updateMessage("根据模板 " + template_file_name + " 创建表单 " + destFile.getName());
|
||||||
try (
|
try (
|
||||||
InputStream inp = new FileInputStream(template);
|
InputStream inp = new FileInputStream(template);
|
||||||
Workbook wb = WorkbookFactory.create(inp)
|
Workbook wb = WorkbookFactory.create(inp)) {
|
||||||
) {
|
|
||||||
updateEvaluationForm(wb, destFile);
|
updateEvaluationForm(wb, destFile);
|
||||||
updateMessage("评价表已创建");
|
updateMessage("评价表已创建");
|
||||||
CompanyCustomerFile customerFile = new CompanyCustomerFile();
|
CompanyCustomerFile customerFile = new CompanyCustomerFile();
|
||||||
@@ -142,7 +144,6 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
getCompanyCustomerFileService().save(customerFile);
|
getCompanyCustomerFileService().save(customerFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新客户评估表,依据模板创建,如果已经存在生成的文件,则更新评估表
|
* 更新客户评估表,依据模板创建,如果已经存在生成的文件,则更新评估表
|
||||||
*
|
*
|
||||||
@@ -150,8 +151,7 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
* @param destFile 目标文件
|
* @param destFile 目标文件
|
||||||
*/
|
*/
|
||||||
public void updateEvaluationForm(
|
public void updateEvaluationForm(
|
||||||
Workbook wb, File destFile
|
Workbook wb, File destFile) throws IOException {
|
||||||
) throws IOException {
|
|
||||||
Company company = customer.getCompany();
|
Company company = customer.getCompany();
|
||||||
if (!Hibernate.isInitialized(company)) {
|
if (!Hibernate.isInitialized(company)) {
|
||||||
company = getCompanyService().findById(company.getId());
|
company = getCompanyService().findById(company.getId());
|
||||||
@@ -172,10 +172,10 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateSheet(Company company, Sheet sheet) {
|
private void updateSheet(Company company, Sheet sheet) {
|
||||||
setCellValue(sheet, "B3", "客户编号:" + CompanyBasicService.formatCompanyVendorId(customer.getId()));
|
setCellValue(sheet, "B3", "客户编号:" + CompanyUtils.formatCompanyVendorId(customer.getId()));
|
||||||
setCellValue(sheet, "B4", "客户名称:" + company.getName());
|
setCellValue(sheet, "B4", "客户名称:" + company.getName());
|
||||||
|
|
||||||
LocalDate suggestDate = getCompanyCustomerFileService().getNextSignDate(customer, msg -> {
|
LocalDate suggestDate = getCompanyCustomerFileService().getNextSignDate(customer, (level, msg) -> {
|
||||||
updateMessage(" - " + msg);
|
updateMessage(" - " + msg);
|
||||||
});
|
});
|
||||||
if (suggestDate == null) {
|
if (suggestDate == null) {
|
||||||
@@ -192,7 +192,8 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
setCellValue(sheet, "H6", "成立日期:" + company.getSetupDate());
|
setCellValue(sheet, "H6", "成立日期:" + company.getSetupDate());
|
||||||
// 所属行业
|
// 所属行业
|
||||||
setCellValue(sheet, "D7", "所属行业:" + company.getIndustry());
|
setCellValue(sheet, "D7", "所属行业:" + company.getIndustry());
|
||||||
setCellValue(sheet, "D8", "注册资金:" + company.getRegisteredCapital() + " " + company.getRegisteredCapitalCurrency());
|
setCellValue(sheet, "D8",
|
||||||
|
"注册资金:" + company.getRegisteredCapital() + " " + company.getRegisteredCapitalCurrency());
|
||||||
// 企业类型
|
// 企业类型
|
||||||
setCellValue(sheet, "H10", "企业类型:" + company.getEntType());
|
setCellValue(sheet, "H10", "企业类型:" + company.getEntType());
|
||||||
// 天眼评分
|
// 天眼评分
|
||||||
@@ -200,10 +201,9 @@ public class CompanyCustomerEvaluationFormUpdateTask extends Task<Object> {
|
|||||||
CloudTyc cloudTyc = cloudTycService.getOrCreateCloudTyc(company);
|
CloudTyc cloudTyc = cloudTycService.getOrCreateCloudTyc(company);
|
||||||
setCellValue(sheet, "D10", "天眼评分:" + (cloudTyc.getScore() > 0 ? cloudTyc.getScore() : ""));
|
setCellValue(sheet, "D10", "天眼评分:" + (cloudTyc.getScore() > 0 ? cloudTyc.getScore() : ""));
|
||||||
|
|
||||||
|
|
||||||
// 检索评估表
|
// 检索评估表
|
||||||
List<CompanyCustomerEvaluationFormFile> evaluationFormFiles =
|
List<CompanyCustomerEvaluationFormFile> evaluationFormFiles = getCompanyCustomerFileService()
|
||||||
getCompanyCustomerFileService().findAllCustomerEvaluationFormFiles(customer);
|
.findAllCustomerEvaluationFormFiles(customer);
|
||||||
List<CompanyCustomerEvaluationFormFile> filteredList = evaluationFormFiles.stream()
|
List<CompanyCustomerEvaluationFormFile> filteredList = evaluationFormFiles.stream()
|
||||||
.filter(v -> {
|
.filter(v -> {
|
||||||
CompanyCustomerFile file = v.getCustomerFile();
|
CompanyCustomerFile file = v.getCustomerFile();
|
||||||
@@ -1,17 +1,13 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerEntity;
|
import com.ecep.contract.model.*;
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerEvaluationFormFile;
|
import com.ecep.contract.service.CompanyCustomerEntityService;
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerFile;
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerEntityService;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerFileService;
|
import com.ecep.contract.task.Tasker;
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
import com.ecep.contract.util.UITools;
|
||||||
import com.ecep.contract.manager.ui.MessageHolder;
|
|
||||||
import com.ecep.contract.manager.ui.Tasker;
|
|
||||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.apache.poi.ss.SpreadsheetVersion;
|
import org.apache.poi.ss.SpreadsheetVersion;
|
||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
@@ -31,7 +27,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.ecep.contract.manager.util.ExcelUtils.*;
|
import static com.ecep.contract.util.ExcelUtils.*;
|
||||||
|
|
||||||
public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
|
public class CompanyCustomerExportExcelTasker extends Tasker<Object> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerExportExcelTasker.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerExportExcelTasker.class);
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.CompanyTableCell;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -1,10 +1,24 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import javafx.scene.layout.Priority;
|
||||||
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.stage.FileChooser;
|
||||||
|
import javafx.stage.Stage;
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
@@ -14,31 +28,10 @@ import org.springframework.data.domain.PageRequest;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
import java.io.File;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
import java.time.LocalDate;
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.collections.FXCollections;
|
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.scene.control.ButtonType;
|
|
||||||
import javafx.scene.control.Dialog;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.ListView;
|
|
||||||
import javafx.scene.control.ProgressBar;
|
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import javafx.stage.FileChooser;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -130,7 +123,7 @@ public class CompanyCustomerManagerWindowController
|
|||||||
}
|
}
|
||||||
|
|
||||||
String prefix = (index + i) + "/" + page.getTotalElements() + ", " + company.getName() + "> ";
|
String prefix = (index + i) + "/" + page.getTotalElements() + ", " + company.getName() + "> ";
|
||||||
companyCustomerService.reBuildingFiles(companyCustomer, msg -> {
|
companyCustomerService.reBuildingFiles(companyCustomer, (level, msg) -> {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
listViewDataSet.add(prefix + msg);
|
listViewDataSet.add(prefix + msg);
|
||||||
listView.scrollTo(listViewDataSet.size() - 1);
|
listView.scrollTo(listViewDataSet.size() - 1);
|
||||||
@@ -1,20 +1,24 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
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.model.Company;
|
||||||
|
import com.ecep.contract.model.CompanyContact;
|
||||||
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
|
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.manager.SpringApp;
|
|
||||||
import com.ecep.contract.manager.ds.company.CompanyStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.company.controller.CompanyWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
|
||||||
import com.ecep.contract.manager.ds.company.model.CompanyContact;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyContactService;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -22,9 +26,6 @@ import javafx.scene.control.Tab;
|
|||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.util.converter.LocalDateStringConverter;
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
|
|
||||||
public class CompanyCustomerTabSkinBase
|
public class CompanyCustomerTabSkinBase
|
||||||
extends AbstEntityBasedTabSkin<CompanyCustomerWindowController, CompanyCustomer, CompanyCustomerViewModel>
|
extends AbstEntityBasedTabSkin<CompanyCustomerWindowController, CompanyCustomer, CompanyCustomerViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
@@ -53,8 +54,7 @@ public class CompanyCustomerTabSkinBase
|
|||||||
controller.createdField.textProperty().bind(
|
controller.createdField.textProperty().bind(
|
||||||
Bindings.createStringBinding(
|
Bindings.createStringBinding(
|
||||||
() -> localDateTimeFormatter(viewModel.getCreated()),
|
() -> localDateTimeFormatter(viewModel.getCreated()),
|
||||||
viewModel.getCreated())
|
viewModel.getCreated()));
|
||||||
);
|
|
||||||
controller.versionLabel.textProperty().bind(viewModel.getVersion().asString());
|
controller.versionLabel.textProperty().bind(viewModel.getVersion().asString());
|
||||||
|
|
||||||
controller.relativeCompanyBtn.disableProperty().bind(viewModel.getCompany().isNull());
|
controller.relativeCompanyBtn.disableProperty().bind(viewModel.getCompany().isNull());
|
||||||
@@ -65,7 +65,6 @@ public class CompanyCustomerTabSkinBase
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
controller.createPathBtn.setOnAction(this::onCompanyCustomerCreatePathAction);
|
controller.createPathBtn.setOnAction(this::onCompanyCustomerCreatePathAction);
|
||||||
controller.changePathBtn.setOnAction(this::onCompanyCustomerChangePathAction);
|
controller.changePathBtn.setOnAction(this::onCompanyCustomerChangePathAction);
|
||||||
controller.pathAsNameBtn.setOnAction(this::onCompanyCustomerPathSameAsNameAction);
|
controller.pathAsNameBtn.setOnAction(this::onCompanyCustomerPathSameAsNameAction);
|
||||||
@@ -82,7 +81,9 @@ public class CompanyCustomerTabSkinBase
|
|||||||
private void initializeContactFieldAutoCompletion(TextField textField) {
|
private void initializeContactFieldAutoCompletion(TextField textField) {
|
||||||
EntityStringConverter<CompanyContact> stringConverter = new EntityStringConverter<>();
|
EntityStringConverter<CompanyContact> stringConverter = new EntityStringConverter<>();
|
||||||
stringConverter.setInitialized(cc -> getCompanyContactService().findById(cc.getId()));
|
stringConverter.setInitialized(cc -> getCompanyContactService().findById(cc.getId()));
|
||||||
UITools.autoCompletion(textField, viewModel.getContact(), p -> getCompanyContactService().searchByCompany(viewModel.getCompany().get(), p.getUserText()), stringConverter);
|
UITools.autoCompletion(textField, viewModel.getContact(),
|
||||||
|
p -> getCompanyContactService().searchByCompany(viewModel.getCompany().get(), p.getUserText()),
|
||||||
|
stringConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeCompanyFieldAutoCompletion(TextField textField) {
|
private void initializeCompanyFieldAutoCompletion(TextField textField) {
|
||||||
@@ -100,7 +101,6 @@ public class CompanyCustomerTabSkinBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onCompanyCustomerChangePathAction(ActionEvent event) {
|
public void onCompanyCustomerChangePathAction(ActionEvent event) {
|
||||||
setStatus("未实现");
|
setStatus("未实现");
|
||||||
}
|
}
|
||||||
@@ -110,14 +110,14 @@ public class CompanyCustomerTabSkinBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CompanyCustomerService getCompanyCustomerService() {
|
public CompanyCustomerService getCompanyCustomerService() {
|
||||||
return controller.companyCustomerService;
|
return controller.getCachedBean(CompanyCustomerService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyContactService getCompanyContactService() {
|
public CompanyContactService getCompanyContactService() {
|
||||||
return controller.companyContactService;
|
return controller.getCachedBean(CompanyContactService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyService getCompanyService() {
|
public CompanyService getCompanyService() {
|
||||||
return controller.companyService;
|
return controller.getCachedBean(CompanyService.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +1,36 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyContactService;
|
import java.io.File;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.ViewModelService;
|
|
||||||
import com.ecep.contract.manager.util.DesktopUtils;
|
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import com.ecep.contract.DesktopUtils;
|
||||||
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
|
import com.ecep.contract.service.CompanyContactService;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.vm.CompanyCustomerViewModel;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -33,6 +38,7 @@ import java.io.File;
|
|||||||
@FxmlPath("/ui/company/customer/customer.fxml")
|
@FxmlPath("/ui/company/customer/customer.fxml")
|
||||||
public class CompanyCustomerWindowController extends AbstEntityController<CompanyCustomer, CompanyCustomerViewModel> {
|
public class CompanyCustomerWindowController extends AbstEntityController<CompanyCustomer, CompanyCustomerViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerWindowController.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerWindowController.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示界面
|
* 显示界面
|
||||||
*/
|
*/
|
||||||
@@ -48,14 +54,6 @@ public class CompanyCustomerWindowController extends AbstEntityController<Compan
|
|||||||
public Tab fileTab;
|
public Tab fileTab;
|
||||||
public Tab entityTab;
|
public Tab entityTab;
|
||||||
public Tab satisfactionTab;
|
public Tab satisfactionTab;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
CompanyService companyService;
|
|
||||||
@Autowired
|
|
||||||
CompanyCustomerService companyCustomerService;
|
|
||||||
@Autowired
|
|
||||||
CompanyContactService companyContactService;
|
|
||||||
|
|
||||||
public TextField companyField;
|
public TextField companyField;
|
||||||
public TextField contactField;
|
public TextField contactField;
|
||||||
public TextField pathField;
|
public TextField pathField;
|
||||||
@@ -70,7 +68,6 @@ public class CompanyCustomerWindowController extends AbstEntityController<Compan
|
|||||||
public Button pathAsNameBtn;
|
public Button pathAsNameBtn;
|
||||||
public Button OpenCustomerPathInExplorerBtn;
|
public Button OpenCustomerPathInExplorerBtn;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show(Stage stage) {
|
public void show(Stage stage) {
|
||||||
super.show(stage);
|
super.show(stage);
|
||||||
@@ -79,7 +76,7 @@ public class CompanyCustomerWindowController extends AbstEntityController<Compan
|
|||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
if (!Hibernate.isInitialized(company)) {
|
if (!Hibernate.isInitialized(company)) {
|
||||||
company = companyService.findById(company.getId());
|
company = getCompanyService().findById(company.getId());
|
||||||
viewModel.getCompany().set(company);
|
viewModel.getCompany().set(company);
|
||||||
}
|
}
|
||||||
return getMessage("ui.customer.title", String.valueOf(viewModel.getId().get()), company.getName());
|
return getMessage("ui.customer.title", String.valueOf(viewModel.getId().get()), company.getName());
|
||||||
@@ -96,7 +93,15 @@ public class CompanyCustomerWindowController extends AbstEntityController<Compan
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompanyCustomerService getViewModelService() {
|
public CompanyCustomerService getViewModelService() {
|
||||||
return companyCustomerService;
|
return getCachedBean(CompanyCustomerService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompanyService getCompanyService() {
|
||||||
|
return getCachedBean(CompanyService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompanyContactService getCompanyContactService() {
|
||||||
|
return getCachedBean(CompanyContactService.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -119,6 +124,4 @@ public class CompanyCustomerWindowController extends AbstEntityController<Compan
|
|||||||
DesktopUtils.showInExplorer(file);
|
DesktopUtils.showInExplorer(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,24 +1,24 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
|
import com.ecep.contract.model.CompanyCustomerEntity;
|
||||||
|
import com.ecep.contract.model.CustomerCatalog;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerEntityService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.CustomerEntityViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerEntity;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CustomerCatalog;
|
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerEntityService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.vo.CustomerEntityViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.EmployeeStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.LocalDateTimeTableCell;
|
|
||||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/company/customer/customer-tab-entity.fxml")
|
@FxmlPath("/ui/company/customer/customer-tab-entity.fxml")
|
||||||
public class CustomerTabSkinEntity
|
public class CustomerTabSkinEntity
|
||||||
@@ -52,7 +52,6 @@ public class CustomerTabSkinEntity
|
|||||||
return controller.entityTab;
|
return controller.entityTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeTab() {
|
public void initializeTab() {
|
||||||
super.initializeTab();
|
super.initializeTab();
|
||||||
@@ -66,8 +65,10 @@ public class CustomerTabSkinEntity
|
|||||||
EmployeeStringConverter stringConverter = SpringApp.getBean(EmployeeStringConverter.class);
|
EmployeeStringConverter stringConverter = SpringApp.getBean(EmployeeStringConverter.class);
|
||||||
entityTable_developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
|
entityTable_developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
|
||||||
entityTable_modifyDateColumn.setCellValueFactory(param -> param.getValue().getModifyDate());
|
entityTable_modifyDateColumn.setCellValueFactory(param -> param.getValue().getModifyDate());
|
||||||
entityTable_creatorColumn.setCellValueFactory(param -> param.getValue().getCreator().map(stringConverter::toString));
|
entityTable_creatorColumn
|
||||||
entityTable_modifierColumn.setCellValueFactory(param -> param.getValue().getModifier().map(stringConverter::toString));
|
.setCellValueFactory(param -> param.getValue().getCreator().map(stringConverter::toString));
|
||||||
|
entityTable_modifierColumn
|
||||||
|
.setCellValueFactory(param -> param.getValue().getModifier().map(stringConverter::toString));
|
||||||
entityTable_updatedDateColumn.setCellValueFactory(param -> param.getValue().getUpdatedDate());
|
entityTable_updatedDateColumn.setCellValueFactory(param -> param.getValue().getUpdatedDate());
|
||||||
|
|
||||||
fetchedTimeColumn.setCellValueFactory(param -> param.getValue().getFetchedTime());
|
fetchedTimeColumn.setCellValueFactory(param -> param.getValue().getFetchedTime());
|
||||||
@@ -77,7 +78,6 @@ public class CustomerTabSkinEntity
|
|||||||
entityTable_menu_del.setOnAction(this::onTableDeleteAction);
|
entityTable_menu_del.setOnAction(this::onTableDeleteAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
|
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
|
||||||
EntityStringConverter<CustomerCatalog> converter = new EntityStringConverter<>();
|
EntityStringConverter<CustomerCatalog> converter = new EntityStringConverter<>();
|
||||||
converter.setInitialized(v -> getCompanyCustomerService().findCatalogById(v.getId()));
|
converter.setInitialized(v -> getCompanyCustomerService().findCatalogById(v.getId()));
|
||||||
@@ -97,10 +97,10 @@ public class CustomerTabSkinEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CompanyCustomerEntity> getSpecification(CompanyCustomer parent) {
|
public Map<String, Object> getSpecification(CompanyCustomer parent) {
|
||||||
return SpecificationUtils.and(getSpecification(), (root, query, builder) -> {
|
Map<String, Object> params = getSpecification();
|
||||||
return builder.equal(root.get("customer"), parent);
|
params.put("customer", parent.getId());
|
||||||
});
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,46 +1,54 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
|
||||||
import com.ecep.contract.manager.ds.company.CompanyFileUtils;
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
|
||||||
import com.ecep.contract.manager.ds.customer.CompanyCustomerFileType;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerFile;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerFileTypeLocal;
|
|
||||||
import com.ecep.contract.manager.ds.customer.repository.CompanyCustomerFileTypeLocalRepository;
|
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerFileService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.vo.CompanyCustomerFileViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.BaseEnumEntity;
|
|
||||||
import com.ecep.contract.manager.ui.table.EditableEntityTableTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.Message;
|
|
||||||
import com.ecep.contract.manager.util.DesktopUtils;
|
|
||||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
|
||||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.beans.binding.Bindings;
|
|
||||||
import javafx.collections.ObservableMap;
|
|
||||||
import javafx.concurrent.Task;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
|
||||||
import javafx.scene.input.Dragboard;
|
|
||||||
import javafx.scene.input.TransferMode;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.CompanyCustomerFileType;
|
||||||
|
import com.ecep.contract.DesktopUtils;
|
||||||
|
import com.ecep.contract.Message;
|
||||||
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.constant.CompanyCustomerConstant;
|
||||||
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.model.BaseEnumEntity;
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
|
import com.ecep.contract.model.CompanyCustomerFile;
|
||||||
|
import com.ecep.contract.model.CompanyCustomerFileTypeLocal;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
|
import com.ecep.contract.util.FileUtils;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.CompanyCustomerFileViewModel;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.beans.binding.Bindings;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.collections.ObservableMap;
|
||||||
|
import javafx.concurrent.Task;
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.ButtonType;
|
||||||
|
import javafx.scene.control.MenuItem;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TableCell;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.scene.control.TableView;
|
||||||
|
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||||
|
import javafx.scene.input.Dragboard;
|
||||||
|
import javafx.scene.input.TransferMode;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
@FxmlPath("/ui/company/customer/customer-tab-file.fxml")
|
@FxmlPath("/ui/company/customer/customer-tab-file.fxml")
|
||||||
public class CustomerTabSkinFile
|
public class CustomerTabSkinFile
|
||||||
extends AbstCompanyCustomerTableTabSkin<CompanyCustomerFile, CompanyCustomerFileViewModel>
|
extends AbstCompanyCustomerTableTabSkin<CompanyCustomerFile, CompanyCustomerFileViewModel>
|
||||||
@@ -49,7 +57,6 @@ public class CustomerTabSkinFile
|
|||||||
@Setter
|
@Setter
|
||||||
private CompanyCustomerFileService companyCustomerFileService;
|
private CompanyCustomerFileService companyCustomerFileService;
|
||||||
|
|
||||||
|
|
||||||
public TableColumn<CompanyCustomerFileViewModel, Number> fileTable_idColumn;
|
public TableColumn<CompanyCustomerFileViewModel, Number> fileTable_idColumn;
|
||||||
public TableColumn<CompanyCustomerFileViewModel, String> fileTable_typeColumn;
|
public TableColumn<CompanyCustomerFileViewModel, String> fileTable_typeColumn;
|
||||||
public TableColumn<CompanyCustomerFileViewModel, String> fileTable_filePathColumn;
|
public TableColumn<CompanyCustomerFileViewModel, String> fileTable_filePathColumn;
|
||||||
@@ -83,10 +90,10 @@ public class CustomerTabSkinFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CompanyCustomerFile> getSpecification(CompanyCustomer parent) {
|
public Map<String, Object> getSpecification(CompanyCustomer parent) {
|
||||||
return SpecificationUtils.and(getSpecification(), (root, query, builder) -> {
|
Map<String, Object> params = getSpecification();
|
||||||
return builder.equal(root.get("customer"), parent);
|
params.put("customer", parent.getId());
|
||||||
});
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -98,7 +105,8 @@ public class CustomerTabSkinFile
|
|||||||
table.disableProperty().bind(viewModel.getPath().isEmpty());
|
table.disableProperty().bind(viewModel.getPath().isEmpty());
|
||||||
fileTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
|
fileTable_idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||||
|
|
||||||
ObservableMap<CompanyCustomerFileType, CompanyCustomerFileTypeLocal> observableMapByLocal = SpringApp.getBean(CompanyCustomerFileTypeLocalRepository.class).getObservableMapByLocal();
|
ObservableMap<CompanyCustomerFileType, CompanyCustomerFileTypeLocal> observableMapByLocal = FXCollections
|
||||||
|
.observableMap(companyCustomerFileService.getFileTypeLocalMap(getLocale()));
|
||||||
fileTable_typeColumn.setCellValueFactory(param -> Bindings.valueAt(observableMapByLocal,
|
fileTable_typeColumn.setCellValueFactory(param -> Bindings.valueAt(observableMapByLocal,
|
||||||
param.getValue().getType()).map(BaseEnumEntity::getValue));
|
param.getValue().getType()).map(BaseEnumEntity::getValue));
|
||||||
|
|
||||||
@@ -150,7 +158,8 @@ public class CustomerTabSkinFile
|
|||||||
CompanyCustomerFileType fileType = item.getType().get();
|
CompanyCustomerFileType fileType = item.getType().get();
|
||||||
if (fileType == CompanyCustomerFileType.EvaluationForm) {
|
if (fileType == CompanyCustomerFileType.EvaluationForm) {
|
||||||
// 文件不是 Excel 文件时,打开编辑UI
|
// 文件不是 Excel 文件时,打开编辑UI
|
||||||
if (!CompanyFileUtils.withExtensions(item.getFilePath().get(), CompanyFileUtils.XLS, CompanyFileUtils.XLSX)) {
|
if (!FileUtils.withExtensions(item.getFilePath().get(), FileUtils.XLS,
|
||||||
|
FileUtils.XLSX)) {
|
||||||
CompanyCustomerEvaluationFormFileWindowController.show(item, controller.root.getScene().getWindow());
|
CompanyCustomerEvaluationFormFileWindowController.show(item, controller.root.getScene().getWindow());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -175,12 +184,14 @@ public class CustomerTabSkinFile
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CompanyCustomer companyCustomer = getParent();
|
CompanyCustomer companyCustomer = getParent();
|
||||||
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer, this::setStatus);
|
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer,
|
||||||
|
((level, message) -> setStatus(message)));
|
||||||
if (nextSignDate != null && files.size() == 1) {
|
if (nextSignDate != null && files.size() == 1) {
|
||||||
File file = files.getFirst();
|
File file = files.getFirst();
|
||||||
String fileName = file.getName();
|
String fileName = file.getName();
|
||||||
if (fileName.startsWith("S")) {
|
if (fileName.startsWith("S")) {
|
||||||
String destFileName = CompanyCustomerService.EVALUATION_FORM_NAME2 + "_" + MyDateTimeUtils.format(nextSignDate)
|
String destFileName = CompanyCustomerConstant.EVALUATION_FORM_NAME2 + "_"
|
||||||
|
+ MyDateTimeUtils.format(nextSignDate)
|
||||||
+ "." + StringUtils.getFilenameExtension(fileName);
|
+ "." + StringUtils.getFilenameExtension(fileName);
|
||||||
File dest = new File(dir, destFileName);
|
File dest = new File(dir, destFileName);
|
||||||
if (file.renameTo(dest)) {
|
if (file.renameTo(dest)) {
|
||||||
@@ -195,7 +206,8 @@ public class CustomerTabSkinFile
|
|||||||
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
|
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
|
||||||
model.update(saved);
|
model.update(saved);
|
||||||
dataSet.add(model);
|
dataSet.add(model);
|
||||||
CompanyCustomerEvaluationFormFileWindowController.show(model, getTableView().getScene().getWindow());
|
CompanyCustomerEvaluationFormFileWindowController.show(model,
|
||||||
|
getTableView().getScene().getWindow());
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -226,7 +238,7 @@ public class CustomerTabSkinFile
|
|||||||
CompanyCustomerService customerService = getCompanyCustomerService();
|
CompanyCustomerService customerService = getCompanyCustomerService();
|
||||||
try {
|
try {
|
||||||
CompanyCustomer companyCustomer = customerService.findById(viewModel.getId().get());
|
CompanyCustomer companyCustomer = customerService.findById(viewModel.getId().get());
|
||||||
if (customerService.reBuildingFiles(companyCustomer, this::setStatus)) {
|
if (customerService.reBuildingFiles(companyCustomer, (level, message) -> setStatus(message))) {
|
||||||
loadTableDataSet();
|
loadTableDataSet();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -270,7 +282,6 @@ public class CustomerTabSkinFile
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onFileTableMoveToCompanyPathAction(ActionEvent event) {
|
public void onFileTableMoveToCompanyPathAction(ActionEvent event) {
|
||||||
Company company = viewModel.getCompany().get();
|
Company company = viewModel.getCompany().get();
|
||||||
if (!Hibernate.isInitialized(company)) {
|
if (!Hibernate.isInitialized(company)) {
|
||||||
@@ -318,11 +329,10 @@ public class CustomerTabSkinFile
|
|||||||
|
|
||||||
deleteRow(selectedItem);
|
deleteRow(selectedItem);
|
||||||
|
|
||||||
// getCompanyCustomerService().deleteFileById(selectedItem.getId().get());
|
// getCompanyCustomerService().deleteFileById(selectedItem.getId().get());
|
||||||
// dataSet.remove(selectedItem);
|
// dataSet.remove(selectedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializeTask(Task<Object> task, String prefix, Consumer<String> consumer) {
|
private void initializeTask(Task<Object> task, String prefix, Consumer<String> consumer) {
|
||||||
task.setOnScheduled(e -> {
|
task.setOnScheduled(e -> {
|
||||||
consumer.accept("正在" + prefix + ",请稍后...");
|
consumer.accept("正在" + prefix + ",请稍后...");
|
||||||
@@ -351,11 +361,10 @@ public class CustomerTabSkinFile
|
|||||||
loadTableDataSet();
|
loadTableDataSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void onCalcNextSignDateAction(ActionEvent event) {
|
public void onCalcNextSignDateAction(ActionEvent event) {
|
||||||
UITools.showDialogAndWait("计算客户下一个评价日期", "依据已有的客户评估表和登记采购的合同计算下一个评估日期", ds -> {
|
UITools.showDialogAndWait("计算客户下一个评价日期", "依据已有的客户评估表和登记采购的合同计算下一个评估日期", ds -> {
|
||||||
CompanyCustomer companyCustomer = getCompanyCustomerService().findById(viewModel.getId().get());
|
CompanyCustomer companyCustomer = getCompanyCustomerService().findById(viewModel.getId().get());
|
||||||
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer, msg -> {
|
LocalDate nextSignDate = getCompanyCustomerFileService().getNextSignDate(companyCustomer, (level, msg) -> {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
ds.add(msg);
|
ds.add(msg);
|
||||||
});
|
});
|
||||||
@@ -368,7 +377,6 @@ public class CustomerTabSkinFile
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class FileTableFilePathTableCell extends TableCell<CompanyCustomerFileViewModel, String> {
|
class FileTableFilePathTableCell extends TableCell<CompanyCustomerFileViewModel, String> {
|
||||||
@Override
|
@Override
|
||||||
protected void updateItem(String item, boolean empty) {
|
protected void updateItem(String item, boolean empty) {
|
||||||
@@ -388,7 +396,6 @@ public class CustomerTabSkinFile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private CompanyCustomerFileService getCompanyCustomerFileService() {
|
private CompanyCustomerFileService getCompanyCustomerFileService() {
|
||||||
if (companyCustomerFileService == null) {
|
if (companyCustomerFileService == null) {
|
||||||
companyCustomerFileService = SpringApp.getBean(CompanyCustomerFileService.class);
|
companyCustomerFileService = SpringApp.getBean(CompanyCustomerFileService.class);
|
||||||
@@ -1,29 +1,28 @@
|
|||||||
package com.ecep.contract.manager.ds.customer.controller;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.controller.project.satisfaction_survey.CustomerSatisfactionSurveyWindowController;
|
||||||
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
|
import com.ecep.contract.controller.table.cell.ProjectTableCell;
|
||||||
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
|
import com.ecep.contract.model.CompanyCustomer;
|
||||||
|
import com.ecep.contract.model.CustomerCatalog;
|
||||||
|
import com.ecep.contract.model.CustomerSatisfactionSurvey;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.Project;
|
||||||
|
import com.ecep.contract.service.CustomerSatisfactionSurveyService;
|
||||||
|
import com.ecep.contract.service.ProjectService;
|
||||||
|
import com.ecep.contract.vm.CustomerEntityViewModel;
|
||||||
|
import com.ecep.contract.vm.CustomerSatisfactionSurveyViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomer;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CustomerCatalog;
|
|
||||||
import com.ecep.contract.manager.ds.customer.vo.CustomerEntityViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectService;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.EmployeeTableCell;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.project.controller.satisfaction_survey.CustomerSatisfactionSurveyWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.CustomerSatisfactionSurvey;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.Project;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.CustomerSatisfactionSurveyService;
|
|
||||||
import com.ecep.contract.manager.ds.project.vo.CustomerSatisfactionSurveyViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.ProjectTableCell;
|
|
||||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/company/customer/customer-tab-satisfaction-survey.fxml")
|
@FxmlPath("/ui/company/customer/customer-tab-satisfaction-survey.fxml")
|
||||||
public class CustomerTabSkinSatisfactionSurvey
|
public class CustomerTabSkinSatisfactionSurvey
|
||||||
@@ -41,8 +40,8 @@ public class CustomerTabSkinSatisfactionSurvey
|
|||||||
|
|
||||||
public MenuItem entityTable_menu_refresh;
|
public MenuItem entityTable_menu_refresh;
|
||||||
public MenuItem entityTable_menu_del;
|
public MenuItem entityTable_menu_del;
|
||||||
@Setter
|
@Setter
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
@Setter
|
@Setter
|
||||||
private CustomerSatisfactionSurveyService satisfactionSurveyService;
|
private CustomerSatisfactionSurveyService satisfactionSurveyService;
|
||||||
|
|
||||||
@@ -55,7 +54,6 @@ private ProjectService projectService;
|
|||||||
return controller.satisfactionTab;
|
return controller.satisfactionTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeTab() {
|
public void initializeTab() {
|
||||||
super.initializeTab();
|
super.initializeTab();
|
||||||
@@ -75,7 +73,6 @@ private ProjectService projectService;
|
|||||||
entityTable_menu_del.setOnAction(this::onTableDeleteAction);
|
entityTable_menu_del.setOnAction(this::onTableDeleteAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
|
private void initializeEntityTabCatalogColumn(TableColumn<CustomerEntityViewModel, String> column) {
|
||||||
EntityStringConverter<CustomerCatalog> converter = new EntityStringConverter<>();
|
EntityStringConverter<CustomerCatalog> converter = new EntityStringConverter<>();
|
||||||
converter.setInitialized(v -> getCompanyCustomerService().findCatalogById(v.getId()));
|
converter.setInitialized(v -> getCompanyCustomerService().findCatalogById(v.getId()));
|
||||||
@@ -102,14 +99,10 @@ private ProjectService projectService;
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CustomerSatisfactionSurvey> getSpecification(CompanyCustomer parent) {
|
public Map<String, Object> getSpecification(CompanyCustomer parent) {
|
||||||
return SpecificationUtils.and(getSpecification(), (root, query, builder) -> {
|
Map<String, Object> params = getSpecification();
|
||||||
Company company = parent.getCompany();
|
params.put("project.customer", parent.getId());
|
||||||
if (company == null) {
|
return params;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return builder.equal(root.get("project").get("customer"), company);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1,20 +1,28 @@
|
|||||||
package com.ecep.contract.manager.ds.contract.controller.sale_order;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.contract.model.SalesOrder;
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.SaleOrdersService;
|
|
||||||
import com.ecep.contract.manager.ds.contract.vo.SalesOrderViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.controller.tab.SalesOrderTabSkinBase;
|
||||||
|
import com.ecep.contract.controller.tab.SalesOrderTabSkinBillVoucher;
|
||||||
|
import com.ecep.contract.controller.tab.SalesOrderTabSkinItems;
|
||||||
|
import com.ecep.contract.model.SalesOrder;
|
||||||
|
import com.ecep.contract.service.SaleOrdersService;
|
||||||
|
import com.ecep.contract.vm.SalesOrderViewModel;
|
||||||
|
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@@ -41,19 +49,6 @@ public class SalesOrderWindowController extends AbstEntityController<SalesOrder,
|
|||||||
show(SalesOrderWindowController.class, viewModel, window);
|
show(SalesOrderWindowController.class, viewModel, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SaleOrdersService service;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected SalesOrder loadEntity() {
|
|
||||||
return service.findById(viewModel.getId().get());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected SalesOrder saveEntity(SalesOrder entity) {
|
|
||||||
return service.save(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show(Stage stage) {
|
public void show(Stage stage) {
|
||||||
super.show(stage);
|
super.show(stage);
|
||||||
@@ -69,6 +64,6 @@ public class SalesOrderWindowController extends AbstEntityController<SalesOrder,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SaleOrdersService getViewModelService() {
|
public SaleOrdersService getViewModelService() {
|
||||||
return service;
|
return getCachedBean(SaleOrdersService.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,22 +1,25 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.department;
|
package com.ecep.contract.controller.department;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
|
import com.ecep.contract.model.Department;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import com.ecep.contract.vm.DepartmentViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.EmployeeStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Department;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.DepartmentViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.EditableEntityTableTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||||
import javafx.scene.control.cell.ComboBoxTableCell;
|
import javafx.scene.control.cell.ComboBoxTableCell;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class DepartmentManagerSkin
|
public class DepartmentManagerSkin
|
||||||
extends AbstEntityManagerSkin<Department, DepartmentViewModel, DepartmentManagerSkin, DepartmentManagerWindowController>
|
extends AbstEntityManagerSkin<Department, DepartmentViewModel, DepartmentManagerSkin, DepartmentManagerWindowController>
|
||||||
@@ -31,10 +34,7 @@ public class DepartmentManagerSkin
|
|||||||
public void initializeTable() {
|
public void initializeTable() {
|
||||||
getTableView().setEditable(true);
|
getTableView().setEditable(true);
|
||||||
|
|
||||||
Specification<Employee> spec = (root, query, cb) -> {
|
List<Employee> employees = controller.getEmployeeService().findAll(ParamUtils.equal("isActive", true), Pageable.ofSize(30)).getContent();
|
||||||
return cb.equal(root.get("isActive"), true);
|
|
||||||
};
|
|
||||||
List<Employee> employees = controller.getEmployeeService().findAll(spec, Pageable.ofSize(30)).getContent();
|
|
||||||
|
|
||||||
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
|
||||||
|
|
||||||
@@ -1,20 +1,22 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.department;
|
package com.ecep.contract.controller.department;
|
||||||
|
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Department;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.DepartmentService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.DepartmentViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.ViewModelService;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
|
import com.ecep.contract.model.Department;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.service.DepartmentService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.DepartmentViewModel;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.service.EmployeeRoleService;
|
||||||
|
import com.ecep.contract.service.EmployeeService;
|
||||||
|
import com.ecep.contract.service.PermissionService;
|
||||||
|
import com.ecep.contract.vm.EmployeeViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeRoleService;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeService;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.EmployeeViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public abstract class AbstEmployeeBasedTabSkin
|
public abstract class AbstEmployeeBasedTabSkin
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.service.EmployeeService;
|
||||||
|
import com.ecep.contract.vm.EmployeeBasedViewModel;
|
||||||
|
import com.ecep.contract.vm.EmployeeViewModel;
|
||||||
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
|
||||||
|
public abstract class AbstEmployeeTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
|
extends AbstEntityTableTabSkin<EmployeeWindowController, Employee, EmployeeViewModel, T, TV>
|
||||||
|
implements TabSkin {
|
||||||
|
|
||||||
|
public AbstEmployeeTableTabSkin(EmployeeWindowController controller) {
|
||||||
|
super(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmployeeService getEmployeeService() {
|
||||||
|
return controller.employeeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TV createNewViewModel() {
|
||||||
|
TV model = super.createNewViewModel();
|
||||||
|
if (model instanceof EmployeeBasedViewModel m) {
|
||||||
|
m.getEmployee().set(getEntity());
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getSpecification(Employee parent) {
|
||||||
|
Map<String, Object> params = getSpecification();
|
||||||
|
params.put("employee", parent.getId());
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
|
import com.ecep.contract.controller.table.cell.DepartmentTableCell;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.service.DepartmentService;
|
||||||
|
import com.ecep.contract.vm.EmployeeViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Department;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.DepartmentService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.EmployeeViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.DepartmentTableCell;
|
|
||||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
|
|
||||||
public class EmployeeManagerSkin
|
public class EmployeeManagerSkin
|
||||||
extends AbstEntityManagerSkin<Employee, EmployeeViewModel, EmployeeManagerSkin, EmployeeManagerWindowController>
|
extends AbstEntityManagerSkin<Employee, EmployeeViewModel, EmployeeManagerSkin, EmployeeManagerWindowController>
|
||||||
@@ -30,14 +29,12 @@ public class EmployeeManagerSkin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<Employee> getSpecification() {
|
public Map<String, Object> getSpecification() {
|
||||||
Specification<Employee> spec = super.getSpecification();
|
Map<String, Object> params = super.getSpecification();
|
||||||
if (controller.activeCheckBox.isSelected()) {
|
if (controller.activeCheckBox.isSelected()) {
|
||||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> {
|
params.put("isActive", true);
|
||||||
return builder.isTrue(root.get("isActive"));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return spec;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -51,7 +48,6 @@ public class EmployeeManagerSkin
|
|||||||
controller.departmentColumn.setCellValueFactory(param -> param.getValue().getDepartment());
|
controller.departmentColumn.setCellValueFactory(param -> param.getValue().getDepartment());
|
||||||
controller.departmentColumn.setCellFactory(param -> new DepartmentTableCell<>(getDepartmentService()));
|
controller.departmentColumn.setCellFactory(param -> new DepartmentTableCell<>(getDepartmentService()));
|
||||||
|
|
||||||
|
|
||||||
controller.emailColumn.setCellValueFactory(param -> param.getValue().getEmail());
|
controller.emailColumn.setCellValueFactory(param -> param.getValue().getEmail());
|
||||||
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
|
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
|
||||||
controller.entryDateColumn.setCellValueFactory(param -> param.getValue().getEntryDate());
|
controller.entryDateColumn.setCellValueFactory(param -> param.getValue().getEntryDate());
|
||||||
@@ -1,25 +1,26 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.constant.CloudServiceConstant;
|
||||||
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
|
import com.ecep.contract.model.Department;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.service.EmployeeService;
|
||||||
|
import com.ecep.contract.task.EmployeesSyncTask;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.EmployeeViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.cloud.u8.EmployeesSyncTask;
|
|
||||||
import com.ecep.contract.manager.cloud.u8.YongYouU8Service;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Department;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.EmployeeViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.concurrent.Task;
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -68,8 +69,8 @@ public class EmployeeManagerWindowController
|
|||||||
* 从 U8系统 同步员工数据
|
* 从 U8系统 同步员工数据
|
||||||
*/
|
*/
|
||||||
public void onSyncFromU8Action(ActionEvent event) {
|
public void onSyncFromU8Action(ActionEvent event) {
|
||||||
Task<Object> task = new EmployeesSyncTask();
|
EmployeesSyncTask task = new EmployeesSyncTask();
|
||||||
UITools.showTaskDialogAndWait("从 " + YongYouU8Service.NAME + " 同步员工数据", task, null);
|
UITools.showTaskDialogAndWait("从 " + CloudServiceConstant.U8_NAME + " 同步员工数据", task, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,21 +1,23 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.EmployeeAuthBind;
|
||||||
|
import com.ecep.contract.service.EmployeeAuthBindService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.EmployeeAuthBindViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.EmployeeAuthBind;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeAuthBindService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.EmployeeAuthBindViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.EmployeeTableCell;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/employee/employee-auth-bind.fxml")
|
@FxmlPath("/ui/employee/employee-auth-bind.fxml")
|
||||||
public class EmployeeTabSkinAuthBind
|
public class EmployeeTabSkinAuthBind
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Department;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.DepartmentService;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.scene.control.Tab;
|
|
||||||
import javafx.util.converter.LocalDateStringConverter;
|
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
|
import com.ecep.contract.model.Department;
|
||||||
|
import com.ecep.contract.service.DepartmentService;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
|
|
||||||
public class EmployeeTabSkinBase
|
public class EmployeeTabSkinBase
|
||||||
extends AbstEmployeeBasedTabSkin
|
extends AbstEmployeeBasedTabSkin
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
@@ -1,17 +1,18 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
|
import com.ecep.contract.model.EmployeeLoginHistory;
|
||||||
|
import com.ecep.contract.service.EmployeeLoginHistoryService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.EmployeeLoginHistoryViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.EmployeeLoginHistory;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeLoginHistoryService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.EmployeeLoginHistoryViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.LocalDateTimeTableCell;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/employee/employee-login-history.fxml")
|
@FxmlPath("/ui/employee/employee-login-history.fxml")
|
||||||
public class EmployeeTabSkinLoginHistory
|
public class EmployeeTabSkinLoginHistory
|
||||||
extends AbstEmployeeTableTabSkin<EmployeeLoginHistory, EmployeeLoginHistoryViewModel>
|
extends AbstEmployeeTableTabSkin<EmployeeLoginHistory, EmployeeLoginHistoryViewModel>
|
||||||
@@ -1,18 +1,21 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
|
||||||
|
import com.ecep.contract.Desktop;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.EmployeeRole;
|
||||||
|
|
||||||
import com.ecep.contract.manager.Desktop;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
import javafx.scene.control.ListCell;
|
import javafx.scene.control.ListCell;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class EmployeeTabSkinRole
|
public class EmployeeTabSkinRole
|
||||||
extends AbstEmployeeBasedTabSkin
|
extends AbstEmployeeBasedTabSkin
|
||||||
@@ -48,11 +51,8 @@ public class EmployeeTabSkinRole
|
|||||||
|
|
||||||
private void initializeListView() {
|
private void initializeListView() {
|
||||||
// 非系统内置账户
|
// 非系统内置账户
|
||||||
Specification<EmployeeRole> spec = null;
|
HashMap<String, Object> params = new HashMap<>();
|
||||||
if (!Desktop.instance.getActiveEmployee().isSystemAdministrator()) {
|
List<EmployeeRole> roles = getEmployeeRoleService().findAll(params, Pageable.ofSize(500)).getContent();
|
||||||
spec = (root, query, cb) -> cb.equal(root.get("systemAdministrator"), false);
|
|
||||||
}
|
|
||||||
List<EmployeeRole> roles = getEmployeeRoleService().findAll(spec, Pageable.ofSize(500)).getContent();
|
|
||||||
|
|
||||||
controller.rolesField.getSourceItems().setAll(roles);
|
controller.rolesField.getSourceItems().setAll(roles);
|
||||||
controller.rolesField.setCellFactory(param -> {
|
controller.rolesField.setCellFactory(param -> {
|
||||||
@@ -1,18 +1,5 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.employee;
|
package com.ecep.contract.controller.employee;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.EmployeeViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.ViewModelService;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.controlsfx.control.ListSelectionView;
|
import org.controlsfx.control.ListSelectionView;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -21,6 +8,24 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.EmployeeRole;
|
||||||
|
import com.ecep.contract.service.EmployeeService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.EmployeeViewModel;
|
||||||
|
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TableView;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@@ -1,16 +1,17 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.inventory;
|
package com.ecep.contract.controller.inventory;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
|
import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell;
|
||||||
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
|
import com.ecep.contract.model.Inventory;
|
||||||
|
import com.ecep.contract.model.InventoryCatalog;
|
||||||
|
import com.ecep.contract.service.InventoryCatalogService;
|
||||||
|
import com.ecep.contract.service.InventoryService;
|
||||||
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Inventory;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.InventoryCatalog;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.InventoryCatalogService;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.InventoryService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.InventoryViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.EditableEntityTableTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.util.LocalDateFieldTableCell;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.LocalDateTimeTableCell;
|
|
||||||
import javafx.beans.property.Property;
|
import javafx.beans.property.Property;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
@@ -19,11 +20,8 @@ import javafx.util.converter.CurrencyStringConverter;
|
|||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.function.Function;
|
public class InventoryManagerSkin extends
|
||||||
|
AbstEntityManagerSkin<Inventory, InventoryViewModel, InventoryManagerSkin, InventoryManagerWindowController> {
|
||||||
public class InventoryManagerSkin
|
|
||||||
extends AbstEntityManagerSkin<Inventory, InventoryViewModel, InventoryManagerSkin, InventoryManagerWindowController>
|
|
||||||
implements ManagerSkin, EditableEntityTableTabSkin<Inventory, InventoryViewModel> {
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private InventoryCatalogService catalogService;
|
private InventoryCatalogService catalogService;
|
||||||
@@ -69,7 +67,8 @@ public class InventoryManagerSkin
|
|||||||
|
|
||||||
controller.specificationColumn.setCellValueFactory(param -> param.getValue().getSpecification());
|
controller.specificationColumn.setCellValueFactory(param -> param.getValue().getSpecification());
|
||||||
controller.specificationColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
controller.specificationColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||||
controller.specificationColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getSpecification));
|
controller.specificationColumn
|
||||||
|
.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getSpecification));
|
||||||
|
|
||||||
controller.unitColumn.setCellValueFactory(param -> param.getValue().getUnit());
|
controller.unitColumn.setCellValueFactory(param -> param.getValue().getUnit());
|
||||||
controller.unitColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
controller.unitColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||||
@@ -77,44 +76,48 @@ public class InventoryManagerSkin
|
|||||||
|
|
||||||
controller.purchaseTaxRateColumn.setCellValueFactory(param -> param.getValue().getPurchaseTaxRate());
|
controller.purchaseTaxRateColumn.setCellValueFactory(param -> param.getValue().getPurchaseTaxRate());
|
||||||
controller.purchaseTaxRateColumn.setCellFactory(TextFieldTableCell.forTableColumn(new NumberStringConverter()));
|
controller.purchaseTaxRateColumn.setCellFactory(TextFieldTableCell.forTableColumn(new NumberStringConverter()));
|
||||||
controller.purchaseTaxRateColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getPurchaseTaxRate));
|
controller.purchaseTaxRateColumn
|
||||||
|
.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getPurchaseTaxRate));
|
||||||
|
|
||||||
controller.purchasePriceColumn.setCellValueFactory(param -> param.getValue().getPurchasePrice());
|
controller.purchasePriceColumn.setCellValueFactory(param -> param.getValue().getPurchasePrice());
|
||||||
controller.purchasePriceColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter()));
|
controller.purchasePriceColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter()));
|
||||||
// controller.purchasePriceColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getPurchasePrice));
|
// controller.purchasePriceColumn.setOnEditCommit(event ->
|
||||||
|
// onColumnEditCommit(event, InventoryViewModel::getPurchasePrice));
|
||||||
|
|
||||||
controller.saleTaxRateColumn.setCellValueFactory(param -> param.getValue().getSaleTaxRate());
|
controller.saleTaxRateColumn.setCellValueFactory(param -> param.getValue().getSaleTaxRate());
|
||||||
controller.saleTaxRateColumn.setCellFactory(TextFieldTableCell.forTableColumn(new NumberStringConverter()));
|
controller.saleTaxRateColumn.setCellFactory(TextFieldTableCell.forTableColumn(new NumberStringConverter()));
|
||||||
controller.saleTaxRateColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getSaleTaxRate));
|
controller.saleTaxRateColumn
|
||||||
|
.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getSaleTaxRate));
|
||||||
|
|
||||||
controller.salePriceColumn.setCellValueFactory(param -> param.getValue().getSalePrice());
|
controller.salePriceColumn.setCellValueFactory(param -> param.getValue().getSalePrice());
|
||||||
controller.salePriceColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter()));
|
controller.salePriceColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter()));
|
||||||
// controller.salePriceColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getSalePrice));
|
// controller.salePriceColumn.setOnEditCommit(event -> onColumnEditCommit(event,
|
||||||
|
// InventoryViewModel::getSalePrice));
|
||||||
|
|
||||||
controller.createTimeColumn.setCellValueFactory(param -> param.getValue().getCreateTime());
|
controller.createTimeColumn.setCellValueFactory(param -> param.getValue().getCreateTime());
|
||||||
controller.createTimeColumn.setCellFactory(LocalDateFieldTableCell.forTableColumn());
|
controller.createTimeColumn.setCellFactory(LocalDateFieldTableCell.forTableColumn());
|
||||||
controller.createTimeColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getCreateTime));
|
controller.createTimeColumn
|
||||||
|
.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getCreateTime));
|
||||||
|
|
||||||
controller.updateDateColumn.setCellValueFactory(param -> param.getValue().getUpdateDate());
|
controller.updateDateColumn.setCellValueFactory(param -> param.getValue().getUpdateDate());
|
||||||
controller.updateDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
controller.updateDateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||||
controller.updateDateColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getUpdateDate));
|
controller.updateDateColumn
|
||||||
|
.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getUpdateDate));
|
||||||
|
|
||||||
controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
||||||
controller.descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
controller.descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||||
controller.descriptionColumn.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getDescription));
|
controller.descriptionColumn
|
||||||
|
.setOnEditCommit(event -> onColumnEditCommit(event, InventoryViewModel::getDescription));
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T> void onColumnEditCommit(
|
private <T> void onColumnEditCommit(
|
||||||
TableColumn.CellEditEvent<InventoryViewModel, T> event,
|
TableColumn.CellEditEvent<InventoryViewModel, T> event,
|
||||||
Function<InventoryViewModel, Property<T>> supplier
|
Function<InventoryViewModel, Property<T>> supplier) {
|
||||||
) {
|
|
||||||
InventoryViewModel row = event.getRowValue();
|
InventoryViewModel row = event.getRowValue();
|
||||||
supplier.apply(row).setValue(event.getNewValue());
|
supplier.apply(row).setValue(event.getNewValue());
|
||||||
saveRowData(row);
|
saveRowData(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableRowDoubleClickedAction(InventoryViewModel item) {
|
protected void onTableRowDoubleClickedAction(InventoryViewModel item) {
|
||||||
showInOwner(InventoryWindowController.class, item);
|
showInOwner(InventoryWindowController.class, item);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.inventory;
|
package com.ecep.contract.controller.inventory;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -8,13 +8,14 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Inventory;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.other.model.InventoryCatalog;
|
import com.ecep.contract.model.Inventory;
|
||||||
import com.ecep.contract.manager.ds.other.service.InventoryService;
|
import com.ecep.contract.model.InventoryCatalog;
|
||||||
import com.ecep.contract.manager.ds.other.vo.InventoryViewModel;
|
import com.ecep.contract.service.InventoryService;
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
import com.ecep.contract.task.InventorySyncTask;
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.manager.util.UITools;
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@@ -1,19 +1,25 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.inventory;
|
package com.ecep.contract.controller.inventory;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.MessageHolder;
|
||||||
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
|
import com.ecep.contract.model.Inventory;
|
||||||
|
import com.ecep.contract.model.InventoryCatalog;
|
||||||
|
import com.ecep.contract.service.InventoryCatalogService;
|
||||||
|
import com.ecep.contract.service.InventoryService;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.cloud.u8.ctx.InventoryCtx;
|
|
||||||
import com.ecep.contract.manager.ds.other.EmployeeStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Inventory;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.InventoryCatalog;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.InventoryCatalogService;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.InventoryService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.InventoryViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.EditableEntityTableTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.MessageHolder;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.util.MyDateTimeUtils;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.SimpleDoubleProperty;
|
import javafx.beans.property.SimpleDoubleProperty;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -23,37 +29,21 @@ import javafx.util.converter.CurrencyStringConverter;
|
|||||||
import javafx.util.converter.LocalDateStringConverter;
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
import javafx.util.converter.LocalDateTimeStringConverter;
|
import javafx.util.converter.LocalDateTimeStringConverter;
|
||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
import lombok.Setter;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class InventoryTabSkinBase
|
public class InventoryTabSkinBase
|
||||||
extends AbstEntityBasedTabSkin<InventoryWindowController, Inventory, InventoryViewModel>
|
extends AbstEntityBasedTabSkin<InventoryWindowController, Inventory, InventoryViewModel>
|
||||||
implements TabSkin, EditableEntityTableTabSkin<Inventory, InventoryViewModel> {
|
implements TabSkin, EditableEntityTableTabSkin<Inventory, InventoryViewModel> {
|
||||||
@Setter
|
|
||||||
private InventoryService service;
|
|
||||||
@Setter
|
|
||||||
private InventoryCatalogService catalogService;
|
|
||||||
|
|
||||||
public InventoryTabSkinBase(InventoryWindowController controller) {
|
public InventoryTabSkinBase(InventoryWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryService getService() {
|
InventoryService getService() {
|
||||||
if (service == null) {
|
return getCachedBean(InventoryService.class);
|
||||||
service = getBean(InventoryService.class);
|
|
||||||
}
|
|
||||||
return service;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryCatalogService getCatalogService() {
|
InventoryCatalogService getCatalogService() {
|
||||||
if (catalogService == null) {
|
return getCachedBean(InventoryCatalogService.class);
|
||||||
catalogService = getBean(InventoryCatalogService.class);
|
|
||||||
}
|
|
||||||
return catalogService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,65 +74,83 @@ public class InventoryTabSkinBase
|
|||||||
catalogConverter.setFromString(getCatalogService()::findByName);
|
catalogConverter.setFromString(getCatalogService()::findByName);
|
||||||
UITools.autoCompletion(controller.catalogField, viewModel.getCatalog(), catalogConverter);
|
UITools.autoCompletion(controller.catalogField, viewModel.getCatalog(), catalogConverter);
|
||||||
|
|
||||||
controller.purchaseTaxRateField.textProperty().bindBidirectional(viewModel.getPurchaseTaxRate(), new NumberStringConverter());
|
controller.purchaseTaxRateField.textProperty().bindBidirectional(viewModel.getPurchaseTaxRate(),
|
||||||
|
new NumberStringConverter());
|
||||||
// 采购价
|
// 采购价
|
||||||
bindPriceField(controller.purchasePriceField, viewModel.getPurchasePrice(), currencyStringConverter, viewModel::updatePurchasePrice);
|
bindPriceField(controller.purchasePriceField, viewModel.getPurchasePrice(), currencyStringConverter,
|
||||||
bindPriceField(controller.purchaseTaxPriceField, viewModel.getPurchaseTaxPrice(), currencyStringConverter, viewModel::updatePurchaseTaxPrice);
|
viewModel::updatePurchasePrice);
|
||||||
|
bindPriceField(controller.purchaseTaxPriceField, viewModel.getPurchaseTaxPrice(), currencyStringConverter,
|
||||||
|
viewModel::updatePurchaseTaxPrice);
|
||||||
|
|
||||||
controller.saleTaxRateField.textProperty().bindBidirectional(viewModel.getSaleTaxRate(), new NumberStringConverter());
|
controller.saleTaxRateField.textProperty().bindBidirectional(viewModel.getSaleTaxRate(),
|
||||||
|
new NumberStringConverter());
|
||||||
// 销售价
|
// 销售价
|
||||||
bindPriceField(controller.salePriceField, viewModel.getSalePrice(), currencyStringConverter, viewModel::updateSalePrice);
|
bindPriceField(controller.salePriceField, viewModel.getSalePrice(), currencyStringConverter,
|
||||||
bindPriceField(controller.saleTaxPriceField, viewModel.getSaleTaxPrice(), currencyStringConverter, viewModel::updateSaleTaxPrice);
|
viewModel::updateSalePrice);
|
||||||
|
bindPriceField(controller.saleTaxPriceField, viewModel.getSaleTaxPrice(), currencyStringConverter,
|
||||||
|
viewModel::updateSaleTaxPrice);
|
||||||
|
|
||||||
// 采购价不能大于销售价
|
// 采购价不能大于销售价
|
||||||
Bindings.greaterThan(viewModel.getPurchasePrice(), viewModel.getSalePrice()).addListener((observable, oldValue, newValue) -> {
|
Bindings.greaterThan(viewModel.getPurchasePrice(), viewModel.getSalePrice())
|
||||||
if (newValue) {
|
.addListener((observable, oldValue, newValue) -> {
|
||||||
controller.purchasePriceField.getStyleClass().add("error");
|
if (newValue) {
|
||||||
controller.salePriceField.getStyleClass().add("error");
|
controller.purchasePriceField.getStyleClass().add("error");
|
||||||
} else {
|
controller.salePriceField.getStyleClass().add("error");
|
||||||
controller.purchasePriceField.getStyleClass().remove("error");
|
} else {
|
||||||
controller.salePriceField.getStyleClass().remove("error");
|
controller.purchasePriceField.getStyleClass().remove("error");
|
||||||
}
|
controller.salePriceField.getStyleClass().remove("error");
|
||||||
});
|
}
|
||||||
Bindings.greaterThan(viewModel.getPurchaseTaxPrice(), viewModel.getSaleTaxPrice()).addListener((observable, oldValue, newValue) -> {
|
});
|
||||||
if (newValue) {
|
Bindings.greaterThan(viewModel.getPurchaseTaxPrice(), viewModel.getSaleTaxPrice())
|
||||||
controller.purchaseTaxPriceField.getStyleClass().add("error");
|
.addListener((observable, oldValue, newValue) -> {
|
||||||
controller.saleTaxPriceField.getStyleClass().add("error");
|
if (newValue) {
|
||||||
} else {
|
controller.purchaseTaxPriceField.getStyleClass().add("error");
|
||||||
controller.purchaseTaxPriceField.getStyleClass().remove("error");
|
controller.saleTaxPriceField.getStyleClass().add("error");
|
||||||
controller.saleTaxPriceField.getStyleClass().remove("error");
|
} else {
|
||||||
}
|
controller.purchaseTaxPriceField.getStyleClass().remove("error");
|
||||||
});
|
controller.saleTaxPriceField.getStyleClass().remove("error");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
EmployeeStringConverter employeeStringConverter = getBean(EmployeeStringConverter.class);
|
EmployeeStringConverter employeeStringConverter = getBean(EmployeeStringConverter.class);
|
||||||
UITools.autoCompletion(controller.creatorField, viewModel.getCreator(), employeeStringConverter);
|
UITools.autoCompletion(controller.creatorField, viewModel.getCreator(), employeeStringConverter);
|
||||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(MyDateTimeUtils.DEFAULT_DATE_FORMAT_PATTERN);
|
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(MyDateTimeUtils.DEFAULT_DATE_FORMAT_PATTERN);
|
||||||
controller.createTimeField.textProperty().bindBidirectional(viewModel.getCreateTime(), new LocalDateStringConverter(dateFormatter, null));
|
controller.createTimeField.textProperty().bindBidirectional(viewModel.getCreateTime(),
|
||||||
|
new LocalDateStringConverter(dateFormatter, null));
|
||||||
|
|
||||||
UITools.autoCompletion(controller.updaterField, viewModel.getUpdater(), employeeStringConverter);
|
UITools.autoCompletion(controller.updaterField, viewModel.getUpdater(), employeeStringConverter);
|
||||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(MyDateTimeUtils.DEFAULT_DATETIME_FORMAT_PATTERN);
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter
|
||||||
controller.updateDateField.textProperty().bindBidirectional(viewModel.getUpdateDate(), new LocalDateTimeStringConverter(dateTimeFormatter, null));
|
.ofPattern(MyDateTimeUtils.DEFAULT_DATETIME_FORMAT_PATTERN);
|
||||||
|
controller.updateDateField.textProperty().bindBidirectional(viewModel.getUpdateDate(),
|
||||||
|
new LocalDateTimeStringConverter(dateTimeFormatter, null));
|
||||||
|
|
||||||
controller.weightUnitField.textProperty().bindBidirectional(viewModel.getWeightUnit());
|
controller.weightUnitField.textProperty().bindBidirectional(viewModel.getWeightUnit());
|
||||||
controller.sizeUnitField.textProperty().bindBidirectional(viewModel.getSizeUnit());
|
controller.sizeUnitField.textProperty().bindBidirectional(viewModel.getSizeUnit());
|
||||||
controller.volumeUnitField.textProperty().bindBidirectional(viewModel.getVolumeUnit());
|
controller.volumeUnitField.textProperty().bindBidirectional(viewModel.getVolumeUnit());
|
||||||
controller.weightField.textProperty().bindBidirectional(viewModel.getWeight(), new NumberStringConverter());
|
controller.weightField.textProperty().bindBidirectional(viewModel.getWeight(), new NumberStringConverter());
|
||||||
controller.packagedWeightField.textProperty().bindBidirectional(viewModel.getPackagedWeight(), new NumberStringConverter());
|
controller.packagedWeightField.textProperty().bindBidirectional(viewModel.getPackagedWeight(),
|
||||||
controller.sizeLengthField.textProperty().bindBidirectional(viewModel.getSizeLength(), new NumberStringConverter());
|
new NumberStringConverter());
|
||||||
controller.sizeWidthField.textProperty().bindBidirectional(viewModel.getSizeWidth(), new NumberStringConverter());
|
controller.sizeLengthField.textProperty().bindBidirectional(viewModel.getSizeLength(),
|
||||||
controller.sizeHeightField.textProperty().bindBidirectional(viewModel.getSizeHeight(), new NumberStringConverter());
|
new NumberStringConverter());
|
||||||
|
controller.sizeWidthField.textProperty().bindBidirectional(viewModel.getSizeWidth(),
|
||||||
|
new NumberStringConverter());
|
||||||
|
controller.sizeHeightField.textProperty().bindBidirectional(viewModel.getSizeHeight(),
|
||||||
|
new NumberStringConverter());
|
||||||
controller.volumeField.textProperty().bindBidirectional(viewModel.getVolume(), new NumberStringConverter());
|
controller.volumeField.textProperty().bindBidirectional(viewModel.getVolume(), new NumberStringConverter());
|
||||||
controller.packagedSizeLengthField.textProperty().bindBidirectional(viewModel.getPackagedSizeLength(), new NumberStringConverter());
|
controller.packagedSizeLengthField.textProperty().bindBidirectional(viewModel.getPackagedSizeLength(),
|
||||||
controller.packagedSizeWidthField.textProperty().bindBidirectional(viewModel.getPackagedSizeWidth(), new NumberStringConverter());
|
new NumberStringConverter());
|
||||||
controller.packagedSizeHeightField.textProperty().bindBidirectional(viewModel.getPackagedSizeHeight(), new NumberStringConverter());
|
controller.packagedSizeWidthField.textProperty().bindBidirectional(viewModel.getPackagedSizeWidth(),
|
||||||
controller.packagedVolumeField.textProperty().bindBidirectional(viewModel.getPackagedVolume(), new NumberStringConverter());
|
new NumberStringConverter());
|
||||||
|
controller.packagedSizeHeightField.textProperty().bindBidirectional(viewModel.getPackagedSizeHeight(),
|
||||||
|
new NumberStringConverter());
|
||||||
|
controller.packagedVolumeField.textProperty().bindBidirectional(viewModel.getPackagedVolume(),
|
||||||
|
new NumberStringConverter());
|
||||||
|
|
||||||
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindPriceField(TextField textField, SimpleDoubleProperty property, CurrencyStringConverter stringConverter, Consumer<Double> updater) {
|
private void bindPriceField(TextField textField, SimpleDoubleProperty property,
|
||||||
|
CurrencyStringConverter stringConverter, Consumer<Double> updater) {
|
||||||
textField.setText(stringConverter.toString(property.get()));
|
textField.setText(stringConverter.toString(property.get()));
|
||||||
property.addListener((observable, oldValue, newValue) -> {
|
property.addListener((observable, oldValue, newValue) -> {
|
||||||
textField.setText(stringConverter.toString(newValue));
|
textField.setText(stringConverter.toString(newValue));
|
||||||
@@ -165,15 +173,8 @@ public class InventoryTabSkinBase
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setStatus("正在同步数据...");
|
setStatus("正在同步数据...");
|
||||||
InventoryCtx ctx = new InventoryCtx();
|
|
||||||
MessageHolder holder = (lv, msg) -> setStatus(msg);
|
MessageHolder holder = (lv, msg) -> setStatus(msg);
|
||||||
ctx.initializeRepository(holder);
|
getService().syncInventory(inventory, holder);
|
||||||
if (ctx.syncInventoryDetailByCode(inventory, inventory.getCode(), holder)) {
|
|
||||||
save(inventory);
|
|
||||||
setStatus("同步数据完成.");
|
|
||||||
} else {
|
|
||||||
setStatus("没有数据更新.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,34 +1,32 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.inventory;
|
package com.ecep.contract.controller.inventory;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.contract.ContractWindowController;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.model.Contract;
|
||||||
|
import com.ecep.contract.model.Inventory;
|
||||||
|
import com.ecep.contract.service.ContractItemService;
|
||||||
|
import com.ecep.contract.service.ContractService;
|
||||||
|
import com.ecep.contract.service.InventoryHistoryPriceService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.contract.controller.ContractWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
|
||||||
import com.ecep.contract.manager.ds.contract.model.ContractItem;
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractItemService;
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractService;
|
|
||||||
import com.ecep.contract.manager.ds.contract.vo.ContractViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Inventory;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.InventoryHistoryPriceService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.InventoryViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.table.AbstEntityTableTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
|
||||||
import jakarta.persistence.criteria.Root;
|
|
||||||
import jakarta.persistence.criteria.Subquery;
|
|
||||||
import javafx.scene.control.ContextMenu;
|
import javafx.scene.control.ContextMenu;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.util.converter.CurrencyStringConverter;
|
import javafx.util.converter.CurrencyStringConverter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/inventory/inventory-contract.fxml")
|
@FxmlPath("/ui/inventory/inventory-contract.fxml")
|
||||||
public class InventoryTabSkinContracts
|
public class InventoryTabSkinContracts
|
||||||
extends AbstEntityTableTabSkin<InventoryWindowController, Inventory, InventoryViewModel, Contract, ContractViewModel>
|
extends
|
||||||
|
AbstEntityTableTabSkin<InventoryWindowController, Inventory, InventoryViewModel, Contract, ContractViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
public TableColumn<ContractViewModel, Number> idColumn;
|
public TableColumn<ContractViewModel, Number> idColumn;
|
||||||
public TableColumn<ContractViewModel, String> nameColumn;
|
public TableColumn<ContractViewModel, String> nameColumn;
|
||||||
@@ -77,7 +75,6 @@ public class InventoryTabSkinContracts
|
|||||||
return controller.contractsTab;
|
return controller.contractsTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeTable() {
|
public void initializeTable() {
|
||||||
super.initializeTable();
|
super.initializeTable();
|
||||||
@@ -93,18 +90,22 @@ public class InventoryTabSkinContracts
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<Contract> getSpecification(Inventory parent) {
|
public Map<String, Object> getSpecification(Inventory parent) {
|
||||||
return SpecificationUtils.and(getSpecification(), (root, query, builder) -> {
|
Map<String, Object> params = getSpecification();
|
||||||
// 创建ContractItem的子查询
|
params.put("inventory", parent);
|
||||||
Subquery<Integer> subquery = query.subquery(Integer.class);
|
|
||||||
Root<ContractItem> from = subquery.from(ContractItem.class);
|
|
||||||
// 子查询选择与指定库存相关的合同ID
|
|
||||||
subquery.select(from.get("contract").get("id"))
|
|
||||||
.where(builder.equal(from.get("inventory"), parent));
|
|
||||||
|
|
||||||
// 主查询筛选ID在子查询结果中的合同
|
// return SpecificationUtils.and(getSpecification(), (root, query, builder) -> {
|
||||||
return builder.in(root.get("id")).value(subquery);
|
// // 创建ContractItem的子查询
|
||||||
});
|
// Subquery<Integer> subquery = query.subquery(Integer.class);
|
||||||
|
// Root<ContractItem> from = subquery.from(ContractItem.class);
|
||||||
|
// // 子查询选择与指定库存相关的合同ID
|
||||||
|
// subquery.select(from.get("contract").get("id"))
|
||||||
|
// .where(builder.equal(from.get("inventory"), parent));
|
||||||
|
|
||||||
|
// // 主查询筛选ID在子查询结果中的合同
|
||||||
|
// return builder.in(root.get("id")).value(subquery);
|
||||||
|
// });
|
||||||
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1,28 +1,4 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.inventory;
|
package com.ecep.contract.controller.inventory;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.contract.ContractPayWay;
|
|
||||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
|
||||||
import com.ecep.contract.manager.ds.contract.model.ContractItem;
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractItemService;
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractService;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.HistoryPrice;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Inventory;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.InventoryHistoryPrice;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.InventoryHistoryPriceService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.InventoryHistoryPriceViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.InventoryViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.table.AbstEntityTableTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
|
||||||
import javafx.util.converter.CurrencyStringConverter;
|
|
||||||
import javafx.util.converter.NumberStringConverter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.time.MonthDay;
|
import java.time.MonthDay;
|
||||||
@@ -30,11 +6,41 @@ import java.time.Year;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import com.ecep.contract.ContractPayWay;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.model.Contract;
|
||||||
|
import com.ecep.contract.model.ContractItem;
|
||||||
|
import com.ecep.contract.model.HistoryPrice;
|
||||||
|
import com.ecep.contract.model.Inventory;
|
||||||
|
import com.ecep.contract.model.InventoryHistoryPrice;
|
||||||
|
import com.ecep.contract.service.ContractItemService;
|
||||||
|
import com.ecep.contract.service.ContractService;
|
||||||
|
import com.ecep.contract.service.InventoryHistoryPriceService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.InventoryHistoryPriceViewModel;
|
||||||
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.ContextMenu;
|
||||||
|
import javafx.scene.control.MenuItem;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
|
import javafx.util.converter.CurrencyStringConverter;
|
||||||
|
import javafx.util.converter.NumberStringConverter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
@FxmlPath("/ui/inventory/inventory-history-price.fxml")
|
@FxmlPath("/ui/inventory/inventory-history-price.fxml")
|
||||||
public class InventoryTabSkinHistoryPrice
|
public class InventoryTabSkinHistoryPrice
|
||||||
extends AbstEntityTableTabSkin<InventoryWindowController, Inventory, InventoryViewModel, InventoryHistoryPrice, InventoryHistoryPriceViewModel>
|
extends
|
||||||
|
AbstEntityTableTabSkin<InventoryWindowController, Inventory, InventoryViewModel, InventoryHistoryPrice, InventoryHistoryPriceViewModel>
|
||||||
implements TabSkin {
|
implements TabSkin {
|
||||||
public Button refreshBtn;
|
public Button refreshBtn;
|
||||||
public TableColumn<InventoryHistoryPriceViewModel, Number> idColumn;
|
public TableColumn<InventoryHistoryPriceViewModel, Number> idColumn;
|
||||||
@@ -66,7 +72,6 @@ public class InventoryTabSkinHistoryPrice
|
|||||||
public TableColumn<InventoryHistoryPriceViewModel, Number> miniPurchaseTaxPriceColumn;
|
public TableColumn<InventoryHistoryPriceViewModel, Number> miniPurchaseTaxPriceColumn;
|
||||||
public TableColumn<InventoryHistoryPriceViewModel, MonthDay> miniPurchasePriceDateColumn;
|
public TableColumn<InventoryHistoryPriceViewModel, MonthDay> miniPurchasePriceDateColumn;
|
||||||
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
InventoryHistoryPriceService service;
|
InventoryHistoryPriceService service;
|
||||||
@Setter
|
@Setter
|
||||||
@@ -109,7 +114,6 @@ public class InventoryTabSkinHistoryPrice
|
|||||||
return controller.historyPriceTab;
|
return controller.historyPriceTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeTable() {
|
public void initializeTable() {
|
||||||
super.initializeTable();
|
super.initializeTable();
|
||||||
@@ -185,7 +189,6 @@ public class InventoryTabSkinHistoryPrice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<ContractItem> items = getContractItemService().findAllByInventory(getParent());
|
List<ContractItem> items = getContractItemService().findAllByInventory(getParent());
|
||||||
items.stream().collect(Collectors.groupingBy(v -> {
|
items.stream().collect(Collectors.groupingBy(v -> {
|
||||||
Contract contract = v.getContract();
|
Contract contract = v.getContract();
|
||||||
@@ -213,8 +216,10 @@ public class InventoryTabSkinHistoryPrice
|
|||||||
return contract.getSetupDate();
|
return contract.getSetupDate();
|
||||||
})).ifPresent(v -> update(historyPrice.getLatestSalePrice(), v));
|
})).ifPresent(v -> update(historyPrice.getLatestSalePrice(), v));
|
||||||
|
|
||||||
list.stream().max(Comparator.comparing(ContractItem::getTaxPrice)).ifPresent(v -> update(historyPrice.getMaxSalePrice(), v));
|
list.stream().max(Comparator.comparing(ContractItem::getTaxPrice))
|
||||||
list.stream().min(Comparator.comparing(ContractItem::getTaxPrice)).ifPresent(v -> update(historyPrice.getMiniSalePrice(), v));
|
.ifPresent(v -> update(historyPrice.getMaxSalePrice(), v));
|
||||||
|
list.stream().min(Comparator.comparing(ContractItem::getTaxPrice))
|
||||||
|
.ifPresent(v -> update(historyPrice.getMiniSalePrice(), v));
|
||||||
|
|
||||||
} else if (ContractPayWay.PAY.equals(payWay)) {
|
} else if (ContractPayWay.PAY.equals(payWay)) {
|
||||||
// 采购
|
// 采购
|
||||||
@@ -223,8 +228,10 @@ public class InventoryTabSkinHistoryPrice
|
|||||||
return contract.getSetupDate();
|
return contract.getSetupDate();
|
||||||
})).ifPresent(v -> update(historyPrice.getLatestPurchasePrice(), v));
|
})).ifPresent(v -> update(historyPrice.getLatestPurchasePrice(), v));
|
||||||
|
|
||||||
list.stream().max(Comparator.comparing(ContractItem::getTaxPrice)).ifPresent(v -> update(historyPrice.getMaxPurchasePrice(), v));
|
list.stream().max(Comparator.comparing(ContractItem::getTaxPrice))
|
||||||
list.stream().min(Comparator.comparing(ContractItem::getTaxPrice)).ifPresent(v -> update(historyPrice.getMiniPurchasePrice(), v));
|
.ifPresent(v -> update(historyPrice.getMaxPurchasePrice(), v));
|
||||||
|
list.stream().min(Comparator.comparing(ContractItem::getTaxPrice))
|
||||||
|
.ifPresent(v -> update(historyPrice.getMiniPurchasePrice(), v));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -257,10 +264,10 @@ public class InventoryTabSkinHistoryPrice
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<InventoryHistoryPrice> getSpecification(Inventory parent) {
|
public Map<String, Object> getSpecification(Inventory parent) {
|
||||||
return SpecificationUtils.and(getSpecification(), (root, query, builder) -> {
|
Map<String, Object> params = getSpecification();
|
||||||
return builder.equal(root.get("inventory"), parent);
|
params.put("inventory", parent.getId());
|
||||||
});
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1,20 +1,27 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.inventory;
|
package com.ecep.contract.controller.inventory;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Inventory;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.InventoryService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.InventoryViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import javafx.beans.binding.Bindings;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.model.Inventory;
|
||||||
|
import com.ecep.contract.service.InventoryService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.InventoryViewModel;
|
||||||
|
|
||||||
|
import javafx.beans.binding.Bindings;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextArea;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@@ -31,7 +38,6 @@ public class InventoryWindowController extends AbstEntityController<Inventory, I
|
|||||||
@FXML
|
@FXML
|
||||||
public Tab contractsTab;
|
public Tab contractsTab;
|
||||||
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
public TextField nameField;
|
public TextField nameField;
|
||||||
@FXML
|
@FXML
|
||||||
@@ -97,14 +103,16 @@ public class InventoryWindowController extends AbstEntityController<Inventory, I
|
|||||||
@FXML
|
@FXML
|
||||||
public TextField packagedVolumeField;
|
public TextField packagedVolumeField;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private InventoryService service;
|
private InventoryService service;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
getTitle().bind(Bindings.createStringBinding(() -> "[" + viewModel.getId().get() + "] 存货详情 " + viewModel.getName().getValue() + " " + viewModel.getSpecification().get(), viewModel.getName(), viewModel.getCode(), viewModel.getSpecification()));
|
getTitle().bind(Bindings.createStringBinding(
|
||||||
|
() -> "[" + viewModel.getId().get() + "] 存货详情 " + viewModel.getName().getValue() + " "
|
||||||
|
+ viewModel.getSpecification().get(),
|
||||||
|
viewModel.getName(), viewModel.getCode(), viewModel.getSpecification()));
|
||||||
root.getScene().getStylesheets().add("/ui/inventory/inventory.css");
|
root.getScene().getStylesheets().add("/ui/inventory/inventory.css");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
|
import com.ecep.contract.model.EmployeeRole;
|
||||||
|
import com.ecep.contract.service.EmployeeRoleService;
|
||||||
|
import com.ecep.contract.service.FunctionService;
|
||||||
|
import com.ecep.contract.service.PermissionService;
|
||||||
|
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
||||||
|
|
||||||
|
public abstract class AbstEmployeeRoleBasedTabSkin
|
||||||
|
extends AbstEntityBasedTabSkin<EmployeeRoleWindowController, EmployeeRole, EmployeeRoleViewModel> {
|
||||||
|
|
||||||
|
public AbstEmployeeRoleBasedTabSkin(EmployeeRoleWindowController controller) {
|
||||||
|
super(controller);
|
||||||
|
viewModel = controller.getViewModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
EmployeeRoleService getRoleService() {
|
||||||
|
return getCachedBean(EmployeeRoleService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
FunctionService getFunctionService() {
|
||||||
|
return getCachedBean(FunctionService.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PermissionService getPermissionService() {
|
||||||
|
return controller.permissionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,24 +1,23 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Function;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.FunctionService;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.PermissionViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.ViewModelService;
|
|
||||||
import javafx.event.ActionEvent;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.TableColumn;
|
|
||||||
import javafx.scene.control.TableView;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Description;
|
import org.springframework.context.annotation.Description;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
|
import com.ecep.contract.model.Function;
|
||||||
|
import com.ecep.contract.service.FunctionService;
|
||||||
|
import com.ecep.contract.service.PermissionService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.FunctionViewModel;
|
||||||
|
|
||||||
|
import javafx.event.ActionEvent;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -1,16 +1,18 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.model.EmployeeRole;
|
||||||
|
import com.ecep.contract.service.PermissionService;
|
||||||
|
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.EditableEntityTableTabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
|
||||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
public class EmployeeRoleManagerSkin
|
public class EmployeeRoleManagerSkin
|
||||||
extends AbstEntityManagerSkin<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin, EmployeeRoleManagerWindowController>
|
extends
|
||||||
|
AbstEntityManagerSkin<EmployeeRole, EmployeeRoleViewModel, EmployeeRoleManagerSkin, EmployeeRoleManagerWindowController>
|
||||||
implements ManagerSkin, EditableEntityTableTabSkin<EmployeeRole, EmployeeRoleViewModel> {
|
implements ManagerSkin, EditableEntityTableTabSkin<EmployeeRole, EmployeeRoleViewModel> {
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -7,15 +7,14 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeRoleService;
|
import com.ecep.contract.model.EmployeeRole;
|
||||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
import com.ecep.contract.service.EmployeeRoleService;
|
||||||
import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
import com.ecep.contract.service.PermissionService;
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
|
import com.ecep.contract.Desktop;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
|
||||||
import com.ecep.contract.manager.Desktop;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
|
|
||||||
public class EmployeeRoleTabSkinBase extends AbstEmployeeRoleBasedTabSkin implements TabSkin {
|
public class EmployeeRoleTabSkinBase extends AbstEmployeeRoleBasedTabSkin implements TabSkin {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -6,8 +6,9 @@ import org.controlsfx.control.ListSelectionView;
|
|||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
import com.ecep.contract.model.EmployeeRole;
|
||||||
import com.ecep.contract.manager.ds.other.model.Function;
|
import com.ecep.contract.model.Function;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.collections.ListChangeListener;
|
import javafx.collections.ListChangeListener;
|
||||||
@@ -59,8 +60,8 @@ public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
|||||||
|
|
||||||
private void initializeListView() {
|
private void initializeListView() {
|
||||||
// 非系统内置账户
|
// 非系统内置账户
|
||||||
Specification<Function> spec = (root, query, cb) -> cb.equal(root.get("active"), true);
|
List<Function> roles = getFunctionService()
|
||||||
List<Function> roles = getFunctionService().findAll(spec, Pageable.ofSize(500)).getContent();
|
.findAll(ParamUtils.builder().equals("active", true).build(), Pageable.ofSize(500)).getContent();
|
||||||
|
|
||||||
functionsField.getSourceItems().setAll(roles);
|
functionsField.getSourceItems().setAll(roles);
|
||||||
functionsField.setCellFactory(param -> {
|
functionsField.setCellFactory(param -> {
|
||||||
@@ -1,18 +1,5 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.EmployeeRole;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeRoleService;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.EmployeeRoleViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.ViewModelService;
|
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import org.controlsfx.control.ListSelectionView;
|
import org.controlsfx.control.ListSelectionView;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -21,6 +8,24 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.model.EmployeeRole;
|
||||||
|
import com.ecep.contract.service.EmployeeRoleService;
|
||||||
|
import com.ecep.contract.service.PermissionService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.DatePicker;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -53,7 +58,7 @@ public class EmployeeRoleWindowController extends AbstEntityController<EmployeeR
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
public Tab functionsTab;
|
public Tab functionsTab;
|
||||||
public ListSelectionView<com.ecep.contract.manager.ds.other.model.Function> functionsField;
|
public ListSelectionView<com.ecep.contract.model.Function> functionsField;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Function;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.manager.ds.other.service.FunctionService;
|
import com.ecep.contract.model.Function;
|
||||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
import com.ecep.contract.service.FunctionService;
|
||||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
import com.ecep.contract.service.PermissionService;
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
import com.ecep.contract.vm.FunctionViewModel;
|
||||||
|
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.cell.CheckBoxTableCell;
|
import javafx.scene.control.cell.CheckBoxTableCell;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Function;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
import com.ecep.contract.model.Function;
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.vm.FunctionViewModel;
|
||||||
|
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
|
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Function;
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
import com.ecep.contract.manager.ds.other.model.Permission;
|
import com.ecep.contract.model.Function;
|
||||||
import com.ecep.contract.manager.ds.other.service.PermissionService;
|
import com.ecep.contract.model.Permission;
|
||||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
import com.ecep.contract.service.PermissionService;
|
||||||
import com.ecep.contract.manager.ds.other.vo.PermissionViewModel;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.manager.ui.table.AbstEntityTableTabSkin;
|
import com.ecep.contract.vm.FunctionViewModel;
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
import com.ecep.contract.vm.PermissionViewModel;
|
||||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
@@ -61,10 +61,10 @@ public class FunctionTabSkinPermission
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<Permission> getSpecification(Function parent) {
|
public Map<String, Object> getSpecification(Function parent) {
|
||||||
return SpecificationUtils.and(getSpecification(), (root, query, criteriaBuilder) -> {
|
Map<String, Object> params = getSpecification();
|
||||||
return criteriaBuilder.equal(root.get("function"), parent);
|
params.put("function", parent.getId());
|
||||||
});
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,5 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Function;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.FunctionService;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.AbstEntityController;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.stage.Window;
|
|
||||||
import javafx.stage.WindowEvent;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -18,6 +7,23 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.model.Function;
|
||||||
|
import com.ecep.contract.service.FunctionService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.FunctionViewModel;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.CheckBox;
|
||||||
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TabPane;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.stage.Window;
|
||||||
|
import javafx.stage.WindowEvent;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@@ -1,11 +1,22 @@
|
|||||||
package com.ecep.contract.manager.ds.other.controller.permission;
|
package com.ecep.contract.controller.permission;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
|
import com.ecep.contract.controller.table.TableTabSkin;
|
||||||
|
import com.ecep.contract.model.Permission;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
import com.ecep.contract.vm.FunctionViewModel;
|
||||||
|
import com.ecep.contract.vm.PermissionViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Permission;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.FunctionViewModel;
|
|
||||||
import com.ecep.contract.manager.ds.other.vo.PermissionViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.TableTabSkin;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.property.Property;
|
import javafx.beans.property.Property;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
@@ -16,14 +27,6 @@ import javafx.scene.control.MenuItem;
|
|||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.TableView;
|
import javafx.scene.control.TableView;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permission, PermissionViewModel> {
|
public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permission, PermissionViewModel> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PermissionManagerSkin.class);
|
private static final Logger logger = LoggerFactory.getLogger(PermissionManagerSkin.class);
|
||||||
@@ -56,7 +59,6 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
|||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void install() {
|
public void install() {
|
||||||
initializeTable();
|
initializeTable();
|
||||||
@@ -64,14 +66,14 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
|||||||
loadTableDataSet();
|
loadTableDataSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeTable() {
|
public void initializeTable() {
|
||||||
table.setEditable(true);
|
table.setEditable(true);
|
||||||
|
|
||||||
// controller.permissionTable_descriptionColumn.setCellValueFactory(param -> param.getValue().getDescription());
|
// controller.permissionTable_descriptionColumn.setCellValueFactory(param ->
|
||||||
// controller.permissionTable_descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
// param.getValue().getDescription());
|
||||||
// controller.permissionTable_descriptionColumn.setOnEditCommit(this::onSignMethodTableDescriptionColumnEditCommitAction);
|
// controller.permissionTable_descriptionColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||||
|
// controller.permissionTable_descriptionColumn.setOnEditCommit(this::onSignMethodTableDescriptionColumnEditCommitAction);
|
||||||
|
|
||||||
table.setItems(dataSet);
|
table.setItems(dataSet);
|
||||||
|
|
||||||
@@ -98,7 +100,7 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
|||||||
|
|
||||||
protected void onTableCreateNewAction(ActionEvent event) {
|
protected void onTableCreateNewAction(ActionEvent event) {
|
||||||
Permission newRow = new Permission();
|
Permission newRow = new Permission();
|
||||||
com.ecep.contract.manager.ds.other.model.Function function = controller.functionService.findById(viewModel.getId().get());
|
com.ecep.contract.model.Function function = controller.functionService.findById(viewModel.getId().get());
|
||||||
newRow.setFunction(function);
|
newRow.setFunction(function);
|
||||||
|
|
||||||
Permission saved = controller.permissionService.save(newRow);
|
Permission saved = controller.permissionService.save(newRow);
|
||||||
@@ -141,7 +143,8 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
|||||||
if (viewModel == null) {
|
if (viewModel == null) {
|
||||||
return List.of();
|
return List.of();
|
||||||
}
|
}
|
||||||
return controller.permissionService.findByFunctionId(viewModel.getId().get()).stream().map(PermissionViewModel::from).toList();
|
return controller.permissionService.findByFunctionId(viewModel.getId().get()).stream()
|
||||||
|
.map(PermissionViewModel::from).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadTableDataSet() {
|
public void loadTableDataSet() {
|
||||||
@@ -161,12 +164,14 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<Permission> getSpecification() {
|
public Map<String, Object> getSpecification() {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
return controller.permissionService.getSpecification(null);
|
// 使用permissionService的specification逻辑
|
||||||
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
private <K> void acceptSignMethodCellEditEvent(TableColumn.CellEditEvent<PermissionViewModel, K> event, Function<PermissionViewModel, Property<K>> function) {
|
private <K> void acceptSignMethodCellEditEvent(TableColumn.CellEditEvent<PermissionViewModel, K> event,
|
||||||
|
Function<PermissionViewModel, Property<K>> function) {
|
||||||
PermissionViewModel row = event.getRowValue();
|
PermissionViewModel row = event.getRowValue();
|
||||||
Property<K> property = function.apply(row);
|
Property<K> property = function.apply(row);
|
||||||
property.setValue(event.getNewValue());
|
property.setValue(event.getNewValue());
|
||||||
@@ -186,5 +191,4 @@ public class PermissionManagerSkin implements ManagerSkin, TableTabSkin<Permissi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.ecep.contract.manager.ds.project.controller;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.project.model.Project;
|
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectService;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
import com.ecep.contract.manager.ds.project.vo.ProjectViewModel;
|
import com.ecep.contract.model.Project;
|
||||||
import com.ecep.contract.manager.ui.tab.AbstEntityBasedTabSkin;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
|
|
||||||
public abstract class AbstProjectBasedTabSkin
|
public abstract class AbstProjectBasedTabSkin
|
||||||
extends AbstEntityBasedTabSkin<ProjectWindowController, Project, ProjectViewModel>
|
extends AbstEntityBasedTabSkin<ProjectWindowController, Project, ProjectViewModel>
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.AbstEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
import com.ecep.contract.model.Project;
|
||||||
|
import com.ecep.contract.service.ProjectService;
|
||||||
|
import com.ecep.contract.vm.IdentityViewModel;
|
||||||
|
import com.ecep.contract.vm.ProjectBasedViewModel;
|
||||||
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
|
|
||||||
|
public abstract class AbstProjectTableTabSkin<T extends IdentityEntity, TV extends IdentityViewModel<T>>
|
||||||
|
extends AbstEntityTableTabSkin<ProjectWindowController, Project, ProjectViewModel, T, TV>
|
||||||
|
implements TabSkin {
|
||||||
|
|
||||||
|
public AbstProjectTableTabSkin(ProjectWindowController controller) {
|
||||||
|
super(controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectService getProjectService() {
|
||||||
|
return controller.projectService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TV createNewViewModel() {
|
||||||
|
TV model = super.createNewViewModel();
|
||||||
|
if (model instanceof ProjectBasedViewModel m) {
|
||||||
|
m.getProject().set(getEntity());
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getSpecification(Project parent) {
|
||||||
|
Map<String, Object> params = getSpecification();
|
||||||
|
params.put("project", parent.getId());
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,16 +1,26 @@
|
|||||||
package com.ecep.contract.manager.ds.project.controller;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.ecep.contract.Desktop;
|
||||||
|
import com.ecep.contract.controller.BaseController;
|
||||||
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.Project;
|
||||||
|
import com.ecep.contract.model.ProjectSaleType;
|
||||||
|
import com.ecep.contract.service.EmployeeService;
|
||||||
|
import com.ecep.contract.service.ProjectService;
|
||||||
|
import com.ecep.contract.service.SaleTypeService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.Desktop;
|
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeService;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.Project;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.ProjectSaleType;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectService;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.SaleTypeService;
|
|
||||||
import com.ecep.contract.manager.ds.project.vo.ProjectViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.ObjectProperty;
|
import javafx.beans.property.ObjectProperty;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
@@ -26,14 +36,6 @@ import javafx.stage.Stage;
|
|||||||
import javafx.stage.Window;
|
import javafx.stage.Window;
|
||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.context.annotation.Scope;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ecep.contract.model.Company;
|
||||||
|
import com.ecep.contract.model.CompanyInvoiceInfo;
|
||||||
|
import com.ecep.contract.service.ViewModelService;
|
||||||
|
import com.ecep.contract.vm.CompanyInvoiceInfoViewModel;
|
||||||
|
|
||||||
|
public class CompanyInvoiceInfoService implements ViewModelService<CompanyInvoiceInfo, CompanyInvoiceInfoViewModel> {
|
||||||
|
|
||||||
|
public List<CompanyInvoiceInfo> searchByCompany(Company company, String searchText) {
|
||||||
|
throw new UnsupportedOperationException("未实现");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +1,24 @@
|
|||||||
package com.ecep.contract.manager.ds.project.controller;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.CompanyTableCell;
|
import com.ecep.contract.controller.AbstEntityManagerSkin;
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
import com.ecep.contract.controller.BaseController;
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
import com.ecep.contract.controller.ComboBoxUtils;
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
import com.ecep.contract.manager.ds.project.model.ProductType;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
import com.ecep.contract.manager.ds.project.model.Project;
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
import com.ecep.contract.manager.ds.project.model.ProjectSaleType;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.manager.ds.project.model.ProjectType;
|
import com.ecep.contract.model.ProductType;
|
||||||
import com.ecep.contract.manager.ds.project.service.ProductTypeService;
|
import com.ecep.contract.model.Project;
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectService;
|
import com.ecep.contract.model.ProjectSaleType;
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectTypeService;
|
import com.ecep.contract.model.ProjectType;
|
||||||
import com.ecep.contract.manager.ds.project.service.SaleTypeService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.manager.ds.project.vo.ProjectViewModel;
|
import com.ecep.contract.service.ProductTypeService;
|
||||||
import com.ecep.contract.manager.ui.AbstEntityManagerSkin;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
import com.ecep.contract.service.ProjectTypeService;
|
||||||
import com.ecep.contract.manager.ui.ComboBoxUtils;
|
import com.ecep.contract.service.SaleTypeService;
|
||||||
import com.ecep.contract.manager.ui.ManagerSkin;
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
import com.ecep.contract.manager.util.SpecificationUtils;
|
|
||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
@@ -41,7 +40,6 @@ public class ProjectManagerSkin
|
|||||||
@Setter
|
@Setter
|
||||||
private ProductTypeService productTypeService;
|
private ProductTypeService productTypeService;
|
||||||
|
|
||||||
|
|
||||||
public ProjectManagerSkin(ProjectManagerWindowController controller) {
|
public ProjectManagerSkin(ProjectManagerWindowController controller) {
|
||||||
super(controller);
|
super(controller);
|
||||||
}
|
}
|
||||||
@@ -50,7 +48,7 @@ public class ProjectManagerSkin
|
|||||||
return controller.getViewModelService();
|
return controller.getViewModelService();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyService getCompanyService(){
|
public CompanyService getCompanyService() {
|
||||||
if (companyService == null) {
|
if (companyService == null) {
|
||||||
companyService = getBean(CompanyService.class);
|
companyService = getBean(CompanyService.class);
|
||||||
}
|
}
|
||||||
@@ -78,16 +76,13 @@ public class ProjectManagerSkin
|
|||||||
return productTypeService;
|
return productTypeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<Project> getSpecification() {
|
public Map<String, Object> getSpecification() {
|
||||||
Specification<Project> spec = super.getSpecification();
|
Map<String, Object> params = super.getSpecification();
|
||||||
if (controller.saleTypeSelector.getValue() != null) {
|
if (controller.saleTypeSelector.getValue() != null) {
|
||||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> {
|
params.put("saleType", controller.saleTypeSelector.getValue());
|
||||||
return builder.equal(root.get("saleType"), controller.saleTypeSelector.getValue());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return spec;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -102,7 +97,9 @@ public class ProjectManagerSkin
|
|||||||
controller.nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
controller.nameColumn.setCellValueFactory(param -> param.getValue().getName());
|
||||||
|
|
||||||
controller.amountColumn.setCellValueFactory(param -> param.getValue().getAmount());
|
controller.amountColumn.setCellValueFactory(param -> param.getValue().getAmount());
|
||||||
controller.amountColumn.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));//, "#,##0"
|
controller.amountColumn
|
||||||
|
.setCellFactory(TextFieldTableCell.forTableColumn(new CurrencyStringConverter(getLocale())));// ,
|
||||||
|
// "#,##0"
|
||||||
|
|
||||||
initializeSaleTypeColumn(controller.saleTypeColumn);
|
initializeSaleTypeColumn(controller.saleTypeColumn);
|
||||||
initializeCustomerColumn(controller.customerColumn);
|
initializeCustomerColumn(controller.customerColumn);
|
||||||
@@ -114,7 +111,6 @@ public class ProjectManagerSkin
|
|||||||
controller.useOfferColumn.setCellValueFactory(param -> param.getValue().getUseOffer());
|
controller.useOfferColumn.setCellValueFactory(param -> param.getValue().getUseOffer());
|
||||||
controller.useOfferColumn.setCellFactory(CheckBoxTableCell.forTableColumn(controller.useOfferColumn));
|
controller.useOfferColumn.setCellFactory(CheckBoxTableCell.forTableColumn(controller.useOfferColumn));
|
||||||
|
|
||||||
|
|
||||||
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
|
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
@@ -122,10 +118,9 @@ public class ProjectManagerSkin
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initializeCustomerColumn(TableColumn<ProjectViewModel, Company> column) {
|
private void initializeCustomerColumn(TableColumn<ProjectViewModel, Company> column) {
|
||||||
column.setCellValueFactory(param -> param.getValue().getCustomer());
|
column.setCellValueFactory(param -> param.getValue().getCustomer());
|
||||||
column.setCellFactory(param-> new CompanyTableCell<>(getCompanyService()));
|
column.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeProductTypeColumn(TableColumn<ProjectViewModel, String> column) {
|
private void initializeProductTypeColumn(TableColumn<ProjectViewModel, String> column) {
|
||||||
@@ -156,13 +151,14 @@ public class ProjectManagerSkin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTableCreateNewAction(ActionEvent event) {
|
protected void onTableCreateNewAction(ActionEvent event) {
|
||||||
BaseController.show(ApplyNewProjectWindowController.class, getTableView().getScene().getWindow(), controller -> {
|
BaseController.show(ApplyNewProjectWindowController.class, getTableView().getScene().getWindow(),
|
||||||
controller.setOnApplied(project -> {
|
controller -> {
|
||||||
ProjectViewModel viewModel = ProjectViewModel.from(project);
|
controller.setOnApplied(project -> {
|
||||||
dataSet.addFirst(viewModel);
|
ProjectViewModel viewModel = ProjectViewModel.from(project);
|
||||||
showInOwner(viewModel);
|
dataSet.addFirst(viewModel);
|
||||||
});
|
showInOwner(viewModel);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showInOwner(ProjectViewModel model) {
|
private void showInOwner(ProjectViewModel model) {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ecep.contract.manager.ds.project.controller;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
@@ -9,19 +9,19 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.company.model.Company;
|
import com.ecep.contract.controller.AbstManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.project.controller.industry.ProjectIndustryManagerWindowController;
|
import com.ecep.contract.controller.BaseController;
|
||||||
import com.ecep.contract.manager.ds.project.controller.product_type.ProductTypeManagerWindowController;
|
import com.ecep.contract.controller.project.industry.ProjectIndustryManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.project.controller.project_type.ProjectTypeManagerWindowController;
|
import com.ecep.contract.controller.project.product_type.ProductTypeManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.project.controller.sale_type.ProjectSaleTypeManagerWindowController;
|
import com.ecep.contract.controller.project.project_type.ProjectTypeManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.project.controller.usage.ProductUsageManagerWindowController;
|
import com.ecep.contract.controller.project.sale_type.ProjectSaleTypeManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.project.model.Project;
|
import com.ecep.contract.controller.project.usage.ProductUsageManagerWindowController;
|
||||||
import com.ecep.contract.manager.ds.project.model.ProjectSaleType;
|
import com.ecep.contract.model.Company;
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectService;
|
import com.ecep.contract.model.Project;
|
||||||
import com.ecep.contract.manager.ds.project.vo.ProjectViewModel;
|
import com.ecep.contract.model.ProjectSaleType;
|
||||||
import com.ecep.contract.manager.ui.AbstManagerWindowController;
|
import com.ecep.contract.service.ProjectService;
|
||||||
import com.ecep.contract.manager.ui.BaseController;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
import com.ecep.contract.vm.ProjectViewModel;
|
||||||
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.ComboBox;
|
import javafx.scene.control.ComboBox;
|
||||||
@@ -1,14 +1,33 @@
|
|||||||
package com.ecep.contract.manager.ds.project.controller;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.ComboBoxUtils;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
|
import com.ecep.contract.converter.EntityStringConverter;
|
||||||
|
import com.ecep.contract.model.DeliverySignMethod;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.ProductType;
|
||||||
|
import com.ecep.contract.model.ProductUsage;
|
||||||
|
import com.ecep.contract.model.Project;
|
||||||
|
import com.ecep.contract.model.ProjectCost;
|
||||||
|
import com.ecep.contract.model.ProjectIndustry;
|
||||||
|
import com.ecep.contract.model.ProjectSaleType;
|
||||||
|
import com.ecep.contract.model.ProjectType;
|
||||||
|
import com.ecep.contract.service.DeliverySignMethodService;
|
||||||
|
import com.ecep.contract.service.EmployeeService;
|
||||||
|
import com.ecep.contract.service.ProductTypeService;
|
||||||
|
import com.ecep.contract.service.ProductUsageService;
|
||||||
|
import com.ecep.contract.service.ProjectCostService;
|
||||||
|
import com.ecep.contract.service.ProjectIndustryService;
|
||||||
|
import com.ecep.contract.service.ProjectTypeService;
|
||||||
|
import com.ecep.contract.service.SaleTypeService;
|
||||||
|
import com.ecep.contract.util.UITools;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.other.EmployeeStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.EntityStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.other.service.EmployeeService;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.*;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.*;
|
|
||||||
import com.ecep.contract.manager.ui.ComboBoxUtils;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.util.UITools;
|
|
||||||
import javafx.beans.binding.Bindings;
|
import javafx.beans.binding.Bindings;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
@@ -21,10 +40,6 @@ import javafx.scene.control.TextField;
|
|||||||
import javafx.util.converter.LocalDateStringConverter;
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础信息
|
* 基础信息
|
||||||
@@ -1,35 +1,33 @@
|
|||||||
package com.ecep.contract.manager.ds.project.controller;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
import com.ecep.contract.manager.SpringApp;
|
|
||||||
import com.ecep.contract.manager.ds.company.CompanyStringConverter;
|
|
||||||
import com.ecep.contract.manager.ds.company.service.CompanyService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerEvaluationFormFile;
|
|
||||||
import com.ecep.contract.manager.ds.customer.model.CompanyCustomerFile;
|
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerFileService;
|
|
||||||
import com.ecep.contract.manager.ds.customer.service.CompanyCustomerService;
|
|
||||||
import com.ecep.contract.manager.ds.other.EmployeeStringConverter;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.EmployeeTableCell;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.project.controller.bid.ProjectBidWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.Project;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.ProjectBid;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectBidService;
|
|
||||||
import com.ecep.contract.manager.ds.project.vo.ProjectBidViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.*;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.EditableEntityTableTabSkin;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.util.converter.LocalDateStringConverter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
|
import com.ecep.contract.controller.project.bid.ProjectBidWindowController;
|
||||||
|
import com.ecep.contract.controller.tab.RefreshableSkin;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
|
import com.ecep.contract.converter.CompanyStringConverter;
|
||||||
|
import com.ecep.contract.converter.EmployeeStringConverter;
|
||||||
|
import com.ecep.contract.model.CompanyCustomerEvaluationFormFile;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.Project;
|
||||||
|
import com.ecep.contract.model.ProjectBid;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerFileService;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerService;
|
||||||
|
import com.ecep.contract.service.CompanyService;
|
||||||
|
import com.ecep.contract.service.ProjectBidService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.ProjectBidViewModel;
|
||||||
|
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TableCell;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
@FxmlPath("/ui/project/project-tab-bid.fxml")
|
@FxmlPath("/ui/project/project-tab-bid.fxml")
|
||||||
public class ProjectTabSkinBid
|
public class ProjectTabSkinBid
|
||||||
@@ -1,18 +1,19 @@
|
|||||||
package com.ecep.contract.manager.ds.project.controller;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.contract.ContractWindowController;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.model.Contract;
|
||||||
|
import com.ecep.contract.service.ContractService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.ContractViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.contract.controller.ContractWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.contract.model.Contract;
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractService;
|
|
||||||
import com.ecep.contract.manager.ds.contract.vo.ContractViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.scene.control.MenuItem;
|
import javafx.scene.control.MenuItem;
|
||||||
import javafx.scene.control.Tab;
|
import javafx.scene.control.Tab;
|
||||||
import javafx.scene.control.TableColumn;
|
import javafx.scene.control.TableColumn;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/project/project-tab-contract.fxml")
|
@FxmlPath("/ui/project/project-tab-contract.fxml")
|
||||||
public class ProjectTabSkinContract
|
public class ProjectTabSkinContract
|
||||||
extends AbstProjectTableTabSkin<Contract, ContractViewModel>
|
extends AbstProjectTableTabSkin<Contract, ContractViewModel>
|
||||||
@@ -1,30 +1,34 @@
|
|||||||
package com.ecep.contract.manager.ds.project.controller;
|
package com.ecep.contract.controller.project;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.ecep.contract.controller.project.cost.ProjectCostWindowController;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.controller.table.cell.EmployeeTableCell;
|
||||||
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
|
import com.ecep.contract.model.Employee;
|
||||||
|
import com.ecep.contract.model.Project;
|
||||||
|
import com.ecep.contract.model.ProjectCost;
|
||||||
|
import com.ecep.contract.model.ProjectCostItem;
|
||||||
|
import com.ecep.contract.service.ContractItemService;
|
||||||
|
import com.ecep.contract.service.ProjectCostItemService;
|
||||||
|
import com.ecep.contract.service.ProjectCostService;
|
||||||
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vm.ProjectCostItemViewModel;
|
||||||
|
import com.ecep.contract.vm.ProjectCostViewModel;
|
||||||
|
|
||||||
import com.ecep.contract.manager.ds.contract.service.ContractItemService;
|
|
||||||
import com.ecep.contract.manager.ds.contract.vo.ProjectCostItemViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.EmployeeTableCell;
|
|
||||||
import com.ecep.contract.manager.ds.other.model.Employee;
|
|
||||||
import com.ecep.contract.manager.ds.project.controller.cost.ProjectCostWindowController;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.Project;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.ProjectCost;
|
|
||||||
import com.ecep.contract.manager.ds.project.model.ProjectCostItem;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectCostItemService;
|
|
||||||
import com.ecep.contract.manager.ds.project.service.ProjectCostService;
|
|
||||||
import com.ecep.contract.manager.ds.project.vo.ProjectCostViewModel;
|
|
||||||
import com.ecep.contract.manager.ui.FxmlPath;
|
|
||||||
import com.ecep.contract.manager.ui.tab.TabSkin;
|
|
||||||
import com.ecep.contract.manager.ui.table.cell.LocalDateTimeTableCell;
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.ContextMenu;
|
||||||
|
import javafx.scene.control.MenuItem;
|
||||||
|
import javafx.scene.control.Tab;
|
||||||
|
import javafx.scene.control.TableColumn;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
import javafx.util.converter.CurrencyStringConverter;
|
import javafx.util.converter.CurrencyStringConverter;
|
||||||
import javafx.util.converter.NumberStringConverter;
|
import javafx.util.converter.NumberStringConverter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@FxmlPath("/ui/project/project-tab-cost.fxml")
|
@FxmlPath("/ui/project/project-tab-cost.fxml")
|
||||||
public class ProjectTabSkinCost
|
public class ProjectTabSkinCost
|
||||||
extends AbstProjectTableTabSkin<ProjectCost, ProjectCostViewModel>
|
extends AbstProjectTableTabSkin<ProjectCost, ProjectCostViewModel>
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user