This commit is contained in:
2025-09-24 00:11:21 +08:00
parent 7b023fd07b
commit 45eed8281f
9 changed files with 98 additions and 25 deletions

View File

@@ -1,26 +1,68 @@
# Contract-Manager 项目规则
## 技术栈规范
# server 模块 ### server 模块
Java 21 - Java 21
Spring Boot 3.3.7 - Spring Boot 3.3.7
Spring Data JPA 3.3.7 - Spring Data JPA 3.3.7
MySQL 8.0.33 - MySQL 8.0.33
Lombok 1.18.32 - Lombok 1.18.32
POI 5.2.5 - POI 5.2.5
PDFBox 3.0.1 - PDFBox 3.0.1
Redis - Redis
# client 模块 ### client 模块
Java 21 - Java 21
JavaFX 21 - JavaFX 21
ControlsFX 11.1.2 - ControlsFX 11.1.2
Lombok 1.18.32 - Lombok 1.18.32
caffeine 3.1.8 - caffeine 3.1.8
.fxml 界面UI, /client/src/main/resources/ui/ 目录下 - .fxml 界面UI, 放置于 /client/src/main/resources/ui/ 目录下
websocket 与 server 模块通信 - websocket 与 server 模块通信
# common 模块 ### common 模块
- Java 21
- Lombok 1.18.32
## 文件命名规范
- Java类名使用驼峰命名法首字母大写`ContractService.java`
- 接口名使用驼峰命名法首字母大写以I开头`IContractService.java`
- 控制器类名以Controller结尾`ContractController.java`
- 服务类名以Service结尾`ContractService.java`
- 实体类名:使用驼峰命名法,首字母大写,如 `Contract.java`
- FXML文件使用小写字母和下划线`contract_view.fxml`
- SQL文件表名使用大写和下划线`CONTRACT_TYPE_LOCAL.sql`
## 目录结构规范
- 源代码位于 `src/main/java` 目录
- 资源文件位于 `src/main/resources` 目录
- 测试代码位于 `src/test` 目录
- 数据库脚本位于 `docs/db` 目录
## 数据库规范
- 表名使用大写字母和下划线,如 `COMPANY_VENDOR_FILE_TYPE_LOCAL`
- 字段名使用大写字母和下划线,如 `CREATE_DATE`
- 主键命名为 `ID`
- 外键命名格式为 `[关联表名]_ID`
- 唯一约束命名格式为 `UK_[表名缩写]_[字段名]`
## 代码规范
- 使用Lombok注解简化代码`@Data``@Slf4j`
- 类和方法应有适当的JavaDoc注释
- 变量命名应清晰表达其含义
- 避免魔法数字,使用常量替代
- 异常处理使用统一的异常处理机制
## 忽略文件
ignore: ignore:
- .idea - .idea
- target - target
- *.iml
- .gitignore
- .gitattributes
- out/
- *.log
- build/
- .DS_Store
- *.class

View File

@@ -3,8 +3,10 @@ package com.ecep.contract.controller.customer;
import com.ecep.contract.MyDateTimeUtils; import com.ecep.contract.MyDateTimeUtils;
import com.ecep.contract.controller.AbstEntityManagerSkin; import com.ecep.contract.controller.AbstEntityManagerSkin;
import com.ecep.contract.controller.table.cell.CompanyTableCell; import com.ecep.contract.controller.table.cell.CompanyTableCell;
import com.ecep.contract.controller.table.cell.CustomerCatalogTableCell;
import com.ecep.contract.service.CompanyCustomerService; import com.ecep.contract.service.CompanyCustomerService;
import com.ecep.contract.service.CompanyService; import com.ecep.contract.service.CompanyService;
import com.ecep.contract.service.CustomerCatalogService;
import com.ecep.contract.vm.CompanyCustomerViewModel; import com.ecep.contract.vm.CompanyCustomerViewModel;
import com.ecep.contract.vo.CompanyCustomerVo; import com.ecep.contract.vo.CompanyCustomerVo;
import com.ecep.contract.vo.CompanyVo; import com.ecep.contract.vo.CompanyVo;
@@ -31,7 +33,10 @@ public class CompanyCustomerManagerSkin
public void initializeTable() { public void initializeTable() {
controller.idColumn.setCellValueFactory(param -> param.getValue().getId()); controller.idColumn.setCellValueFactory(param -> param.getValue().getId());
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany()); controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
controller.companyColumn.setCellFactory(param -> new CompanyTableCell<>(getCompanyService())); controller.companyColumn.setCellFactory(CompanyTableCell.forTableColumn(getCompanyService()));
controller.catalogColumn.setCellValueFactory(param -> param.getValue().getCatalog());
controller.catalogColumn.setCellFactory(CustomerCatalogTableCell.forTableColumn(getBean(CustomerCatalogService.class)));
controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate()); controller.developDateColumn.setCellValueFactory(param -> param.getValue().getDevelopDate());
controller.pathColumn.setCellValueFactory(param -> param.getValue().getPath()); controller.pathColumn.setCellValueFactory(param -> param.getValue().getPath());

View File

@@ -52,7 +52,7 @@ public class CompanyCustomerManagerWindowController
* 客户所属公司,Company * 客户所属公司,Company
*/ */
public TableColumn<CompanyCustomerViewModel, Integer> companyColumn; public TableColumn<CompanyCustomerViewModel, Integer> companyColumn;
public TableColumn<CompanyCustomerViewModel, String> catalogColumn; public TableColumn<CompanyCustomerViewModel, Integer> catalogColumn;
public TableColumn<CompanyCustomerViewModel, LocalDate> developDateColumn; public TableColumn<CompanyCustomerViewModel, LocalDate> developDateColumn;
public TableColumn<CompanyCustomerViewModel, String> pathColumn; public TableColumn<CompanyCustomerViewModel, String> pathColumn;
public TableColumn<CompanyCustomerViewModel, String> createdColumn; public TableColumn<CompanyCustomerViewModel, String> createdColumn;

View File

@@ -68,7 +68,7 @@ public class CustomerTabSkinSatisfactionSurvey
bindLocalDateColumn(dateColumn, CustomerSatisfactionSurveyViewModel::getDate); bindLocalDateColumn(dateColumn, CustomerSatisfactionSurveyViewModel::getDate);
bindNumberColumn(totalScoreColumn, CustomerSatisfactionSurveyViewModel::getTotalScore); bindNumberColumn(totalScoreColumn, CustomerSatisfactionSurveyViewModel::getTotalScore);
applicantColumn.setCellValueFactory(param -> param.getValue().getApplicant()); applicantColumn.setCellValueFactory(param -> param.getValue().getApplicant());
applicantColumn.setCellFactory(cell -> new EmployeeTableCell<>(getEmployeeService())); applicantColumn.setCellFactory(EmployeeTableCell.forTableColumn(getEmployeeService()));
bindLocalDateTimeColumn(applyTimeColumn, CustomerSatisfactionSurveyViewModel::getApplyTime); bindLocalDateTimeColumn(applyTimeColumn, CustomerSatisfactionSurveyViewModel::getApplyTime);
bindColumn(descriptionColumn, CustomerSatisfactionSurveyViewModel::getDescription); bindColumn(descriptionColumn, CustomerSatisfactionSurveyViewModel::getDescription);

View File

@@ -20,6 +20,8 @@ public class CompanyCustomerViewModel extends IdentityViewModel<CompanyCustomerV
* 关联的企业,Company * 关联的企业,Company
*/ */
private SimpleObjectProperty<Integer> company = new SimpleObjectProperty<>(); private SimpleObjectProperty<Integer> company = new SimpleObjectProperty<>();
private SimpleObjectProperty<Integer> catalog = new SimpleObjectProperty<>();
/** /**
* 发展日期 * 发展日期
*/ */
@@ -46,6 +48,7 @@ public class CompanyCustomerViewModel extends IdentityViewModel<CompanyCustomerV
public void updateFrom(CompanyCustomerVo c) { public void updateFrom(CompanyCustomerVo c) {
super.updateFrom(c); super.updateFrom(c);
getCompany().set(c.getCompanyId()); getCompany().set(c.getCompanyId());
getCatalog().set(c.getCatalogId());
getDevelopDate().set(c.getDevelopDate()); getDevelopDate().set(c.getDevelopDate());
getContact().set(c.getContactId()); getContact().set(c.getContactId());
getPath().set(c.getPath()); getPath().set(c.getPath());
@@ -60,6 +63,10 @@ public class CompanyCustomerViewModel extends IdentityViewModel<CompanyCustomerV
v.setCompanyId(company.get()); v.setCompanyId(company.get());
modified = true; modified = true;
} }
if (!Objects.equals(catalog.get(), v.getCatalogId())) {
v.setCatalogId(catalog.get());
modified = true;
}
if (!Objects.equals(contact.get(), v.getContactId())) { if (!Objects.equals(contact.get(), v.getContactId())) {
v.setContactId(contact.get()); v.setContactId(contact.get());
modified = true; modified = true;

View File

@@ -5,7 +5,7 @@
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"
xmlns:fx="http://javafx.com/fxml/1" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="com.ecep.contract.manager.ds.customer.controller.CustomerTabSkinSatisfactionSurvey"> fx:controller="com.ecep.contract.controller.customer.CustomerTabSkinSatisfactionSurvey">
<children> <children>
<VBox AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" <VBox AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0"
AnchorPane.topAnchor="5.0"> AnchorPane.topAnchor="5.0">
@@ -41,7 +41,8 @@
</TableView> </TableView>
<Pane prefHeight="50.0"> <Pane prefHeight="50.0">
<children> <children>
<Label layoutX="14.0" layoutY="7.0" text="相关项是U8系统中的客户更新日期表示数据从U8系统中获取数据有变化时记录的日期同步时间表示发生从U8系统中获取时的时间戳。"/> <Label layoutX="14.0" layoutY="7.0"
text="以抽查的方式,使用电话或者现场要求客户对服务质量评价。"/>
</children> </children>
</Pane> </Pane>
</children> </children>

View File

@@ -43,6 +43,14 @@ public class CompanyCustomer implements IdentityEntity, CompanyBasedEntity, Seri
@ToString.Exclude @ToString.Exclude
private Company company; private Company company;
/**
* 客户分组
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "CUS_CLS")
@ToString.Exclude
private CustomerCatalog catalog;
/** /**
* 发展日期 * 发展日期
*/ */
@@ -97,6 +105,7 @@ public class CompanyCustomer implements IdentityEntity, CompanyBasedEntity, Seri
CompanyCustomerVo vo = new CompanyCustomerVo(); CompanyCustomerVo vo = new CompanyCustomerVo();
vo.setId(id); vo.setId(id);
vo.setCompanyId(company != null ? company.getId() : null); vo.setCompanyId(company != null ? company.getId() : null);
vo.setCatalogId(catalog != null ? catalog.getId() : null);
vo.setDevelopDate(developDate); vo.setDevelopDate(developDate);
vo.setPath(path); vo.setPath(path);
vo.setContactId(contact != null ? contact.getId() : null); vo.setContactId(contact != null ? contact.getId() : null);

View File

@@ -14,6 +14,7 @@ public class CompanyCustomerVo implements IdentityEntity, CompanyBasedVo {
* 公司 * 公司
*/ */
private Integer companyId; private Integer companyId;
private Integer catalogId;
private LocalDate developDate; private LocalDate developDate;
private String path; private String path;
/** /**

View File

@@ -3,6 +3,7 @@ package com.ecep.contract.ds.project.service;
import java.util.List; import java.util.List;
import com.ecep.contract.QueryService; import com.ecep.contract.QueryService;
import com.ecep.contract.constant.ServiceConstant;
import com.ecep.contract.model.CompanyBankAccount; import com.ecep.contract.model.CompanyBankAccount;
import com.ecep.contract.util.SpecificationUtils; import com.ecep.contract.util.SpecificationUtils;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
@@ -94,8 +95,15 @@ public class CustomerSatisfactionSurveyService
@Override @Override
public Page<CustomerSatisfactionSurvey> findAll(JsonNode paramsNode, Pageable pageable) { public Page<CustomerSatisfactionSurvey> findAll(JsonNode paramsNode, Pageable pageable) {
Specification<CustomerSatisfactionSurvey> spec = null; Specification<CustomerSatisfactionSurvey> spec = null;
if (paramsNode.has("searchText")) { if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
spec = getSpecification(paramsNode.get("searchText").asText()); spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
}
if (paramsNode.has("project.customer")) {
int customerId = paramsNode.get("project.customer").asInt();
spec = SpecificationUtils.and(spec, (root, query, builder) -> {
return builder.equal(root.get("project").get("customer").get("id"), customerId);
});
} }
// field // field
spec = SpecificationUtils.andParam(spec, paramsNode, "project", "applicant"); spec = SpecificationUtils.andParam(spec, paramsNode, "project", "applicant");