Compare commits
18 Commits
c10bd369c0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 643338f4b0 | |||
| 880671a5a9 | |||
| 4e738bea3c | |||
| 3cf3a717be | |||
| e8c8305f40 | |||
| be63ff62a4 | |||
| 18057a657e | |||
| db07befffe | |||
| 94030a5a39 | |||
| 7e59f2c17e | |||
| c8b0d57f22 | |||
| 6eebdb1744 | |||
| 9dc90507cb | |||
| 0c26d329c6 | |||
| e3661630fe | |||
| 5d6fb961b6 | |||
| 72edb07798 | |||
| 330418cfd6 |
1
.env
1
.env
@@ -0,0 +1 @@
|
|||||||
|
PLAYWRIGHT_MCP_EXTENSION_TOKEN=TB7T39NhEbruyS7L-E7RXIGYk39PVK7eu1h-WP8M1Cg
|
||||||
@@ -196,6 +196,3 @@ Contract-Manager/
|
|||||||
3. 增强系统安全机制
|
3. 增强系统安全机制
|
||||||
4. 改进用户界面体验
|
4. 改进用户界面体验
|
||||||
5. 扩展更多云端服务集成
|
5. 扩展更多云端服务集成
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,15 +45,33 @@ public abstract class AbstEntityController<T extends IdentityEntity, TV extends
|
|||||||
protected CompletableFuture<T> loadedFuture;
|
protected CompletableFuture<T> loadedFuture;
|
||||||
private final ObservableList<TabSkin> tabSkins = FXCollections.observableArrayList();
|
private final ObservableList<TabSkin> tabSkins = FXCollections.observableArrayList();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShown(WindowEvent windowEvent) {
|
public void onShown(WindowEvent windowEvent) {
|
||||||
super.onShown(windowEvent);
|
super.onShown(windowEvent);
|
||||||
|
// 载数据
|
||||||
|
initializeData();
|
||||||
|
// 注册 skin
|
||||||
|
registerTabSkins();
|
||||||
|
// 初始化保存按钮
|
||||||
|
initializeSaveBtn();
|
||||||
|
// 安装 skin
|
||||||
|
installTabSkins();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initializeSaveBtn() {
|
||||||
|
if (saveBtn != null) {
|
||||||
|
saveBtn.disableProperty().bind(createTabSkinChangedBindings().not());
|
||||||
|
saveBtn.setOnAction(event -> saveTabSkins());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void initializeData() {
|
||||||
ViewModelService<T, TV> service = getViewModelService();
|
ViewModelService<T, TV> service = getViewModelService();
|
||||||
|
|
||||||
if (service instanceof QueryService<T, TV> queryService) {
|
if (service instanceof QueryService<T, TV> queryService) {
|
||||||
setStatus("读取...");
|
setStatus("读取...");
|
||||||
loadedFuture = queryService.asyncFindById(viewModel.getId().get());
|
loadedFuture = queryService.asyncFindById(viewModel.getId().get());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
loadedFuture = CompletableFuture.supplyAsync(() -> {
|
loadedFuture = CompletableFuture.supplyAsync(() -> {
|
||||||
return getViewModelService().findById(viewModel.getId().get());
|
return getViewModelService().findById(viewModel.getId().get());
|
||||||
@@ -72,14 +90,6 @@ public abstract class AbstEntityController<T extends IdentityEntity, TV extends
|
|||||||
handleException("载入失败,#" + viewModel.getId().get(), ex);
|
handleException("载入失败,#" + viewModel.getId().get(), ex);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
registerTabSkins();
|
|
||||||
if (saveBtn != null) {
|
|
||||||
saveBtn.disableProperty().bind(createTabSkinChangedBindings().not());
|
|
||||||
saveBtn.setOnAction(event -> saveTabSkins());
|
|
||||||
}
|
|
||||||
|
|
||||||
installTabSkins();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateViewModel(T entity) {
|
protected void updateViewModel(T entity) {
|
||||||
@@ -105,6 +115,19 @@ public abstract class AbstEntityController<T extends IdentityEntity, TV extends
|
|||||||
return saved;
|
return saved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void save() {
|
||||||
|
T entity = getEntity();
|
||||||
|
if (entity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (viewModel.copyTo(entity)) {
|
||||||
|
save(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册 skin
|
||||||
|
*/
|
||||||
protected void registerTabSkins() {
|
protected void registerTabSkins() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,6 +139,9 @@ public abstract class AbstEntityController<T extends IdentityEntity, TV extends
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装 skin
|
||||||
|
*/
|
||||||
protected void installTabSkins() {
|
protected void installTabSkins() {
|
||||||
for (TabSkin tabSkin : tabSkins) {
|
for (TabSkin tabSkin : tabSkins) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.ecep.contract.controller.AbstEntityManagerSkin;
|
|||||||
import com.ecep.contract.controller.ManagerSkin;
|
import com.ecep.contract.controller.ManagerSkin;
|
||||||
import com.ecep.contract.controller.company.CompanyWindowController;
|
import com.ecep.contract.controller.company.CompanyWindowController;
|
||||||
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
import com.ecep.contract.controller.table.cell.CompanyTableCell;
|
||||||
|
import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateTimeTableCell;
|
||||||
import com.ecep.contract.service.CompanyService;
|
import com.ecep.contract.service.CompanyService;
|
||||||
import com.ecep.contract.service.YongYouU8Service;
|
import com.ecep.contract.service.YongYouU8Service;
|
||||||
@@ -15,6 +16,7 @@ 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 javafx.scene.control.cell.CheckBoxTableCell;
|
||||||
|
|
||||||
public class YongYouU8ManagerSkin
|
public class YongYouU8ManagerSkin
|
||||||
extends
|
extends
|
||||||
@@ -36,10 +38,9 @@ public class YongYouU8ManagerSkin
|
|||||||
@Override
|
@Override
|
||||||
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.setCellFactory(param -> new CompanyTableCell<>(getCompanyService()));
|
|
||||||
|
|
||||||
controller.cloudIdColumn.setCellValueFactory(param -> param.getValue().getCloudId());
|
controller.companyColumn.setCellValueFactory(param -> param.getValue().getCompany());
|
||||||
|
controller.companyColumn.setCellFactory( CompanyTableCell.forTableColumn(getCompanyService()));
|
||||||
|
|
||||||
controller.latestUpdateColumn.setCellValueFactory(param -> param.getValue().getLatestUpdate());
|
controller.latestUpdateColumn.setCellValueFactory(param -> param.getValue().getLatestUpdate());
|
||||||
controller.latestUpdateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
controller.latestUpdateColumn.setCellFactory(param -> new LocalDateTimeTableCell<>());
|
||||||
@@ -47,7 +48,14 @@ public class YongYouU8ManagerSkin
|
|||||||
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.descriptionColumn.setCellValueFactory(param -> param.getValue().getVendorCode());
|
controller.cloudVendorUpdateDateColumn.setCellValueFactory(param -> param.getValue().getVendorUpdateDate());
|
||||||
|
|
||||||
|
controller.cloudCustomerUpdateDateColumn.setCellValueFactory(param -> param.getValue().getCustomerUpdateDate());
|
||||||
|
|
||||||
|
controller.activeColumn.setCellValueFactory(param -> param.getValue().getActive());
|
||||||
|
controller.activeColumn.setCellFactory(CheckBoxTableCell.forTableColumn(controller.activeColumn));
|
||||||
|
|
||||||
|
controller.descriptionColumn.setCellValueFactory(param -> param.getValue().getExceptionMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,7 +81,7 @@ public class YongYouU8ManagerSkin
|
|||||||
}
|
}
|
||||||
for (CloudYuInfoViewModel selectedItem : selectedItems) {
|
for (CloudYuInfoViewModel selectedItem : selectedItems) {
|
||||||
CloudYuVo yongYouU8Vo = getU8Service().findById(selectedItem.getId().get());
|
CloudYuVo yongYouU8Vo = getU8Service().findById(selectedItem.getId().get());
|
||||||
selectedItem.getCustomerCode().set("");
|
selectedItem.getExceptionMessage().set("");
|
||||||
if (selectedItem.copyTo(yongYouU8Vo)) {
|
if (selectedItem.copyTo(yongYouU8Vo)) {
|
||||||
CloudYuVo saved = getU8Service().save(yongYouU8Vo);
|
CloudYuVo saved = getU8Service().save(yongYouU8Vo);
|
||||||
selectedItem.update(saved);
|
selectedItem.update(saved);
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ public class YongYouU8ManagerWindowController
|
|||||||
public TableColumn<CloudYuInfoViewModel, Number> idColumn;
|
public TableColumn<CloudYuInfoViewModel, Number> idColumn;
|
||||||
public TableColumn<CloudYuInfoViewModel, LocalDateTime> latestUpdateColumn;
|
public TableColumn<CloudYuInfoViewModel, LocalDateTime> latestUpdateColumn;
|
||||||
public TableColumn<CloudYuInfoViewModel, Integer> companyColumn;
|
public TableColumn<CloudYuInfoViewModel, Integer> companyColumn;
|
||||||
public TableColumn<CloudYuInfoViewModel, String> cloudIdColumn;
|
|
||||||
public TableColumn<CloudYuInfoViewModel, LocalDateTime> cloudLatestColumn;
|
public TableColumn<CloudYuInfoViewModel, LocalDateTime> cloudLatestColumn;
|
||||||
|
public TableColumn<CloudYuInfoViewModel, java.time.LocalDate> cloudVendorUpdateDateColumn;
|
||||||
|
public TableColumn<CloudYuInfoViewModel, java.time.LocalDate> cloudCustomerUpdateDateColumn;
|
||||||
|
public TableColumn<CloudYuInfoViewModel, Boolean> activeColumn;
|
||||||
public TableColumn<CloudYuInfoViewModel, String> descriptionColumn;
|
public TableColumn<CloudYuInfoViewModel, String> descriptionColumn;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import com.ecep.contract.controller.tab.TabSkin;
|
|||||||
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
import com.ecep.contract.controller.table.EditableEntityTableTabSkin;
|
||||||
import com.ecep.contract.controller.table.cell.ContractFileTypeTableCell;
|
import com.ecep.contract.controller.table.cell.ContractFileTypeTableCell;
|
||||||
import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell;
|
import com.ecep.contract.controller.table.cell.LocalDateFieldTableCell;
|
||||||
import com.ecep.contract.model.ContractFileTypeLocal;
|
|
||||||
import com.ecep.contract.service.ContractFileService;
|
import com.ecep.contract.service.ContractFileService;
|
||||||
import com.ecep.contract.service.ContractFileTypeService;
|
import com.ecep.contract.service.ContractFileTypeService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
@@ -22,7 +21,6 @@ import javafx.event.ActionEvent;
|
|||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.cell.TextFieldTableCell;
|
import javafx.scene.control.cell.TextFieldTableCell;
|
||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
import javafx.util.StringConverter;
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.apache.pdfbox.Loader;
|
import org.apache.pdfbox.Loader;
|
||||||
import org.apache.pdfbox.io.IOUtils;
|
import org.apache.pdfbox.io.IOUtils;
|
||||||
@@ -95,21 +93,6 @@ public class ContractTabSkinFiles
|
|||||||
return controller.fileTab;
|
return controller.fileTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class ContractFileTypeLocalStringConverter extends StringConverter<ContractFileTypeLocal> {
|
|
||||||
@Override
|
|
||||||
public String toString(ContractFileTypeLocal local) {
|
|
||||||
if (local == null) {
|
|
||||||
return "-";
|
|
||||||
}
|
|
||||||
return local.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ContractFileTypeLocal fromString(String string) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeTab() {
|
public void initializeTab() {
|
||||||
TableView<ContractFileViewModel> table = getTableView();
|
TableView<ContractFileViewModel> table = getTableView();
|
||||||
@@ -135,6 +118,7 @@ public class ContractTabSkinFiles
|
|||||||
.setCellFactory(ContractFileTypeTableCell.forTableColumn(getCachedBean(ContractFileTypeService.class)));
|
.setCellFactory(ContractFileTypeTableCell.forTableColumn(getCachedBean(ContractFileTypeService.class)));
|
||||||
fileTable_typeColumn.setEditable(false);
|
fileTable_typeColumn.setEditable(false);
|
||||||
|
|
||||||
|
|
||||||
/* 文件名编辑器 */
|
/* 文件名编辑器 */
|
||||||
fileTable_filePathColumn.setCellValueFactory(param -> param.getValue().getFileName());
|
fileTable_filePathColumn.setCellValueFactory(param -> param.getValue().getFileName());
|
||||||
fileTable_filePathColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
fileTable_filePathColumn.setCellFactory(TextFieldTableCell.forTableColumn());
|
||||||
@@ -194,6 +178,34 @@ public class ContractTabSkinFiles
|
|||||||
createVendorContractRequestByTemplateUpdateMenuItem(),
|
createVendorContractRequestByTemplateUpdateMenuItem(),
|
||||||
createVendorContractApplyByTemplateUpdateMenuItem());
|
createVendorContractApplyByTemplateUpdateMenuItem());
|
||||||
|
|
||||||
|
|
||||||
|
runAsync(() -> {
|
||||||
|
getCachedBean(ContractFileTypeService.class).findAll(getLocale()).forEach((k, v) -> {
|
||||||
|
if (isCustomer && !k.isSupportCustomer()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isVendor && !k.isSupportVendor()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
MenuItem item = new MenuItem();
|
||||||
|
item.setText(v.getValue());
|
||||||
|
item.getProperties().put("typeLocal", v);
|
||||||
|
item.setOnAction(this::onFileTableContextMenuChangeTypeAndNameAction);
|
||||||
|
fileTable_menu_change_type.getItems().add(item);
|
||||||
|
}
|
||||||
|
if (StringUtils.hasText(v.getSuggestFileName())) {
|
||||||
|
MenuItem item = new MenuItem();
|
||||||
|
item.setText(v.getValue());
|
||||||
|
item.getProperties().put("typeLocal", v);
|
||||||
|
item.getProperties().put("rename", true);
|
||||||
|
item.setOnAction(this::onFileTableContextMenuChangeTypeAndNameAction);
|
||||||
|
fileTable_menu_change_type_and_name.getItems().add(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
super.initializeTab();
|
super.initializeTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,13 +553,13 @@ public class ContractTabSkinFiles
|
|||||||
//
|
//
|
||||||
fileTable_menu_change_type.setVisible(true);
|
fileTable_menu_change_type.setVisible(true);
|
||||||
for (MenuItem item : fileTable_menu_change_type.getItems()) {
|
for (MenuItem item : fileTable_menu_change_type.getItems()) {
|
||||||
ContractFileTypeLocal typeLocal = (ContractFileTypeLocal) item.getProperties().get("typeLocal");
|
ContractFileTypeLocalVo typeLocal = (ContractFileTypeLocalVo) item.getProperties().get("typeLocal");
|
||||||
item.setVisible(typeLocal.getType() != selectedItem.getType().get());
|
item.setVisible(typeLocal.getType() != selectedItem.getType().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
fileTable_menu_change_type_and_name.setVisible(true);
|
fileTable_menu_change_type_and_name.setVisible(true);
|
||||||
for (MenuItem item : fileTable_menu_change_type.getItems()) {
|
for (MenuItem item : fileTable_menu_change_type.getItems()) {
|
||||||
ContractFileTypeLocal typeLocal = (ContractFileTypeLocal) item.getProperties().get("typeLocal");
|
ContractFileTypeLocalVo typeLocal = (ContractFileTypeLocalVo) item.getProperties().get("typeLocal");
|
||||||
item.setVisible(typeLocal.getType() != selectedItem.getType().get());
|
item.setVisible(typeLocal.getType() != selectedItem.getType().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +572,7 @@ public class ContractTabSkinFiles
|
|||||||
if (selectedItems == null || selectedItems.isEmpty()) {
|
if (selectedItems == null || selectedItems.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ContractFileTypeLocal typeLocal = (ContractFileTypeLocal) item.getProperties().get("typeLocal");
|
ContractFileTypeLocalVo typeLocal = (ContractFileTypeLocalVo) item.getProperties().get("typeLocal");
|
||||||
if (typeLocal == null) {
|
if (typeLocal == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import org.controlsfx.control.PopOver;
|
||||||
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;
|
||||||
@@ -50,13 +53,6 @@ import javafx.collections.ObservableList;
|
|||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
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.scene.layout.HBox;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
import javafx.stage.Modality;
|
import javafx.stage.Modality;
|
||||||
@@ -79,6 +75,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
return super.show(loader, owner, modality);
|
return super.show(loader, owner, modality);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
public static class MessageExt extends Message {
|
public static class MessageExt extends Message {
|
||||||
@@ -90,12 +87,16 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Model implements MessageHolder {
|
public static class Model {
|
||||||
private SimpleStringProperty code = new SimpleStringProperty();
|
private SimpleStringProperty code = new SimpleStringProperty();
|
||||||
private SimpleStringProperty name = new SimpleStringProperty();
|
private SimpleStringProperty name = new SimpleStringProperty();
|
||||||
private SimpleObjectProperty<Integer> employee = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<Integer> employee = new SimpleObjectProperty<>();
|
||||||
private SimpleObjectProperty<LocalDate> setupDate = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<LocalDate> setupDate = new SimpleObjectProperty<>();
|
||||||
private SimpleListProperty<MessageExt> messages = new SimpleListProperty<>(FXCollections.observableArrayList());
|
private SimpleListProperty<MessageExt> messages = new SimpleListProperty<>(FXCollections.observableArrayList());
|
||||||
|
}
|
||||||
|
|
||||||
|
static class MessageHolderImpl implements MessageHolder {
|
||||||
|
List<MessageExt> messages = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addMessage(Level level, String message) {
|
public void addMessage(Level level, String message) {
|
||||||
@@ -261,6 +262,8 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
long total = contractService.count(params);
|
long total = contractService.count(params);
|
||||||
setStatus("合同:" + total + " 条");
|
setStatus("合同:" + total + " 条");
|
||||||
|
|
||||||
|
MessageHolderImpl messageHolder = new MessageHolderImpl();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (isCloseRequested()) {
|
if (isCloseRequested()) {
|
||||||
break;
|
break;
|
||||||
@@ -268,6 +271,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
|
|
||||||
Page<ContractVo> page = contractService.findAll(params, pageRequest);
|
Page<ContractVo> page = contractService.findAll(params, pageRequest);
|
||||||
for (ContractVo contract : page) {
|
for (ContractVo contract : page) {
|
||||||
|
messageHolder.messages.clear();
|
||||||
if (isCloseRequested()) {
|
if (isCloseRequested()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -285,11 +289,11 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
model.getName().set(contract.getName());
|
model.getName().set(contract.getName());
|
||||||
model.getSetupDate().set(contract.getSetupDate());
|
model.getSetupDate().set(contract.getSetupDate());
|
||||||
|
|
||||||
comm.verify(contract, model);
|
comm.verify(contract, messageHolder);
|
||||||
setStatus("合同验证进度:" + counter.get() + " / " + total);
|
setStatus("合同验证进度:" + counter.get() + " / " + total);
|
||||||
// 移除中间消息
|
// 移除中间消息
|
||||||
if (!model.getMessages().isEmpty()) {
|
if (!messageHolder.messages.isEmpty()) {
|
||||||
model.getMessages().removeIf(msg -> msg.getLevel().intValue() <= Level.INFO.intValue());
|
model.getMessages().setAll(messageHolder.messages.stream().filter(msg -> msg.getLevel().intValue() > Level.INFO.intValue()).limit(50).toList());
|
||||||
}
|
}
|
||||||
if (model.getMessages().isEmpty()) {
|
if (model.getMessages().isEmpty()) {
|
||||||
if (onlyShowVerifiedChecker.isSelected()) {
|
if (onlyShowVerifiedChecker.isSelected()) {
|
||||||
@@ -325,6 +329,7 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
}
|
}
|
||||||
runAsync(() -> {
|
runAsync(() -> {
|
||||||
ContractVo contract = null;
|
ContractVo contract = null;
|
||||||
|
MessageHolderImpl messageHolder = new MessageHolderImpl();
|
||||||
try {
|
try {
|
||||||
contract = contractService.findByCode(contractCode);
|
contract = contractService.findByCode(contractCode);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -336,17 +341,18 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
}
|
}
|
||||||
model.getMessages().clear();
|
model.getMessages().clear();
|
||||||
try {
|
try {
|
||||||
comm.verify(contract, model);
|
comm.verify(contract, messageHolder);
|
||||||
// 移除中间消息
|
|
||||||
if (!model.getMessages().isEmpty()) {
|
|
||||||
model.getMessages().removeIf(msg -> msg.getLevel().intValue() <= Level.INFO.intValue());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(model.getCode().get(), e);
|
logger.error(model.getCode().get(), e);
|
||||||
model.error(e.getMessage());
|
messageHolder.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.getMessages().isEmpty()) {
|
// 移除中间消息
|
||||||
|
if (!messageHolder.messages.isEmpty()) {
|
||||||
|
model.getMessages().setAll(messageHolder.messages.stream().filter(msg -> msg.getLevel().intValue() > Level.INFO.intValue()).limit(50).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (messageHolder.messages.isEmpty()) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
viewTableDataSet.remove(model);
|
viewTableDataSet.remove(model);
|
||||||
});
|
});
|
||||||
@@ -380,6 +386,38 @@ public class ContractVerifyWindowController extends BaseController {
|
|||||||
ContractWindowController.show(contract, viewTable.getScene().getWindow());
|
ContractWindowController.show(contract, viewTable.getScene().getWindow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onShowVerifyStatusAction(ActionEvent event) {
|
||||||
|
|
||||||
|
// 在新新窗口中显示 状态消息 Model# messages
|
||||||
|
|
||||||
|
Model selectedItem = viewTable.getSelectionModel().getSelectedItem();
|
||||||
|
if (selectedItem == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView<MessageExt> listView = new ListView<>();
|
||||||
|
listView.setItems(selectedItem.messages);
|
||||||
|
listView.setCellFactory(v -> new ListCell<>() {
|
||||||
|
@Override
|
||||||
|
protected void updateItem(MessageExt item, boolean empty) {
|
||||||
|
super.updateItem(item, empty);
|
||||||
|
if (item == null || empty) {
|
||||||
|
setText(null);
|
||||||
|
setGraphic(null);
|
||||||
|
} else {
|
||||||
|
setText(item.getMessage());
|
||||||
|
setGraphic(new Label(item.getPrefix()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PopOver popOver = new PopOver(listView);
|
||||||
|
popOver.setArrowLocation(PopOver.ArrowLocation.TOP_LEFT);
|
||||||
|
MenuItem menuItem = (MenuItem) event.getSource();
|
||||||
|
Node node = viewTable.lookup(".table-row-cell:selected");
|
||||||
|
popOver.show(node);
|
||||||
|
}
|
||||||
|
|
||||||
public void onExportVerifyResultAsFileAction(ActionEvent e) {
|
public void onExportVerifyResultAsFileAction(ActionEvent e) {
|
||||||
FileChooser chooser = new FileChooser();
|
FileChooser chooser = new FileChooser();
|
||||||
chooser.setTitle("导出核验结果");
|
chooser.setTitle("导出核验结果");
|
||||||
|
|||||||
@@ -1,14 +1,26 @@
|
|||||||
package com.ecep.contract.controller.customer;
|
package com.ecep.contract.controller.customer;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import com.ecep.contract.controller.AbstEntityController;
|
import com.ecep.contract.controller.AbstEntityController;
|
||||||
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
|
import com.ecep.contract.service.CompanyCustomerFileTypeService;
|
||||||
import com.ecep.contract.service.ViewModelService;
|
import com.ecep.contract.service.ViewModelService;
|
||||||
import com.ecep.contract.util.FxmlPath;
|
import com.ecep.contract.util.FxmlPath;
|
||||||
|
import com.ecep.contract.vo.CustomerFileTypeLocalVo;
|
||||||
|
import javafx.beans.binding.BooleanBinding;
|
||||||
|
import javafx.beans.property.*;
|
||||||
|
import javafx.scene.input.MouseButton;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
import javafx.scene.text.FontWeight;
|
||||||
|
import javafx.util.converter.LocalDateStringConverter;
|
||||||
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;
|
||||||
@@ -18,6 +30,7 @@ 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.FileSystemUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.controller.BaseController;
|
import com.ecep.contract.controller.BaseController;
|
||||||
@@ -32,11 +45,9 @@ import com.ecep.contract.vm.CustomerFileViewModel;
|
|||||||
|
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.beans.binding.Bindings;
|
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.event.ActionEvent;
|
||||||
import javafx.geometry.Bounds;
|
import javafx.geometry.Bounds;
|
||||||
|
import javafx.scene.canvas.GraphicsContext;
|
||||||
import javafx.scene.control.CheckBox;
|
import javafx.scene.control.CheckBox;
|
||||||
import javafx.scene.control.DatePicker;
|
import javafx.scene.control.DatePicker;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
@@ -58,8 +69,16 @@ import javafx.stage.WindowEvent;
|
|||||||
@Scope("prototype")
|
@Scope("prototype")
|
||||||
@Component
|
@Component
|
||||||
@FxmlPath("/ui/company/customer/customer_evaluation_form.fxml")
|
@FxmlPath("/ui/company/customer/customer_evaluation_form.fxml")
|
||||||
public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntityController<CompanyCustomerEvaluationFormFileVo, CompanyCustomerEvaluationFormFileViewModel> {
|
public class CompanyCustomerEvaluationFormFileWindowController
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyCustomerEvaluationFormFileWindowController.class);
|
extends AbstEntityController<CompanyCustomerEvaluationFormFileVo, CompanyCustomerEvaluationFormFileViewModel> {
|
||||||
|
private static final Logger logger = LoggerFactory
|
||||||
|
.getLogger(CompanyCustomerEvaluationFormFileWindowController.class);
|
||||||
|
|
||||||
|
public static void show(CustomerFileViewModel item, Window window) {
|
||||||
|
show(CompanyCustomerEvaluationFormFileWindowController.class, window, controller -> {
|
||||||
|
controller.fileViewModel = item;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public static void show(CompanyCustomerEvaluationFormFileVo saved, Window window) {
|
public static void show(CompanyCustomerEvaluationFormFileVo saved, Window window) {
|
||||||
show(CompanyCustomerEvaluationFormFileViewModel.from(saved), window);
|
show(CompanyCustomerEvaluationFormFileViewModel.from(saved), window);
|
||||||
@@ -69,7 +88,6 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
show(CompanyCustomerEvaluationFormFileWindowController.class, viewModel, window);
|
show(CompanyCustomerEvaluationFormFileWindowController.class, viewModel, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Label idField;
|
public Label idField;
|
||||||
public TextField filePathField;
|
public TextField filePathField;
|
||||||
public CheckBox validField;
|
public CheckBox validField;
|
||||||
@@ -88,67 +106,66 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
public ScrollPane leftPane;
|
public ScrollPane leftPane;
|
||||||
public Label totalCreditScoreLabel;
|
public Label totalCreditScoreLabel;
|
||||||
|
|
||||||
private final SimpleStringProperty catalogProperty = new SimpleStringProperty("");
|
|
||||||
private final SimpleStringProperty levelProperty = new SimpleStringProperty("");
|
|
||||||
private final SimpleIntegerProperty score1Property = new SimpleIntegerProperty(-1);
|
|
||||||
private final SimpleIntegerProperty score2Property = new SimpleIntegerProperty(-1);
|
|
||||||
private final SimpleIntegerProperty score3Property = new SimpleIntegerProperty(-1);
|
|
||||||
private final SimpleIntegerProperty score4Property = new SimpleIntegerProperty(-1);
|
|
||||||
private final SimpleIntegerProperty score5Property = new SimpleIntegerProperty(-1);
|
|
||||||
private final SimpleIntegerProperty creditLevelProperty = new SimpleIntegerProperty(-1);
|
|
||||||
private final SimpleIntegerProperty totalCreditScoreProperty = new SimpleIntegerProperty(-1);
|
private final SimpleIntegerProperty totalCreditScoreProperty = new SimpleIntegerProperty(-1);
|
||||||
|
|
||||||
private SimpleObjectProperty<Image> imageProperty = new SimpleObjectProperty<>();
|
private CustomerFileViewModel fileViewModel;
|
||||||
|
|
||||||
private SimpleStringProperty filePathProperty = new SimpleStringProperty();
|
private SimpleBooleanProperty changed = new SimpleBooleanProperty(false);
|
||||||
private SimpleStringProperty editFilePathProperty = new SimpleStringProperty();
|
|
||||||
|
|
||||||
@Lazy
|
|
||||||
@Autowired
|
|
||||||
private CompanyCustomerFileService companyCustomerFileService;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private CompanyCustomerEvaluationFormFileService evaluationFormFileService;
|
private CompanyCustomerEvaluationFormFileService evaluationFormFileService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show(Stage stage) {
|
public void show(Stage stage) {
|
||||||
super.show(stage);
|
super.show(stage);
|
||||||
stage.setFullScreen(false);
|
stage.setFullScreen(false);
|
||||||
// Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds();
|
|
||||||
//
|
|
||||||
// stage.setX(screenBounds.getMinX());
|
|
||||||
// stage.setY(screenBounds.getMinY());
|
|
||||||
// stage.setWidth(screenBounds.getWidth());
|
|
||||||
// stage.setHeight(screenBounds.getHeight());
|
|
||||||
//
|
|
||||||
// stage.isMaximized();
|
|
||||||
stage.setMaximized(true);
|
stage.setMaximized(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShown(WindowEvent windowEvent) {
|
||||||
|
super.onShown(windowEvent);
|
||||||
getTitle().set("客户评估表单");
|
getTitle().set("客户评估表单");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void registerTabSkins() {
|
|
||||||
initializePane();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void updateViewModel(CompanyCustomerEvaluationFormFileVo entity) {
|
|
||||||
super.updateViewModel(entity);
|
|
||||||
CustomerFileVo file = companyCustomerFileService.findById(entity.getCustomerFile());
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
filePathProperty.set(file.getFilePath());
|
|
||||||
editFilePathProperty.set(file.getEditFilePath());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ViewModelService<CompanyCustomerEvaluationFormFileVo, CompanyCustomerEvaluationFormFileViewModel> getViewModelService() {
|
public ViewModelService<CompanyCustomerEvaluationFormFileVo, CompanyCustomerEvaluationFormFileViewModel> getViewModelService() {
|
||||||
return evaluationFormFileService;
|
return evaluationFormFileService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initializeData() {
|
||||||
|
CompanyCustomerEvaluationFormFileViewModel viewModel = new CompanyCustomerEvaluationFormFileViewModel();
|
||||||
|
setViewModel(viewModel);
|
||||||
|
runAsync(() -> {
|
||||||
|
CompanyCustomerEvaluationFormFileVo item = getCachedBean(CompanyCustomerEvaluationFormFileService.class)
|
||||||
|
.findByCustomerFile(fileViewModel.getId().get());
|
||||||
|
viewModel.getId().set(item.getId());
|
||||||
|
updateViewModel(item);
|
||||||
|
super.initializeData();
|
||||||
|
Platform.runLater(this::initializePane);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateViewModel(CompanyCustomerEvaluationFormFileVo entity) {
|
||||||
|
super.updateViewModel(entity);
|
||||||
|
changed.set(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BooleanBinding createTabSkinChangedBindings() {
|
||||||
|
return viewModel.getChanged().or(fileViewModel.getChanged()).or(changed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveTabSkins() {
|
||||||
|
save();
|
||||||
|
changed.setValue(false);
|
||||||
|
}
|
||||||
|
|
||||||
BiConsumer<ToggleGroup, String> stringRadioGroupUpdater = (group, newValue) -> {
|
BiConsumer<ToggleGroup, String> stringRadioGroupUpdater = (group, newValue) -> {
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
for (Toggle toggle : group.getToggles()) {
|
for (Toggle toggle : group.getToggles()) {
|
||||||
@@ -164,14 +181,15 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
changed.set(true);
|
||||||
}
|
}
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
group.selectToggle(null);
|
group.selectToggle(null);
|
||||||
// Toggle first = group.getToggles().getFirst();
|
// Toggle first = group.getToggles().getFirst();
|
||||||
// first.setSelected(true);
|
// first.setSelected(true);
|
||||||
// first.setSelected(false);
|
// first.setSelected(false);
|
||||||
// RadioButton btn = (RadioButton) first;
|
// RadioButton btn = (RadioButton) first;
|
||||||
// btn.setText(newValue);
|
// btn.setText(newValue);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -182,9 +200,11 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
}
|
}
|
||||||
String data = (String) toggle.getUserData();
|
String data = (String) toggle.getUserData();
|
||||||
property.set(data);
|
property.set(data);
|
||||||
|
changed.set(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
BiConsumer<ToggleGroup, Number> numberRadioGroupUpdater = (group, newValue) -> {
|
BiConsumer<ToggleGroup, Number> numberRadioGroupUpdater = (group, newValue) -> {
|
||||||
|
System.out.println("group = " + group + ", newValue = " + newValue);
|
||||||
String value = String.valueOf(newValue);
|
String value = String.valueOf(newValue);
|
||||||
for (Toggle toggle : group.getToggles()) {
|
for (Toggle toggle : group.getToggles()) {
|
||||||
String data = (String) toggle.getUserData();
|
String data = (String) toggle.getUserData();
|
||||||
@@ -195,12 +215,13 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
}
|
}
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
group.selectToggle(null);
|
group.selectToggle(null);
|
||||||
// Toggle first = group.getToggles().getFirst();
|
// Toggle first = group.getToggles().getFirst();
|
||||||
// first.setSelected(true);
|
// first.setSelected(true);
|
||||||
// first.setSelected(false);
|
// first.setSelected(false);
|
||||||
// RadioButton btn = (RadioButton) first;
|
// RadioButton btn = (RadioButton) first;
|
||||||
// btn.setText(String.valueOf(newValue));
|
// btn.setText(String.valueOf(newValue));
|
||||||
});
|
});
|
||||||
|
changed.set(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
BiConsumer<SimpleIntegerProperty, Toggle> numberPropertyUpdater = (property, toggle) -> {
|
BiConsumer<SimpleIntegerProperty, Toggle> numberPropertyUpdater = (property, toggle) -> {
|
||||||
@@ -210,9 +231,9 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
}
|
}
|
||||||
String data = (String) toggle.getUserData();
|
String data = (String) toggle.getUserData();
|
||||||
property.set(Integer.parseInt(data));
|
property.set(Integer.parseInt(data));
|
||||||
|
changed.set(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int totalScoreToLevel(int score) {
|
int totalScoreToLevel(int score) {
|
||||||
if (score >= 200) {
|
if (score >= 200) {
|
||||||
return 4;
|
return 4;
|
||||||
@@ -227,63 +248,73 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean calcValid() {
|
boolean calcValid() {
|
||||||
if (creditLevelProperty.get() <= 0) {
|
if (viewModel.getCreditLevel().get() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!StringUtils.hasText(catalogProperty.get())) {
|
if (!StringUtils.hasText(viewModel.getCatalog().get())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!StringUtils.hasText(levelProperty.get())) {
|
if (!StringUtils.hasText(viewModel.getLevel().get())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (score1Property.get() <= 0) {
|
|
||||||
|
if (viewModel.getScore1().get() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (score2Property.get() <= 0) {
|
if (viewModel.getScore2().get() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (score3Property.get() <= 0) {
|
if (viewModel.getScore3().get() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (score4Property.get() <= 0) {
|
if (viewModel.getScore4().get() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (score5Property.get() <= 0) {
|
if (viewModel.getScore5().get() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (creditLevelProperty.get() <= 0) {
|
if (viewModel.getCreditLevel().get() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializePane() {
|
private void initializePane() {
|
||||||
|
setStatus("");
|
||||||
idField.textProperty().bind(viewModel.getId().asString());
|
idField.textProperty().bind(viewModel.getId().asString());
|
||||||
filePathField.textProperty().bind(filePathProperty);
|
filePathField.textProperty().bind(fileViewModel.getFilePath());
|
||||||
editFilePathField.textProperty().bind(editFilePathProperty);
|
editFilePathField.textProperty().bind(fileViewModel.getEditFilePath());
|
||||||
// signDateField.valueProperty().bindBidirectional(viewModel.getSignDate());
|
String pattern = "yyyy-MM-dd";
|
||||||
// validField.selectedProperty().bindBidirectional(viewModel.getValid());
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||||
|
signDateField.setConverter(new LocalDateStringConverter(formatter, null));
|
||||||
initializeRadioGroup(catalog, catalogProperty);
|
signDateField.valueProperty().bindBidirectional(fileViewModel.getSignDate());
|
||||||
initializeRadioGroup(level, levelProperty);
|
signDateField.valueProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
|
changed.set(true);
|
||||||
initializeRadioGroup(score1, score1Property);
|
|
||||||
initializeRadioGroup(score2, score2Property);
|
|
||||||
initializeRadioGroup(score3, score3Property);
|
|
||||||
initializeRadioGroup(score4, score4Property);
|
|
||||||
initializeRadioGroup(score5, score5Property);
|
|
||||||
|
|
||||||
creditLevelProperty.addListener((observable, oldValue, newValue) -> {
|
|
||||||
numberRadioGroupUpdater.accept(creditLevel, newValue);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
SimpleIntegerProperty[] scores = new SimpleIntegerProperty[]{score1Property, score2Property, score3Property, score4Property, score5Property};
|
initializeRadioGroup(catalog, viewModel.getCatalog());
|
||||||
|
initializeRadioGroup(level, viewModel.getLevel());
|
||||||
|
|
||||||
|
initializeRadioGroup(score1, viewModel.getScore1());
|
||||||
|
initializeRadioGroup(score2, viewModel.getScore2());
|
||||||
|
initializeRadioGroup(score3, viewModel.getScore3());
|
||||||
|
initializeRadioGroup(score4, viewModel.getScore4());
|
||||||
|
initializeRadioGroup(score5, viewModel.getScore5());
|
||||||
|
|
||||||
|
// 信用等级
|
||||||
|
viewModel.getCreditLevel().addListener((observable, oldValue, newValue) -> {
|
||||||
|
numberRadioGroupUpdater.accept(creditLevel, newValue);
|
||||||
|
});
|
||||||
|
numberRadioGroupUpdater.accept(creditLevel, viewModel.getCreditLevel().get());
|
||||||
|
|
||||||
|
SimpleIntegerProperty[] scores = new SimpleIntegerProperty[]{viewModel.getScore1(), viewModel.getScore2(),
|
||||||
|
viewModel.getScore3(), viewModel.getScore4(), viewModel.getScore5()};
|
||||||
totalCreditScoreProperty.bind(Bindings.createIntegerBinding(() -> {
|
totalCreditScoreProperty.bind(Bindings.createIntegerBinding(() -> {
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (SimpleIntegerProperty score : scores) {
|
for (SimpleIntegerProperty score : scores) {
|
||||||
total += score.get();
|
total += score.get();
|
||||||
}
|
}
|
||||||
creditLevelProperty.set(totalScoreToLevel(total));
|
viewModel.getCreditLevel().set(totalScoreToLevel(total));
|
||||||
return total;
|
return total;
|
||||||
}, scores));
|
}, scores));
|
||||||
|
|
||||||
@@ -291,27 +322,191 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
return "合计总分:" + score;
|
return "合计总分:" + score;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Bindings.createBooleanBinding(() -> {
|
Bindings.createBooleanBinding(this::calcValid, viewModel.getCatalog(), viewModel.getLevel(),
|
||||||
boolean valid = calcValid();
|
viewModel.getScore1(), viewModel.getScore2(), viewModel.getScore3(), viewModel.getScore4(),
|
||||||
// viewModel.getValid().set(valid);
|
viewModel.getScore5(), viewModel.getCreditLevel())
|
||||||
return valid;
|
.addListener((observable, oldValue, newValue) -> {
|
||||||
}, catalogProperty, levelProperty, score1Property, score2Property, score3Property, score4Property, score5Property, creditLevelProperty).addListener(((observable, oldValue, newValue) -> {
|
fileViewModel.getValid().set(newValue);
|
||||||
logger.info("valid:{}", newValue);
|
changed.set(true);
|
||||||
}));
|
});
|
||||||
|
validField.selectedProperty().bindBidirectional(fileViewModel.getValid());
|
||||||
|
validField.setSelected(fileViewModel.getValid().getValue());
|
||||||
|
|
||||||
|
fileViewModel.getFilePath().addListener((observable, oldValue, newValue) -> {
|
||||||
|
File file = new File(newValue);
|
||||||
|
loadFile(file);
|
||||||
|
});
|
||||||
|
if (StringUtils.hasText(fileViewModel.getFilePath().get())) {
|
||||||
|
loadFile(new File(fileViewModel.getFilePath().get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
imageView.imageProperty().bind(filePathProperty.map(path -> {
|
leftPane.widthProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
if (FileUtils.withExtensions(path, FileUtils.PDF)) {
|
Platform.runLater(() -> {
|
||||||
File pdfFile = new File(path);
|
imageView.setFitWidth(leftPane.getWidth());
|
||||||
try (PDDocument pdDocument = Loader.loadPDF(pdfFile)) {
|
imageView.setFitHeight(-1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
imageView.setFitWidth(leftPane.getWidth());
|
||||||
|
imageView.setFitHeight(-1);
|
||||||
|
|
||||||
|
imageView.setOnScroll(event -> {
|
||||||
|
Bounds bounds = imageView.getBoundsInLocal();
|
||||||
|
imageView.setFitWidth(bounds.getWidth() + event.getDeltaY());
|
||||||
|
imageView.setFitHeight(-1);
|
||||||
|
event.consume();
|
||||||
|
});
|
||||||
|
|
||||||
|
imageView.setOnMouseClicked(event -> {
|
||||||
|
System.out.println("imageView.getFitWidth() = " + imageView.getFitWidth());
|
||||||
|
System.out.println("imageView.getFitHeight() = " + imageView.getFitHeight());
|
||||||
|
|
||||||
|
System.out.println("leftPane.getWidth() = " + leftPane.getWidth());
|
||||||
|
System.out.println("leftPane.getViewportBounds().getWidth() = " + leftPane.getViewportBounds().getWidth());
|
||||||
|
|
||||||
|
if (event.getClickCount() == 2 && event.getButton() == MouseButton.PRIMARY) {
|
||||||
|
Image image = imageView.getImage();
|
||||||
|
if (image != null) {
|
||||||
|
System.out.println("image.getWidth() = " + image.getWidth());
|
||||||
|
if (image.getWidth() > imageView.getFitWidth()) {
|
||||||
|
imageView.setFitWidth(image.getWidth());
|
||||||
|
} else {
|
||||||
|
imageView.setFitWidth(leftPane.getWidth());
|
||||||
|
}
|
||||||
|
imageView.setFitHeight(-1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadFile(File file) {
|
||||||
|
setStatus("文件" + file.getAbsolutePath() + " 加载中...");
|
||||||
|
if (FileUtils.withExtensions(file.getName(), FileUtils.PDF)) {
|
||||||
|
loadPdf(file);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Image image = new Image(file.toURI().toString(), true);
|
||||||
|
imageView.setImage(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadPdf(File pdfFile) {
|
||||||
|
// 绘制文字, 等待加载
|
||||||
|
// 创建画布并绘制备用占位文字
|
||||||
|
javafx.scene.canvas.Canvas canvas = new javafx.scene.canvas.Canvas(leftPane.getWidth(), leftPane.getHeight());
|
||||||
|
GraphicsContext gc = canvas.getGraphicsContext2D();
|
||||||
|
gc.setFill(javafx.scene.paint.Color.RED);
|
||||||
|
var h1 = javafx.scene.text.Font.font("Microsoft YaHei", FontWeight.BOLD, 24);
|
||||||
|
var h2 = javafx.scene.text.Font.font("Microsoft YaHei", FontWeight.NORMAL, 18);
|
||||||
|
gc.setFont(h1);
|
||||||
|
gc.fillText(fileViewModel.getType().get().name(), 50, 100);
|
||||||
|
|
||||||
|
Runnable updateImage = () -> {
|
||||||
|
WritableImage writableImage = new WritableImage((int) canvas.getWidth(), (int) canvas.getHeight());
|
||||||
|
// 将画布内容转为图像
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
canvas.snapshot(null, writableImage);
|
||||||
|
imageView.setImage(writableImage);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
runAsync(() -> {
|
||||||
|
CustomerFileTypeLocalVo localVo = getCachedBean(CompanyCustomerFileTypeService.class).findByLocaleAndType(getLocale(), fileViewModel.getType().get());
|
||||||
|
gc.setFill(Color.WHITE);
|
||||||
|
// 覆盖 fileViewModel.getType() 文字
|
||||||
|
gc.fillRect(0, 55, canvas.getWidth(), 55);
|
||||||
|
|
||||||
|
// 绘制 文件类型
|
||||||
|
gc.setFill(javafx.scene.paint.Color.RED);
|
||||||
|
gc.setFont(h1);
|
||||||
|
gc.fillText(localVo.getValue(), 50, 100);
|
||||||
|
|
||||||
|
updateImage.run();
|
||||||
|
});
|
||||||
|
|
||||||
|
gc.setStroke(javafx.scene.paint.Color.BLACK);
|
||||||
|
gc.setFont(h2);
|
||||||
|
gc.strokeText("正在加载文件..." + pdfFile.getName(), 50, 150);
|
||||||
|
updateImage.run();
|
||||||
|
|
||||||
|
runAsync(() -> {
|
||||||
|
|
||||||
|
//FileSystemUtils.
|
||||||
|
long fileSize = pdfFile.length();
|
||||||
|
byte[] bytes = new byte[0];
|
||||||
|
try (java.io.FileInputStream fis = new java.io.FileInputStream(pdfFile);
|
||||||
|
java.io.BufferedInputStream bis = new java.io.BufferedInputStream(fis)) {
|
||||||
|
|
||||||
|
bytes = new byte[(int) fileSize];
|
||||||
|
int totalBytesRead = 0;
|
||||||
|
int bytesRead;
|
||||||
|
byte[] buffer = new byte[8192]; // 8KB buffer
|
||||||
|
|
||||||
|
while ((bytesRead = bis.read(buffer)) != -1) {
|
||||||
|
System.arraycopy(buffer, 0, bytes, totalBytesRead, bytesRead);
|
||||||
|
totalBytesRead += bytesRead;
|
||||||
|
|
||||||
|
// 更新进度
|
||||||
|
double progress = (double) totalBytesRead / fileSize * 100;
|
||||||
|
final String status = String.format("正在加载文件... %s (%.1f%%)",
|
||||||
|
pdfFile.getName(), progress);
|
||||||
|
|
||||||
|
gc.setFill(Color.WHITE);
|
||||||
|
gc.fillRect(0, 200, canvas.getWidth(), 80);
|
||||||
|
|
||||||
|
|
||||||
|
gc.setFill(Color.BLACK);
|
||||||
|
gc.setFont(h2);
|
||||||
|
gc.fillText(status, 50, 250);
|
||||||
|
|
||||||
|
|
||||||
|
// 绘制进度条背景
|
||||||
|
gc.setFill(Color.LIGHTGRAY);
|
||||||
|
gc.fillRect(50, 270, 400, 20);
|
||||||
|
|
||||||
|
// 绘制进度条
|
||||||
|
gc.setFill(Color.GREEN);
|
||||||
|
gc.fillRect(50, 270, 400 * (totalBytesRead / (double) fileSize), 20);
|
||||||
|
|
||||||
|
// 绘制进度条边框
|
||||||
|
gc.setStroke(Color.BLACK);
|
||||||
|
gc.setLineWidth(1);
|
||||||
|
gc.strokeRect(50, 270, 400, 20);
|
||||||
|
|
||||||
|
|
||||||
|
updateImage.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
gc.setFill(Color.BLACK);
|
||||||
|
gc.setFont(h2);
|
||||||
|
gc.fillText("Loading file: " + pdfFile.getName() + ", size: " + bytes.length + " bytes", 50, 320);
|
||||||
|
updateImage.run();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try (PDDocument pdDocument = Loader.loadPDF(bytes)) {
|
||||||
|
gc.setFill(Color.BLACK);
|
||||||
|
gc.setFont(h2);
|
||||||
|
gc.fillText("PDF has " + pdDocument.getNumberOfPages() + " pages", 50, 380);
|
||||||
|
updateImage.run();
|
||||||
|
|
||||||
PDFRenderer pdfRenderer = new PDFRenderer(pdDocument);
|
PDFRenderer pdfRenderer = new PDFRenderer(pdDocument);
|
||||||
|
|
||||||
BufferedImage bufferedImage = pdfRenderer.renderImageWithDPI(0, 300);
|
BufferedImage bufferedImage = pdfRenderer.renderImageWithDPI(0, 300);
|
||||||
|
|
||||||
// 获取 BufferedImage 的宽度和高度
|
// 获取 BufferedImage 的宽度和高度
|
||||||
int width = bufferedImage.getWidth();
|
int width = bufferedImage.getWidth();
|
||||||
int height = bufferedImage.getHeight();
|
int height = bufferedImage.getHeight();
|
||||||
WritableImage writableImage = new WritableImage(width, height);
|
canvas.resize(width, height);
|
||||||
PixelWriter pixelWriter = writableImage.getPixelWriter();
|
GraphicsContext graphic = canvas.getGraphicsContext2D();
|
||||||
|
|
||||||
|
WritableImage writableImage1 = new WritableImage(width, height);
|
||||||
|
|
||||||
|
PixelWriter pixelWriter = writableImage1.getPixelWriter();
|
||||||
// 将 BufferedImage 的像素数据复制到 WritableImage
|
// 将 BufferedImage 的像素数据复制到 WritableImage
|
||||||
for (int y = 0; y < height; y++) {
|
for (int y = 0; y < height; y++) {
|
||||||
for (int x = 0; x < width; x++) {
|
for (int x = 0; x < width; x++) {
|
||||||
@@ -319,42 +514,13 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
pixelWriter.setArgb(x, y, argb);
|
pixelWriter.setArgb(x, y, argb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return writableImage;
|
setStatus();
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
imageView.setImage(writableImage1);
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
setStatus(e.getMessage());
|
setStatus(e.getMessage());
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
File file = new File(path);
|
|
||||||
Image image = new Image(file.toURI().toString());
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
|
||||||
leftPane.widthProperty().addListener((observable, oldValue, newValue) -> {
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
imageView.setFitWidth(leftPane.getWidth());
|
|
||||||
imageView.setFitHeight(leftPane.getHeight());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
imageView.setFitWidth(leftPane.getWidth());
|
|
||||||
imageView.setFitHeight(leftPane.getHeight());
|
|
||||||
|
|
||||||
imageView.setOnScroll(event -> {
|
|
||||||
System.out.println("event = " + event);
|
|
||||||
System.out.println("event.getDeltaY() = " + event.getDeltaY());
|
|
||||||
Bounds bounds = imageView.getBoundsInLocal();
|
|
||||||
// Bounds latestBounds = (Bounds) imageView.getProperties().get("latestBounds");
|
|
||||||
// if (latestBounds != null) {
|
|
||||||
// double latestBoundsWidth = latestBounds.getWidth();
|
|
||||||
// }
|
|
||||||
// if (bounds.getWidth() < leftPane.getWidth()) {
|
|
||||||
imageView.setFitWidth(bounds.getWidth() + event.getDeltaY());
|
|
||||||
// } else {
|
|
||||||
imageView.setFitHeight(bounds.getHeight() + event.getDeltaY());
|
|
||||||
// }
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,6 +531,7 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
|
toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
stringPropertyUpdater.accept(property, newValue);
|
stringPropertyUpdater.accept(property, newValue);
|
||||||
});
|
});
|
||||||
|
stringRadioGroupUpdater.accept(toggleGroup, property.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeRadioGroup(ToggleGroup toggleGroup, SimpleIntegerProperty property) {
|
private void initializeRadioGroup(ToggleGroup toggleGroup, SimpleIntegerProperty property) {
|
||||||
@@ -375,21 +542,8 @@ public class CompanyCustomerEvaluationFormFileWindowController extends AbstEntit
|
|||||||
toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
|
toggleGroup.selectedToggleProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
numberPropertyUpdater.accept(property, newValue);
|
numberPropertyUpdater.accept(property, newValue);
|
||||||
});
|
});
|
||||||
|
numberRadioGroupUpdater.accept(toggleGroup, property.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void update(CompanyCustomerEvaluationFormFileVo formFile) {
|
|
||||||
|
|
||||||
viewModel.update(formFile);
|
|
||||||
|
|
||||||
// formFile.getScoreTemplateVersion();
|
|
||||||
|
|
||||||
catalogProperty.set(formFile.getCatalog());
|
|
||||||
levelProperty.set(formFile.getLevel());
|
|
||||||
score1Property.set(formFile.getScore1());
|
|
||||||
score2Property.set(formFile.getScore2());
|
|
||||||
score3Property.set(formFile.getScore3());
|
|
||||||
score4Property.set(formFile.getScore4());
|
|
||||||
score5Property.set(formFile.getScore5());
|
|
||||||
creditLevelProperty.set(formFile.getCreditLevel());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,9 +161,7 @@ public class CustomerTabSkinFile
|
|||||||
// 文件不是 Excel 文件时,打开编辑UI
|
// 文件不是 Excel 文件时,打开编辑UI
|
||||||
if (!FileUtils.withExtensions(item.getFilePath().get(), FileUtils.XLS,
|
if (!FileUtils.withExtensions(item.getFilePath().get(), FileUtils.XLS,
|
||||||
FileUtils.XLSX)) {
|
FileUtils.XLSX)) {
|
||||||
CompanyCustomerEvaluationFormFileVo evaluationFormFile = getEvaluationFormFileService()
|
CompanyCustomerEvaluationFormFileWindowController.show(item,
|
||||||
.findByCustomerFile(item.getId().get());
|
|
||||||
CompanyCustomerEvaluationFormFileWindowController.show(evaluationFormFile,
|
|
||||||
controller.root.getScene().getWindow());
|
controller.root.getScene().getWindow());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -211,10 +209,7 @@ public class CustomerTabSkinFile
|
|||||||
model.update(saved);
|
model.update(saved);
|
||||||
dataSet.add(model);
|
dataSet.add(model);
|
||||||
|
|
||||||
CompanyCustomerEvaluationFormFileVo evaluationFormFile = getCachedBean(
|
CompanyCustomerEvaluationFormFileWindowController.show(model,
|
||||||
CompanyCustomerEvaluationFormFileService.class).findByCustomerFile(saved);
|
|
||||||
|
|
||||||
CompanyCustomerEvaluationFormFileWindowController.show(evaluationFormFile,
|
|
||||||
getTableView().getScene().getWindow());
|
getTableView().getScene().getWindow());
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package com.ecep.contract.controller.employee;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import com.ecep.contract.controller.tab.TabSkin;
|
import com.ecep.contract.controller.tab.TabSkin;
|
||||||
@@ -48,7 +50,7 @@ public class EmployeeTabSkinRole
|
|||||||
|
|
||||||
private void initializeListView() {
|
private void initializeListView() {
|
||||||
// 非系统内置账户
|
// 非系统内置账户
|
||||||
HashMap<String, Object> params = new HashMap<>();
|
Map<String, Object> params = ParamUtils.builder().build();
|
||||||
List<EmployeeRoleVo> roles = getEmployeeRoleService().findAll(params, Pageable.ofSize(500)).getContent();
|
List<EmployeeRoleVo> roles = getEmployeeRoleService().findAll(params, Pageable.ofSize(500)).getContent();
|
||||||
|
|
||||||
controller.rolesField.getSourceItems().setAll(roles);
|
controller.rolesField.getSourceItems().setAll(roles);
|
||||||
|
|||||||
@@ -69,11 +69,6 @@ public class CompanyTabSkinBankAccount
|
|||||||
bankAccountTable_openingBankColumn.setCellValueFactory(param -> param.getValue().getOpeningBank());
|
bankAccountTable_openingBankColumn.setCellValueFactory(param -> param.getValue().getOpeningBank());
|
||||||
bankAccountTable_accountColumn.setCellValueFactory(param -> param.getValue().getAccount());
|
bankAccountTable_accountColumn.setCellValueFactory(param -> param.getValue().getAccount());
|
||||||
|
|
||||||
|
|
||||||
bankAccountTable_menu_refresh.setOnAction(this::onTableRefreshAction);
|
|
||||||
bankAccountTable_menu_add.setOnAction(this::onTableAddAction);
|
|
||||||
bankAccountTable_menu_del.setOnAction(this::onTableDeleteAction);
|
|
||||||
|
|
||||||
super.initializeTab();
|
super.initializeTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,8 +97,10 @@ public class CompanyTabSkinOther
|
|||||||
// Yu //
|
// Yu //
|
||||||
public TitledPane yuCloudPane;
|
public TitledPane yuCloudPane;
|
||||||
public TextField cloudYuIdField;
|
public TextField cloudYuIdField;
|
||||||
public TextField cloudYuCloudIdField;
|
|
||||||
public TextField cloudYuLatestField;
|
public TextField cloudYuLatestField;
|
||||||
|
public TextField cloudYuVendorUpdateDateField;
|
||||||
|
public TextField cloudYuCustomerUpdateDateField;
|
||||||
|
public CheckBox cloudYuActiveField;
|
||||||
public Label cloudYuVersionLabel;
|
public Label cloudYuVersionLabel;
|
||||||
public Button yuCloudPaneSaveButton;
|
public Button yuCloudPaneSaveButton;
|
||||||
|
|
||||||
@@ -417,8 +419,10 @@ public class CompanyTabSkinOther
|
|||||||
}
|
}
|
||||||
|
|
||||||
cloudYuIdField.textProperty().bind(yuCloudInfoViewModel.getId().asString());
|
cloudYuIdField.textProperty().bind(yuCloudInfoViewModel.getId().asString());
|
||||||
cloudYuCloudIdField.textProperty().bindBidirectional(yuCloudInfoViewModel.getCloudId());
|
|
||||||
cloudYuLatestField.textProperty().bind(yuCloudInfoViewModel.getLatestUpdate().map(MyDateTimeUtils::format));
|
cloudYuLatestField.textProperty().bind(yuCloudInfoViewModel.getLatestUpdate().map(MyDateTimeUtils::format));
|
||||||
|
cloudYuVendorUpdateDateField.textProperty().bind(yuCloudInfoViewModel.getVendorUpdateDate().map(MyDateTimeUtils::format));
|
||||||
|
cloudYuCustomerUpdateDateField.textProperty().bind(yuCloudInfoViewModel.getCustomerUpdateDate().map(MyDateTimeUtils::format));
|
||||||
|
cloudYuActiveField.selectedProperty().bindBidirectional(yuCloudInfoViewModel.getActive());
|
||||||
cloudYuVersionLabel.textProperty().bind(yuCloudInfoViewModel.getVersion().asString("Ver:%s"));
|
cloudYuVersionLabel.textProperty().bind(yuCloudInfoViewModel.getVersion().asString("Ver:%s"));
|
||||||
|
|
||||||
Button button = yuCloudPaneSaveButton;
|
Button button = yuCloudPaneSaveButton;
|
||||||
@@ -436,6 +440,34 @@ public class CompanyTabSkinOther
|
|||||||
button.setDisable(false);
|
button.setDisable(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
DelayOnceExecutor saveExecutor = new DelayOnceExecutor(() -> {
|
||||||
|
save(yuCloudInfoViewModel);
|
||||||
|
cloudYuActiveField.setBorder(null);
|
||||||
|
}, 2, TimeUnit.SECONDS).exception(e -> logger.error(e.getMessage(), e));
|
||||||
|
cloudYuActiveField.setOnMouseClicked(event -> {
|
||||||
|
cloudYuActiveField.setBorder(Border.stroke(Color.RED));
|
||||||
|
saveExecutor.tick();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(CloudYuInfoViewModel viewModel) {
|
||||||
|
int infoId = viewModel.getId().get();
|
||||||
|
YongYouU8Service service = getYongYouU8Service();
|
||||||
|
CloudYuVo cloudYu = service.findById(infoId);
|
||||||
|
if (cloudYu == null) {
|
||||||
|
throw new RuntimeException("CloudTyc not found");
|
||||||
|
}
|
||||||
|
if (viewModel.copyTo(cloudYu)) {
|
||||||
|
CloudYuVo saved = service.save(cloudYu);
|
||||||
|
if (Platform.isFxApplicationThread()) {
|
||||||
|
viewModel.update(saved);
|
||||||
|
} else {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
viewModel.update(saved);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onCloudYuUpdateButtonClicked(ActionEvent event) {
|
private void onCloudYuUpdateButtonClicked(ActionEvent event) {
|
||||||
@@ -516,10 +548,12 @@ public class CompanyTabSkinOther
|
|||||||
CompanyExtendInfoViewModel viewModel = extendInfoViewModel;
|
CompanyExtendInfoViewModel viewModel = extendInfoViewModel;
|
||||||
CompanyExtendInfoService service = getExtendInfoService();
|
CompanyExtendInfoService service = getExtendInfoService();
|
||||||
CompanyExtendInfoVo extendInfo = service.findByCompany(company);
|
CompanyExtendInfoVo extendInfo = service.findByCompany(company);
|
||||||
|
if (extendInfo != null) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
viewModel.update(extendInfo);
|
viewModel.update(extendInfo);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CloudRkService getCloudRkService() {
|
CloudRkService getCloudRkService() {
|
||||||
if (cloudRkService == null) {
|
if (cloudRkService == null) {
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ public class VendorTypeTableCell<T> extends AsyncUpdateTableCell<T, VendorType,
|
|||||||
protected VendorTypeLocalVo initialize() {
|
protected VendorTypeLocalVo initialize() {
|
||||||
VendorType item = getItem();
|
VendorType item = getItem();
|
||||||
VendorTypeLocalVo localVo = getServiceBean().findByType(item);
|
VendorTypeLocalVo localVo = getServiceBean().findByType(item);
|
||||||
System.out.println("item = " + item + ", localVo = " + getServiceBean().getStringConverter().toString(localVo));
|
|
||||||
return localVo;
|
return localVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ public class VendorApprovedListTabSkinVendors
|
|||||||
task.setEveryYearMinContracts(qualifiedVendorEveryYearMinContractsSpinner.getValue());
|
task.setEveryYearMinContracts(qualifiedVendorEveryYearMinContractsSpinner.getValue());
|
||||||
|
|
||||||
UITools.showTaskDialogAndWait("导入供方", task, null);
|
UITools.showTaskDialogAndWait("导入供方", task, null);
|
||||||
|
loadTableDataSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVendorTableRefreshAction(ActionEvent event) {
|
public void onVendorTableRefreshAction(ActionEvent event) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import java.util.Objects;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.ecep.contract.constant.CompanyVendorConstant;
|
||||||
import com.ecep.contract.service.*;
|
import com.ecep.contract.service.*;
|
||||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
@@ -119,7 +120,8 @@ public class VendorApprovedListVendorExportTask extends Tasker<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private File getVendorApprovedListTemplate() {
|
private File getVendorApprovedListTemplate() {
|
||||||
return getVendorService().getVendorApprovedListTemplate();
|
String path = getConfService().getString(CompanyVendorConstant.KEY_APPROVED_LIST_TEMPLATE);
|
||||||
|
return new File(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public class VendorApprovedListVendorImportTask extends Tasker<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
service = getBean(VendorApprovedService.class);
|
service = getBean(VendorApprovedService.class);
|
||||||
|
// 检索供方
|
||||||
VendorService vendorService = getBean(VendorService.class);
|
VendorService vendorService = getBean(VendorService.class);
|
||||||
Page<VendorVo> page = vendorService.findAll(
|
Page<VendorVo> page = vendorService.findAll(
|
||||||
ParamUtils.builder()
|
ParamUtils.builder()
|
||||||
@@ -136,7 +137,17 @@ public class VendorApprovedListVendorImportTask extends Tasker<Object> {
|
|||||||
// 明确 company 实例
|
// 明确 company 实例
|
||||||
CompanyVo company = initializedVendorCompany(vendor);
|
CompanyVo company = initializedVendorCompany(vendor);
|
||||||
if (company == null) {
|
if (company == null) {
|
||||||
// 无效
|
// 无效, 删除异常数据
|
||||||
|
holder.error("供方(#" + vendor.getId() + ")无对应的公司消息");
|
||||||
|
List<VendorApprovedItemVo> items = getItemService().findAllByListAndVendor(approvedList, vendor);
|
||||||
|
if (items != null && !items.isEmpty()) {
|
||||||
|
// 删除
|
||||||
|
MessageHolder subHolder = holder.sub(" - ");
|
||||||
|
items.forEach(item -> {
|
||||||
|
getItemService().delete(item);
|
||||||
|
subHolder.info("删除 #" + item.getId() + ", " + item.getVendorName());
|
||||||
|
});
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,15 +155,15 @@ public class VendorApprovedListVendorImportTask extends Tasker<Object> {
|
|||||||
|
|
||||||
VendorType vendorType = vendor.getType();
|
VendorType vendorType = vendor.getType();
|
||||||
if (vendorType == null) {
|
if (vendorType == null) {
|
||||||
subHolder.error("供方的分类为空");
|
subHolder.debug("供方分类未设置");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确认供方的developDate 是否在供方名录的发布日期之后
|
// 确认供方的developDate 是否在供方名录的发布日期之后
|
||||||
LocalDate developDate = vendor.getDevelopDate();
|
LocalDate developDate = vendor.getDevelopDate();
|
||||||
if (developDate == null) {
|
if (developDate == null) {
|
||||||
subHolder.error("供方的开发日期为空");
|
subHolder.error("开发日期未设置");
|
||||||
} else if (developDate.isAfter(approvedList.getPublishDate())) {
|
} else if (developDate.isAfter(approvedList.getPublishDate())) {
|
||||||
|
subHolder.info("开发日期在供方名录发布之后, 跳过...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,6 +171,34 @@ public class VendorApprovedListVendorImportTask extends Tasker<Object> {
|
|||||||
List<VendorApprovedItemVo> items = getItemService().findAllByListAndVendor(approvedList, vendor);
|
List<VendorApprovedItemVo> items = getItemService().findAllByListAndVendor(approvedList, vendor);
|
||||||
if (items == null || items.isEmpty()) {
|
if (items == null || items.isEmpty()) {
|
||||||
// 供方不在供方名录中时,新建一个
|
// 供方不在供方名录中时,新建一个
|
||||||
|
syncWhenNoItem(vendor, company, subHolder);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VendorApprovedItemVo first = items.getFirst();
|
||||||
|
syncItem(vendor, company, first, subHolder);
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 1; i < items.size(); i++) {
|
||||||
|
VendorApprovedItemVo item = items.get(i);
|
||||||
|
getItemService().delete(item);
|
||||||
|
subHolder.debug("删除重复的供方名录项:#" + item.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当没有匹配的供方名录项时
|
||||||
|
*
|
||||||
|
* @param vendor
|
||||||
|
* @param company
|
||||||
|
* @param subHolder
|
||||||
|
*/
|
||||||
|
private void syncWhenNoItem(VendorVo vendor, CompanyVo company, MessageHolder subHolder) {
|
||||||
|
VendorType vendorType = vendor.getType();
|
||||||
|
if (vendorType == null) {
|
||||||
|
subHolder.debug("供方分类未设置");
|
||||||
|
}
|
||||||
|
|
||||||
VendorApprovedItemVo item = new VendorApprovedItemVo();
|
VendorApprovedItemVo item = new VendorApprovedItemVo();
|
||||||
item.setListId(approvedList.getId());
|
item.setListId(approvedList.getId());
|
||||||
item.setVendorId(vendor.getId());
|
item.setVendorId(vendor.getId());
|
||||||
@@ -195,7 +234,7 @@ public class VendorApprovedListVendorImportTask extends Tasker<Object> {
|
|||||||
if (logTypicallyVendorNoThreeYearContract) {
|
if (logTypicallyVendorNoThreeYearContract) {
|
||||||
subHolder.warn("供方近" + vendorContractMinusYear + "年没有合作, 应该转为不合格供应商");
|
subHolder.warn("供方近" + vendorContractMinusYear + "年没有合作, 应该转为不合格供应商");
|
||||||
}
|
}
|
||||||
item.setDescription(STR_MEET_UNQUALIFIED);
|
item.setDescription(STR_MEET_UNQUALIFIED + "(缺合同1)");
|
||||||
} else {
|
} else {
|
||||||
// 检查近3年期间是否都有合同
|
// 检查近3年期间是否都有合同
|
||||||
if (checkAllYearHasContract(contracts, approvedList.getPublishDate())) {
|
if (checkAllYearHasContract(contracts, approvedList.getPublishDate())) {
|
||||||
@@ -226,7 +265,7 @@ public class VendorApprovedListVendorImportTask extends Tasker<Object> {
|
|||||||
if (logTypicallyVendorNoThreeYearContract) {
|
if (logTypicallyVendorNoThreeYearContract) {
|
||||||
subHolder.warn("供方近" + vendorContractMinusYear + "年没有合作, 应该转为不合格供应商");
|
subHolder.warn("供方近" + vendorContractMinusYear + "年没有合作, 应该转为不合格供应商");
|
||||||
}
|
}
|
||||||
item.setDescription(STR_MEET_UNQUALIFIED);
|
item.setDescription(STR_MEET_UNQUALIFIED + "(缺合同2)");
|
||||||
} else {
|
} else {
|
||||||
// 检查近3年期间是否都有合同
|
// 检查近3年期间是否都有合同
|
||||||
if (checkAllYearHasContract(contracts, approvedList.getPublishDate())) {
|
if (checkAllYearHasContract(contracts, approvedList.getPublishDate())) {
|
||||||
@@ -249,32 +288,21 @@ public class VendorApprovedListVendorImportTask extends Tasker<Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 匹配的历史名称
|
// 匹配的历史名称
|
||||||
updateVendorNameWithOldName(vendor, item);
|
updateVendorNameWithOldName(company, item);
|
||||||
getItemService().save(item);
|
getItemService().save(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 匹配历史名称,当前供方名称为空时
|
||||||
|
* @param company
|
||||||
|
* @param item
|
||||||
|
*/
|
||||||
|
private void updateVendorNameWithOldName(CompanyVo company, VendorApprovedItemVo item) {
|
||||||
|
if (StringUtils.hasText(item.getVendorName())) {
|
||||||
|
// 已经有供方名称时,不更新
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items.size() == 1) {
|
|
||||||
VendorApprovedItemVo first = items.getFirst();
|
|
||||||
if (!StringUtils.hasText(first.getVendorName())) {
|
|
||||||
updateVendorNameWithOldName(vendor, first);
|
|
||||||
}
|
|
||||||
updateItem(vendor, first, subHolder);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 1; i < items.size(); i++) {
|
|
||||||
VendorApprovedItemVo item = items.get(i);
|
|
||||||
getItemService().delete(item);
|
|
||||||
subHolder.debug("删除重复的供方名录项:#" + item.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateVendorNameWithOldName(VendorVo vendor, VendorApprovedItemVo item) {
|
|
||||||
CompanyVo company = initializedVendorCompany(vendor);
|
|
||||||
if (company == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CompanyOldNameVo companyOldName = getCompanyOldNameService().findMatchByDate(company,
|
CompanyOldNameVo companyOldName = getCompanyOldNameService().findMatchByDate(company,
|
||||||
approvedList.getPublishDate());
|
approvedList.getPublishDate());
|
||||||
if (companyOldName != null) {
|
if (companyOldName != null) {
|
||||||
@@ -288,11 +316,12 @@ public class VendorApprovedListVendorImportTask extends Tasker<Object> {
|
|||||||
@Setter
|
@Setter
|
||||||
private boolean logUnqualifiedVendorRemove = true;
|
private boolean logUnqualifiedVendorRemove = true;
|
||||||
|
|
||||||
private void updateItem(
|
private void syncItem(
|
||||||
VendorVo vendor, VendorApprovedItemVo item, MessageHolder holder) {
|
VendorVo vendor, CompanyVo company, VendorApprovedItemVo item, MessageHolder holder) {
|
||||||
VendorType t1 = item.getType();
|
VendorType t1 = item.getType();
|
||||||
VendorType vendorType = vendor.getType();
|
VendorType vendorType = vendor.getType();
|
||||||
VendorApprovedItemService itemService = getItemService();
|
VendorApprovedItemService itemService = getItemService();
|
||||||
|
updateVendorNameWithOldName(company, item);
|
||||||
if (t1 != vendorType) {
|
if (t1 != vendorType) {
|
||||||
holder.warn("注意分类不一致, " + t1 + ", " + vendorType + ".");
|
holder.warn("注意分类不一致, " + t1 + ", " + vendorType + ".");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ecep.contract.controller.vendor.approved_list;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import com.ecep.contract.task.VendorApprovedListMakePathTask;
|
||||||
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;
|
||||||
@@ -104,15 +105,13 @@ public class VendorApprovedListWindowController
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onApprovedListCreatePathAction(ActionEvent event) {
|
public void onApprovedListCreatePathAction(ActionEvent event) {
|
||||||
|
VendorApprovedListMakePathTask task = new VendorApprovedListMakePathTask();
|
||||||
|
task.setApprovedList(getEntity());
|
||||||
|
UITools.showTaskDialogAndWait("创建目录", task, null);
|
||||||
|
|
||||||
int id = viewModel.getId().get();
|
int id = viewModel.getId().get();
|
||||||
VendorApprovedVo list = service.findById(id);
|
VendorApprovedVo list = service.findById(id);
|
||||||
|
viewModel.update(list);
|
||||||
if (service.makePathAbsent(list)) {
|
|
||||||
VendorApprovedVo saved = service.save(list);
|
|
||||||
viewModel.update(saved);
|
|
||||||
} else {
|
|
||||||
setStatus("目录存在或创建失败");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onApprovedListChangePathAction(ActionEvent event) {
|
public void onApprovedListChangePathAction(ActionEvent event) {
|
||||||
@@ -123,8 +122,4 @@ public class VendorApprovedListWindowController
|
|||||||
task.setApprovedList(getEntity());
|
task.setApprovedList(getEntity());
|
||||||
UITools.showTaskDialogAndWait("导出供方", task, null);
|
UITools.showTaskDialogAndWait("导出供方", task, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void save(ActionEvent event) {
|
|
||||||
saveTabSkins();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ public class VendorCatalogStringConverter extends StringConverter<VendorCatalogV
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(VendorCatalogVo object) {
|
public String toString(VendorCatalogVo object) {
|
||||||
|
if (object == null) {
|
||||||
|
return "-";
|
||||||
|
}
|
||||||
return object.getName();
|
return object.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,18 +29,11 @@ public class CompanyCustomerEvaluationFormFileService
|
|||||||
* 根据客户文件查找评估表文件
|
* 根据客户文件查找评估表文件
|
||||||
*/
|
*/
|
||||||
public CompanyCustomerEvaluationFormFileVo findByCustomerFile(CustomerFileVo customerFile) {
|
public CompanyCustomerEvaluationFormFileVo findByCustomerFile(CustomerFileVo customerFile) {
|
||||||
return findByCustomerFile(customerFile.getId());
|
return findOneByProperty("customerFile", customerFile.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyCustomerEvaluationFormFileVo findByCustomerFile(Integer customerFileId) {
|
public CompanyCustomerEvaluationFormFileVo findByCustomerFile(Integer customerFileId) {
|
||||||
List<CompanyCustomerEvaluationFormFileVo> page = findAll(ParamUtils.builder()
|
return findOneByProperty("customerFile", customerFileId);
|
||||||
.equals("customerFile", customerFileId)
|
|
||||||
.build(), Pageable.ofSize(1))
|
|
||||||
.getContent();
|
|
||||||
if (page.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return page.getFirst();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyCustomerEvaluationFormFileVo> searchByCompany(Integer companyId, String searchText) {
|
public List<CompanyCustomerEvaluationFormFileVo> searchByCompany(Integer companyId, String searchText) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import javafx.util.StringConverter;
|
|||||||
@CacheConfig(cacheNames = "company-customer-file-type")
|
@CacheConfig(cacheNames = "company-customer-file-type")
|
||||||
public class CompanyCustomerFileTypeService
|
public class CompanyCustomerFileTypeService
|
||||||
extends QueryService<CustomerFileTypeLocalVo, CompanyCustomerFileTypeLocalViewModel> {
|
extends QueryService<CustomerFileTypeLocalVo, CompanyCustomerFileTypeLocalViewModel> {
|
||||||
private final StringConverter<CustomerFileTypeLocalVo> stringConverter = new CustomerFileTypeStringConverter(this);
|
private final CustomerFileTypeStringConverter stringConverter = new CustomerFileTypeStringConverter(this);
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
@@ -39,13 +39,13 @@ public class CompanyCustomerFileTypeService
|
|||||||
return super.findAll();
|
return super.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(put = { @CachePut(key = "#p0.id"), @CachePut(key = "'all'") })
|
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
|
||||||
@Override
|
@Override
|
||||||
public CustomerFileTypeLocalVo save(CustomerFileTypeLocalVo entity) {
|
public CustomerFileTypeLocalVo save(CustomerFileTypeLocalVo entity) {
|
||||||
return super.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(put = { @CachePut(key = "#p0.id"), @CachePut(key = "'all'") })
|
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
|
||||||
@Override
|
@Override
|
||||||
public void delete(CustomerFileTypeLocalVo entity) {
|
public void delete(CustomerFileTypeLocalVo entity) {
|
||||||
super.delete(entity);
|
super.delete(entity);
|
||||||
@@ -53,8 +53,7 @@ public class CompanyCustomerFileTypeService
|
|||||||
|
|
||||||
@Cacheable
|
@Cacheable
|
||||||
public Map<CustomerFileType, CustomerFileTypeLocalVo> findAll(Locale locale) {
|
public Map<CustomerFileType, CustomerFileTypeLocalVo> findAll(Locale locale) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = ParamUtils.builder().equals("lang", locale.toLanguageTag()).build();
|
||||||
params.put("lang", locale.toLanguageTag());
|
|
||||||
return findAll(params, Pageable.unpaged()).stream()
|
return findAll(params, Pageable.unpaged()).stream()
|
||||||
.collect(Collectors.toMap(CustomerFileTypeLocalVo::getType, Function.identity()));
|
.collect(Collectors.toMap(CustomerFileTypeLocalVo::getType, Function.identity()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ecep.contract.service;
|
package com.ecep.contract.service;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import com.ecep.contract.vm.CompanyInvoiceInfoViewModel;
|
import com.ecep.contract.vm.CompanyInvoiceInfoViewModel;
|
||||||
import com.ecep.contract.vo.CompanyInvoiceInfoVo;
|
import com.ecep.contract.vo.CompanyInvoiceInfoVo;
|
||||||
import com.ecep.contract.vo.CompanyVo;
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
@@ -15,9 +16,8 @@ import java.util.Map;
|
|||||||
public class CompanyInvoiceInfoService extends QueryService<CompanyInvoiceInfoVo, CompanyInvoiceInfoViewModel> {
|
public class CompanyInvoiceInfoService extends QueryService<CompanyInvoiceInfoVo, CompanyInvoiceInfoViewModel> {
|
||||||
|
|
||||||
public List<CompanyInvoiceInfoVo> searchByCompany(CompanyVo company, String searchText) {
|
public List<CompanyInvoiceInfoVo> searchByCompany(CompanyVo company, String searchText) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = ParamUtils.builder().equals("company", company.getId())
|
||||||
params.put("company", company);
|
.search(searchText).build();
|
||||||
params.put("searchText", searchText);
|
|
||||||
return findAll(params, Pageable.unpaged()).getContent();
|
return findAll(params, Pageable.unpaged()).getContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,11 +71,16 @@ public class CompanyOldNameService extends QueryService<CompanyOldNameVo, Compan
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CompanyOldNameVo findMatchByDate(CompanyVo company, LocalDate localDate) {
|
public CompanyOldNameVo findMatchByDate(CompanyVo company, LocalDate localDate) {
|
||||||
|
findAll(ParamUtils.builder()
|
||||||
|
.equals("company", company.getId())
|
||||||
|
.equals("ambiguity", true)
|
||||||
|
.isNotNull("beginDate")
|
||||||
|
.build(), Pageable.unpaged()).getContent();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyOldNameVo> findAllByCompanyAndName(CompanyVo company, String oldName) {
|
public List<CompanyOldNameVo> findAllByCompanyAndName(CompanyVo company, String oldName) {
|
||||||
return findAll(ParamUtils.builder().equals("company", company.getId()).equals("oldName", oldName).build(),
|
return findAll(ParamUtils.builder().equals("company", company.getId()).equals("name", oldName).build(),
|
||||||
Pageable.unpaged()).getContent();
|
Pageable.unpaged()).getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
@@ -58,8 +59,7 @@ public class CompanyService extends QueryService<CompanyVo, CompanyViewModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyVo> findAllByName(String name) {
|
public List<CompanyVo> findAllByName(String name) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = ParamUtils.builder().equals("name", name).build();
|
||||||
params.put("name", name);
|
|
||||||
return findAll(params, Pageable.unpaged()).getContent();
|
return findAll(params, Pageable.unpaged()).getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ import com.ecep.contract.vo.ContractVo;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ContractFileService extends QueryService<ContractFileVo, ContractFileViewModel> {
|
public class ContractFileService extends QueryService<ContractFileVo, ContractFileViewModel> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContractFileVo findById(Integer id) {
|
||||||
|
return super.findById(id);
|
||||||
|
}
|
||||||
|
|
||||||
public List<ContractFileVo> findAllByContract(ContractVo contract) {
|
public List<ContractFileVo> findAllByContract(ContractVo contract) {
|
||||||
return findAll(ParamUtils.equal("contract", contract.getId()), Pageable.unpaged()).getContent();
|
return findAll(ParamUtils.equal("contract", contract.getId()), Pageable.unpaged()).getContent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ecep.contract.service;
|
|||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -9,6 +10,7 @@ import org.springframework.cache.annotation.CacheConfig;
|
|||||||
import org.springframework.cache.annotation.CachePut;
|
import org.springframework.cache.annotation.CachePut;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.cache.annotation.Caching;
|
import org.springframework.cache.annotation.Caching;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -37,13 +39,13 @@ public class ContractFileTypeService extends QueryService<ContractFileTypeLocalV
|
|||||||
return super.findAll();
|
return super.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(put = { @CachePut(key = "#p0.id"), @CachePut(key = "'all'") })
|
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
|
||||||
@Override
|
@Override
|
||||||
public ContractFileTypeLocalVo save(ContractFileTypeLocalVo entity) {
|
public ContractFileTypeLocalVo save(ContractFileTypeLocalVo entity) {
|
||||||
return super.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(put = { @CachePut(key = "#p0.id"), @CachePut(key = "'all'") })
|
@Caching(put = {@CachePut(key = "#p0.id"), @CachePut(key = "'all'")})
|
||||||
@Override
|
@Override
|
||||||
public void delete(ContractFileTypeLocalVo entity) {
|
public void delete(ContractFileTypeLocalVo entity) {
|
||||||
super.delete(entity);
|
super.delete(entity);
|
||||||
@@ -55,6 +57,10 @@ public class ContractFileTypeService extends QueryService<ContractFileTypeLocalV
|
|||||||
.collect(Collectors.toMap(ContractFileTypeLocalVo::getType, Function.identity()));
|
.collect(Collectors.toMap(ContractFileTypeLocalVo::getType, Function.identity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<Page<ContractFileTypeLocalVo>> asyncFindAll(Locale locale) {
|
||||||
|
return asyncFindAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).build(), Pageable.unpaged());
|
||||||
|
}
|
||||||
|
|
||||||
@Cacheable
|
@Cacheable
|
||||||
public ContractFileTypeLocalVo findByType(Locale locale, ContractFileType type) {
|
public ContractFileTypeLocalVo findByType(Locale locale, ContractFileType type) {
|
||||||
return findAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).equals("type", type).build(), Pageable.ofSize(1)).stream().findFirst().orElse(null);
|
return findAll(ParamUtils.builder().equals("lang", locale.toLanguageTag()).equals("type", type).build(), Pageable.ofSize(1)).stream().findFirst().orElse(null);
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ public class ProjectSaleTypeService extends QueryService<ProjectSaleTypeVo, Proj
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ProjectSaleTypeVo findByCode(String code) {
|
public ProjectSaleTypeVo findByCode(String code) {
|
||||||
return findAll(ParamUtils.builder().equals("code", code).build(), Pageable.ofSize(1)).getContent().getFirst();
|
return findOneByProperty("code", code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectSaleTypeVo findByName(String name) {
|
public ProjectSaleTypeVo findByName(String name) {
|
||||||
return findAll(ParamUtils.builder().equals("name", name).build(), Pageable.ofSize(1)).getContent().getFirst();
|
return findOneByProperty("name", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = {@CacheEvict(key = "#p0.id")})
|
@Caching(evict = {@CacheEvict(key = "#p0.id")})
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ecep.contract.service;
|
|||||||
import com.ecep.contract.PageArgument;
|
import com.ecep.contract.PageArgument;
|
||||||
import com.ecep.contract.PageContent;
|
import com.ecep.contract.PageContent;
|
||||||
import com.ecep.contract.WebSocketClientService;
|
import com.ecep.contract.WebSocketClientService;
|
||||||
|
import com.ecep.contract.constant.ServiceConstant;
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.model.NamedEntity;
|
import com.ecep.contract.model.NamedEntity;
|
||||||
import com.ecep.contract.util.ParamUtils;
|
import com.ecep.contract.util.ParamUtils;
|
||||||
@@ -67,7 +68,7 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
|
|||||||
@Override
|
@Override
|
||||||
public T save(T entity) {
|
public T save(T entity) {
|
||||||
try {
|
try {
|
||||||
return async("save", entity, entity.getClass().getName()).handle((response, ex) -> {
|
return async(ServiceConstant.SAVE_METHOD_NAME, entity, entity.getClass().getName()).handle((response, ex) -> {
|
||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
throw new RuntimeException("保存实体失败", ex);
|
throw new RuntimeException("保存实体失败", ex);
|
||||||
}
|
}
|
||||||
@@ -88,7 +89,7 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
|
|||||||
@Override
|
@Override
|
||||||
public void delete(T entity) {
|
public void delete(T entity) {
|
||||||
try {
|
try {
|
||||||
async("delete", entity, entity.getClass().getName()).handle((response, ex) -> {
|
async(ServiceConstant.DELETE_METHOD_NAME, entity, entity.getClass().getName()).handle((response, ex) -> {
|
||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
throw new RuntimeException("删除实体失败", ex);
|
throw new RuntimeException("删除实体失败", ex);
|
||||||
}
|
}
|
||||||
@@ -117,7 +118,7 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<T> asyncFindById(Integer id) {
|
public CompletableFuture<T> asyncFindById(Integer id) {
|
||||||
return async("findById", id, Integer.class).handle((response, ex) -> {
|
return async(ServiceConstant.FIND_BY_ID_METHOD_NAME, id, Integer.class).handle((response, ex) -> {
|
||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
throw new RuntimeException("查询实体失败", ex);
|
throw new RuntimeException("查询实体失败", ex);
|
||||||
}
|
}
|
||||||
@@ -149,7 +150,7 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
|
|||||||
*/
|
*/
|
||||||
public CompletableFuture<Page<T>> asyncFindAll(Map<String, Object> params, Pageable pageable) {
|
public CompletableFuture<Page<T>> asyncFindAll(Map<String, Object> params, Pageable pageable) {
|
||||||
// 调用async方法发送WebSocket请求,获取异步响应结果
|
// 调用async方法发送WebSocket请求,获取异步响应结果
|
||||||
return async("findAll", params, PageArgument.of(pageable)).handle((response, ex) -> {
|
return async(ServiceConstant.FIND_ALL_METHOD_NAME, params, PageArgument.of(pageable)).handle((response, ex) -> {
|
||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
throw new RuntimeException("远程方法+findAll+调用失败", ex);
|
throw new RuntimeException("远程方法+findAll+调用失败", ex);
|
||||||
}
|
}
|
||||||
@@ -188,8 +189,9 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public T findOneByProperty(String propertyName, Object propertyValue) {
|
public T findOneByProperty(String propertyName, Object propertyValue) {
|
||||||
return findAll(ParamUtils.builder().equals(propertyName, propertyValue).build(), Pageable.ofSize(1)).stream()
|
ParamUtils.Builder paramBuilder = ParamUtils.builder().equals(propertyName, propertyValue);
|
||||||
.findFirst().orElse(null);
|
Page<T> page = findAll(paramBuilder.build(), Pageable.ofSize(1));
|
||||||
|
return page.stream().findFirst().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,7 +203,7 @@ public class QueryService<T extends IdentityEntity, TV extends IdentityViewModel
|
|||||||
public CompletableFuture<Long> asyncCount(Map<String, Object> params) {
|
public CompletableFuture<Long> asyncCount(Map<String, Object> params) {
|
||||||
// 调用async方法执行名为"count"的异步操作,传入参数params
|
// 调用async方法执行名为"count"的异步操作,传入参数params
|
||||||
// 使用handle方法处理异步操作的结果或异常
|
// 使用handle方法处理异步操作的结果或异常
|
||||||
return async("count", params).handle((response, ex) -> {
|
return async(ServiceConstant.COUNT_METHOD_NAME, params).handle((response, ex) -> {
|
||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
throw new RuntimeException("远程方法+count+调用失败", ex);
|
throw new RuntimeException("远程方法+count+调用失败", ex);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ public class SysConfService {
|
|||||||
if (ex != null) {
|
if (ex != null) {
|
||||||
throw new RuntimeException("远程方法+findById+调用失败", ex);
|
throw new RuntimeException("远程方法+findById+调用失败", ex);
|
||||||
}
|
}
|
||||||
|
if (response == null || response.isNull()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
SysConf newEntity = new SysConf();
|
SysConf newEntity = new SysConf();
|
||||||
try {
|
try {
|
||||||
objectMapper.updateValue(newEntity, response);
|
objectMapper.updateValue(newEntity, response);
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.ecep.contract.service;
|
package com.ecep.contract.service;
|
||||||
|
|
||||||
|
import com.ecep.contract.util.ParamUtils;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
@@ -12,13 +14,14 @@ public class VendorApprovedFileService
|
|||||||
extends QueryService<VendorApprovedFileVo, CompanyVendorApprovedFileViewModel> {
|
extends QueryService<VendorApprovedFileVo, CompanyVendorApprovedFileViewModel> {
|
||||||
|
|
||||||
public VendorApprovedFileVo findByName(VendorApprovedVo approvedList, String name) {
|
public VendorApprovedFileVo findByName(VendorApprovedVo approvedList, String name) {
|
||||||
// TODO Auto-generated method stub
|
return findOneByProperty(approvedList, "fileName", name);
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'findByName'");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean reBuildingFiles(VendorApprovedVo list, MessageHolder holder) {
|
public VendorApprovedFileVo findOneByProperty(VendorApprovedVo list, String propertyName, Object propertyValue) {
|
||||||
// TODO Auto-generated method stub
|
return findAll(ParamUtils.builder()
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
|
.equals("list", list.getId())
|
||||||
|
.equals(propertyName, propertyValue)
|
||||||
|
.build(), Pageable.ofSize(1)).stream()
|
||||||
|
.findFirst().orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ecep.contract.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ecep.contract.vo.VendorApprovedFileVo;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -23,4 +24,12 @@ public class VendorApprovedItemService
|
|||||||
.build(), Pageable.unpaged()).getContent();
|
.build(), Pageable.unpaged()).getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VendorApprovedItemVo findOneByProperty(VendorApprovedVo list, String propertyName, Object propertyValue) {
|
||||||
|
return findAll(ParamUtils.builder()
|
||||||
|
.equals("list", list.getId())
|
||||||
|
.equals(propertyName, propertyValue)
|
||||||
|
.build(), Pageable.ofSize(1)).stream()
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,23 +6,23 @@ import com.ecep.contract.MessageHolder;
|
|||||||
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;
|
import com.ecep.contract.vm.CompanyVendorApprovedListViewModel;
|
||||||
import com.ecep.contract.vo.VendorApprovedVo;
|
import com.ecep.contract.vo.VendorApprovedVo;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class VendorApprovedService
|
public class VendorApprovedService
|
||||||
extends QueryService<VendorApprovedVo, CompanyVendorApprovedListViewModel> {
|
extends QueryService<VendorApprovedVo, CompanyVendorApprovedListViewModel> {
|
||||||
|
|
||||||
public boolean makePathAbsent(VendorApprovedVo list) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'makePathAbsent'");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean reBuildingFiles(VendorApprovedVo list, MessageHolder holder) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'reBuildingFiles'");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean existPath(VendorApprovedVo entity) {
|
public boolean existPath(VendorApprovedVo entity) {
|
||||||
// TODO Auto-generated method stub
|
try {
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'existPath'");
|
return async("existPath", entity.getId(), Integer.class).handle((response, ex) -> {
|
||||||
|
if (ex != null) {
|
||||||
|
throw new RuntimeException("远程方法+existPath+调用失败", ex);
|
||||||
|
}
|
||||||
|
return response != null && response.isBoolean() && response.asBoolean();
|
||||||
|
}).get();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,15 +43,6 @@ public class VendorService extends QueryService<VendorVo, CompanyVendorViewModel
|
|||||||
return basePath;
|
return basePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getVendorApprovedListTemplate() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'getVendorApprovedListTemplate'");
|
|
||||||
}
|
|
||||||
|
|
||||||
public VendorCatalog findCatalogById(Integer id) {
|
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'findCatalogById'");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cacheable(key = "'company-'+#p0.id")
|
@Cacheable(key = "'company-'+#p0.id")
|
||||||
public VendorVo findByCompany(CompanyVo company) {
|
public VendorVo findByCompany(CompanyVo company) {
|
||||||
return findOneByProperty("company", company.getId());
|
return findOneByProperty("company", company.getId());
|
||||||
|
|||||||
@@ -1,11 +1,41 @@
|
|||||||
package com.ecep.contract.task;
|
package com.ecep.contract.task;
|
||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
|
import com.ecep.contract.WebSocketClientTasker;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同全量同步任务
|
||||||
|
* 通过WebSocket与服务器进行通信,实现合同数据的全量同步
|
||||||
|
*/
|
||||||
|
public class ContractSyncAllTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||||
|
private static final String TASK_NAME = "ContractSyncAllTask";
|
||||||
|
|
||||||
public class ContractSyncAllTask extends Tasker<Object> {
|
|
||||||
@Override
|
@Override
|
||||||
public Object execute(MessageHolder holder) {
|
public String getTaskName() {
|
||||||
return null;
|
return TASK_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateProgress(long current, long total) {
|
||||||
|
super.updateProgress(current, total);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute(MessageHolder holder) {
|
||||||
|
// 更新任务状态信息
|
||||||
|
updateTitle("开始合同全量同步任务");
|
||||||
|
holder.info("准备连接服务器进行合同数据同步...");
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 调用远程任务
|
||||||
|
Object result = callRemoteTask(holder, Locale.getDefault());
|
||||||
|
holder.info("合同全量同步任务完成");
|
||||||
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
holder.error("同步失败: " + e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -373,7 +373,10 @@ public class ContractVerifyComm implements BeanContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CompanyVo company = getCompanyService().findById(bidVendor.getCompanyId());
|
CompanyVo company = getCompanyService().findById(bidVendor.getCompanyId());
|
||||||
ContractFileVo contractFile = fileService.findById(bidVendor.getQuotationSheetFileId());
|
ContractFileVo contractFile = null;
|
||||||
|
if (bidVendor.getQuotationSheetFileId() != null) {
|
||||||
|
contractFile = fileService.findById(bidVendor.getQuotationSheetFileId());
|
||||||
|
}
|
||||||
// 报价表文件不存在
|
// 报价表文件不存在
|
||||||
if (contractFile == null) {
|
if (contractFile == null) {
|
||||||
if (requireQuotation && bidVendor.getCompanyId().equals(contract.getCompanyId())) {
|
if (requireQuotation && bidVendor.getCompanyId().equals(contract.getCompanyId())) {
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.ecep.contract.task;
|
||||||
|
|
||||||
|
import com.ecep.contract.MessageHolder;
|
||||||
|
import com.ecep.contract.WebSocketClientTasker;
|
||||||
|
import com.ecep.contract.vo.VendorApprovedVo;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合格供方名录生成路径任务器客户端实现
|
||||||
|
* 用于通过WebSocket与服务器通信,为合格供方名录生成文件路径
|
||||||
|
*/
|
||||||
|
public class VendorApprovedListMakePathTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(VendorApprovedListMakePathTask.class);
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private VendorApprovedVo approvedList;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
protected boolean modified = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTaskName() {
|
||||||
|
return "VendorApprovedListMakePathTask";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateProgress(long current, long total) {
|
||||||
|
super.updateProgress(current, total);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object execute(MessageHolder holder) throws Exception {
|
||||||
|
updateTitle("生成合格供方名录文件路径");
|
||||||
|
if (approvedList == null) {
|
||||||
|
holder.addMessage(java.util.logging.Level.SEVERE, "合格供方名录信息不能为空");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return callRemoteTask(holder, getLocale(), approvedList.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理从服务器返回的修改状态
|
||||||
|
* 当服务器端更新此属性时,客户端会接收到更新
|
||||||
|
*
|
||||||
|
* @param modified 文件是否被修改
|
||||||
|
*/
|
||||||
|
public void setModified(boolean modified) {
|
||||||
|
this.modified = modified;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,12 @@ package com.ecep.contract.util;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
import com.ecep.contract.constant.ServiceConstant;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.constant.ParamConstant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数工具类,用于构建查询条件参数
|
* 参数工具类,用于构建查询条件参数
|
||||||
@@ -15,64 +17,65 @@ public class ParamUtils {
|
|||||||
/**
|
/**
|
||||||
* 创建日期范围查询参数
|
* 创建日期范围查询参数
|
||||||
*
|
*
|
||||||
* @param key 查询字段名
|
* @param field 查询字段名
|
||||||
* @param begin 开始日期
|
* @param begin 开始日期
|
||||||
* @param end 结束日期
|
* @param end 结束日期
|
||||||
* @return 包含日期范围的查询参数Map
|
* @return 包含日期范围的查询参数Map
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> between(String key, LocalDate begin, LocalDate end) {
|
public static Map<String, Object> between(String field, LocalDate begin, LocalDate end) {
|
||||||
return Map.of(key, Map.of(
|
Builder builder = builder();
|
||||||
"begin", begin,
|
builder.between(field, begin, end);
|
||||||
"end", end));
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建等于条件查询参数
|
* 创建等于条件查询参数
|
||||||
*
|
*
|
||||||
* @param key 查询字段名
|
* @param field 查询字段名
|
||||||
* @param value 查询值
|
* @param value 查询值
|
||||||
* @return 包含等于条件的查询参数Map
|
* @return 包含等于条件的查询参数Map
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> equal(String key, Object value) {
|
public static Map<String, Object> equal(String field, Object value) {
|
||||||
return Map.of(key, value);
|
Builder builder = builder();
|
||||||
|
builder.equals(field, value);
|
||||||
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建字符串模糊查询参数
|
* 创建字符串模糊查询参数
|
||||||
*
|
*
|
||||||
* @param key 查询字段名
|
* @param field 查询字段名
|
||||||
* @param value 模糊查询的字符串值
|
* @param value 模糊查询的字符串值
|
||||||
* @return 包含模糊查询条件的查询参数Map
|
* @return 包含模糊查询条件的查询参数Map
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> like(String key, String value) {
|
public static Map<String, Object> contains(String field, String value, boolean caseSensitive) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Builder builder = builder();
|
||||||
params.put(key, "%" + value + "%");
|
builder.and().like(field, value, ParamConstant.Mode.CONTAINS, caseSensitive, false);
|
||||||
return params;
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static Map<String, Object> startsWith(String field, String value, boolean caseSensitive) {
|
||||||
* 创建日期模糊查询参数
|
Builder builder = builder();
|
||||||
*
|
builder.and().like(field, value, ParamConstant.Mode.STARTS_WITH, caseSensitive, false);
|
||||||
* @param key 查询字段名
|
return builder.build();
|
||||||
* @param value 模糊查询的日期值
|
}
|
||||||
* @return 包含日期模糊查询条件的查询参数Map
|
|
||||||
*/
|
public static Map<String, Object> endsWith(String field, String value, boolean caseSensitive) {
|
||||||
public static Map<String, Object> like(String key, LocalDate value) {
|
Builder builder = builder();
|
||||||
Map<String, Object> params = new HashMap<>();
|
builder.and().like(field, value, ParamConstant.Mode.ENDS_WITH, caseSensitive, false);
|
||||||
params.put(key, "%" + value + "%");
|
return builder.build();
|
||||||
return params;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建非空条件查询参数
|
* 创建非空条件查询参数
|
||||||
*
|
*
|
||||||
* @param key 查询字段名
|
* @param field 查询字段名
|
||||||
* @return 包含非空条件的查询参数Map
|
* @return 包含非空条件的查询参数Map
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> isNotNull(String key) {
|
public static Map<String, Object> isNotNull(String field) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Builder builder = builder();
|
||||||
params.put(key, Map.of("isNotNull", true));
|
builder.isNotNull(field);
|
||||||
return params;
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,9 +86,22 @@ public class ParamUtils {
|
|||||||
* @return 包含小于条件的查询参数Map
|
* @return 包含小于条件的查询参数Map
|
||||||
*/
|
*/
|
||||||
public static Map<String, Object> lessThan(String key, LocalDate value) {
|
public static Map<String, Object> lessThan(String key, LocalDate value) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
Builder builder = builder();
|
||||||
params.put(key, Map.of("lessThan", value));
|
builder.lessThan(key, value);
|
||||||
return params;
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建大于条件的日期查询参数
|
||||||
|
*
|
||||||
|
* @param key 查询字段名
|
||||||
|
* @param value 比较的日期值
|
||||||
|
* @return 包含大于条件的查询参数Map
|
||||||
|
*/
|
||||||
|
public static Map<String, Object> greaterThan(String key, LocalDate value) {
|
||||||
|
Builder builder = builder();
|
||||||
|
builder.greaterThan(key, value);
|
||||||
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,7 +119,8 @@ public class ParamUtils {
|
|||||||
*/
|
*/
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
// 存储构建的查询参数
|
// 存储构建的查询参数
|
||||||
private Map<String, Object> params = new HashMap<>();
|
private String searchText;
|
||||||
|
private FilterGroup group;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 私有构造方法,防止外部直接实例化
|
* 私有构造方法,防止外部直接实例化
|
||||||
@@ -119,7 +136,7 @@ public class ParamUtils {
|
|||||||
* @return 当前Builder实例,支持链式调用
|
* @return 当前Builder实例,支持链式调用
|
||||||
*/
|
*/
|
||||||
public Builder isNotNull(String key) {
|
public Builder isNotNull(String key) {
|
||||||
params.put(key, Map.of("isNotNull", true));
|
getDefaultGroup().isNotNull(key);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +148,7 @@ public class ParamUtils {
|
|||||||
* @return 当前Builder实例,支持链式调用
|
* @return 当前Builder实例,支持链式调用
|
||||||
*/
|
*/
|
||||||
public Builder lessThan(String key, LocalDate value) {
|
public Builder lessThan(String key, LocalDate value) {
|
||||||
params.put(key, Map.of("lessThan", value));
|
getDefaultGroup().lessThan(key, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +160,7 @@ public class ParamUtils {
|
|||||||
* @return 当前Builder实例,支持链式调用
|
* @return 当前Builder实例,支持链式调用
|
||||||
*/
|
*/
|
||||||
public Builder greaterThan(String key, LocalDate value) {
|
public Builder greaterThan(String key, LocalDate value) {
|
||||||
params.put(key, Map.of("greaterThan", value));
|
getDefaultGroup().greaterThan(key, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +172,7 @@ public class ParamUtils {
|
|||||||
* @return 当前Builder实例,支持链式调用
|
* @return 当前Builder实例,支持链式调用
|
||||||
*/
|
*/
|
||||||
public Builder equals(String key, Object value) {
|
public Builder equals(String key, Object value) {
|
||||||
params.put(key, value);
|
getDefaultGroup().equals(key, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,13 +185,16 @@ public class ParamUtils {
|
|||||||
* @return 当前Builder实例,支持链式调用
|
* @return 当前Builder实例,支持链式调用
|
||||||
*/
|
*/
|
||||||
public Builder between(String key, LocalDate begin, LocalDate end) {
|
public Builder between(String key, LocalDate begin, LocalDate end) {
|
||||||
Map<String, Object> params = new HashMap<>();
|
getDefaultGroup().between(key, begin, end);
|
||||||
params.put("begin", begin);
|
|
||||||
params.put("end", end);
|
|
||||||
this.params.put(key, params);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private FilterGroup getDefaultGroup() {
|
||||||
|
if (group != null) {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
return and();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加全文搜索条件到构建器
|
* 添加全文搜索条件到构建器
|
||||||
@@ -183,45 +203,343 @@ public class ParamUtils {
|
|||||||
* @return 当前Builder实例,支持链式调用
|
* @return 当前Builder实例,支持链式调用
|
||||||
*/
|
*/
|
||||||
public Builder search(String searchText) {
|
public Builder search(String searchText) {
|
||||||
params.put(ServiceConstant.KEY_SEARCH_TEXT, searchText);
|
this.searchText = searchText;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建并返回查询参数Map
|
* 构建并返回查询参数Map
|
||||||
|
* 推荐的结构(仅为契约示例,服务端需配套解析):
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* {
|
||||||
|
* "searchText": "关键词",
|
||||||
|
* "filter": {
|
||||||
|
* "op": "and",
|
||||||
|
* "conditions": [
|
||||||
|
* { "field": "code", "op": "equal", "value": "V-0001" },
|
||||||
|
* {
|
||||||
|
* "field": "createdDate",
|
||||||
|
* "op": "between",
|
||||||
|
* "value": {
|
||||||
|
* "begin": "2024-01-01",
|
||||||
|
* "end": "2024-12-31",
|
||||||
|
* "includeBegin": true,
|
||||||
|
* "includeEnd": false
|
||||||
|
* }
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "field": "name",
|
||||||
|
* "op": "like",
|
||||||
|
* "value": "元素",
|
||||||
|
* "mode": "contains",
|
||||||
|
* "caseSensitive": false
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "op": "or",
|
||||||
|
* "conditions": [
|
||||||
|
* { "field": "name", "op": "like", "value": "元素", "mode": "contains", "caseSensitive": false },
|
||||||
|
* { "field": "abbName", "op": "like", "value": "元素", "mode": "contains", "caseSensitive": false }
|
||||||
|
* ]
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* 约定说明:
|
||||||
|
* - 分组节点:{ op: "and"|"or", conditions: [...] }
|
||||||
|
* - 叶子条件:{ field: "路径", op: "equal"|"between"|..., value: ... }
|
||||||
|
* - like 扩展:支持 mode("contains"|"startsWith"|"endsWith") 和
|
||||||
|
* caseSensitive(boolean)
|
||||||
|
* - between 扩展:value 为对象,支持包含边界 includeBegin/includeEnd
|
||||||
*
|
*
|
||||||
* @return 包含所有添加条件的查询参数Map
|
* @return 包含所有添加条件的查询参数Map
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> build() {
|
public Map<String, Object> build() {
|
||||||
return params;
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
if (StringUtils.hasText(searchText)) {
|
||||||
|
map.put(ParamConstant.KEY_SEARCH_TEXT, searchText);
|
||||||
|
}
|
||||||
|
if (group != null) {
|
||||||
|
Map<String, Object> filter = new HashMap<>();
|
||||||
|
filter.put(ParamConstant.KEY_OPERATOR, group.operator.name().toLowerCase());
|
||||||
|
filter.put(ParamConstant.KEY_CONDITIONS, group.conditions);
|
||||||
|
map.put(ParamConstant.KEY_FILTER, filter);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加AND逻辑条件组到构建器
|
* 添加AND逻辑条件组到构建器
|
||||||
*
|
*
|
||||||
* @param consumer Builder消费者,用于构建子条件
|
* @return 新建的分组实例,支持链式调用添加子条件
|
||||||
* @return 当前Builder实例,支持链式调用
|
|
||||||
*/
|
*/
|
||||||
public Builder and(Consumer<Builder> consumer) {
|
public FilterGroup and() {
|
||||||
Builder builder = new Builder();
|
if (group == null) {
|
||||||
consumer.accept(builder);
|
group = new FilterGroup(ParamConstant.Operator.AND);
|
||||||
params.put("and", builder);
|
} else {
|
||||||
return this;
|
if (group.operator != ParamConstant.Operator.AND) {
|
||||||
|
throw new IllegalArgumentException(" 当前是 " + group.operator + " 条件组不允许修改为 AND 条件");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加OR逻辑条件组到构建器
|
* 添加OR逻辑条件组到构建器
|
||||||
*
|
*
|
||||||
* @param consumer Builder消费者,用于构建子条件
|
* @return 新建的分组实例,支持链式调用添加子条件
|
||||||
* @return 当前Builder实例,支持链式调用
|
|
||||||
*/
|
*/
|
||||||
public Builder or(Consumer<Builder> consumer) {
|
public FilterGroup or() {
|
||||||
Builder builder = new Builder();
|
if (group == null) {
|
||||||
consumer.accept(builder);
|
group = new FilterGroup(ParamConstant.Operator.OR);
|
||||||
params.put("or", builder);
|
} else {
|
||||||
|
if (group.operator != ParamConstant.Operator.OR) {
|
||||||
|
throw new IllegalArgumentException(" 当前是 " + group.operator + " 条件组不允许修改为 OR 条件");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过滤条件组,支持 AND/OR 逻辑组合
|
||||||
|
*/
|
||||||
|
public static class FilterGroup {
|
||||||
|
private ParamConstant.Operator operator = ParamConstant.Operator.AND;
|
||||||
|
List<Map<String, Object>> conditions = new java.util.ArrayList<>();
|
||||||
|
|
||||||
|
public FilterGroup(ParamConstant.Operator operator) {
|
||||||
|
this.operator = operator;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加叶子条件:equal(支持 ignoreNull)
|
||||||
|
public FilterGroup equals(String field, Object value) {
|
||||||
|
return equals(field, value, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGroup equals(String field, Object value, boolean ignoreNull) {
|
||||||
|
if (ignoreNull && isNullOrEmpty(value)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
Map<String, Object> leaf = new HashMap<>();
|
||||||
|
leaf.put(ParamConstant.KEY_FIELD, field);
|
||||||
|
leaf.put(ParamConstant.KEY_OPERATOR, ParamConstant.KEY_equal);
|
||||||
|
leaf.put(ParamConstant.KEY_VALUE, value);
|
||||||
|
if (ignoreNull) {
|
||||||
|
leaf.put(ParamConstant.KEY_IGNORE_NULL, true);
|
||||||
|
}
|
||||||
|
conditions.add(leaf);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加叶子条件:between(对象形式 + 边界 + ignoreNull)
|
||||||
|
public FilterGroup between(String field, LocalDate begin, LocalDate end) {
|
||||||
|
return between(field, begin, end, true, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FilterGroup between(String field, LocalDate begin, LocalDate end,
|
||||||
|
boolean includeBegin, boolean includeEnd, boolean ignoreNull) {
|
||||||
|
boolean noBegin = begin == null;
|
||||||
|
boolean noEnd = end == null;
|
||||||
|
if (ignoreNull && noBegin && noEnd) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
Map<String, Object> value = new HashMap<>();
|
||||||
|
if (!noBegin) {
|
||||||
|
value.put(ParamConstant.KEY_between_begin, begin);
|
||||||
|
}
|
||||||
|
if (!noEnd) {
|
||||||
|
value.put(ParamConstant.KEY_between_end, end);
|
||||||
|
}
|
||||||
|
value.put(ParamConstant.KEY_INCLUDE_BEGIN, includeBegin);
|
||||||
|
value.put(ParamConstant.KEY_INCLUDE_END, includeEnd);
|
||||||
|
|
||||||
|
Map<String, Object> leaf = new HashMap<>();
|
||||||
|
leaf.put(ParamConstant.KEY_FIELD, field);
|
||||||
|
leaf.put(ParamConstant.KEY_OPERATOR, ParamConstant.KEY_BETWEEN);
|
||||||
|
leaf.put(ParamConstant.KEY_VALUE, value);
|
||||||
|
if (ignoreNull) {
|
||||||
|
leaf.put(ParamConstant.KEY_IGNORE_NULL, true);
|
||||||
|
}
|
||||||
|
conditions.add(leaf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加叶子条件:lessThan(支持 ignoreNull)
|
||||||
|
public FilterGroup lessThan(String field, LocalDate value) {
|
||||||
|
return lessThan(field, value, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGroup lessThan(String field, LocalDate value, boolean ignoreNull) {
|
||||||
|
if (ignoreNull && value == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
Map<String, Object> leaf = new HashMap<>();
|
||||||
|
leaf.put(ParamConstant.KEY_FIELD, field);
|
||||||
|
leaf.put(ParamConstant.KEY_OPERATOR, ParamConstant.KEY_lessThan);
|
||||||
|
leaf.put(ParamConstant.KEY_VALUE, value);
|
||||||
|
if (ignoreNull) {
|
||||||
|
leaf.put(ParamConstant.KEY_IGNORE_NULL, true);
|
||||||
|
}
|
||||||
|
conditions.add(leaf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加叶子条件:greaterThan(支持 ignoreNull)
|
||||||
|
public FilterGroup greaterThan(String field, LocalDate value) {
|
||||||
|
return greaterThan(field, value, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGroup greaterThan(String field, LocalDate value, boolean ignoreNull) {
|
||||||
|
if (ignoreNull && value == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
Map<String, Object> leaf = new HashMap<>();
|
||||||
|
leaf.put(ParamConstant.KEY_FIELD, field);
|
||||||
|
leaf.put(ParamConstant.KEY_OPERATOR, ParamConstant.KEY_greaterThan);
|
||||||
|
leaf.put(ParamConstant.KEY_VALUE, value);
|
||||||
|
if (ignoreNull) {
|
||||||
|
leaf.put(ParamConstant.KEY_IGNORE_NULL, true);
|
||||||
|
}
|
||||||
|
conditions.add(leaf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加叶子条件:isNotNull
|
||||||
|
public FilterGroup isNotNull(String field) {
|
||||||
|
Map<String, Object> leaf = new HashMap<>();
|
||||||
|
leaf.put(ParamConstant.KEY_FIELD, field);
|
||||||
|
leaf.put(ParamConstant.KEY_OPERATOR, ParamConstant.KEY_isNotNull);
|
||||||
|
leaf.put(ParamConstant.KEY_VALUE, true);
|
||||||
|
conditions.add(leaf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加叶子条件:like(支持 mode/caseSensitive/ignoreNull)
|
||||||
|
public FilterGroup like(String field, String value) {
|
||||||
|
return like(field, value, ParamConstant.Mode.CONTAINS, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGroup like(String field, String value, ParamConstant.Mode mode, boolean caseSensitive,
|
||||||
|
boolean ignoreNull) {
|
||||||
|
if (ignoreNull && isNullOrEmpty(value)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
Map<String, Object> leaf = new HashMap<>();
|
||||||
|
leaf.put(ParamConstant.KEY_FIELD, field);
|
||||||
|
leaf.put(ParamConstant.KEY_OPERATOR, ParamConstant.KEY_like);
|
||||||
|
leaf.put(ParamConstant.KEY_VALUE, value);
|
||||||
|
// 使用枚举值作为模式输出
|
||||||
|
leaf.put(ParamConstant.KEY_MODE, mode.name());
|
||||||
|
leaf.put(ParamConstant.KEY_CASE_SENSITIVE, caseSensitive);
|
||||||
|
if (ignoreNull) {
|
||||||
|
leaf.put(ParamConstant.KEY_IGNORE_NULL, true);
|
||||||
|
}
|
||||||
|
conditions.add(leaf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加叶子条件:notLike(支持 mode/caseSensitive/ignoreNull)
|
||||||
|
public FilterGroup notLike(String field, String value) {
|
||||||
|
return notLike(field, value, ParamConstant.Mode.CONTAINS, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGroup notLike(String field, String value, ParamConstant.Mode mode, boolean caseSensitive,
|
||||||
|
boolean ignoreNull) {
|
||||||
|
if (ignoreNull && isNullOrEmpty(value)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
Map<String, Object> leaf = new HashMap<>();
|
||||||
|
leaf.put(ParamConstant.KEY_FIELD, field);
|
||||||
|
leaf.put(ParamConstant.KEY_OPERATOR, ParamConstant.KEY_notLike);
|
||||||
|
leaf.put(ParamConstant.KEY_VALUE, value);
|
||||||
|
// 使用枚举值作为模式输出
|
||||||
|
leaf.put(ParamConstant.KEY_MODE, mode.name());
|
||||||
|
leaf.put(ParamConstant.KEY_CASE_SENSITIVE, caseSensitive);
|
||||||
|
if (ignoreNull) {
|
||||||
|
leaf.put(ParamConstant.KEY_IGNORE_NULL, true);
|
||||||
|
}
|
||||||
|
conditions.add(leaf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加叶子条件:in(空集合防护 + ignoreNull)
|
||||||
|
public FilterGroup in(String field, java.util.Collection<?> values) {
|
||||||
|
return in(field, values, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGroup in(String field, java.util.Collection<?> values, boolean ignoreNull) {
|
||||||
|
if (ignoreNull && (values == null || values.isEmpty())) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
Map<String, Object> leaf = new HashMap<>();
|
||||||
|
leaf.put(ParamConstant.KEY_FIELD, field);
|
||||||
|
leaf.put(ParamConstant.KEY_OPERATOR, ParamConstant.KEY_in);
|
||||||
|
leaf.put(ParamConstant.KEY_VALUE, values);
|
||||||
|
if (ignoreNull) {
|
||||||
|
leaf.put(ParamConstant.KEY_IGNORE_NULL, true);
|
||||||
|
}
|
||||||
|
conditions.add(leaf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加叶子条件:notIn(空集合防护 + ignoreNull)
|
||||||
|
public FilterGroup notIn(String field, java.util.Collection<?> values) {
|
||||||
|
return notIn(field, values, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGroup notIn(String field, java.util.Collection<?> values, boolean ignoreNull) {
|
||||||
|
if (ignoreNull && (values == null || values.isEmpty())) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
Map<String, Object> leaf = new HashMap<>();
|
||||||
|
leaf.put(ParamConstant.KEY_FIELD, field);
|
||||||
|
leaf.put(ParamConstant.KEY_OPERATOR, ParamConstant.KEY_notIn);
|
||||||
|
leaf.put(ParamConstant.KEY_VALUE, values);
|
||||||
|
if (ignoreNull) {
|
||||||
|
leaf.put(ParamConstant.KEY_IGNORE_NULL, true);
|
||||||
|
}
|
||||||
|
conditions.add(leaf);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 嵌套分组:and / or(保持原有行为)
|
||||||
|
public FilterGroup and() {
|
||||||
|
FilterGroup group = new FilterGroup(ParamConstant.Operator.AND);
|
||||||
|
Map<String, Object> child = new HashMap<>();
|
||||||
|
child.put(ParamConstant.KEY_OPERATOR, ParamConstant.Operator.AND.name().toLowerCase());
|
||||||
|
child.put(ParamConstant.KEY_CONDITIONS, group.conditions);
|
||||||
|
conditions.add(child);
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilterGroup or() {
|
||||||
|
FilterGroup group = new FilterGroup(ParamConstant.Operator.OR);
|
||||||
|
Map<String, Object> child = new HashMap<>();
|
||||||
|
child.put(ParamConstant.KEY_OPERATOR, ParamConstant.Operator.OR.name().toLowerCase());
|
||||||
|
child.put(ParamConstant.KEY_CONDITIONS, group.conditions);
|
||||||
|
conditions.add(child);
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 辅助:空值判断(String/Collection/Array/null)
|
||||||
|
private boolean isNullOrEmpty(Object value) {
|
||||||
|
if (value == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (value instanceof String s) {
|
||||||
|
return !org.springframework.util.StringUtils.hasText(s);
|
||||||
|
}
|
||||||
|
if (value instanceof java.util.Collection<?> c) {
|
||||||
|
return c.isEmpty();
|
||||||
|
}
|
||||||
|
if (value.getClass().isArray()) {
|
||||||
|
return java.lang.reflect.Array.getLength(value) == 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ public class UITools {
|
|||||||
|
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
box.getChildren().add(progressBar);
|
box.getChildren().add(progressBar);
|
||||||
System.out.println("add progressBar = " + progressBar);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// progressBar.disabledProperty().bind(task.runningProperty());
|
// progressBar.disabledProperty().bind(task.runningProperty());
|
||||||
@@ -223,20 +222,18 @@ public class UITools {
|
|||||||
|
|
||||||
if (task instanceof Tasker<?> tasker) {
|
if (task instanceof Tasker<?> tasker) {
|
||||||
// 提交任务
|
// 提交任务
|
||||||
try (ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor()) {
|
new Thread(tasker).start();
|
||||||
executor.submit(tasker);
|
// try (ExecutorService executor = Executors.newVirtualThreadPerTaskExecutor()) {
|
||||||
}
|
// executor.submit(tasker);
|
||||||
|
// System.out.println("executor = " + executor);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
if (init != null) {
|
if (init != null) {
|
||||||
init.accept(consumer::test);
|
init.accept(consumer::test);
|
||||||
}
|
}
|
||||||
dialog.showAndWait();
|
dialog.showAndWait();
|
||||||
if (task.getProgress() < 1) {
|
|
||||||
task.cancel();
|
task.cancel();
|
||||||
}
|
}
|
||||||
// if (task.isRunning()) {
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String printStackTrace(Throwable e) {
|
private static String printStackTrace(Throwable e) {
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import com.ecep.contract.vo.CloudYuVo;
|
import com.ecep.contract.vo.CloudYuVo;
|
||||||
|
|
||||||
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
@@ -15,10 +16,6 @@ import lombok.EqualsAndHashCode;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class CloudYuInfoViewModel extends IdentityViewModel<CloudYuVo> {
|
public class CloudYuInfoViewModel extends IdentityViewModel<CloudYuVo> {
|
||||||
/**
|
|
||||||
* 云端Id
|
|
||||||
*/
|
|
||||||
private SimpleStringProperty cloudId = new SimpleStringProperty();
|
|
||||||
/**
|
/**
|
||||||
* 公司ID
|
* 公司ID
|
||||||
*/
|
*/
|
||||||
@@ -28,15 +25,16 @@ public class CloudYuInfoViewModel extends IdentityViewModel<CloudYuVo> {
|
|||||||
*/
|
*/
|
||||||
private SimpleObjectProperty<LocalDateTime> latestUpdate = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<LocalDateTime> latestUpdate = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
private SimpleStringProperty vendorCode = new SimpleStringProperty();
|
private SimpleStringProperty exceptionMessage = new SimpleStringProperty();
|
||||||
private SimpleStringProperty vendorClassCode = new SimpleStringProperty();
|
|
||||||
private SimpleObjectProperty<LocalDate> vendorDevelopDate = new SimpleObjectProperty<>();
|
|
||||||
|
|
||||||
private SimpleStringProperty customerCode = new SimpleStringProperty();
|
private SimpleObjectProperty<LocalDate> vendorUpdateDate = new SimpleObjectProperty<>();
|
||||||
private SimpleStringProperty customerClassCode = new SimpleStringProperty();
|
private SimpleObjectProperty<LocalDate> customerUpdateDate = new SimpleObjectProperty<>();
|
||||||
private SimpleObjectProperty<LocalDate> customerDevelopDate = new SimpleObjectProperty<>();
|
|
||||||
|
|
||||||
private SimpleObjectProperty<LocalDateTime> cloudLatest = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<LocalDateTime> cloudLatest = new SimpleObjectProperty<>();
|
||||||
|
/**
|
||||||
|
* 是否激活
|
||||||
|
*/
|
||||||
|
private SimpleBooleanProperty active = new SimpleBooleanProperty();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version
|
* Version
|
||||||
@@ -46,11 +44,13 @@ public class CloudYuInfoViewModel extends IdentityViewModel<CloudYuVo> {
|
|||||||
@Override
|
@Override
|
||||||
protected void updateFrom(CloudYuVo info) {
|
protected void updateFrom(CloudYuVo info) {
|
||||||
super.updateFrom(info);
|
super.updateFrom(info);
|
||||||
vendorCode.set(info.getExceptionMessage());
|
company.set(info.getCompanyId());
|
||||||
vendorDevelopDate.set(info.getVendorUpdateDate());
|
exceptionMessage.set(info.getExceptionMessage());
|
||||||
customerDevelopDate.set(info.getCustomerUpdateDate());
|
vendorUpdateDate.set(info.getVendorUpdateDate());
|
||||||
|
customerUpdateDate.set(info.getCustomerUpdateDate());
|
||||||
cloudLatest.set(info.getCloudLatest());
|
cloudLatest.set(info.getCloudLatest());
|
||||||
latestUpdate.set(info.getLatestUpdate());
|
latestUpdate.set(info.getLatestUpdate());
|
||||||
|
active.set(info.isActive());
|
||||||
version.set(info.getVersion());
|
version.set(info.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,16 +65,20 @@ public class CloudYuInfoViewModel extends IdentityViewModel<CloudYuVo> {
|
|||||||
|
|
||||||
private boolean copyTo_(CloudYuVo info) {
|
private boolean copyTo_(CloudYuVo info) {
|
||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
if (!Objects.equals(info.getExceptionMessage(), vendorCode.get())) {
|
if (!Objects.equals(info.getCompanyId(), company.get())) {
|
||||||
info.setExceptionMessage(vendorCode.get());
|
info.setCompanyId(company.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(info.getVendorUpdateDate(), vendorDevelopDate.get())) {
|
if (!Objects.equals(info.getExceptionMessage(), exceptionMessage.get())) {
|
||||||
info.setVendorUpdateDate(vendorDevelopDate.get());
|
info.setExceptionMessage(exceptionMessage.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(info.getCustomerUpdateDate(), customerDevelopDate.get())) {
|
if (!Objects.equals(info.getVendorUpdateDate(), vendorUpdateDate.get())) {
|
||||||
info.setCustomerUpdateDate(customerDevelopDate.get());
|
info.setVendorUpdateDate(vendorUpdateDate.get());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(info.getCustomerUpdateDate(), customerUpdateDate.get())) {
|
||||||
|
info.setCustomerUpdateDate(customerUpdateDate.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,6 +90,10 @@ public class CloudYuInfoViewModel extends IdentityViewModel<CloudYuVo> {
|
|||||||
info.setLatestUpdate(latestUpdate.get());
|
info.setLatestUpdate(latestUpdate.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(info.isActive(), active.get())) {
|
||||||
|
info.setActive(active.get());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
if (!Objects.equals(info.getVersion(), version.get())) {
|
if (!Objects.equals(info.getVersion(), version.get())) {
|
||||||
info.setVersion(version.get());
|
info.setVersion(version.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import com.ecep.contract.vo.CompanyBankAccountVo;
|
import com.ecep.contract.vo.CompanyBankAccountVo;
|
||||||
|
|
||||||
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
import javafx.beans.property.SimpleObjectProperty;
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
@@ -15,8 +16,6 @@ import lombok.EqualsAndHashCode;
|
|||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class CompanyBankAccountViewModel extends IdentityViewModel<CompanyBankAccountVo>
|
public class CompanyBankAccountViewModel extends IdentityViewModel<CompanyBankAccountVo>
|
||||||
implements CompanyBasedViewModel {
|
implements CompanyBasedViewModel {
|
||||||
private SimpleIntegerProperty id = new SimpleIntegerProperty();
|
|
||||||
|
|
||||||
private SimpleObjectProperty<Integer> companyId = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<Integer> companyId = new SimpleObjectProperty<>();
|
||||||
private SimpleObjectProperty<Integer> bankId = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<Integer> bankId = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
@@ -24,25 +23,27 @@ public class CompanyBankAccountViewModel extends IdentityViewModel<CompanyBankAc
|
|||||||
private SimpleStringProperty account = new SimpleStringProperty();
|
private SimpleStringProperty account = new SimpleStringProperty();
|
||||||
|
|
||||||
private SimpleObjectProperty<LocalDate> created = new SimpleObjectProperty<>();
|
private SimpleObjectProperty<LocalDate> created = new SimpleObjectProperty<>();
|
||||||
|
private SimpleStringProperty description = new SimpleStringProperty();
|
||||||
|
private SimpleBooleanProperty active = new SimpleBooleanProperty();
|
||||||
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
private SimpleIntegerProperty version = new SimpleIntegerProperty();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateFrom(CompanyBankAccountVo v) {
|
protected void updateFrom(CompanyBankAccountVo v) {
|
||||||
getId().set(v.getId());
|
super.updateFrom(v);
|
||||||
companyId.set(v.getCompanyId());
|
companyId.set(v.getCompanyId());
|
||||||
bankId.set(v.getBankId());
|
bankId.set(v.getBankId());
|
||||||
getOpeningBank().set(v.getOpeningBank());
|
getOpeningBank().set(v.getOpeningBank());
|
||||||
getAccount().set(v.getAccount());
|
getAccount().set(v.getAccount());
|
||||||
|
created.set(v.getCreated());
|
||||||
|
description.set(v.getDescription());
|
||||||
|
active.set(v.isActive());
|
||||||
|
version.set(v.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean copyTo(CompanyBankAccountVo v) {
|
public boolean copyTo(CompanyBankAccountVo v) {
|
||||||
boolean modified = super.copyTo(v);
|
boolean modified = super.copyTo(v);
|
||||||
if (!Objects.equals(id.get(), v.getId())) {
|
|
||||||
v.setId(id.get());
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(companyId.get(), v.getCompanyId())) {
|
if (!Objects.equals(companyId.get(), v.getCompanyId())) {
|
||||||
v.setCompanyId(companyId.get());
|
v.setCompanyId(companyId.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
@@ -59,6 +60,18 @@ public class CompanyBankAccountViewModel extends IdentityViewModel<CompanyBankAc
|
|||||||
v.setAccount(account.get());
|
v.setAccount(account.get());
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(created.get(), v.getCreated())) {
|
||||||
|
v.setCreated(created.get());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(description.get(), v.getDescription())) {
|
||||||
|
v.setDescription(description.get());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(active.get(), v.isActive())) {
|
||||||
|
v.setActive(active.get());
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.Objects;
|
|||||||
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
import com.ecep.contract.vo.CompanyCustomerEvaluationFormFileVo;
|
||||||
|
|
||||||
import javafx.beans.property.SimpleIntegerProperty;
|
import javafx.beans.property.SimpleIntegerProperty;
|
||||||
|
import javafx.beans.property.SimpleObjectProperty;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -13,7 +14,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class CompanyCustomerEvaluationFormFileViewModel extends IdentityViewModel<CompanyCustomerEvaluationFormFileVo> {
|
public class CompanyCustomerEvaluationFormFileViewModel extends IdentityViewModel<CompanyCustomerEvaluationFormFileVo> {
|
||||||
|
|
||||||
private SimpleIntegerProperty customerFile = new SimpleIntegerProperty();
|
private SimpleObjectProperty<Integer> customerFile = new SimpleObjectProperty<>();
|
||||||
private SimpleStringProperty catalog = new SimpleStringProperty();
|
private SimpleStringProperty catalog = new SimpleStringProperty();
|
||||||
private SimpleStringProperty level = new SimpleStringProperty();
|
private SimpleStringProperty level = new SimpleStringProperty();
|
||||||
private SimpleIntegerProperty creditLevel = new SimpleIntegerProperty(0);
|
private SimpleIntegerProperty creditLevel = new SimpleIntegerProperty(0);
|
||||||
@@ -65,6 +66,7 @@ public class CompanyCustomerEvaluationFormFileViewModel extends IdentityViewMode
|
|||||||
if (vo.getScoreTemplateVersion() != null) {
|
if (vo.getScoreTemplateVersion() != null) {
|
||||||
scoreTemplateVersion.set(vo.getScoreTemplateVersion());
|
scoreTemplateVersion.set(vo.getScoreTemplateVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<VBox prefHeight="400.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
<VBox prefHeight="400.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
fx:controller="com.ecep.contract.manager.cloud.tyc.CloudTycManagerWindowController">
|
fx:controller="com.ecep.contract.controller.cloud.tyc.CloudTycManagerWindowController">
|
||||||
<children>
|
<children>
|
||||||
<MenuBar VBox.vgrow="NEVER">
|
<MenuBar VBox.vgrow="NEVER">
|
||||||
<menus>
|
<menus>
|
||||||
@@ -39,7 +39,6 @@
|
|||||||
</Menu>
|
</Menu>
|
||||||
<Menu mnemonicParsing="false" text="Help">
|
<Menu mnemonicParsing="false" text="Help">
|
||||||
<items>
|
<items>
|
||||||
<MenuItem mnemonicParsing="false" onAction="#onDateTransferAction" text="数据迁移"/>
|
|
||||||
<MenuItem mnemonicParsing="false" text="About MyHelloApp"/>
|
<MenuItem mnemonicParsing="false" text="About MyHelloApp"/>
|
||||||
</items>
|
</items>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|||||||
@@ -9,37 +9,41 @@
|
|||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import org.controlsfx.control.ToggleSwitch?>
|
<?import org.controlsfx.control.ToggleSwitch?>
|
||||||
|
|
||||||
<VBox prefHeight="400.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ecep.contract.manager.cloud.u8.YongYouU8ConfigWindowController">
|
<VBox prefHeight="400.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="com.ecep.contract.controller.cloud.u8.YongYouU8ConfigWindowController">
|
||||||
<children>
|
<children>
|
||||||
<GridPane>
|
<GridPane>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="50.0" prefWidth="250.0" />
|
<ColumnConstraints halignment="RIGHT" hgrow="SOMETIMES" minWidth="50.0" prefWidth="250.0"/>
|
||||||
<ColumnConstraints fillWidth="false" halignment="RIGHT" hgrow="NEVER" maxWidth="5.0" minWidth="5.0" prefWidth="5.0" />
|
<ColumnConstraints fillWidth="false" halignment="RIGHT" hgrow="NEVER" maxWidth="5.0" minWidth="5.0"
|
||||||
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
|
prefWidth="5.0"/>
|
||||||
|
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints fillHeight="false" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints fillHeight="false" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints fillHeight="false" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints fillHeight="false" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints fillHeight="false" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints fillHeight="false" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints fillHeight="false" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints fillHeight="false" minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="同步时公司未创建时, 公司开发日期在此之后的自动创建" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
<Label text="同步时公司未创建时, 公司开发日期在此之后的自动创建" GridPane.columnIndex="2"
|
||||||
<DatePicker fx:id="auto_create_company_after" GridPane.columnIndex="2" />
|
GridPane.rowIndex="1"/>
|
||||||
<Label text="cloud.u8.contract.latestDate" GridPane.rowIndex="4" />
|
<DatePicker fx:id="auto_create_company_after" GridPane.columnIndex="2"/>
|
||||||
<TextField fx:id="contract_latest_date" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
<Label text="cloud.u8.contract.latestDate" GridPane.rowIndex="4"/>
|
||||||
<Label text="cloud.u8.contract.latestId" GridPane.rowIndex="5" />
|
<TextField fx:id="contract_latest_date" GridPane.columnIndex="2" GridPane.rowIndex="4"/>
|
||||||
<TextField fx:id="contract_latest_id" GridPane.columnIndex="2" GridPane.rowIndex="5" />
|
<Label text="cloud.u8.contract.latestId" GridPane.rowIndex="5"/>
|
||||||
<Label text="cloud.u8.sync.elapse" GridPane.rowIndex="6" />
|
<TextField fx:id="contract_latest_id" GridPane.columnIndex="2" GridPane.rowIndex="5"/>
|
||||||
<TextField fx:id="sync_elapse" GridPane.columnIndex="2" GridPane.rowIndex="6" />
|
<Label text="cloud.u8.sync.elapse" GridPane.rowIndex="6"/>
|
||||||
<Label text="创建在此之后日期的公司" />
|
<TextField fx:id="sync_elapse" GridPane.columnIndex="2" GridPane.rowIndex="6"/>
|
||||||
<ToggleSwitch fx:id="use_latest_id" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
<Label text="创建在此之后日期的公司"/>
|
||||||
<Label text="使用latestId同步" GridPane.rowIndex="2" />
|
<ToggleSwitch fx:id="use_latest_id" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
|
||||||
<Label text="合同同步时是否使用最后更新的Id来判断更新范围,否则使用最后更新的合同日期来判断更新范围" GridPane.columnIndex="2" GridPane.rowIndex="3" />
|
<Label text="使用latestId同步" GridPane.rowIndex="2"/>
|
||||||
|
<Label text="合同同步时是否使用最后更新的Id来判断更新范围,否则使用最后更新的合同日期来判断更新范围"
|
||||||
|
GridPane.columnIndex="2" GridPane.rowIndex="3"/>
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -61,9 +61,10 @@
|
|||||||
<TableColumn fx:id="idColumn" prefWidth="75.0" text="ID"/>
|
<TableColumn fx:id="idColumn" prefWidth="75.0" text="ID"/>
|
||||||
<TableColumn fx:id="companyColumn" prefWidth="200.0" text="公司"/>
|
<TableColumn fx:id="companyColumn" prefWidth="200.0" text="公司"/>
|
||||||
<TableColumn fx:id="latestUpdateColumn" prefWidth="160.0" text="更新日期"/>
|
<TableColumn fx:id="latestUpdateColumn" prefWidth="160.0" text="更新日期"/>
|
||||||
<TableColumn fx:id="cloudIdColumn" prefWidth="150.0" text="平台编号"/>
|
<TableColumn fx:id="cloudLatestColumn" prefWidth="160.0" text="平台更新日期"/>
|
||||||
<TableColumn fx:id="cloudLatestColumn" prefWidth="160.0"
|
<TableColumn fx:id="cloudVendorUpdateDateColumn" prefWidth="160.0" text="供方更新日期"/>
|
||||||
text="平台更新日期"/>
|
<TableColumn fx:id="cloudCustomerUpdateDateColumn" prefWidth="160.0" text="客户更新日期"/>
|
||||||
|
<TableColumn fx:id="activeColumn" text="启用"/>
|
||||||
<TableColumn fx:id="descriptionColumn" text="Description"/>
|
<TableColumn fx:id="descriptionColumn" text="Description"/>
|
||||||
</columns>
|
</columns>
|
||||||
</TableView>
|
</TableView>
|
||||||
|
|||||||
@@ -22,14 +22,5 @@
|
|||||||
<TableColumn fx:id="bankAccountTable_openingBankColumn" prefWidth="300" text="开户行"/>
|
<TableColumn fx:id="bankAccountTable_openingBankColumn" prefWidth="300" text="开户行"/>
|
||||||
<TableColumn fx:id="bankAccountTable_accountColumn" prefWidth="300.0" text="账号"/>
|
<TableColumn fx:id="bankAccountTable_accountColumn" prefWidth="300.0" text="账号"/>
|
||||||
</columns>
|
</columns>
|
||||||
<contextMenu>
|
|
||||||
<ContextMenu>
|
|
||||||
<items>
|
|
||||||
<MenuItem fx:id="bankAccountTable_menu_refresh" mnemonicParsing="false" text="刷新"/>
|
|
||||||
<MenuItem fx:id="bankAccountTable_menu_add" mnemonicParsing="false" text="新建"/>
|
|
||||||
<MenuItem fx:id="bankAccountTable_menu_del" mnemonicParsing="false" text="删除"/>
|
|
||||||
</items>
|
|
||||||
</ContextMenu>
|
|
||||||
</contextMenu>
|
|
||||||
</TableView>
|
</TableView>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
@@ -1,88 +1,75 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.control.CheckBox?>
|
||||||
<ScrollPane fitToWidth="true" minHeight="300.0" minWidth="400.0" xmlns="http://javafx.com/javafx/22"
|
<?import javafx.scene.control.Hyperlink?>
|
||||||
xmlns:fx="http://javafx.com/fxml/1"
|
<?import javafx.scene.control.Label?>
|
||||||
fx:controller="com.ecep.contract.controller.tab.CompanyTabSkinOther">
|
<?import javafx.scene.control.ScrollPane?>
|
||||||
|
<?import javafx.scene.control.TextField?>
|
||||||
|
<?import javafx.scene.control.TitledPane?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
|
<ScrollPane fitToWidth="true" minHeight="300.0" minWidth="400.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ecep.contract.controller.tab.CompanyTabSkinOther">
|
||||||
<content>
|
<content>
|
||||||
<VBox spacing="5.0">
|
<VBox spacing="5.0">
|
||||||
<children>
|
<children>
|
||||||
<TitledPane fx:id="rkCloudPane" animated="false" collapsible="false" text="集团相关方平台"
|
<TitledPane fx:id="rkCloudPane" animated="false" collapsible="false" text="集团相关方平台" VBox.vgrow="NEVER">
|
||||||
VBox.vgrow="NEVER">
|
|
||||||
<content>
|
<content>
|
||||||
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
|
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0"
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
minWidth="80.0" prefWidth="120.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="220.0" />
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0"
|
<ColumnConstraints halignment="CENTER" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
prefWidth="220.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="220.0" />
|
||||||
<ColumnConstraints halignment="CENTER" maxWidth="200.0" minWidth="80.0"
|
|
||||||
prefWidth="120.0"/>
|
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0"
|
|
||||||
prefWidth="220.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="记录编号"/>
|
<Label text="记录编号" />
|
||||||
<TextField fx:id="cloudRkIdField" editable="false" text="-" GridPane.columnIndex="1"/>
|
<TextField fx:id="cloudRkIdField" editable="false" text="-" GridPane.columnIndex="1" />
|
||||||
<Label text="平台编号" GridPane.columnIndex="2"/>
|
<Label text="平台编号" GridPane.columnIndex="2" />
|
||||||
<TextField fx:id="cloudRkCloudIdField" layoutX="255.0" layoutY="14.0" text="-"
|
<TextField fx:id="cloudRkCloudIdField" layoutX="255.0" layoutY="14.0" text="-" GridPane.columnIndex="3" />
|
||||||
GridPane.columnIndex="3"/>
|
<Label text="更新日期" GridPane.columnIndex="2" GridPane.rowIndex="7" />
|
||||||
<Label text="更新日期" GridPane.columnIndex="2" GridPane.rowIndex="7"/>
|
<TextField fx:id="cloudRkLatestField" editable="false" layoutX="255.0" layoutY="44.0" text="-" GridPane.columnIndex="3" GridPane.rowIndex="7" />
|
||||||
<TextField fx:id="cloudRkLatestField" editable="false" layoutX="255.0" layoutY="44.0"
|
<Label text="客户评级" GridPane.rowIndex="2" />
|
||||||
text="-" GridPane.columnIndex="3" GridPane.rowIndex="7"/>
|
<TextField fx:id="cloudRkCustomerGradeField" editable="false" text="-" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
||||||
<Label text="客户评级" GridPane.rowIndex="2"/>
|
<Label text="客户得分" GridPane.rowIndex="3" />
|
||||||
<TextField fx:id="cloudRkCustomerGradeField" editable="false" text="-"
|
<TextField fx:id="cloudRkCustomerScoreField" editable="false" text="-" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
<Label text="企业资信评级" GridPane.rowIndex="1" />
|
||||||
<Label text="客户得分" GridPane.rowIndex="3"/>
|
<TextField fx:id="cloudRkCreditRankField" editable="false" text="-" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||||
<TextField fx:id="cloudRkCustomerScoreField" editable="false" text="-"
|
<Label layoutX="44.0" layoutY="58.0" text="企业资信评级说明" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="3"/>
|
<TextField fx:id="cloudRkCreditRankDescriptionField" editable="false" layoutX="140.0" layoutY="54.0" text="-" GridPane.columnIndex="3" GridPane.rowIndex="1" />
|
||||||
<Label text="企业资信评级" GridPane.rowIndex="1"/>
|
<Label text="平台更新日期" GridPane.rowIndex="5" />
|
||||||
<TextField fx:id="cloudRkCreditRankField" editable="false" text="-"
|
<TextField fx:id="cloudRkCloudLatestField" editable="false" text="-" GridPane.columnIndex="1" GridPane.rowIndex="5" />
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
<Label text="黑名单更新日期" GridPane.rowIndex="7" />
|
||||||
<Label layoutX="44.0" layoutY="58.0" text="企业资信评级说明" GridPane.columnIndex="2"
|
<TextField fx:id="cloudRkBlackListUpdatedField" editable="false" text="-" GridPane.columnIndex="1" GridPane.rowIndex="7" />
|
||||||
GridPane.rowIndex="1"/>
|
<Label text="供方评级" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
||||||
<TextField fx:id="cloudRkCreditRankDescriptionField" editable="false" layoutX="140.0"
|
<TextField fx:id="cloudRkVendorGradeField" editable="false" text="-" GridPane.columnIndex="3" GridPane.rowIndex="2" />
|
||||||
layoutY="54.0" text="-" GridPane.columnIndex="3" GridPane.rowIndex="1"/>
|
<Label text="供方得分" GridPane.columnIndex="2" GridPane.rowIndex="3" />
|
||||||
<Label text="平台更新日期" GridPane.rowIndex="5"/>
|
<TextField fx:id="cloudRkVendorScoreField" editable="false" text="-" GridPane.columnIndex="3" GridPane.rowIndex="3" />
|
||||||
<TextField fx:id="cloudRkCloudLatestField" editable="false" text="-"
|
<Label text="工商信息更新日期" wrapText="true" GridPane.rowIndex="6" />
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="5"/>
|
<TextField fx:id="cloudRkEntUpdateField" editable="false" text="-" GridPane.columnIndex="1" GridPane.rowIndex="6" />
|
||||||
<Label text="黑名单更新日期" GridPane.rowIndex="7"/>
|
<Label fx:id="cloudRkVersionLabel" text="\@Version" GridPane.rowIndex="8" />
|
||||||
<TextField fx:id="cloudRkBlackListUpdatedField" editable="false" text="-"
|
<Button mnemonicParsing="false" onAction="#onCloudRkUpdateButtonClickedAction" text="从平台更新" GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.rowIndex="8" />
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="7"/>
|
<CheckBox fx:id="cloudRkAutoUpdateField" mnemonicParsing="false" text="自动更新" GridPane.columnIndex="1" GridPane.rowIndex="8" />
|
||||||
<Label text="供方评级" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
|
<Label text="客户评级说明" GridPane.rowIndex="4" />
|
||||||
<TextField fx:id="cloudRkVendorGradeField" editable="false" text="-"
|
<Label text="供方评级说明" GridPane.columnIndex="2" GridPane.rowIndex="4" />
|
||||||
GridPane.columnIndex="3" GridPane.rowIndex="2"/>
|
<TextField fx:id="cloudRkCustomerDescriptionField" editable="false" text="-" GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
||||||
<Label text="供方得分" GridPane.columnIndex="2" GridPane.rowIndex="3"/>
|
<TextField fx:id="cloudRkVendorDescriptionField" editable="false" text="-" GridPane.columnIndex="3" GridPane.rowIndex="4" />
|
||||||
<TextField fx:id="cloudRkVendorScoreField" editable="false" text="-"
|
|
||||||
GridPane.columnIndex="3" GridPane.rowIndex="3"/>
|
|
||||||
<Label text="工商信息更新日期" wrapText="true" GridPane.rowIndex="6"/>
|
|
||||||
<TextField fx:id="cloudRkEntUpdateField" editable="false" text="-"
|
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="6"/>
|
|
||||||
<Label fx:id="cloudRkVersionLabel" text="\@Version" GridPane.rowIndex="8"/>
|
|
||||||
<Button mnemonicParsing="false" onAction="#onCloudRkUpdateButtonClickedAction"
|
|
||||||
text="从平台更新" GridPane.columnIndex="3" GridPane.halignment="RIGHT"
|
|
||||||
GridPane.rowIndex="8"/>
|
|
||||||
<CheckBox fx:id="cloudRkAutoUpdateField" mnemonicParsing="false" text="自动更新"
|
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="8"/>
|
|
||||||
<Label text="客户评级说明" GridPane.rowIndex="4"/>
|
|
||||||
<Label text="供方评级说明" GridPane.columnIndex="2" GridPane.rowIndex="4"/>
|
|
||||||
<TextField fx:id="cloudRkCustomerDescriptionField" editable="false" text="-"
|
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
|
||||||
<TextField fx:id="cloudRkVendorDescriptionField" editable="false" text="-"
|
|
||||||
GridPane.columnIndex="3" GridPane.rowIndex="4"/>
|
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</content>
|
</content>
|
||||||
@@ -91,43 +78,34 @@
|
|||||||
<content>
|
<content>
|
||||||
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
|
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0"
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
minWidth="80.0" prefWidth="120.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="220.0" />
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0"
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
prefWidth="220.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="220.0" />
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0"
|
|
||||||
minWidth="80.0" prefWidth="120.0"/>
|
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0"
|
|
||||||
prefWidth="220.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="记录编号"/>
|
<Label text="记录编号" />
|
||||||
<Label text="平台编号" GridPane.columnIndex="2"/>
|
<Label text="平台编号" GridPane.columnIndex="2" />
|
||||||
<Label text="天眼评分" GridPane.rowIndex="1"/>
|
<Label text="天眼评分" GridPane.rowIndex="1" />
|
||||||
<TextField fx:id="cloudTycIdField" editable="false" text="-" GridPane.columnIndex="1"/>
|
<TextField fx:id="cloudTycIdField" editable="false" text="-" GridPane.columnIndex="1" />
|
||||||
<TextField fx:id="cloudTycCloudIdField" text="-" GridPane.columnIndex="3"/>
|
<TextField fx:id="cloudTycCloudIdField" text="-" GridPane.columnIndex="3" />
|
||||||
<TextField fx:id="cloudTycLatestField" editable="false" layoutX="255.0" layoutY="44.0"
|
<TextField fx:id="cloudTycLatestField" editable="false" layoutX="255.0" layoutY="44.0" text="-" GridPane.columnIndex="3" GridPane.rowIndex="2" />
|
||||||
text="-" GridPane.columnIndex="3" GridPane.rowIndex="2"/>
|
<Label text="更新日期" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
||||||
<Label text="更新日期" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
|
<TextField fx:id="tycCloudPaneCloudScore" text="-" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||||
<TextField fx:id="tycCloudPaneCloudScore" text="-" GridPane.columnIndex="1"
|
<Hyperlink onAction="#onTycCloudPaneHyperLinkClickedAction" text="浏览器打开" GridPane.columnIndex="3" GridPane.halignment="RIGHT" />
|
||||||
GridPane.rowIndex="1"/>
|
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="3">
|
||||||
<Hyperlink onAction="#onTycCloudPaneHyperLinkClickedAction" text="浏览器打开"
|
|
||||||
GridPane.columnIndex="3" GridPane.halignment="RIGHT"/>
|
|
||||||
<HBox alignment="CENTER_RIGHT" spacing="5.0" GridPane.columnIndex="1"
|
|
||||||
GridPane.columnSpan="3" GridPane.rowIndex="3">
|
|
||||||
<children>
|
<children>
|
||||||
<Button mnemonicParsing="false" onAction="#onCloudTycUpdateButtonClickedAction"
|
<Button mnemonicParsing="false" onAction="#onCloudTycUpdateButtonClickedAction" text="更新" />
|
||||||
text="更新"/>
|
<Button fx:id="tycCloudPaneSaveButton" mnemonicParsing="false" text="保存" />
|
||||||
<Button fx:id="tycCloudPaneSaveButton" mnemonicParsing="false" text="保存"/>
|
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
<Label fx:id="cloudTycVersionLabel" text="\@Version" GridPane.rowIndex="3"/>
|
<Label fx:id="cloudTycVersionLabel" text="\@Version" GridPane.rowIndex="3" />
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</content>
|
</content>
|
||||||
@@ -136,33 +114,30 @@
|
|||||||
<content>
|
<content>
|
||||||
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
|
<GridPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0"
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
minWidth="80.0" prefWidth="120.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="220.0" />
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0"
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
prefWidth="220.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="220.0" />
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0"
|
|
||||||
minWidth="80.0" prefWidth="120.0"/>
|
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0"
|
|
||||||
prefWidth="220.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="记录编号"/>
|
<Label text="记录编号" />
|
||||||
<TextField fx:id="cloudYuIdField" editable="false" text="-" GridPane.columnIndex="1"/>
|
<TextField fx:id="cloudYuIdField" editable="false" text="-" GridPane.columnIndex="1" />
|
||||||
<Label text="U8编号" GridPane.columnIndex="2"/>
|
<Label text="更新日期" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
||||||
<TextField fx:id="cloudYuCloudIdField" text="-" GridPane.columnIndex="3"/>
|
<TextField fx:id="cloudYuLatestField" editable="false" text="-" GridPane.columnIndex="3" GridPane.rowIndex="2" />
|
||||||
<Label text="客户编号" GridPane.rowIndex="1"/>
|
<Button fx:id="yuCloudPaneSaveButton" mnemonicParsing="false" text="更新" GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.rowIndex="3" />
|
||||||
<Label text="更新日期" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
|
<Label fx:id="cloudYuVersionLabel" text="\@Version" GridPane.rowIndex="3" />
|
||||||
<TextField fx:id="cloudYuLatestField" editable="false" text="-" GridPane.columnIndex="3"
|
<Label text="供方更新" GridPane.rowIndex="1" />
|
||||||
GridPane.rowIndex="2"/>
|
<Label text="客户更新" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
||||||
<Button fx:id="yuCloudPaneSaveButton" mnemonicParsing="false" text="更新"
|
<TextField fx:id="cloudYuVendorUpdateDateField" editable="false" text="-" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||||
GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.rowIndex="3"/>
|
<TextField fx:id="cloudYuCustomerUpdateDateField" editable="false" text="-" GridPane.columnIndex="3" GridPane.rowIndex="1" />
|
||||||
<Label fx:id="cloudYuVersionLabel" text="\@Version" GridPane.rowIndex="3"/>
|
<Label text="启用" GridPane.rowIndex="2" />
|
||||||
|
<CheckBox fx:id="cloudYuActiveField" mnemonicParsing="false" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</content>
|
</content>
|
||||||
@@ -171,30 +146,23 @@
|
|||||||
<content>
|
<content>
|
||||||
<GridPane>
|
<GridPane>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0"
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
minWidth="80.0" prefWidth="120.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="220.0" />
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0"
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0" minWidth="80.0" prefWidth="120.0" />
|
||||||
prefWidth="220.0"/>
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0" prefWidth="220.0" />
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="200.0"
|
|
||||||
minWidth="80.0" prefWidth="120.0"/>
|
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="100.0"
|
|
||||||
prefWidth="220.0"/>
|
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="记录编号"/>
|
<Label text="记录编号" />
|
||||||
<TextField fx:id="extendInfoIdField" editable="false" text="-"
|
<TextField fx:id="extendInfoIdField" editable="false" text="-" GridPane.columnIndex="1" />
|
||||||
GridPane.columnIndex="1"/>
|
<Button fx:id="extendInfoPaneSaveButton" mnemonicParsing="false" text="更新" GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
|
||||||
<Button fx:id="extendInfoPaneSaveButton" mnemonicParsing="false" text="更新"
|
<Label fx:id="extendInfoVersionLabel" text="\@Version" GridPane.rowIndex="2" />
|
||||||
GridPane.columnIndex="3" GridPane.halignment="RIGHT" GridPane.rowIndex="2"/>
|
<CheckBox fx:id="extendInfoDisableVerifyField" mnemonicParsing="false" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||||
<Label fx:id="extendInfoVersionLabel" text="\@Version" GridPane.rowIndex="2"/>
|
<Label text="禁用核验" GridPane.rowIndex="1" />
|
||||||
<CheckBox fx:id="extendInfoDisableVerifyField" mnemonicParsing="false"
|
|
||||||
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
|
||||||
<Label text="禁用核验" GridPane.rowIndex="1"/>
|
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</content>
|
</content>
|
||||||
@@ -203,6 +171,6 @@
|
|||||||
</VBox>
|
</VBox>
|
||||||
</content>
|
</content>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0"/>
|
<Insets bottom="8.0" left="8.0" right="8.0" top="8.0" />
|
||||||
</padding>
|
</padding>
|
||||||
</ScrollPane>
|
</ScrollPane>
|
||||||
|
|||||||
@@ -22,8 +22,9 @@
|
|||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
<VBox prefHeight="800.0" prefWidth="1280.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
<VBox prefHeight="800.0" prefWidth="1280.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
||||||
fx:controller="com.ecep.contract.controller.customer.CompanyCustomerEvaluationFormFileWindowController">
|
fx:controller="com.ecep.contract.controller.customer.CompanyCustomerEvaluationFormFileWindowController">
|
||||||
<children>
|
<children>
|
||||||
<MenuBar>
|
<MenuBar>
|
||||||
<menus>
|
<menus>
|
||||||
@@ -209,7 +210,7 @@ fx:controller="com.ecep.contract.controller.customer.CompanyCustomerEvaluationFo
|
|||||||
<Label text="★★★★≤200分,★★★≤150分,★★≤100分,★≤60分" />
|
<Label text="★★★★≤200分,★★★≤150分,★★≤100分,★≤60分" />
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
<Button mnemonicParsing="false" text="保存" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="10" />
|
<Button fx:id="saveBtn" mnemonicParsing="false" text="保存" GridPane.columnIndex="1" GridPane.halignment="CENTER" GridPane.rowIndex="10" />
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets right="5.0" />
|
<Insets right="5.0" />
|
||||||
@@ -217,5 +218,15 @@ fx:controller="com.ecep.contract.controller.customer.CompanyCustomerEvaluationFo
|
|||||||
</GridPane>
|
</GridPane>
|
||||||
</items>
|
</items>
|
||||||
</SplitPane>
|
</SplitPane>
|
||||||
|
<HBox alignment="CENTER_LEFT" prefWidth="500.0" spacing="1.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
|
<children>
|
||||||
|
<Pane HBox.hgrow="ALWAYS">
|
||||||
|
<children>
|
||||||
|
<Label fx:id="leftStatusLabel" contentDisplay="TOP" layoutX="3.0" layoutY="8.0" wrapText="true" />
|
||||||
|
</children>
|
||||||
|
</Pane>
|
||||||
|
</children>
|
||||||
|
</HBox>
|
||||||
|
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|||||||
@@ -11,39 +11,49 @@
|
|||||||
<?import javafx.scene.layout.GridPane?>
|
<?import javafx.scene.layout.GridPane?>
|
||||||
<?import javafx.scene.layout.RowConstraints?>
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
|
||||||
<TabPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" tabClosingPolicy="UNAVAILABLE" tabMinWidth="80.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ecep.contract.manager.ds.other.controller.SysConfWindowController">
|
<TabPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0"
|
||||||
|
prefWidth="600.0" tabClosingPolicy="UNAVAILABLE" tabMinWidth="80.0" xmlns="http://javafx.com/javafx/22"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="com.ecep.contract.controller.SysConfWindowController">
|
||||||
<tabs>
|
<tabs>
|
||||||
<Tab text="通用">
|
<Tab text="通用">
|
||||||
<content>
|
<content>
|
||||||
<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">
|
||||||
<children>
|
<children>
|
||||||
<GridPane layoutX="100.0" layoutY="96.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane layoutX="100.0" layoutY="96.0" AnchorPane.leftAnchor="0.0"
|
||||||
|
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="110.0" minWidth="110.0" prefWidth="110.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="110.0" minWidth="110.0"
|
||||||
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="200.0" prefWidth="432.0" />
|
prefWidth="110.0"/>
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="48.0" minWidth="48.0" prefWidth="48.0" />
|
<ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="200.0"
|
||||||
|
prefWidth="432.0"/>
|
||||||
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="48.0" minWidth="48.0"
|
||||||
|
prefWidth="48.0"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="通用的配置选项" GridPane.columnIndex="1" />
|
<Label text="通用的配置选项" GridPane.columnIndex="1"/>
|
||||||
<Label text="合同文件夹" GridPane.rowIndex="1" />
|
<Label text="合同文件夹" GridPane.rowIndex="1"/>
|
||||||
<Label text="Label" GridPane.rowIndex="2" />
|
<Label text="Label" GridPane.rowIndex="2"/>
|
||||||
<Label text="Label" GridPane.rowIndex="3" />
|
<Label text="Label" GridPane.rowIndex="3"/>
|
||||||
<Label text="Label" GridPane.rowIndex="4" />
|
<Label text="Label" GridPane.rowIndex="4"/>
|
||||||
<TextField prefHeight="23.0" prefWidth="251.0" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="2" />
|
<TextField prefHeight="23.0" prefWidth="251.0" GridPane.columnIndex="1"
|
||||||
<TextField GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="3" />
|
GridPane.columnSpan="2" GridPane.rowIndex="2"/>
|
||||||
<TextField GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="4" />
|
<TextField GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="3"/>
|
||||||
<Label fx:id="companyContractPathLabel" text="\\\10.84.209.8\" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
<TextField GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.rowIndex="4"/>
|
||||||
<Button mnemonicParsing="false" onAction="#changeCompanyContractPath" text="更换" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
<Label fx:id="companyContractPathLabel" text="\\\10.84.209.8\" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="1"/>
|
||||||
|
<Button mnemonicParsing="false" onAction="#changeCompanyContractPath" text="更换"
|
||||||
|
GridPane.columnIndex="2" GridPane.rowIndex="1"/>
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
||||||
</padding>
|
</padding>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
@@ -56,30 +66,35 @@
|
|||||||
<children>
|
<children>
|
||||||
<GridPane AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="110.0" minWidth="110.0" prefWidth="110.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="110.0" minWidth="110.0"
|
||||||
<ColumnConstraints hgrow="ALWAYS" minWidth="150.0" prefWidth="460.0" />
|
prefWidth="110.0"/>
|
||||||
|
<ColumnConstraints hgrow="ALWAYS" minWidth="150.0" prefWidth="460.0"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="数据库名称" GridPane.rowIndex="2" />
|
<Label text="数据库名称" GridPane.rowIndex="2"/>
|
||||||
<Label text="数据库IP地址" GridPane.rowIndex="1" />
|
<Label text="数据库IP地址" GridPane.rowIndex="1"/>
|
||||||
<Label text="配置用友U8的数据库信息" GridPane.columnIndex="1" />
|
<Label text="配置用友U8的数据库信息" GridPane.columnIndex="1"/>
|
||||||
<Label text="数据库账户" GridPane.rowIndex="3" />
|
<Label text="数据库账户" GridPane.rowIndex="3"/>
|
||||||
<Label text="数据库账户密码" GridPane.rowIndex="4" />
|
<Label text="数据库账户密码" GridPane.rowIndex="4"/>
|
||||||
<TextField fx:id="u8DataBaseServerHostField" promptText="192.168.1.1" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
<TextField fx:id="u8DataBaseServerHostField" promptText="192.168.1.1"
|
||||||
<TextField fx:id="u8DataBaseCatalogField" promptText="UF_DATA_001_2017" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
|
||||||
<TextField fx:id="u8DataBaseUserNameField" promptText="sa" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
<TextField fx:id="u8DataBaseCatalogField" promptText="UF_DATA_001_2017"
|
||||||
<TextField fx:id="u8DataBasePasswordField" promptText="密码" GridPane.columnIndex="1" GridPane.rowIndex="4" />
|
GridPane.columnIndex="1" GridPane.rowIndex="2"/>
|
||||||
|
<TextField fx:id="u8DataBaseUserNameField" promptText="sa" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="3"/>
|
||||||
|
<TextField fx:id="u8DataBasePasswordField" promptText="密码" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="4"/>
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
||||||
</padding>
|
</padding>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
@@ -92,29 +107,36 @@
|
|||||||
<children>
|
<children>
|
||||||
<GridPane AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="130.0" minWidth="130.0" prefWidth="130.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="130.0" minWidth="130.0"
|
||||||
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="428.0" />
|
prefWidth="130.0"/>
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="48.0" minWidth="48.0" prefWidth="48.0" />
|
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="428.0"/>
|
||||||
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="48.0" minWidth="48.0"
|
||||||
|
prefWidth="48.0"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="供应商的配置选项" GridPane.columnIndex="1" />
|
<Label text="供应商的配置选项" GridPane.columnIndex="1"/>
|
||||||
<Label text="供应商文件夹" GridPane.rowIndex="1" />
|
<Label text="供应商文件夹" GridPane.rowIndex="1"/>
|
||||||
<Label text="供方调查评价表模板" GridPane.rowIndex="2" />
|
<Label text="供方调查评价表模板" GridPane.rowIndex="2"/>
|
||||||
<Label fx:id="vendorPathLabel" text="\\\10.84.209.8\" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
<Label fx:id="vendorPathLabel" text="\\\10.84.209.8\" GridPane.columnIndex="1"
|
||||||
<Label fx:id="vendorEvaluationFormTemplateLabel" text="\\\10.84.209.8\template.xls" textOverrun="CLIP" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
GridPane.rowIndex="1"/>
|
||||||
<Button mnemonicParsing="false" onAction="#changeVendorPath" text="更换" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
<Label fx:id="vendorEvaluationFormTemplateLabel" text="\\\10.84.209.8\template.xls"
|
||||||
<Button mnemonicParsing="false" onAction="#changeVendorEvaluationFormTemplate" text="更换" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
textOverrun="CLIP" wrapText="true" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="2"/>
|
||||||
|
<Button mnemonicParsing="false" onAction="#changeVendorPath" text="更换"
|
||||||
|
GridPane.columnIndex="2" GridPane.rowIndex="1"/>
|
||||||
|
<Button mnemonicParsing="false" onAction="#changeVendorEvaluationFormTemplate"
|
||||||
|
text="更换" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
||||||
</padding>
|
</padding>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
@@ -125,33 +147,43 @@
|
|||||||
<content>
|
<content>
|
||||||
<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">
|
||||||
<children>
|
<children>
|
||||||
<GridPane layoutX="100.0" layoutY="96.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane layoutX="100.0" layoutY="96.0" AnchorPane.leftAnchor="0.0"
|
||||||
|
AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="130.0" minWidth="130.0" prefWidth="130.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="130.0" minWidth="130.0"
|
||||||
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
|
prefWidth="130.0"/>
|
||||||
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="48.0" minWidth="48.0" prefWidth="48.0" />
|
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0"/>
|
||||||
|
<ColumnConstraints halignment="CENTER" hgrow="SOMETIMES" maxWidth="48.0" minWidth="48.0"
|
||||||
|
prefWidth="48.0"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label text="客户的配置选项" GridPane.columnIndex="1" />
|
<Label text="客户的配置选项" GridPane.columnIndex="1"/>
|
||||||
<Label text="客户的文件夹" GridPane.rowIndex="1" />
|
<Label text="客户的文件夹" GridPane.rowIndex="1"/>
|
||||||
<Label text="客户资信评估表模板" GridPane.rowIndex="2" />
|
<Label text="客户资信评估表模板" GridPane.rowIndex="2"/>
|
||||||
<Label text="销售台账目录" GridPane.rowIndex="3" />
|
<Label text="销售台账目录" GridPane.rowIndex="3"/>
|
||||||
<Label fx:id="customerPathLabel" text="\\\10.84.209.8\" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
<Label fx:id="customerPathLabel" text="\\\10.84.209.8\" GridPane.columnIndex="1"
|
||||||
<Label fx:id="customerEvaluationFormTemplateLabel" text="\\\10.84.209.8\template.xls" textOverrun="CLIP" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="2" />
|
GridPane.rowIndex="1"/>
|
||||||
<Button mnemonicParsing="false" onAction="#changeCustomerPath" text="更换" GridPane.columnIndex="2" GridPane.rowIndex="1" />
|
<Label fx:id="customerEvaluationFormTemplateLabel" text="\\\10.84.209.8\template.xls"
|
||||||
<Button mnemonicParsing="false" onAction="#changeCustomerEvaluationFormTemplate" text="更换" GridPane.columnIndex="2" GridPane.rowIndex="2" />
|
textOverrun="CLIP" wrapText="true" GridPane.columnIndex="1"
|
||||||
<Button mnemonicParsing="false" onAction="#changeCustomerSaleBookPath" text="更换" GridPane.columnIndex="2" GridPane.rowIndex="3" />
|
GridPane.rowIndex="2"/>
|
||||||
<Label fx:id="customerSaleBookPathLabel" text="\\\10.84.209.8\" GridPane.columnIndex="1" GridPane.rowIndex="3" />
|
<Button mnemonicParsing="false" onAction="#changeCustomerPath" text="更换"
|
||||||
|
GridPane.columnIndex="2" GridPane.rowIndex="1"/>
|
||||||
|
<Button mnemonicParsing="false" onAction="#changeCustomerEvaluationFormTemplate"
|
||||||
|
text="更换" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
|
||||||
|
<Button mnemonicParsing="false" onAction="#changeCustomerSaleBookPath" text="更换"
|
||||||
|
GridPane.columnIndex="2" GridPane.rowIndex="3"/>
|
||||||
|
<Label fx:id="customerSaleBookPathLabel" text="\\\10.84.209.8\" GridPane.columnIndex="1"
|
||||||
|
GridPane.rowIndex="3"/>
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0"/>
|
||||||
</padding>
|
</padding>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
|
|||||||
@@ -105,9 +105,9 @@
|
|||||||
<contextMenu>
|
<contextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<items>
|
<items>
|
||||||
<MenuItem mnemonicParsing="false" onAction="#onShowContractDetailAction"
|
<MenuItem mnemonicParsing="false" onAction="#onShowContractDetailAction" text="合同详情"/>
|
||||||
text="合同详情"/>
|
|
||||||
<MenuItem mnemonicParsing="false" onAction="#onContractReVerifyAction" text="重新验证"/>
|
<MenuItem mnemonicParsing="false" onAction="#onContractReVerifyAction" text="重新验证"/>
|
||||||
|
<MenuItem mnemonicParsing="false" onAction="#onShowVerifyStatusAction" text="查看状态"/>
|
||||||
</items>
|
</items>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</contextMenu>
|
</contextMenu>
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.ecep.contract;
|
||||||
|
|
||||||
|
public enum ContractFileTypeGroup {
|
||||||
|
/**
|
||||||
|
* 普通文件
|
||||||
|
*/
|
||||||
|
GENERAL,
|
||||||
|
/**
|
||||||
|
* 申请文件
|
||||||
|
*/
|
||||||
|
REQUEST,
|
||||||
|
/**
|
||||||
|
* 审批文件
|
||||||
|
*/
|
||||||
|
APPROVAL,
|
||||||
|
/**
|
||||||
|
* 通知文件
|
||||||
|
*/
|
||||||
|
NOTICE,
|
||||||
|
/**
|
||||||
|
* 其他文件
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.ecep.contract.constant;
|
||||||
|
|
||||||
|
public class ParamConstant {
|
||||||
|
// 操作符常量
|
||||||
|
public static final String KEY_like = "like";
|
||||||
|
public static final String KEY_notLike = "notLike";
|
||||||
|
public static final String KEY_in = "in";
|
||||||
|
public static final String KEY_notIn = "notIn";
|
||||||
|
public static final String KEY_isNotNull = "isNotNull";
|
||||||
|
public static final String KEY_lessThan = "lessThan";
|
||||||
|
public static final String KEY_greaterThan = "greaterThan";
|
||||||
|
public static final String KEY_BETWEEN = "between";
|
||||||
|
public static final String KEY_between_begin = "begin";
|
||||||
|
public static final String KEY_between_end = "end";
|
||||||
|
public static final String KEY_INCLUDE_BEGIN = "includeBegin";
|
||||||
|
public static final String KEY_INCLUDE_END = "includeEnd";
|
||||||
|
public static final String KEY_equal = "equal";
|
||||||
|
|
||||||
|
public static final String KEY_SEARCH_TEXT = "searchText";
|
||||||
|
public static final String KEY_FILTER = "filter";
|
||||||
|
public static final String KEY_OPERATOR = "op";
|
||||||
|
public static final String KEY_CONDITIONS = "conditions";
|
||||||
|
// 新增:统一字段与值的键名、like 配置、between 边界、忽略空值
|
||||||
|
public static final String KEY_FIELD = "field";
|
||||||
|
public static final String KEY_VALUE = "value";
|
||||||
|
// 新增:like 的模式键名
|
||||||
|
public static final String KEY_MODE = "mode";
|
||||||
|
public static final String KEY_CASE_SENSITIVE = "caseSensitive";
|
||||||
|
|
||||||
|
public static final String KEY_IGNORE_NULL = "ignoreNull";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public enum Operator {
|
||||||
|
OR, AND
|
||||||
|
}
|
||||||
|
// 新增:like 模式枚举
|
||||||
|
public enum Mode {
|
||||||
|
CONTAINS,
|
||||||
|
STARTS_WITH,
|
||||||
|
ENDS_WITH
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
package com.ecep.contract.constant;
|
package com.ecep.contract.constant;
|
||||||
|
|
||||||
public class ServiceConstant {
|
public class ServiceConstant {
|
||||||
public static final String KEY_SEARCH_TEXT = "searchText";
|
public static final String COUNT_METHOD_NAME = "count";
|
||||||
|
public static final String FIND_ALL_METHOD_NAME = "findAll";
|
||||||
|
public static final String FIND_BY_ID_METHOD_NAME = "findById";
|
||||||
|
public static final String DELETE_METHOD_NAME = "delete";
|
||||||
|
public static final String SAVE_METHOD_NAME = "save";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,17 @@ import lombok.EqualsAndHashCode;
|
|||||||
public class CloudYuVo extends CloudBasedVo implements CompanyBasedVo, Serializable {
|
public class CloudYuVo extends CloudBasedVo implements CompanyBasedVo, Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private Integer companyId;
|
private Integer companyId;
|
||||||
|
/**
|
||||||
|
* 公司对应供应商角色更新时间戳
|
||||||
|
*/
|
||||||
private LocalDate vendorUpdateDate;
|
private LocalDate vendorUpdateDate;
|
||||||
|
/**
|
||||||
|
* 公司对应客户角色更新时间戳
|
||||||
|
*/
|
||||||
private LocalDate customerUpdateDate;
|
private LocalDate customerUpdateDate;
|
||||||
|
/**
|
||||||
|
* 云端最新更新时间
|
||||||
|
*/
|
||||||
private LocalDateTime cloudLatest;
|
private LocalDateTime cloudLatest;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.ecep.contract.vo;
|
package com.ecep.contract.vo;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -20,20 +22,30 @@ public class CompanyBankAccountVo implements IdentityEntity, CompanyBasedVo, Ser
|
|||||||
* @see BankVo
|
* @see BankVo
|
||||||
*/
|
*/
|
||||||
private Integer bankId;
|
private Integer bankId;
|
||||||
/**
|
|
||||||
* 账号
|
|
||||||
*/
|
|
||||||
private String account;
|
|
||||||
/**
|
/**
|
||||||
* 开户行
|
* 开户行
|
||||||
*/
|
*/
|
||||||
private String openingBank;
|
private String openingBank;
|
||||||
|
/**
|
||||||
|
* 账号
|
||||||
|
*/
|
||||||
|
private String account;
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
*/
|
*/
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDate created;
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
private boolean active = false;
|
private boolean active = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本
|
||||||
|
*/
|
||||||
|
private int version;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package com.ecep.contract.vo;
|
package com.ecep.contract.vo;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import com.ecep.contract.model.IdentityEntity;
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import com.ecep.contract.model.Voable;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,4 +38,5 @@ public class VendorApprovedFileVo implements IdentityEntity, Serializable {
|
|||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,6 @@ import lombok.Data;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 合格供方名录VO类
|
* 合格供方名录VO类
|
||||||
* @see VendorApproved
|
|
||||||
* @see VendorApprovedFileVo
|
* @see VendorApprovedFileVo
|
||||||
* @see VendorApprovedItemVo
|
* @see VendorApprovedItemVo
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2,18 +2,23 @@ package com.ecep.contract;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import com.ecep.contract.constant.ParamConstant;
|
||||||
|
import org.hibernate.query.sqm.tree.domain.SqmBasicValuedSimplePath;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
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 org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.constant.ServiceConstant;
|
|
||||||
import com.ecep.contract.ds.MyRepository;
|
import com.ecep.contract.ds.MyRepository;
|
||||||
|
import com.ecep.contract.model.IdentityEntity;
|
||||||
import com.ecep.contract.model.Voable;
|
import com.ecep.contract.model.Voable;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
import com.ecep.contract.util.SpecificationUtils;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import jakarta.persistence.criteria.Path;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实体服务基类
|
* 实体服务基类
|
||||||
@@ -23,6 +28,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
* @param <VO> VO类型
|
* @param <VO> VO类型
|
||||||
* @param <ID> 主键类型
|
* @param <ID> 主键类型
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
public abstract class EntityService<T extends Voable<VO>, VO, ID> {
|
public abstract class EntityService<T extends Voable<VO>, VO, ID> {
|
||||||
/**
|
/**
|
||||||
* 获取实体数据访问层接口
|
* 获取实体数据访问层接口
|
||||||
@@ -36,50 +42,408 @@ public abstract class EntityService<T extends Voable<VO>, VO, ID> {
|
|||||||
return getRepository().findById(id).orElse(null);
|
return getRepository().findById(id).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建新实体实例
|
||||||
|
* 设置默认值或必要的属性
|
||||||
|
* 实例是游离态的,未存储到数据库
|
||||||
|
*
|
||||||
|
* @return 新实体实例
|
||||||
|
*/
|
||||||
public abstract T createNewEntity();
|
public abstract T createNewEntity();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计所有实体数量
|
||||||
|
*
|
||||||
|
* @return 实体数量
|
||||||
|
*/
|
||||||
public long count() {
|
public long count() {
|
||||||
return getRepository().count();
|
return getRepository().count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据查询规范统计实体数量
|
||||||
|
*
|
||||||
|
* @param spec 查询规范
|
||||||
|
* @return 符合规范的实体数量
|
||||||
|
*/
|
||||||
public long count(Specification<T> spec) {
|
public long count(Specification<T> spec) {
|
||||||
return getRepository().count(spec);
|
return getRepository().count(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据JSON参数节点统计实体数量
|
||||||
|
*
|
||||||
|
* @param paramsNode JSON参数节点
|
||||||
|
* @return 符合参数节点规范的实体数量
|
||||||
|
*/
|
||||||
public long count(JsonNode paramsNode) {
|
public long count(JsonNode paramsNode) {
|
||||||
return getRepository().count(buildParameterSpecification(paramsNode));
|
return count(applyJsonParameter(paramsNode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存实体到数据库
|
||||||
|
*
|
||||||
|
* @param entity 要保存的实体
|
||||||
|
* @return 保存后的实体
|
||||||
|
*/
|
||||||
|
public T save(T entity) {
|
||||||
|
return getRepository().save(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除实体
|
||||||
|
*
|
||||||
|
* @param entity 要删除的实体
|
||||||
|
*/
|
||||||
|
public void delete(T entity) {
|
||||||
|
getRepository().delete(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
protected abstract Specification<T> buildParameterSpecification(JsonNode paramsNode);
|
protected abstract Specification<T> buildParameterSpecification(JsonNode paramsNode);
|
||||||
|
|
||||||
public Page<VO> findAll(JsonNode paramsNode, Pageable pageable) {
|
/**
|
||||||
Specification<T> spec = null;
|
* 应用JSON参数节点到查询规范
|
||||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
*
|
||||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
* @param node JSON参数节点
|
||||||
|
* @return 应用参数节点后的查询规范
|
||||||
|
*/
|
||||||
|
protected Specification<T> applyJsonParameter(JsonNode node) {
|
||||||
|
Specification<T> spec = SpecificationUtils.applySearchText(node, this::getSearchSpecification);
|
||||||
|
JsonNode filterNode = node.get(ParamConstant.KEY_FILTER);
|
||||||
|
if (filterNode != null) {
|
||||||
|
Specification<T> childSpec = buildFilterCondition(filterNode);
|
||||||
|
if (childSpec != null) {
|
||||||
|
spec = SpecificationUtils.and(spec, childSpec);
|
||||||
}
|
}
|
||||||
spec = SpecificationUtils.and(spec, buildParameterSpecification(paramsNode));
|
}
|
||||||
return findAll(spec, pageable).map(T::toVo);
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据JSON参数节点查询所有实体
|
||||||
|
*
|
||||||
|
* @param paramsNode JSON参数节点
|
||||||
|
* @param pageable 分页信息
|
||||||
|
* @return 符合参数节点规范的实体分页结果
|
||||||
|
*/
|
||||||
|
public Page<VO> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||||
|
return findAll(applyJsonParameter(paramsNode), pageable).map(T::toVo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据查询规范查询所有实体
|
||||||
|
*
|
||||||
|
* @param spec 查询规范
|
||||||
|
* @param pageable 分页信息
|
||||||
|
* @return 符合规范的实体分页结果
|
||||||
|
*/
|
||||||
public Page<T> findAll(Specification<T> spec, Pageable pageable) {
|
public Page<T> findAll(Specification<T> spec, Pageable pageable) {
|
||||||
return getRepository().findAll(spec, pageable);
|
return getRepository().findAll(spec, pageable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据查询规范查询所有实体
|
||||||
|
*
|
||||||
|
* @param spec 查询规范
|
||||||
|
* @param sort 排序信息
|
||||||
|
* @return 符合规范的实体列表
|
||||||
|
*/
|
||||||
public List<T> findAll(Specification<T> spec, Sort sort) {
|
public List<T> findAll(Specification<T> spec, Sort sort) {
|
||||||
return getRepository().findAll(spec, sort);
|
return getRepository().findAll(spec, sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Specification<T> buildSearchSpecification(String searchText);
|
/**
|
||||||
|
* 根据搜索文本查询所有实体
|
||||||
|
*
|
||||||
|
* @param searchText 搜索文本
|
||||||
|
* @return 符合搜索文本规范的实体列表
|
||||||
|
*/
|
||||||
|
public List<T> search(String searchText) {
|
||||||
|
Specification<T> spec = getSearchSpecification(searchText);
|
||||||
|
return getRepository().findAll(spec, Pageable.ofSize(10)).getContent();
|
||||||
|
}
|
||||||
|
|
||||||
public Specification<T> getSpecification(String searchText) {
|
/**
|
||||||
|
* 根据搜索文本构建查询规范
|
||||||
|
*
|
||||||
|
* @param searchText 搜索文本
|
||||||
|
* @return 符合搜索文本规范的查询规范
|
||||||
|
*/
|
||||||
|
public Specification<T> getSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
if (!StringUtils.hasText(searchText)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return SpecificationUtils.andWith(searchText, this::buildSearchSpecification);
|
return SpecificationUtils.andWith(searchText, this::buildSearchSpecification);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<T> search(String searchText) {
|
/**
|
||||||
Specification<T> spec = getSpecification(searchText);
|
* 构建搜索规范
|
||||||
return getRepository().findAll(spec, Pageable.ofSize(10)).getContent();
|
*
|
||||||
|
* @param searchText 搜索文本,非空
|
||||||
|
* @return 符合搜索文本规范的查询规范
|
||||||
|
*/
|
||||||
|
protected abstract Specification<T> buildSearchSpecification(String searchText);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建过滤条件规范
|
||||||
|
*
|
||||||
|
* @param filterNode 过滤条件节点
|
||||||
|
* @return 过滤条件规范
|
||||||
|
*/
|
||||||
|
private Specification<T> buildFilterCondition(JsonNode filterNode) {
|
||||||
|
String operatorStr = filterNode.get(ParamConstant.KEY_OPERATOR).asText();
|
||||||
|
|
||||||
|
if (isAndOrOperator(operatorStr)) {
|
||||||
|
if (filterNode.has(ParamConstant.KEY_CONDITIONS)) {
|
||||||
|
JsonNode conditionsNode = filterNode.get(ParamConstant.KEY_CONDITIONS);
|
||||||
|
if (conditionsNode.isArray()) {
|
||||||
|
List<Specification<T>> specs = new java.util.ArrayList<>();
|
||||||
|
|
||||||
|
for (JsonNode conditionNode : conditionsNode) {
|
||||||
|
Specification<T> childSpec = buildFilterCondition(conditionNode);
|
||||||
|
if (childSpec != null) {
|
||||||
|
specs.add(childSpec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!specs.isEmpty()) {
|
||||||
|
ParamConstant.Operator op = ParamConstant.Operator.AND;
|
||||||
|
if (ParamConstant.Operator.OR.name().equalsIgnoreCase(operatorStr)) {
|
||||||
|
op = ParamConstant.Operator.OR;
|
||||||
|
}
|
||||||
|
return (op == ParamConstant.Operator.AND) ? Specification.allOf(specs)
|
||||||
|
: Specification.anyOf(specs);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.debug("filterNode 中没有 conditions 数组");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String field = filterNode.get(ParamConstant.KEY_FIELD).asText();
|
||||||
|
if (!StringUtils.hasText(field)) {
|
||||||
|
log.debug("filterNode 中没有 field 字段");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
field = aliasFor(field, filterNode);
|
||||||
|
|
||||||
|
if (ParamConstant.KEY_equal.equals(operatorStr)) {
|
||||||
|
return buildEqualSpecification(field, filterNode);
|
||||||
|
}
|
||||||
|
if (ParamConstant.KEY_BETWEEN.equals(operatorStr)) {
|
||||||
|
return buildBetweenSpecification(field, filterNode);
|
||||||
|
}
|
||||||
|
if (ParamConstant.KEY_like.equals(operatorStr)) {
|
||||||
|
return buildLikeSpecification(field, filterNode);
|
||||||
|
}
|
||||||
|
if (ParamConstant.KEY_in.equals(operatorStr)) {
|
||||||
|
return buildInSpecification(field, filterNode);
|
||||||
|
}
|
||||||
|
if (ParamConstant.KEY_notIn.equals(operatorStr)) {
|
||||||
|
return buildNotInSpecification(field, filterNode);
|
||||||
|
}
|
||||||
|
if (ParamConstant.KEY_greaterThan.equals(operatorStr)) {
|
||||||
|
return buildGreaterThanSpecification(field, filterNode);
|
||||||
|
}
|
||||||
|
if (ParamConstant.KEY_lessThan.equals(operatorStr)) {
|
||||||
|
return buildLessThanSpecification(field, filterNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为查询字段添加别名
|
||||||
|
*
|
||||||
|
* @param field
|
||||||
|
* @param filterNode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected String aliasFor(String field, JsonNode filterNode) {
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
|
private <X extends Comparable<? super X>> Specification<T> buildLessThanSpecification(String field,
|
||||||
|
JsonNode filterNode) {
|
||||||
|
JsonNode valueNode = filterNode.get(ParamConstant.KEY_VALUE);
|
||||||
|
if (valueNode == null || valueNode.isNull()) {
|
||||||
|
log.debug("lessThan 操作符需要 value 字段");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (root, query, cb) -> {
|
||||||
|
// 支持嵌套属性路径,如 company.id
|
||||||
|
String[] fieldPath = field.split("\\.");
|
||||||
|
Path<?> path = root;
|
||||||
|
for (String segment : fieldPath) {
|
||||||
|
path = path.get(segment);
|
||||||
|
}
|
||||||
|
Class<X> clz = (Class<X>) path.getJavaType();
|
||||||
|
ObjectMapper objectMapper = SpringApp.getBean(ObjectMapper.class);
|
||||||
|
X value = objectMapper.convertValue(valueNode, clz);
|
||||||
|
return cb.lessThan(path.as(clz), value);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Specification<T> buildGreaterThanSpecification(String field, JsonNode filterNode) {
|
||||||
|
// TODO 实现大于操作符的逻辑
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'buildGreaterThanSpecification'");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Specification<T> buildNotInSpecification(String field, JsonNode filterNode) {
|
||||||
|
// TODO 实现 NOT IN 操作符的逻辑
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'buildNotInSpecification'");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Specification<T> buildInSpecification(String field, JsonNode filterNode) {
|
||||||
|
// TODO 实现 IN 操作符的逻辑
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'buildInSpecification'");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Specification<T> buildLikeSpecification(String field, JsonNode filterNode) {
|
||||||
|
JsonNode valueNode = filterNode.get(ParamConstant.KEY_VALUE);
|
||||||
|
if (valueNode == null || !valueNode.isTextual()) {
|
||||||
|
log.debug("LIKE 操作符需要 value 为字符串");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ParamConstant.Mode mode = ParamConstant.Mode.CONTAINS;
|
||||||
|
if (filterNode.has(ParamConstant.KEY_MODE)) {
|
||||||
|
mode = ParamConstant.Mode.valueOf(filterNode.get(ParamConstant.KEY_MODE).asText());
|
||||||
|
}
|
||||||
|
|
||||||
|
String likeValue;
|
||||||
|
switch (mode) {
|
||||||
|
case STARTS_WITH:
|
||||||
|
likeValue = valueNode.asText() + "%";
|
||||||
|
break;
|
||||||
|
case ENDS_WITH:
|
||||||
|
likeValue = "%" + valueNode.asText();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
likeValue = "%" + valueNode.asText() + "%";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return (root, query, cb) -> {
|
||||||
|
// 支持 company.name 这种嵌套属性路径
|
||||||
|
String[] fieldPath = field.split("\\.");
|
||||||
|
Path<?> path = root;
|
||||||
|
for (String segment : fieldPath) {
|
||||||
|
path = path.get(segment);
|
||||||
|
}
|
||||||
|
return cb.like(path.as(String.class), likeValue);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等于操作符的逻辑
|
||||||
|
*
|
||||||
|
* @param field
|
||||||
|
* @param filterNode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Specification<T> buildEqualSpecification(String field, JsonNode filterNode) {
|
||||||
|
// 等于操作符的逻辑
|
||||||
|
JsonNode valueNode = filterNode.get(ParamConstant.KEY_VALUE);
|
||||||
|
if (valueNode == null || valueNode.isNull()) {
|
||||||
|
return (root, query, cb) -> cb.isNull(root.get(field));
|
||||||
|
}
|
||||||
|
return (root, query, cb) -> {
|
||||||
|
// 支持 company.id 这种嵌套属性路径
|
||||||
|
String[] fieldPath = field.split("\\.");
|
||||||
|
Path<?> path = root;
|
||||||
|
for (String segment : fieldPath) {
|
||||||
|
path = path.get(segment);
|
||||||
|
}
|
||||||
|
Class<?> clz = path.getJavaType();
|
||||||
|
if (IdentityEntity.class.isAssignableFrom(clz)) {
|
||||||
|
if (valueNode.isNumber()) {
|
||||||
|
return cb.equal(path.get("id"), valueNode.asInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (valueNode.isObject() && valueNode.has("id")) {
|
||||||
|
JsonNode identity = valueNode.get("id");
|
||||||
|
if (identity.isNumber()) {
|
||||||
|
return cb.equal(path.get("id"), identity.asInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (clz == java.lang.Enum.class) {
|
||||||
|
// 将字符串转换为对应的枚举值
|
||||||
|
clz = ((SqmBasicValuedSimplePath) path).getExpressibleJavaType().getJavaTypeClass();
|
||||||
|
}
|
||||||
|
ObjectMapper objectMapper = SpringApp.getBean(ObjectMapper.class);
|
||||||
|
Object value = null;
|
||||||
|
try {
|
||||||
|
value = objectMapper.convertValue(valueNode, clz);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("field=" + field + ", clz=" + clz.getName() + ", value=" + valueNode, e);
|
||||||
|
}
|
||||||
|
// Object value = valueNode.isTextual() ? valueNode.asText()
|
||||||
|
// : valueNode.isNumber() ? valueNode.numberValue()
|
||||||
|
// : valueNode.isBoolean() ? valueNode.asBoolean() : valueNode;
|
||||||
|
return cb.equal(path, value);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BETWEEN 操作符的逻辑
|
||||||
|
*
|
||||||
|
* @param field
|
||||||
|
* @param filterNode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private <X extends Comparable<? super X>> Specification<T> buildBetweenSpecification(String field,
|
||||||
|
JsonNode filterNode) {
|
||||||
|
// BETWEEN 操作符:要求 value 为数组,且长度=2
|
||||||
|
JsonNode valueNode = filterNode.get(ParamConstant.KEY_VALUE);
|
||||||
|
JsonNode lowNode, highNode;
|
||||||
|
boolean includeBegin = false, includeEnd = false;
|
||||||
|
if (valueNode == null || valueNode.isNull()) {
|
||||||
|
throw new IllegalArgumentException(field + " 的 BETWEEN 操作符需要参数");
|
||||||
|
}
|
||||||
|
if (valueNode.isArray()) {
|
||||||
|
if (valueNode.size() != 2) {
|
||||||
|
throw new IllegalArgumentException(field + " 的 BETWEEN 操作符的 value 数组长度必须为 2");
|
||||||
|
}
|
||||||
|
lowNode = valueNode.get(0);
|
||||||
|
highNode = valueNode.get(1);
|
||||||
|
} else if (valueNode.isObject()) {
|
||||||
|
lowNode = valueNode.get(ParamConstant.KEY_between_begin);
|
||||||
|
highNode = valueNode.get(ParamConstant.KEY_between_end);
|
||||||
|
|
||||||
|
if (valueNode.has(ParamConstant.KEY_INCLUDE_BEGIN)) {
|
||||||
|
includeBegin = valueNode.get(ParamConstant.KEY_INCLUDE_BEGIN).asBoolean();
|
||||||
|
}
|
||||||
|
if (valueNode.has(ParamConstant.KEY_INCLUDE_END)) {
|
||||||
|
includeEnd = valueNode.get(ParamConstant.KEY_INCLUDE_END).asBoolean();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException(field + " 的 BETWEEN 操作符的 value 必须为数组或对象");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lowNode == null || highNode == null || lowNode.isNull() || highNode.isNull()) {
|
||||||
|
throw new IllegalArgumentException(field + " 的 BETWEEN 操作符的 value 数组元素不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (root, query, cb) -> {
|
||||||
|
// 支持嵌套属性路径,如 company.id
|
||||||
|
String[] fieldPath = field.split("\\.");
|
||||||
|
Path<?> path = root;
|
||||||
|
for (String segment : fieldPath) {
|
||||||
|
path = path.get(segment);
|
||||||
|
}
|
||||||
|
Class<X> clz = (Class<X>) path.getJavaType();
|
||||||
|
ObjectMapper objectMapper = SpringApp.getBean(ObjectMapper.class);
|
||||||
|
X lowVal = objectMapper.convertValue(lowNode, clz);
|
||||||
|
X highVal = objectMapper.convertValue(highNode, clz);
|
||||||
|
return cb.between(path.as(clz), lowVal, highVal);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAndOrOperator(String str) {
|
||||||
|
return ParamConstant.Operator.AND.name().equalsIgnoreCase(str)
|
||||||
|
|| ParamConstant.Operator.OR.name().equalsIgnoreCase(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public interface IEntityService<T> {
|
|||||||
* @param searchText 要搜索的文本
|
* @param searchText 要搜索的文本
|
||||||
* @return 规格化查询
|
* @return 规格化查询
|
||||||
*/
|
*/
|
||||||
Specification<T> getSpecification(String searchText);
|
Specification<T> getSearchSpecification(String searchText);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据搜索文本查询列表
|
* 根据搜索文本查询列表
|
||||||
|
|||||||
@@ -1,17 +1,11 @@
|
|||||||
package com.ecep.contract.cloud.rk;
|
package com.ecep.contract.cloud.rk;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.ecep.contract.*;
|
|
||||||
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;
|
||||||
@@ -26,17 +20,19 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.BlackReasonType;
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
|
import com.ecep.contract.IEntityService;
|
||||||
|
import com.ecep.contract.MessageHolder;
|
||||||
|
import com.ecep.contract.QueryService;
|
||||||
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.cloud.CloudInfo;
|
import com.ecep.contract.cloud.CloudInfo;
|
||||||
import com.ecep.contract.ds.company.model.Company;
|
import com.ecep.contract.ds.company.model.Company;
|
||||||
import com.ecep.contract.ds.company.model.CompanyBlackReason;
|
import com.ecep.contract.ds.company.model.CompanyBlackReason;
|
||||||
import com.ecep.contract.ds.company.repository.CompanyBlackReasonRepository;
|
|
||||||
import com.ecep.contract.ds.company.repository.CompanyOldNameRepository;
|
|
||||||
import com.ecep.contract.ds.company.service.CompanyService;
|
import com.ecep.contract.ds.company.service.CompanyService;
|
||||||
import com.ecep.contract.ds.other.model.CloudRk;
|
import com.ecep.contract.ds.other.model.CloudRk;
|
||||||
import com.ecep.contract.ds.other.service.SysConfService;
|
import com.ecep.contract.ds.other.service.SysConfService;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.FileUtils;
|
|
||||||
import com.ecep.contract.util.HttpJsonUtils;
|
|
||||||
import com.ecep.contract.util.MyStringUtils;
|
import com.ecep.contract.util.MyStringUtils;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
import com.ecep.contract.util.SpecificationUtils;
|
||||||
import com.ecep.contract.vo.CloudRkVo;
|
import com.ecep.contract.vo.CloudRkVo;
|
||||||
@@ -53,7 +49,8 @@ import lombok.Data;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "cloud-rk")
|
@CacheConfig(cacheNames = "cloud-rk")
|
||||||
public class CloudRkService implements IEntityService<CloudRk>, QueryService<CloudRkVo>, VoableService<CloudRk, CloudRkVo> {
|
public class CloudRkService extends EntityService<CloudRk, CloudRkVo, Integer>
|
||||||
|
implements IEntityService<CloudRk>, QueryService<CloudRkVo>, VoableService<CloudRk, CloudRkVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CloudRkService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CloudRkService.class);
|
||||||
|
|
||||||
public static final String KEY_PROXY = "cloud.rk.proxy";
|
public static final String KEY_PROXY = "cloud.rk.proxy";
|
||||||
@@ -93,46 +90,41 @@ public class CloudRkService implements IEntityService<CloudRk>, QueryService<Clo
|
|||||||
private boolean nowName;
|
private boolean nowName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysConfService confService;
|
private SysConfService confService;
|
||||||
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private CloudRkRepository cloudRKRepository;
|
private CloudRkRepository cloudRKRepository;
|
||||||
@Autowired
|
|
||||||
private CompanyOldNameRepository companyOldNameRepository;
|
|
||||||
@Autowired
|
|
||||||
private CompanyBlackReasonRepository companyBlackReasonRepository;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CloudRk getById(Integer id) {
|
protected CloudRkRepository getRepository() {
|
||||||
return cloudRKRepository.findById(id).orElse(null);
|
return cloudRKRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
public CloudRkVo findById(Integer id) {
|
public CloudRkVo findById(Integer id) {
|
||||||
return cloudRKRepository.findById(id).map(CloudRk::toVo).orElse(null);
|
return getRepository().findById(id).map(CloudRk::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CloudRkVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
public CloudRk createNewEntity() {
|
||||||
|
return new CloudRk();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<CloudRk> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
Specification<CloudRk> spec = null;
|
Specification<CloudRk> spec = null;
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||||
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "cloudId", "customerGrade", "customerScore", "vendorGrade", "vendorScore", "active", "version", "rank", "description");
|
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "cloudId", "customerGrade", "customerScore",
|
||||||
// 可以根据需要添加更多参数处理
|
"vendorGrade", "vendorScore", "active", "version", "rank", "description");
|
||||||
return findAll(spec, pageable).map(CloudRk::toVo);
|
return spec;
|
||||||
}
|
|
||||||
|
|
||||||
public Page<CloudRk> findAll(Specification<CloudRk> spec, Pageable pageable) {
|
|
||||||
return cloudRKRepository.findAll(spec, pageable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CloudRk> getSpecification(String searchText) {
|
protected Specification<CloudRk> buildSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
Path<Object> company = root.get("company");
|
Path<Object> company = root.get("company");
|
||||||
return builder.or(
|
return builder.or(
|
||||||
@@ -143,6 +135,10 @@ public class CloudRkService implements IEntityService<CloudRk>, QueryService<Clo
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Page<CloudRk> findAll(Specification<CloudRk> spec, Pageable pageable) {
|
||||||
|
return cloudRKRepository.findAll(spec, pageable);
|
||||||
|
}
|
||||||
|
|
||||||
private void toCompanyBlackReasonList(
|
private void toCompanyBlackReasonList(
|
||||||
Company company, BlackReasonType type,
|
Company company, BlackReasonType type,
|
||||||
JsonNode reason, List<CompanyBlackReason> dbReasons,
|
JsonNode reason, List<CompanyBlackReason> dbReasons,
|
||||||
@@ -386,4 +382,5 @@ public class CloudRkService implements IEntityService<CloudRk>, QueryService<Clo
|
|||||||
|
|
||||||
cloudRk.setVersion(vo.getVersion());
|
cloudRk.setVersion(vo.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
@@ -27,6 +28,7 @@ import com.ecep.contract.cloud.CloudInfo;
|
|||||||
import com.ecep.contract.constant.CloudServiceConstant;
|
import com.ecep.contract.constant.CloudServiceConstant;
|
||||||
import com.ecep.contract.ds.company.service.CompanyService;
|
import com.ecep.contract.ds.company.service.CompanyService;
|
||||||
import com.ecep.contract.ds.other.model.CloudTyc;
|
import com.ecep.contract.ds.other.model.CloudTyc;
|
||||||
|
import com.ecep.contract.ds.MyRepository;
|
||||||
import com.ecep.contract.ds.company.model.Company;
|
import com.ecep.contract.ds.company.model.Company;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.MyStringUtils;
|
import com.ecep.contract.util.MyStringUtils;
|
||||||
@@ -35,7 +37,8 @@ import com.ecep.contract.vo.CloudTycVo;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "cloud-tyc")
|
@CacheConfig(cacheNames = "cloud-tyc")
|
||||||
public class CloudTycService implements IEntityService<CloudTyc>, QueryService<CloudTycVo>, VoableService<CloudTyc, CloudTycVo> {
|
public class CloudTycService extends EntityService<CloudTyc, CloudTycVo, Integer>
|
||||||
|
implements IEntityService<CloudTyc>, QueryService<CloudTycVo>, VoableService<CloudTyc, CloudTycVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CloudTycService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CloudTycService.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,12 +52,18 @@ public class CloudTycService implements IEntityService<CloudTyc>, QueryService<C
|
|||||||
return fileName.contains(CloudServiceConstant.TYC_NAME);
|
return fileName.contains(CloudServiceConstant.TYC_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private CloudTycRepository cloudTycRepository;
|
private CloudTycRepository cloudTycRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CloudTyc getById(Integer id) {
|
protected CloudTycRepository getRepository() {
|
||||||
return cloudTycRepository.findById(id).orElse(null);
|
return cloudTycRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloudTyc createNewEntity() {
|
||||||
|
return new CloudTyc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CloudTyc getOrCreateCloudTyc(CloudInfo info) {
|
public CloudTyc getOrCreateCloudTyc(CloudInfo info) {
|
||||||
@@ -163,30 +172,15 @@ public class CloudTycService implements IEntityService<CloudTyc>, QueryService<C
|
|||||||
return cloudTycRepository.findById(id).map(CloudTyc::toVo).orElse(null);
|
return cloudTycRepository.findById(id).map(CloudTyc::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<CloudTyc> findAll(Specification<CloudTyc> spec, PageRequest pageable) {
|
|
||||||
return cloudTycRepository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Page<CloudTyc> findAll(Specification<CloudTyc> spec, Pageable pageable) {
|
|
||||||
return cloudTycRepository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CloudTycVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
protected Specification<CloudTyc> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
Specification<CloudTyc> spec = null;
|
Specification<CloudTyc> spec = null;
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||||
// 可以根据需要添加更多参数处理
|
return spec;
|
||||||
return findAll(spec, pageable).map(CloudTyc::toVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CloudTyc> getSpecification(String searchText) {
|
protected Specification<CloudTyc> buildSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.like(root.get("cloudId"), "%" + searchText + "%");
|
return builder.like(root.get("cloudId"), "%" + searchText + "%");
|
||||||
};
|
};
|
||||||
@@ -227,4 +221,5 @@ public class CloudTycService implements IEntityService<CloudTyc>, QueryService<C
|
|||||||
}
|
}
|
||||||
cloudTyc.setVersion(vo.getVersion());
|
cloudTyc.setVersion(vo.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class ContractGroupSyncTask extends Tasker<Object> implements WebSocketSe
|
|||||||
ContractGroupService service = getContractGroupService();
|
ContractGroupService service = getContractGroupService();
|
||||||
var contractGroup = service.findByCode(groupCode);
|
var contractGroup = service.findByCode(groupCode);
|
||||||
if (contractGroup == null) {
|
if (contractGroup == null) {
|
||||||
var newGroup = service.newContractGroup();
|
var newGroup = service.createNewEntity();
|
||||||
newGroup.setCode(groupCode);
|
newGroup.setCode(groupCode);
|
||||||
newGroup.setName(groupName);
|
newGroup.setName(groupName);
|
||||||
newGroup.setTitle(groupTitle);
|
newGroup.setTitle(groupTitle);
|
||||||
|
|||||||
@@ -9,13 +9,28 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.ds.contract.tasker.AbstContractRepairTasker;
|
import com.ecep.contract.ds.contract.tasker.AbstContractRepairTasker;
|
||||||
|
import com.ecep.contract.service.tasker.WebSocketServerTasker;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用友U8系统-同步全量合同
|
* 用友U8系统-同步全量合同
|
||||||
|
* 通过WebSocket与客户端进行通信,实现合同数据的全量同步
|
||||||
*/
|
*/
|
||||||
public class ContractSyncAllTask extends AbstContractRepairTasker {
|
public class ContractSyncAllTask extends AbstContractRepairTasker implements WebSocketServerTasker {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ContractSyncAllTask.class);
|
private static final Logger logger = LoggerFactory.getLogger(ContractSyncAllTask.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(JsonNode argsNode) {
|
||||||
|
// 初始化任务参数
|
||||||
|
// 在这个方法中可以解析argsNode获取客户端传递的参数
|
||||||
|
updateTitle("初始化合同全量同步任务");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object execute(MessageHolder holder) throws Exception {
|
||||||
|
repair(holder);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void repair(MessageHolder holder) {
|
protected void repair(MessageHolder holder) {
|
||||||
@@ -35,7 +50,7 @@ public class ContractSyncAllTask extends AbstContractRepairTasker {
|
|||||||
try {
|
try {
|
||||||
repairFromCMList(rs, subHolder);
|
repairFromCMList(rs, subHolder);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
updateMessage(e.getMessage());
|
subHolder.error(e.getMessage());
|
||||||
logger.error("data = {}", rs, e);
|
logger.error("data = {}", rs, e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
package com.ecep.contract.cloud.u8;
|
package com.ecep.contract.cloud.u8;
|
||||||
|
|
||||||
import com.ecep.contract.ds.vendor.model.PurchaseOrder;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||||
@@ -11,13 +18,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.ecep.contract.ContractPayWay;
|
import com.ecep.contract.ContractPayWay;
|
||||||
|
import com.ecep.contract.ds.vendor.model.PurchaseOrder;
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Repository
|
@Repository
|
||||||
@@ -36,7 +37,6 @@ public class YongYouU8Repository {
|
|||||||
return jdbcTemplate;
|
return jdbcTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回 U8 系统中 供应商总数
|
* 返回 U8 系统中 供应商总数
|
||||||
*
|
*
|
||||||
@@ -57,11 +57,9 @@ public class YongYouU8Repository {
|
|||||||
"cVCCode,cVenAddress,cast(dVenDevDate as DATE) as venDevDate," +
|
"cVCCode,cVenAddress,cast(dVenDevDate as DATE) as venDevDate," +
|
||||||
"cVenBank, cVenAccount, cCreatePerson,cModifyPerson,dModifyDate " +
|
"cVenBank, cVenAccount, cCreatePerson,cModifyPerson,dModifyDate " +
|
||||||
"from Vendor",
|
"from Vendor",
|
||||||
new ColumnMapRowMapper()
|
new ColumnMapRowMapper());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 以 U8 供应商 的代码查询 供应商
|
* 以 U8 供应商 的代码查询 供应商
|
||||||
*
|
*
|
||||||
@@ -102,8 +100,7 @@ public class YongYouU8Repository {
|
|||||||
"cCCCode,cCusAddress,cast(dCusDevDate as DATE) as cusDevDate," +
|
"cCCCode,cCusAddress,cast(dCusDevDate as DATE) as cusDevDate," +
|
||||||
"cCusBank,cCusAccount, cCreatePerson,cModifyPerson,dModifyDate " +
|
"cCusBank,cCusAccount, cCreatePerson,cModifyPerson,dModifyDate " +
|
||||||
"from Customer",
|
"from Customer",
|
||||||
new ColumnMapRowMapper()
|
new ColumnMapRowMapper());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,30 +143,27 @@ public class YongYouU8Repository {
|
|||||||
return getJdbcTemplate().queryForObject(
|
return getJdbcTemplate().queryForObject(
|
||||||
"select count(*) " +
|
"select count(*) " +
|
||||||
"from CM_Contract_B " +
|
"from CM_Contract_B " +
|
||||||
"where strSetupDate>=? or (dtVaryDate is not null and dtVaryDate>=?)"
|
"where strSetupDate>=? or (dtVaryDate is not null and dtVaryDate>=?)",
|
||||||
, Long.class, latestDate, latestDate);
|
Long.class, latestDate, latestDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream<Map<String, Object>> queryAllContractForStream() {
|
public Stream<Map<String, Object>> queryAllContractForStream() {
|
||||||
return getJdbcTemplate().queryForStream(
|
return getJdbcTemplate().queryForStream(
|
||||||
"select * from CM_List", new ColumnMapRowMapper()
|
"select * from CM_List", new ColumnMapRowMapper());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream<Map<String, Object>> queryAllContractForStream(int latestId) {
|
public Stream<Map<String, Object>> queryAllContractForStream(int latestId) {
|
||||||
return getJdbcTemplate().queryForStream(
|
return getJdbcTemplate().queryForStream(
|
||||||
"select * from CM_List where ID > ?",
|
"select * from CM_List where ID > ?",
|
||||||
new ColumnMapRowMapper(),
|
new ColumnMapRowMapper(),
|
||||||
latestId
|
latestId);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream<Map<String, Object>> queryAllContractForStream(LocalDateTime dateTime) {
|
public Stream<Map<String, Object>> queryAllContractForStream(LocalDateTime dateTime) {
|
||||||
return getJdbcTemplate().queryForStream(
|
return getJdbcTemplate().queryForStream(
|
||||||
"select * from CM_List where dtDate > ?",
|
"select * from CM_List where dtDate > ?",
|
||||||
new ColumnMapRowMapper(),
|
new ColumnMapRowMapper(),
|
||||||
dateTime
|
dateTime);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream<Map<String, Object>> queryAllContractBForStream() {
|
public Stream<Map<String, Object>> queryAllContractBForStream() {
|
||||||
@@ -188,8 +182,7 @@ public class YongYouU8Repository {
|
|||||||
"strPersonID, " +
|
"strPersonID, " +
|
||||||
"dblTotalCurrency,dblExecCurrency,dblTotalQuantity,dblExecQuqantity " +
|
"dblTotalCurrency,dblExecCurrency,dblTotalQuantity,dblExecQuqantity " +
|
||||||
"from CM_Contract_B ",
|
"from CM_Contract_B ",
|
||||||
new ColumnMapRowMapper()
|
new ColumnMapRowMapper());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream<Map<String, Object>> queryAllContractBForStream(LocalDate latestDate) {
|
public Stream<Map<String, Object>> queryAllContractBForStream(LocalDate latestDate) {
|
||||||
@@ -208,8 +201,7 @@ public class YongYouU8Repository {
|
|||||||
"strPersonID, " +
|
"strPersonID, " +
|
||||||
"dblTotalCurrency,dblExecCurrency,dblTotalQuantity,dblExecQuqantity " +
|
"dblTotalCurrency,dblExecCurrency,dblTotalQuantity,dblExecQuqantity " +
|
||||||
"from CM_Contract_B where strSetupDate>=? or (dtVaryDate is not null and dtVaryDate>=?)",
|
"from CM_Contract_B where strSetupDate>=? or (dtVaryDate is not null and dtVaryDate>=?)",
|
||||||
new ColumnMapRowMapper(), latestDate, latestDate
|
new ColumnMapRowMapper(), latestDate, latestDate);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -234,12 +226,12 @@ public class YongYouU8Repository {
|
|||||||
"strPersonID, " +
|
"strPersonID, " +
|
||||||
"dblTotalCurrency,dblExecCurrency,dblTotalQuantity,dblExecQuqantity " +
|
"dblTotalCurrency,dblExecCurrency,dblTotalQuantity,dblExecQuqantity " +
|
||||||
"from CM_Contract_B where strBisectionUnit=? and strWay=?",
|
"from CM_Contract_B where strBisectionUnit=? and strWay=?",
|
||||||
new ColumnMapRowMapper(), unit, payWay.getText()
|
new ColumnMapRowMapper(), unit, payWay.getText());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> queryContractDetail(String guid) {
|
public Map<String, Object> queryContractDetail(String guid) {
|
||||||
return getJdbcTemplate().queryForObject("select GUID,strContractID,strContractName,strContractType,strParentID,strContractKind,strWay," +
|
return getJdbcTemplate().queryForObject(
|
||||||
|
"select GUID,strContractID,strContractName,strContractType,strParentID,strContractKind,strWay," +
|
||||||
"strContractGrp, strContractDesc,strBisectionUnit," +
|
"strContractGrp, strContractDesc,strBisectionUnit," +
|
||||||
// 时间
|
// 时间
|
||||||
"strContractOrderDate,strContractStartDate,strContractEndDate," +
|
"strContractOrderDate,strContractStartDate,strContractEndDate," +
|
||||||
@@ -252,7 +244,8 @@ public class YongYouU8Repository {
|
|||||||
// 业务员
|
// 业务员
|
||||||
"strPersonID, " +
|
"strPersonID, " +
|
||||||
"dblTotalCurrency,dblExecCurrency,dblTotalQuantity,dblExecQuqantity " +
|
"dblTotalCurrency,dblExecCurrency,dblTotalQuantity,dblExecQuqantity " +
|
||||||
" from CM_Contract_B where GUID = ?", new ColumnMapRowMapper(), guid);
|
" from CM_Contract_B where GUID = ?",
|
||||||
|
new ColumnMapRowMapper(), guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -262,9 +255,12 @@ public class YongYouU8Repository {
|
|||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> sumContractExec(String code) {
|
public Map<String, Object> sumContractExec(String code) {
|
||||||
return getJdbcTemplate().queryForObject("select sum(decCount) as execQuantity, sum(decRateMoney) as execAmount, sum(decNoRateMoney) as execUnTaxAmount " +
|
return getJdbcTemplate().queryForObject(
|
||||||
|
"select sum(decCount) as execQuantity, sum(decRateMoney) as execAmount, sum(decNoRateMoney) as execUnTaxAmount "
|
||||||
|
+
|
||||||
"from CM_ExecInterface " +
|
"from CM_ExecInterface " +
|
||||||
"where cContractID = ?;", new ColumnMapRowMapper(), code);
|
"where cContractID = ?;",
|
||||||
|
new ColumnMapRowMapper(), code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> findAllContractExecByContractCode(String code) {
|
public List<Map<String, Object>> findAllContractExecByContractCode(String code) {
|
||||||
@@ -293,7 +289,6 @@ public class YongYouU8Repository {
|
|||||||
" from PO_Pomain where POID = ?", new ColumnMapRowMapper(), code);
|
" from PO_Pomain where POID = ?", new ColumnMapRowMapper(), code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购合同项
|
* 采购合同项
|
||||||
*
|
*
|
||||||
@@ -321,7 +316,9 @@ public class YongYouU8Repository {
|
|||||||
* @return Map<String, Object>
|
* @return Map<String, Object>
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> queryInventoryDetail(String code) {
|
public Map<String, Object> queryInventoryDetail(String code) {
|
||||||
return getJdbcTemplate().queryForObject("select I.*, U.cComUnitName from Inventory as I left join ComputationUnit as U on I.cComUnitCode=U.cComunitCode where cInvCode = ?", new ColumnMapRowMapper(), code);
|
return getJdbcTemplate().queryForObject(
|
||||||
|
"select I.*, U.cComUnitName from Inventory as I left join ComputationUnit as U on I.cComUnitCode=U.cComunitCode where cInvCode = ?",
|
||||||
|
new ColumnMapRowMapper(), code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> queryAllPerson() {
|
public List<Map<String, Object>> queryAllPerson() {
|
||||||
@@ -350,13 +347,13 @@ public class YongYouU8Repository {
|
|||||||
return getJdbcTemplate().queryForList("select cCCCode, cCCName, iCCGrade from CustomerClass;");
|
return getJdbcTemplate().queryForList("select cCCCode, cCCName, iCCGrade from CustomerClass;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Map<String, Object>> findAllPurchaseBillVoucherByVendorCode(String code) {
|
public List<Map<String, Object>> findAllPurchaseBillVoucherByVendorCode(String code) {
|
||||||
return getJdbcTemplate().queryForList("select * from PurBillVouch where cVenCode=?", code);
|
return getJdbcTemplate().queryForList("select * from PurBillVouch where cVenCode=?", code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> findPurchaseBillVoucherById(Integer pbvId) {
|
public Map<String, Object> findPurchaseBillVoucherById(Integer pbvId) {
|
||||||
return getJdbcTemplate().queryForObject("select * from PurBillVouch where PBVID = ?", new ColumnMapRowMapper(), pbvId);
|
return getJdbcTemplate().queryForObject("select * from PurBillVouch where PBVID = ?", new ColumnMapRowMapper(),
|
||||||
|
pbvId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> findAllPurchaseBillVoucherItemByPbvId(int pbvId) {
|
public List<Map<String, Object>> findAllPurchaseBillVoucherItemByPbvId(int pbvId) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.Optional;
|
|||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
|
import com.ecep.contract.constant.ParamConstant;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
import com.ecep.contract.util.SpecificationUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -21,13 +22,13 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.cloud.CloudInfo;
|
import com.ecep.contract.cloud.CloudInfo;
|
||||||
import com.ecep.contract.cloud.CloudInfoRepository;
|
import com.ecep.contract.cloud.CloudInfoRepository;
|
||||||
import com.ecep.contract.cloud.u8.ctx.AbstractYongYouU8Ctx;
|
import com.ecep.contract.cloud.u8.ctx.AbstractYongYouU8Ctx;
|
||||||
import com.ecep.contract.constant.ServiceConstant;
|
|
||||||
import com.ecep.contract.ds.company.service.CompanyService;
|
import com.ecep.contract.ds.company.service.CompanyService;
|
||||||
import com.ecep.contract.ds.other.model.CloudYu;
|
import com.ecep.contract.ds.other.model.CloudYu;
|
||||||
import com.ecep.contract.ds.company.model.Company;
|
import com.ecep.contract.ds.company.model.Company;
|
||||||
@@ -38,7 +39,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "cloud-yu")
|
@CacheConfig(cacheNames = "cloud-yu")
|
||||||
public class YongYouU8Service
|
public class YongYouU8Service extends EntityService<CloudYu, CloudYuVo, Integer>
|
||||||
implements IEntityService<CloudYu>, QueryService<CloudYuVo>, VoableService<CloudYu, CloudYuVo> {
|
implements IEntityService<CloudYu>, QueryService<CloudYuVo>, VoableService<CloudYu, CloudYuVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(YongYouU8Service.class);
|
private static final Logger logger = LoggerFactory.getLogger(YongYouU8Service.class);
|
||||||
|
|
||||||
@@ -61,6 +62,11 @@ public class YongYouU8Service
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CloudYuRepository getRepository() {
|
||||||
|
return cloudYuRepository;
|
||||||
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#id")
|
@Cacheable(key = "#id")
|
||||||
public CloudYuVo findById(Integer id) {
|
public CloudYuVo findById(Integer id) {
|
||||||
Optional<CloudYu> optional = cloudYuRepository.findById(id);
|
Optional<CloudYu> optional = cloudYuRepository.findById(id);
|
||||||
@@ -68,8 +74,8 @@ public class YongYouU8Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CloudYu getById(Integer id) {
|
public CloudYu createNewEntity() {
|
||||||
return cloudYuRepository.findById(id).orElse(null);
|
return new CloudYu();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,13 +126,13 @@ public class YongYouU8Service
|
|||||||
* @param cloudYu Cloud Yu 对象
|
* @param cloudYu Cloud Yu 对象
|
||||||
* @return 更新的 Cloud Yu
|
* @return 更新的 Cloud Yu
|
||||||
*/
|
*/
|
||||||
@Caching(evict = {@CacheEvict(key = "#cloudYu.id")})
|
@Caching(evict = { @CacheEvict(key = "#cloudYu.id") })
|
||||||
@Override
|
@Override
|
||||||
public CloudYu save(CloudYu cloudYu) {
|
public CloudYu save(CloudYu cloudYu) {
|
||||||
return cloudYuRepository.save(cloudYu);
|
return cloudYuRepository.save(cloudYu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = {@CacheEvict(key = "#cloudYu.id")})
|
@Caching(evict = { @CacheEvict(key = "#cloudYu.id") })
|
||||||
@Override
|
@Override
|
||||||
public void delete(CloudYu vo) {
|
public void delete(CloudYu vo) {
|
||||||
CloudYu entity = cloudYuRepository.findById(vo.getId()).orElse(null);
|
CloudYu entity = cloudYuRepository.findById(vo.getId()).orElse(null);
|
||||||
@@ -157,26 +163,15 @@ public class YongYouU8Service
|
|||||||
cloudYuRepository.saveAll(list);
|
cloudYuRepository.saveAll(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<CloudYu> findAll(Specification<CloudYu> spec, Pageable pageable) {
|
|
||||||
return cloudYuRepository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CloudYuVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
protected Specification<CloudYu> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
Specification<CloudYu> spec = null;
|
Specification<CloudYu> spec = null;
|
||||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
|
||||||
String searchText = paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText();
|
|
||||||
spec = getSpecification(searchText);
|
|
||||||
}
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||||
return findAll(spec, pageable).map(CloudYu::toVo);
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CloudYu> getSpecification(String searchText) {
|
protected Specification<CloudYu> buildSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.like(root.get("cloudId"), "%" + searchText + "%");
|
return builder.like(root.get("cloudId"), "%" + searchText + "%");
|
||||||
};
|
};
|
||||||
@@ -263,7 +258,7 @@ public class YongYouU8Service
|
|||||||
} else {
|
} else {
|
||||||
cloudYu.setCompany(null);
|
cloudYu.setCompany(null);
|
||||||
}
|
}
|
||||||
|
cloudYu.setActive(vo.isActive());
|
||||||
cloudYu.setVersion(vo.getVersion());
|
cloudYu.setVersion(vo.getVersion());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ecep.contract.ds.company.model;
|
package com.ecep.contract.ds.company.model;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.ecep.contract.model.Bank;
|
import com.ecep.contract.model.Bank;
|
||||||
@@ -9,17 +10,11 @@ import com.ecep.contract.model.Voable;
|
|||||||
import com.ecep.contract.util.HibernateProxyUtils;
|
import com.ecep.contract.util.HibernateProxyUtils;
|
||||||
import com.ecep.contract.vo.CompanyBankAccountVo;
|
import com.ecep.contract.vo.CompanyBankAccountVo;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.*;
|
||||||
import jakarta.persistence.FetchType;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.JoinColumn;
|
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -56,6 +51,24 @@ public class CompanyBankAccount implements IdentityEntity, BasedEntity, CompanyB
|
|||||||
@Column(name = "DESCRIPTION")
|
@Column(name = "DESCRIPTION")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(name = "CREATED")
|
||||||
|
private LocalDate created;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用
|
||||||
|
*/
|
||||||
|
@Column(name = "ACTIVE")
|
||||||
|
private boolean active = false;
|
||||||
|
|
||||||
|
@Version
|
||||||
|
@ColumnDefault("0")
|
||||||
|
@Column(name = "VERSION", nullable = false)
|
||||||
|
@ToString.Exclude
|
||||||
|
private int version;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toPrettyString() {
|
public String toPrettyString() {
|
||||||
return account;
|
return account;
|
||||||
@@ -85,7 +98,9 @@ public class CompanyBankAccount implements IdentityEntity, BasedEntity, CompanyB
|
|||||||
vo.setAccount(getAccount());
|
vo.setAccount(getAccount());
|
||||||
vo.setOpeningBank(getOpeningBank());
|
vo.setOpeningBank(getOpeningBank());
|
||||||
vo.setDescription(getDescription());
|
vo.setDescription(getDescription());
|
||||||
vo.setActive(false); // 默认值
|
vo.setCreated(getCreated());
|
||||||
|
vo.setActive(isActive()); // 默认值
|
||||||
|
vo.setVersion(getVersion());
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,14 @@
|
|||||||
package com.ecep.contract.ds.company.repository;
|
package com.ecep.contract.ds.company.repository;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
||||||
import org.springframework.data.repository.CrudRepository;
|
|
||||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.ecep.contract.ds.MyRepository;
|
||||||
import com.ecep.contract.ds.company.model.CompanyInvoiceInfo;
|
import com.ecep.contract.ds.company.model.CompanyInvoiceInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公司发票信息 Repository
|
* 公司发票信息 Repository
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface CompanyInvoiceInfoRepository extends
|
public interface CompanyInvoiceInfoRepository extends MyRepository<CompanyInvoiceInfo, Integer> {
|
||||||
// JDBC interfaces
|
|
||||||
CrudRepository<CompanyInvoiceInfo, Integer>, PagingAndSortingRepository<CompanyInvoiceInfo, Integer>,
|
|
||||||
// JPA interfaces
|
|
||||||
JpaRepository<CompanyInvoiceInfo, Integer>, JpaSpecificationExecutor<CompanyInvoiceInfo> {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,22 +2,15 @@ package com.ecep.contract.ds.company.repository;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
import org.springframework.data.jpa.repository.Modifying;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
|
||||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.ecep.contract.ds.MyRepository;
|
||||||
import com.ecep.contract.ds.company.model.CompanyOldName;
|
import com.ecep.contract.ds.company.model.CompanyOldName;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface CompanyOldNameRepository extends
|
public interface CompanyOldNameRepository extends MyRepository<CompanyOldName, Integer> {
|
||||||
// JDBC interfaces
|
|
||||||
CrudRepository<CompanyOldName, Integer>, PagingAndSortingRepository<CompanyOldName, Integer>,
|
|
||||||
// JPA interfaces
|
|
||||||
JpaRepository<CompanyOldName, Integer>, JpaSpecificationExecutor<CompanyOldName> {
|
|
||||||
|
|
||||||
List<CompanyOldName> findAllByCompanyId(Integer companyId);
|
List<CompanyOldName> findAllByCompanyId(Integer companyId);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ecep.contract.ds.company.service;
|
package com.ecep.contract.ds.company.service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -7,6 +8,7 @@ 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;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
@@ -16,14 +18,15 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.ds.company.repository.CompanyBankAccountRepository;
|
|
||||||
import com.ecep.contract.ds.other.service.BankService;
|
|
||||||
import com.ecep.contract.ds.company.model.Company;
|
import com.ecep.contract.ds.company.model.Company;
|
||||||
import com.ecep.contract.ds.company.model.CompanyBankAccount;
|
import com.ecep.contract.ds.company.model.CompanyBankAccount;
|
||||||
|
import com.ecep.contract.ds.company.repository.CompanyBankAccountRepository;
|
||||||
|
import com.ecep.contract.ds.other.service.BankService;
|
||||||
import com.ecep.contract.service.ServiceException;
|
import com.ecep.contract.service.ServiceException;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
import com.ecep.contract.util.SpecificationUtils;
|
||||||
@@ -33,13 +36,46 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company-bank-account")
|
@CacheConfig(cacheNames = "company-bank-account")
|
||||||
public class CompanyBankAccountService implements IEntityService<CompanyBankAccount>, QueryService<CompanyBankAccountVo>,
|
public class CompanyBankAccountService
|
||||||
|
extends EntityService<CompanyBankAccount, CompanyBankAccountVo, Integer>
|
||||||
|
implements IEntityService<CompanyBankAccount>, QueryService<CompanyBankAccountVo>,
|
||||||
VoableService<CompanyBankAccount, CompanyBankAccountVo> {
|
VoableService<CompanyBankAccount, CompanyBankAccountVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyBankAccountService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyBankAccountService.class);
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private CompanyBankAccountRepository repository;
|
private CompanyBankAccountRepository repository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CompanyBankAccountRepository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyBankAccount createNewEntity() {
|
||||||
|
return new CompanyBankAccount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Specification<CompanyBankAccount> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
Specification<CompanyBankAccount> spec = null;
|
||||||
|
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Specification<CompanyBankAccount> buildSearchSpecification(String searchText) {
|
||||||
|
return (root, query, builder) -> {
|
||||||
|
return builder.or(
|
||||||
|
builder.and(
|
||||||
|
builder.isNotNull(root.get("bank")),
|
||||||
|
builder.or(
|
||||||
|
builder.like(root.get("bank").get("name"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("bank").get("code"), "%" + searchText + "%"))),
|
||||||
|
builder.like(root.get("openingBank"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("account"), "%" + searchText + "%"));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public CompanyBankAccount findByAccount(Company company, String account) {
|
public CompanyBankAccount findByAccount(Company company, String account) {
|
||||||
return repository.findByCompanyAndAccount(company, account).orElse(null);
|
return repository.findByCompanyAndAccount(company, account).orElse(null);
|
||||||
}
|
}
|
||||||
@@ -56,6 +92,7 @@ public class CompanyBankAccountService implements IEntityService<CompanyBankAcco
|
|||||||
account = new CompanyBankAccount();
|
account = new CompanyBankAccount();
|
||||||
account.setCompany(company);
|
account.setCompany(company);
|
||||||
account.setAccount(bankAccount);
|
account.setAccount(bankAccount);
|
||||||
|
account.setCreated(LocalDate.now());
|
||||||
holder.info("新增银行账户" + bankAccount);
|
holder.info("新增银行账户" + bankAccount);
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
@@ -74,53 +111,26 @@ public class CompanyBankAccountService implements IEntityService<CompanyBankAcco
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
public CompanyBankAccount save(CompanyBankAccount account) {
|
public CompanyBankAccount save(CompanyBankAccount account) {
|
||||||
return repository.save(account);
|
return super.save(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyBankAccount> findAll(Specification<CompanyBankAccount> spec, Sort sort) {
|
@CacheEvict(key = "#p0.id")
|
||||||
return repository.findAll(spec, sort);
|
public void delete(CompanyBankAccount entity) {
|
||||||
|
super.delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
public CompanyBankAccountVo findById(Integer id) {
|
public CompanyBankAccountVo findById(Integer id) {
|
||||||
return repository.findById(id).map(CompanyBankAccount::toVo).orElse(null);
|
return repository.findById(id).map(CompanyBankAccount::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompanyBankAccount getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<CompanyBankAccount> getSpecification(String searchText) {
|
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
|
||||||
return builder.or(
|
|
||||||
builder.and(
|
|
||||||
builder.isNotNull(root.get("bank")),
|
|
||||||
builder.or(
|
|
||||||
builder.like(root.get("bank").get("name"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("bank").get("code"), "%" + searchText + "%"))),
|
|
||||||
builder.like(root.get("openingBank"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("account"), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<CompanyBankAccount> findAll(Specification<CompanyBankAccount> spec, Pageable pageable) {
|
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delete(CompanyBankAccount entity) {
|
|
||||||
repository.delete(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CompanyBankAccount> searchByCompany(Company company, String searchText) {
|
public List<CompanyBankAccount> searchByCompany(Company company, String searchText) {
|
||||||
Specification<CompanyBankAccount> spec = getSpecification(searchText);
|
Specification<CompanyBankAccount> spec = getSearchSpecification(searchText);
|
||||||
if (company != null) {
|
if (company != null) {
|
||||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> {
|
spec = SpecificationUtils.and(spec, (root, query, builder) -> {
|
||||||
return builder.equal(root.get("company"), company);
|
return builder.equal(root.get("company"), company);
|
||||||
@@ -129,17 +139,6 @@ public class CompanyBankAccountService implements IEntityService<CompanyBankAcco
|
|||||||
return repository.findAll(spec, Pageable.ofSize(10)).getContent();
|
return repository.findAll(spec, Pageable.ofSize(10)).getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<CompanyBankAccountVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<CompanyBankAccount> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
|
||||||
return findAll(spec, pageable).map(CompanyBankAccount::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(CompanyBankAccount model, CompanyBankAccountVo vo) {
|
public void updateByVo(CompanyBankAccount model, CompanyBankAccountVo vo) {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
@@ -168,6 +167,8 @@ public class CompanyBankAccountService implements IEntityService<CompanyBankAcco
|
|||||||
model.setBank(null);
|
model.setBank(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 注意:CompanyBankAccount实体类中没有active字段,所以不需要设置
|
model.setCreated(vo.getCreated());
|
||||||
|
model.setActive(vo.isActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.CustomerFileType;
|
import com.ecep.contract.CustomerFileType;
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.VendorFileType;
|
import com.ecep.contract.VendorFileType;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.ds.company.CompanyFileUtils;
|
import com.ecep.contract.ds.company.CompanyFileUtils;
|
||||||
@@ -26,8 +27,9 @@ import com.ecep.contract.model.CompanyBasicFile;
|
|||||||
import com.ecep.contract.ds.customer.model.CompanyCustomerFile;
|
import com.ecep.contract.ds.customer.model.CompanyCustomerFile;
|
||||||
import com.ecep.contract.ds.vendor.model.VendorFile;
|
import com.ecep.contract.ds.vendor.model.VendorFile;
|
||||||
import com.ecep.contract.model.HolidayTable;
|
import com.ecep.contract.model.HolidayTable;
|
||||||
|
import com.ecep.contract.model.Voable;
|
||||||
|
|
||||||
public abstract class CompanyBasicService {
|
public abstract class CompanyBasicService<T extends Voable<VO>, VO> extends EntityService<T, VO, Integer> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyBasicService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyBasicService.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -458,4 +460,6 @@ public abstract class CompanyBasicService {
|
|||||||
*/
|
*/
|
||||||
protected abstract boolean isEvaluationFile(String fileName);
|
protected abstract boolean isEvaluationFile(String fileName);
|
||||||
|
|
||||||
|
public abstract File getBasePath();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,31 +5,28 @@ import java.util.List;
|
|||||||
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;
|
||||||
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.ds.company.repository.CompanyBlackReasonRepository;
|
|
||||||
import com.ecep.contract.ds.company.model.Company;
|
import com.ecep.contract.ds.company.model.Company;
|
||||||
import com.ecep.contract.ds.company.model.CompanyBlackReason;
|
import com.ecep.contract.ds.company.model.CompanyBlackReason;
|
||||||
|
import com.ecep.contract.ds.company.repository.CompanyBlackReasonRepository;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
|
||||||
import com.ecep.contract.vo.CompanyBlackReasonVo;
|
import com.ecep.contract.vo.CompanyBlackReasonVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company-black-reason")
|
@CacheConfig(cacheNames = "company-black-reason")
|
||||||
public class CompanyBlackReasonService
|
public class CompanyBlackReasonService extends EntityService<CompanyBlackReason, CompanyBlackReasonVo, Integer>
|
||||||
implements IEntityService<CompanyBlackReason>, QueryService<CompanyBlackReasonVo>,
|
implements IEntityService<CompanyBlackReason>, QueryService<CompanyBlackReasonVo>,
|
||||||
VoableService<CompanyBlackReason, CompanyBlackReasonVo> {
|
VoableService<CompanyBlackReason, CompanyBlackReasonVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyContactService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyContactService.class);
|
||||||
@@ -37,16 +34,28 @@ public class CompanyBlackReasonService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CompanyBlackReasonRepository repository;
|
private CompanyBlackReasonRepository repository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CompanyBlackReasonRepository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyBlackReason createNewEntity() {
|
||||||
|
return new CompanyBlackReason();
|
||||||
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
public CompanyBlackReasonVo findById(Integer id) {
|
public CompanyBlackReasonVo findById(Integer id) {
|
||||||
return repository.findById(id).map(CompanyBlackReason::toVo).orElse(null);
|
return repository.findById(id).map(CompanyBlackReason::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CompanyBlackReason> getSpecification(String searchText) {
|
protected Specification<CompanyBlackReason> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<CompanyBlackReason> buildSearchSpecification(String searchText) {
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("applyName"), "%" + searchText + "%"),
|
builder.like(root.get("applyName"), "%" + searchText + "%"),
|
||||||
@@ -55,41 +64,20 @@ public class CompanyBlackReasonService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
@Override
|
@Override
|
||||||
public Page<CompanyBlackReason> findAll(Specification<CompanyBlackReason> spec, Pageable pageable) {
|
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompanyBlackReason getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void delete(CompanyBlackReason entity) {
|
|
||||||
repository.delete(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CompanyBlackReason> findAll(Specification<CompanyBlackReason> spec, Sort by) {
|
|
||||||
return repository.findAll(spec, by);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CompanyBlackReason> findAllByCompany(Company company) {
|
|
||||||
return repository.findAllByCompany(company);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CompanyBlackReason save(CompanyBlackReason companyBlackReason) {
|
public CompanyBlackReason save(CompanyBlackReason companyBlackReason) {
|
||||||
return repository.save(companyBlackReason);
|
return repository.save(companyBlackReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
@Override
|
@Override
|
||||||
public Page<CompanyBlackReasonVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
public void delete(CompanyBlackReason entity) {
|
||||||
Specification<CompanyBlackReason> spec = null;
|
repository.delete(entity);
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
}
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
public List<CompanyBlackReason> findAllByCompany(Company company) {
|
||||||
return findAll(spec, pageable).map(CompanyBlackReason::toVo);
|
return repository.findAllByCompany(company);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,25 +2,23 @@ package com.ecep.contract.ds.company.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ecep.contract.MessageHolder;
|
|
||||||
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;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.ds.company.repository.CompanyContactRepository;
|
|
||||||
import com.ecep.contract.ds.company.model.Company;
|
import com.ecep.contract.ds.company.model.Company;
|
||||||
import com.ecep.contract.ds.company.model.CompanyContact;
|
import com.ecep.contract.ds.company.model.CompanyContact;
|
||||||
|
import com.ecep.contract.ds.company.repository.CompanyContactRepository;
|
||||||
import com.ecep.contract.service.ServiceException;
|
import com.ecep.contract.service.ServiceException;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.MyStringUtils;
|
import com.ecep.contract.util.MyStringUtils;
|
||||||
@@ -35,7 +33,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company-contact")
|
@CacheConfig(cacheNames = "company-contact")
|
||||||
public class CompanyContactService implements IEntityService<CompanyContact>, QueryService<CompanyContactVo>,
|
public class CompanyContactService extends EntityService<CompanyContact, CompanyContactVo, Integer>
|
||||||
|
implements IEntityService<CompanyContact>, QueryService<CompanyContactVo>,
|
||||||
VoableService<CompanyContact, CompanyContactVo> {
|
VoableService<CompanyContact, CompanyContactVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyContactService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyContactService.class);
|
||||||
|
|
||||||
@@ -43,10 +42,11 @@ public class CompanyContactService implements IEntityService<CompanyContact>, Qu
|
|||||||
private CompanyContactRepository repository;
|
private CompanyContactRepository repository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompanyContact getById(Integer id) {
|
protected CompanyContactRepository getRepository() {
|
||||||
return repository.findById(id).orElse(null);
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
@Override
|
@Override
|
||||||
public CompanyContact save(CompanyContact contact) {
|
public CompanyContact save(CompanyContact contact) {
|
||||||
return repository.save(contact);
|
return repository.save(contact);
|
||||||
@@ -76,6 +76,7 @@ public class CompanyContactService implements IEntityService<CompanyContact>, Qu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
@Override
|
@Override
|
||||||
public void delete(CompanyContact entity) {
|
public void delete(CompanyContact entity) {
|
||||||
repository.delete(entity);
|
repository.delete(entity);
|
||||||
@@ -95,10 +96,7 @@ public class CompanyContactService implements IEntityService<CompanyContact>, Qu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CompanyContact> getSpecification(String searchText) {
|
protected Specification<CompanyContact> buildSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||||
@@ -110,36 +108,28 @@ public class CompanyContactService implements IEntityService<CompanyContact>, Qu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CompanyContact> findAll(Specification<CompanyContact> spec, Pageable pageable) {
|
protected Specification<CompanyContact> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
return repository.findAll(spec, pageable);
|
Specification<CompanyContact> spec = null;
|
||||||
|
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||||
|
return spec;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyContact createNewEntity() {
|
||||||
|
return new CompanyContact();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyContact> searchByCompany(Company company, String userText) {
|
public List<CompanyContact> searchByCompany(Company company, String userText) {
|
||||||
Specification<CompanyContact> spec = SpecificationUtils.and((root, query, builder) -> {
|
Specification<CompanyContact> spec = SpecificationUtils.and((root, query, builder) -> {
|
||||||
return builder.equal(root.get("company"), company);
|
return builder.equal(root.get("company"), company);
|
||||||
}, getSpecification(userText));
|
}, getSearchSpecification(userText));
|
||||||
return repository.findAll(spec);
|
return repository.findAll(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyContact> findAll(Specification<CompanyContact> spec, Sort sort) {
|
|
||||||
return repository.findAll(spec, sort);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CompanyContact> findAllByCompanyAndName(Company company, String contactName) {
|
public List<CompanyContact> findAllByCompanyAndName(Company company, String contactName) {
|
||||||
return repository.findAllByCompanyAndName(company, contactName);
|
return repository.findAllByCompanyAndName(company, contactName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<CompanyContactVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<CompanyContact> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
|
||||||
return findAll(spec, pageable).map(CompanyContact::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(CompanyContact model, CompanyContactVo vo) {
|
public void updateByVo(CompanyContact model, CompanyContactVo vo) {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package com.ecep.contract.ds.company.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ecep.contract.SpringApp;
|
|
||||||
import com.ecep.contract.vo.CompanyVo;
|
|
||||||
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;
|
||||||
@@ -14,21 +12,21 @@ import org.springframework.cache.annotation.Caching;
|
|||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.constant.ServiceConstant;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.ds.company.repository.CompanyExtendInfoRepository;
|
|
||||||
import com.ecep.contract.ds.company.model.Company;
|
import com.ecep.contract.ds.company.model.Company;
|
||||||
import com.ecep.contract.ds.company.model.CompanyExtendInfo;
|
import com.ecep.contract.ds.company.model.CompanyExtendInfo;
|
||||||
|
import com.ecep.contract.ds.company.repository.CompanyExtendInfoRepository;
|
||||||
import com.ecep.contract.service.ServiceException;
|
import com.ecep.contract.service.ServiceException;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
import com.ecep.contract.util.SpecificationUtils;
|
||||||
import com.ecep.contract.vo.CompanyExtendInfoVo;
|
import com.ecep.contract.vo.CompanyExtendInfoVo;
|
||||||
|
import com.ecep.contract.vo.CompanyVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,25 +35,33 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company-extend-info")
|
@CacheConfig(cacheNames = "company-extend-info")
|
||||||
public class CompanyExtendInfoService implements IEntityService<CompanyExtendInfo>, QueryService<CompanyExtendInfoVo>, VoableService<CompanyExtendInfo, CompanyExtendInfoVo> {
|
public class CompanyExtendInfoService extends EntityService<CompanyExtendInfo, CompanyExtendInfoVo, Integer>
|
||||||
|
implements IEntityService<CompanyExtendInfo>, QueryService<CompanyExtendInfoVo>,
|
||||||
|
VoableService<CompanyExtendInfo, CompanyExtendInfoVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyExtendInfoService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyExtendInfoService.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
private CompanyExtendInfoRepository repository;
|
private CompanyExtendInfoRepository repository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CompanyExtendInfoRepository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
public CompanyExtendInfoVo findById(Integer id) {
|
public CompanyExtendInfoVo findById(Integer id) {
|
||||||
return repository.findById(id).map(CompanyExtendInfo::toVo).orElse(null);
|
return repository.findById(id).map(CompanyExtendInfo::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyExtendInfo> findAll(Specification<CompanyExtendInfo> spec, Sort sort) {
|
@Override
|
||||||
return repository.findAll(spec, sort);
|
protected Specification<CompanyExtendInfo> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
Specification<CompanyExtendInfo> spec = null;
|
||||||
|
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||||
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Specification<CompanyExtendInfo> getSpecification(String searchText) {
|
@Override
|
||||||
if (!StringUtils.hasText(searchText)) {
|
protected Specification<CompanyExtendInfo> buildSearchSpecification(String searchText) {
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("businessScope"), "%" + searchText + "%"),
|
builder.like(root.get("businessScope"), "%" + searchText + "%"),
|
||||||
@@ -64,21 +70,12 @@ public class CompanyExtendInfoService implements IEntityService<CompanyExtendInf
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<CompanyExtendInfo> findAll(Specification<CompanyExtendInfo> spec, Pageable pageable) {
|
@Override
|
||||||
return repository.findAll(spec, pageable);
|
public CompanyExtendInfo createNewEntity() {
|
||||||
|
return new CompanyExtendInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CompanyExtendInfoVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<CompanyExtendInfo> spec = null;
|
|
||||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
|
||||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
|
||||||
return findAll(spec, pageable).map(CompanyExtendInfo::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "#p0.id"),
|
@CacheEvict(key = "#p0.id"),
|
||||||
@CacheEvict(key = "'byCompany-'+#p0.company.id")
|
@CacheEvict(key = "'byCompany-'+#p0.company.id")
|
||||||
@@ -144,8 +141,5 @@ public class CompanyExtendInfoService implements IEntityService<CompanyExtendInf
|
|||||||
model.setDisableVerify(vo.isDisableVerify());
|
model.setDisableVerify(vo.isDisableVerify());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompanyExtendInfo getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.util.function.Consumer;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.ecep.contract.constant.ParamConstant;
|
||||||
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;
|
||||||
@@ -26,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.CompanyFileType;
|
import com.ecep.contract.CompanyFileType;
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
import com.ecep.contract.MyDateTimeUtils;
|
import com.ecep.contract.MyDateTimeUtils;
|
||||||
@@ -33,7 +35,6 @@ import com.ecep.contract.QueryService;
|
|||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.constant.CloudServiceConstant;
|
import com.ecep.contract.constant.CloudServiceConstant;
|
||||||
import com.ecep.contract.constant.CompanyConstant;
|
import com.ecep.contract.constant.CompanyConstant;
|
||||||
import com.ecep.contract.constant.ServiceConstant;
|
|
||||||
import com.ecep.contract.ds.company.repository.CompanyFileRepository;
|
import com.ecep.contract.ds.company.repository.CompanyFileRepository;
|
||||||
import com.ecep.contract.ds.contract.service.ContractService;
|
import com.ecep.contract.ds.contract.service.ContractService;
|
||||||
import com.ecep.contract.ds.company.model.Company;
|
import com.ecep.contract.ds.company.model.Company;
|
||||||
@@ -52,7 +53,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company-file")
|
@CacheConfig(cacheNames = "company-file")
|
||||||
public class CompanyFileService
|
public class CompanyFileService extends EntityService<CompanyFile, CompanyFileVo, Integer>
|
||||||
implements IEntityService<CompanyFile>, QueryService<CompanyFileVo>, VoableService<CompanyFile, CompanyFileVo> {
|
implements IEntityService<CompanyFile>, QueryService<CompanyFileVo>, VoableService<CompanyFile, CompanyFileVo> {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyFileService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyFileService.class);
|
||||||
@@ -60,11 +61,12 @@ public class CompanyFileService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CompanyFileRepository repository;
|
private CompanyFileRepository repository;
|
||||||
|
|
||||||
public CompanyFileService() {
|
@Override
|
||||||
|
protected CompanyFileRepository getRepository() {
|
||||||
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyFile getById(Integer id) {
|
public CompanyFileService() {
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@@ -151,7 +153,6 @@ public class CompanyFileService
|
|||||||
*
|
*
|
||||||
* @param company 检查的公司对象
|
* @param company 检查的公司对象
|
||||||
* @param verifyDate 检查日期
|
* @param verifyDate 检查日期
|
||||||
* @param status 状态输出
|
|
||||||
* @see CompanyFile
|
* @see CompanyFile
|
||||||
* @see CompanyFileType
|
* @see CompanyFileType
|
||||||
*/
|
*/
|
||||||
@@ -203,9 +204,15 @@ public class CompanyFileService
|
|||||||
* @param companyFile 企业文件
|
* @param companyFile 企业文件
|
||||||
* @return 保存后的企业文件
|
* @return 保存后的企业文件
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
|
public CompanyFile createNewEntity() {
|
||||||
|
return new CompanyFile();
|
||||||
|
}
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "#p0.id")
|
@CacheEvict(key = "#p0.id")
|
||||||
})
|
})
|
||||||
|
@Override
|
||||||
public CompanyFile save(CompanyFile companyFile) {
|
public CompanyFile save(CompanyFile companyFile) {
|
||||||
return repository.save(companyFile);
|
return repository.save(companyFile);
|
||||||
}
|
}
|
||||||
@@ -220,6 +227,7 @@ public class CompanyFileService
|
|||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "#p0.id")
|
@CacheEvict(key = "#p0.id")
|
||||||
})
|
})
|
||||||
|
@Override
|
||||||
public void delete(CompanyFile file) {
|
public void delete(CompanyFile file) {
|
||||||
repository.delete(file);
|
repository.delete(file);
|
||||||
}
|
}
|
||||||
@@ -434,27 +442,6 @@ public class CompanyFileService
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<CompanyFileVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<CompanyFile> spec = null;
|
|
||||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
|
||||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
|
||||||
}
|
|
||||||
spec = SpecificationUtils.and(spec, buildParameterSpecification(paramsNode));
|
|
||||||
return findAll(spec, pageable).map(CompanyFile::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Page<CompanyFile> findAll(Specification<CompanyFile> spec, Pageable pageable) {
|
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<CompanyFile> getSpecification(String searchText) {
|
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return SpecificationUtils.andWith(searchText, this::buildSearchSpecification);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Specification<CompanyFile> buildSearchSpecification(String searchText) {
|
protected Specification<CompanyFile> buildSearchSpecification(String searchText) {
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
|
|||||||
@@ -1,37 +1,34 @@
|
|||||||
package com.ecep.contract.ds.company.service;
|
package com.ecep.contract.ds.company.service;
|
||||||
|
|
||||||
import com.ecep.contract.CompanyFileType;
|
|
||||||
import com.ecep.contract.constant.ServiceConstant;
|
|
||||||
import com.ecep.contract.service.VoableService;
|
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.cache.annotation.Caching;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import com.ecep.contract.IEntityService;
|
|
||||||
import com.ecep.contract.QueryService;
|
|
||||||
import com.ecep.contract.ds.company.repository.CompanyFileTypeLocalRepository;
|
|
||||||
import com.ecep.contract.model.CompanyFileTypeLocal;
|
|
||||||
import com.ecep.contract.vo.CompanyFileTypeLocalVo;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.cache.annotation.Caching;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ecep.contract.CompanyFileType;
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
|
import com.ecep.contract.IEntityService;
|
||||||
|
import com.ecep.contract.QueryService;
|
||||||
|
import com.ecep.contract.ds.company.repository.CompanyFileTypeLocalRepository;
|
||||||
|
import com.ecep.contract.model.CompanyFileTypeLocal;
|
||||||
|
import com.ecep.contract.service.VoableService;
|
||||||
|
import com.ecep.contract.util.SpecificationUtils;
|
||||||
|
import com.ecep.contract.vo.CompanyFileTypeLocalVo;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company-file-type")
|
@CacheConfig(cacheNames = "company-file-type")
|
||||||
public class CompanyFileTypeService
|
public class CompanyFileTypeService extends EntityService<CompanyFileTypeLocal, CompanyFileTypeLocalVo, Integer>
|
||||||
implements IEntityService<CompanyFileTypeLocal>, QueryService<CompanyFileTypeLocalVo>,
|
implements IEntityService<CompanyFileTypeLocal>, QueryService<CompanyFileTypeLocalVo>,
|
||||||
VoableService<CompanyFileTypeLocal, CompanyFileTypeLocalVo> {
|
VoableService<CompanyFileTypeLocal, CompanyFileTypeLocalVo> {
|
||||||
|
|
||||||
@@ -39,8 +36,13 @@ public class CompanyFileTypeService
|
|||||||
private CompanyFileTypeLocalRepository repository;
|
private CompanyFileTypeLocalRepository repository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompanyFileTypeLocal getById(Integer id) {
|
protected CompanyFileTypeLocalRepository getRepository() {
|
||||||
return repository.findById(id).orElse(null);
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyFileTypeLocal createNewEntity() {
|
||||||
|
return new CompanyFileTypeLocal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#id")
|
@Cacheable(key = "#id")
|
||||||
@@ -51,18 +53,13 @@ public class CompanyFileTypeService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CompanyFileTypeLocalVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
protected Specification<CompanyFileTypeLocal> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
Specification<CompanyFileTypeLocal> spec = null;
|
Specification<CompanyFileTypeLocal> spec = null;
|
||||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
|
||||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (paramsNode.has("type")) {
|
if (paramsNode.has("type")) {
|
||||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"),
|
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"),
|
||||||
CompanyFileType.valueOf(paramsNode.get("type").asText())));
|
CompanyFileType.valueOf(paramsNode.get("type").asText())));
|
||||||
}
|
}
|
||||||
// field
|
return spec;
|
||||||
return findAll(spec, pageable).map(CompanyFileTypeLocal::toVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "'all-'+#locale.toLanguageTag()")
|
@Cacheable(key = "'all-'+#locale.toLanguageTag()")
|
||||||
@@ -74,21 +71,9 @@ public class CompanyFileTypeService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CompanyFileTypeLocal> findAll(Specification<CompanyFileTypeLocal> spec, Pageable pageable) {
|
protected Specification<CompanyFileTypeLocal> buildSearchSpecification(String searchText) {
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<CompanyFileTypeLocal> getSpecification(String searchText) {
|
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return
|
return builder.like(root.get("type"), "%" + searchText + "%");
|
||||||
// builder.or(
|
|
||||||
builder.like(root.get("type"), "%" + searchText + "%")
|
|
||||||
// )
|
|
||||||
;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +83,7 @@ public class CompanyFileTypeService
|
|||||||
})
|
})
|
||||||
@Override
|
@Override
|
||||||
public void delete(CompanyFileTypeLocal entity) {
|
public void delete(CompanyFileTypeLocal entity) {
|
||||||
repository.delete(entity);
|
super.delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@@ -107,7 +92,7 @@ public class CompanyFileTypeService
|
|||||||
})
|
})
|
||||||
@Override
|
@Override
|
||||||
public CompanyFileTypeLocal save(CompanyFileTypeLocal entity) {
|
public CompanyFileTypeLocal save(CompanyFileTypeLocal entity) {
|
||||||
return repository.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.ds.company.repository.CompanyInvoiceInfoRepository;
|
import com.ecep.contract.ds.company.repository.CompanyInvoiceInfoRepository;
|
||||||
@@ -33,12 +34,24 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company-invoice-info")
|
@CacheConfig(cacheNames = "company-invoice-info")
|
||||||
public class CompanyInvoiceInfoService implements IEntityService<CompanyInvoiceInfo>, QueryService<CompanyInvoiceInfoVo>, VoableService<CompanyInvoiceInfo, CompanyInvoiceInfoVo> {
|
public class CompanyInvoiceInfoService extends EntityService<CompanyInvoiceInfo, CompanyInvoiceInfoVo, Integer>
|
||||||
|
implements IEntityService<CompanyInvoiceInfo>, QueryService<CompanyInvoiceInfoVo>,
|
||||||
|
VoableService<CompanyInvoiceInfo, CompanyInvoiceInfoVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyInvoiceInfoService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyInvoiceInfoService.class);
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private CompanyInvoiceInfoRepository repository;
|
private CompanyInvoiceInfoRepository repository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CompanyInvoiceInfoRepository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyInvoiceInfo createNewEntity() {
|
||||||
|
return new CompanyInvoiceInfo();
|
||||||
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
public CompanyInvoiceInfoVo findById(Integer id) {
|
public CompanyInvoiceInfoVo findById(Integer id) {
|
||||||
@@ -46,16 +59,7 @@ public class CompanyInvoiceInfoService implements IEntityService<CompanyInvoiceI
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyInvoiceInfo> searchByCompany(Company company, String searchText) {
|
public List<CompanyInvoiceInfo> searchByCompany(Company company, String searchText) {
|
||||||
Specification<CompanyInvoiceInfo> spec = (root, query, builder) -> {
|
Specification<CompanyInvoiceInfo> spec = buildSearchSpecification(searchText);
|
||||||
return builder.or(
|
|
||||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("taxId"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("address"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("phone"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("bankName"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("bankAccount"), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
|
|
||||||
if (company != null) {
|
if (company != null) {
|
||||||
spec = spec.and((root, query, builder) -> {
|
spec = spec.and((root, query, builder) -> {
|
||||||
return builder.equal(root.get("company"), company);
|
return builder.equal(root.get("company"), company);
|
||||||
@@ -64,10 +68,7 @@ public class CompanyInvoiceInfoService implements IEntityService<CompanyInvoiceI
|
|||||||
return repository.findAll(spec, Pageable.ofSize(10)).getContent();
|
return repository.findAll(spec, Pageable.ofSize(10)).getContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Specification<CompanyInvoiceInfo> getSpecification(String searchText) {
|
protected Specification<CompanyInvoiceInfo> buildSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||||
@@ -79,19 +80,11 @@ public class CompanyInvoiceInfoService implements IEntityService<CompanyInvoiceI
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<CompanyInvoiceInfo> findAll(Specification<CompanyInvoiceInfo> spec, Pageable pageable) {
|
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CompanyInvoiceInfoVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
protected Specification<CompanyInvoiceInfo> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
Specification<CompanyInvoiceInfo> spec = null;
|
Specification<CompanyInvoiceInfo> spec = null;
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
||||||
return findAll(spec, pageable).map(CompanyInvoiceInfo::toVo);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@@ -107,6 +100,7 @@ public class CompanyInvoiceInfoService implements IEntityService<CompanyInvoiceI
|
|||||||
@CacheEvict(key = "#p0.id"),
|
@CacheEvict(key = "#p0.id"),
|
||||||
@CacheEvict(key = "'byCompany-'+#p0.company.id")
|
@CacheEvict(key = "'byCompany-'+#p0.company.id")
|
||||||
})
|
})
|
||||||
|
@Override
|
||||||
public void delete(CompanyInvoiceInfo model) {
|
public void delete(CompanyInvoiceInfo model) {
|
||||||
repository.delete(model);
|
repository.delete(model);
|
||||||
}
|
}
|
||||||
@@ -125,9 +119,4 @@ public class CompanyInvoiceInfoService implements IEntityService<CompanyInvoiceI
|
|||||||
model.setBankName(vo.getBankName());
|
model.setBankName(vo.getBankName());
|
||||||
model.setBankAccount(vo.getBankAccount());
|
model.setBankAccount(vo.getBankAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompanyInvoiceInfo getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,15 @@ import java.io.File;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ecep.contract.Message;
|
|
||||||
import com.ecep.contract.MessageHolder;
|
import com.ecep.contract.MessageHolder;
|
||||||
|
import com.ecep.contract.constant.ParamConstant;
|
||||||
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;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.cache.annotation.Caching;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -19,6 +21,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.ds.company.repository.CompanyOldNameRepository;
|
import com.ecep.contract.ds.company.repository.CompanyOldNameRepository;
|
||||||
@@ -35,7 +38,9 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company-old-name")
|
@CacheConfig(cacheNames = "company-old-name")
|
||||||
public class CompanyOldNameService implements IEntityService<CompanyOldName>, QueryService<CompanyOldNameVo>, VoableService<CompanyOldName, CompanyOldNameVo> {
|
public class CompanyOldNameService extends EntityService<CompanyOldName, CompanyOldNameVo, Integer>
|
||||||
|
implements IEntityService<CompanyOldName>, QueryService<CompanyOldNameVo>,
|
||||||
|
VoableService<CompanyOldName, CompanyOldNameVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CompanyOldNameService.class);
|
private static final Logger logger = LoggerFactory.getLogger(CompanyOldNameService.class);
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -44,17 +49,20 @@ public class CompanyOldNameService implements IEntityService<CompanyOldName>, Qu
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CompanyService companyService;
|
private CompanyService companyService;
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Override
|
||||||
public CompanyOldNameVo findById(Integer id) {
|
protected CompanyOldNameRepository getRepository() {
|
||||||
return companyOldNameRepository.findById(id).map(CompanyOldName::toVo).orElse(null);
|
return companyOldNameRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CompanyOldName> getSpecification(String searchText) {
|
public CompanyOldName createNewEntity() {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
return new CompanyOldName();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
return SpecificationUtils.andWith(searchText, this::buildSearchSpecification);
|
|
||||||
|
@Cacheable(key = "#p0")
|
||||||
|
@Override
|
||||||
|
public CompanyOldNameVo findById(Integer id) {
|
||||||
|
return companyOldNameRepository.findById(id).map(CompanyOldName::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Specification<CompanyOldName> buildSearchSpecification(String searchText) {
|
protected Specification<CompanyOldName> buildSearchSpecification(String searchText) {
|
||||||
@@ -65,6 +73,15 @@ public class CompanyOldNameService implements IEntityService<CompanyOldName>, Qu
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<CompanyOldName> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Caching(evict = {
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
|
})
|
||||||
public CompanyOldName save(CompanyOldName companyOldName) {
|
public CompanyOldName save(CompanyOldName companyOldName) {
|
||||||
return companyOldNameRepository.save(companyOldName);
|
return companyOldNameRepository.save(companyOldName);
|
||||||
}
|
}
|
||||||
@@ -120,10 +137,6 @@ public class CompanyOldNameService implements IEntityService<CompanyOldName>, Qu
|
|||||||
return companyOldNameRepository.findAllByName(name);
|
return companyOldNameRepository.findAllByName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyOldName> findAll(Specification<CompanyOldName> spec, Sort sort) {
|
|
||||||
return companyOldNameRepository.findAll(spec, sort);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<CompanyOldName> findAllByCompany(Company company) {
|
public List<CompanyOldName> findAllByCompany(Company company) {
|
||||||
return companyOldNameRepository.findAllByCompanyId(company.getId());
|
return companyOldNameRepository.findAllByCompanyId(company.getId());
|
||||||
}
|
}
|
||||||
@@ -151,6 +164,10 @@ public class CompanyOldNameService implements IEntityService<CompanyOldName>, Qu
|
|||||||
companyOldNameRepository.deleteById(id);
|
companyOldNameRepository.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Caching(evict = {
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
|
})
|
||||||
public void delete(CompanyOldName entity) {
|
public void delete(CompanyOldName entity) {
|
||||||
companyOldNameRepository.delete(entity);
|
companyOldNameRepository.delete(entity);
|
||||||
}
|
}
|
||||||
@@ -179,7 +196,6 @@ public class CompanyOldNameService implements IEntityService<CompanyOldName>, Qu
|
|||||||
}
|
}
|
||||||
companyOldNameRepository.saveAll(list);
|
companyOldNameRepository.saveAll(list);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteByCompany(Company company) {
|
public void deleteByCompany(Company company) {
|
||||||
@@ -191,51 +207,12 @@ public class CompanyOldNameService implements IEntityService<CompanyOldName>, Qu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据提供的搜索文本查询公司旧名称列表。
|
|
||||||
* <p>
|
|
||||||
* 该函数使用JPA的Specification接口构建查询条件,查找公司旧名称中包含指定文本的记录。
|
|
||||||
* 查询结果最多返回10条记录。
|
|
||||||
*
|
|
||||||
* @param searchText 用于搜索的文本,将匹配公司旧名称中包含该文本的记录。
|
|
||||||
* @return 包含匹配的公司旧名称的列表,列表中的每个元素都是一个CompanyOldName对象。
|
|
||||||
*/
|
|
||||||
public List<CompanyOldName> search(String searchText) {
|
|
||||||
return companyOldNameRepository.findAll(getSpecification(searchText), Pageable.ofSize(10)).getContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CompanyOldName> findAll(Specification<CompanyOldName> spec, Pageable pageable) {
|
protected String aliasFor(String field, JsonNode filterNode) {
|
||||||
return companyOldNameRepository.findAll(spec, pageable);
|
if ("company".equals(field)) {
|
||||||
|
return "companyId";
|
||||||
}
|
}
|
||||||
|
return super.aliasFor(field, filterNode);
|
||||||
@Override
|
|
||||||
public CompanyOldName getById(Integer id) {
|
|
||||||
return companyOldNameRepository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<CompanyOldNameVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<CompanyOldName> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
if (paramsNode.has("company")) {
|
|
||||||
JsonNode param = paramsNode.get("company");
|
|
||||||
Integer companyId = null;
|
|
||||||
if (param.isInt()) {
|
|
||||||
companyId = param.asInt();
|
|
||||||
} else if (param.isObject()) {
|
|
||||||
companyId = param.get("id").asInt();
|
|
||||||
}
|
|
||||||
if (companyId != null) {
|
|
||||||
final int id = companyId;
|
|
||||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> {
|
|
||||||
return builder.equal(root.get("companyId"), id);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return findAll(spec, pageable).map(CompanyOldName::toVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompanyOldName createNew(Company company, String name, boolean ambiguity) {
|
public CompanyOldName createNew(Company company, String name, boolean ambiguity) {
|
||||||
@@ -261,4 +238,5 @@ public class CompanyOldNameService implements IEntityService<CompanyOldName>, Qu
|
|||||||
model.getId(), model.getVersion(), vo.getVersion());
|
model.getId(), model.getVersion(), vo.getVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ public class CompanyService extends EntityService<Company, CompanyVo, Integer>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<Company> getSpecification(String searchText) {
|
public Specification<Company> getSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
if (!StringUtils.hasText(searchText)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,15 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.cache.annotation.Caching;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
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 org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.ds.other.repository.HolidayTableRepository;
|
import com.ecep.contract.ds.other.repository.HolidayTableRepository;
|
||||||
@@ -36,11 +39,17 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "HolidayTable")
|
@CacheConfig(cacheNames = "HolidayTable")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class HolidayService implements IEntityService<HolidayTable>, QueryService<HolidayTableVo>, VoableService<HolidayTable, HolidayTableVo> {
|
public class HolidayService extends EntityService<HolidayTable, HolidayTableVo, LocalDate> implements
|
||||||
|
IEntityService<HolidayTable>, QueryService<HolidayTableVo>, VoableService<HolidayTable, HolidayTableVo> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HolidayTableRepository holidayTableRepository;
|
private HolidayTableRepository holidayTableRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected HolidayTableRepository getRepository() {
|
||||||
|
return holidayTableRepository;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调整日期到工作日
|
* 调整日期到工作日
|
||||||
*
|
*
|
||||||
@@ -52,7 +61,8 @@ public class HolidayService implements IEntityService<HolidayTable>, QueryServic
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY || isHoliday(date)) {
|
while (date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY
|
||||||
|
|| isHoliday(date)) {
|
||||||
date = date.plusDays(1);
|
date = date.plusDays(1);
|
||||||
}
|
}
|
||||||
return date;
|
return date;
|
||||||
@@ -75,11 +85,13 @@ public class HolidayService implements IEntityService<HolidayTable>, QueryServic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HolidayTable getById(Integer id) {
|
public HolidayTable getById(Integer id) {
|
||||||
throw new UnsupportedOperationException("HolidayTable uses LocalDate as ID, please use getById(LocalDate id) method instead");
|
throw new UnsupportedOperationException(
|
||||||
|
"HolidayTable uses LocalDate as ID, please use getById(LocalDate id) method instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据LocalDate类型的ID查询实体
|
* 根据LocalDate类型的ID查询实体
|
||||||
|
*
|
||||||
* @param id 实体ID
|
* @param id 实体ID
|
||||||
* @return 实体对象
|
* @return 实体对象
|
||||||
*/
|
*/
|
||||||
@@ -87,26 +99,29 @@ public class HolidayService implements IEntityService<HolidayTable>, QueryServic
|
|||||||
if (id == null) {
|
if (id == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return holidayTableRepository.findById(id).orElse(null);
|
return super.getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Caching(evict = { @CacheEvict(key = "#p0.id") })
|
||||||
public HolidayTable save(HolidayTable entity) {
|
public HolidayTable save(HolidayTable entity) {
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return holidayTableRepository.save(entity);
|
return super.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Caching(evict = { @CacheEvict(key = "#p0.id") })
|
||||||
public void delete(HolidayTable entity) {
|
public void delete(HolidayTable entity) {
|
||||||
if (entity != null && entity.getId() != null) {
|
if (entity != null && entity.getId() != null) {
|
||||||
holidayTableRepository.deleteById(entity.getId());
|
super.delete(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据LocalDate类型的ID删除实体
|
* 根据LocalDate类型的ID删除实体
|
||||||
|
*
|
||||||
* @param id 实体ID
|
* @param id 实体ID
|
||||||
*/
|
*/
|
||||||
public void deleteById(LocalDate id) {
|
public void deleteById(LocalDate id) {
|
||||||
@@ -115,28 +130,15 @@ public class HolidayService implements IEntityService<HolidayTable>, QueryServic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* 获取所有节假日
|
public HolidayTable createNewEntity() {
|
||||||
* @param pageable 分页参数
|
return new HolidayTable();
|
||||||
* @return 分页结果
|
|
||||||
*/
|
|
||||||
public Page<HolidayTable> findAll(Pageable pageable) {
|
|
||||||
return holidayTableRepository.findAll(pageable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<HolidayTable> findAll(Specification<HolidayTable> spec, Pageable pageable) {
|
protected Specification<HolidayTable> buildSearchSpecification(String searchText) {
|
||||||
// 由于HolidayTableRepository不支持Specification查询,返回所有节假日
|
|
||||||
return findAll(pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<HolidayTable> getSpecification(String searchText) {
|
|
||||||
// 实现根据搜索文本构建规格化查询
|
|
||||||
return (Root<HolidayTable> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) -> {
|
return (Root<HolidayTable> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) -> {
|
||||||
List<Predicate> predicates = new ArrayList<>();
|
List<Predicate> predicates = new ArrayList<>();
|
||||||
|
|
||||||
if (searchText != null && !searchText.trim().isEmpty()) {
|
|
||||||
try {
|
try {
|
||||||
// 尝试将搜索文本解析为日期
|
// 尝试将搜索文本解析为日期
|
||||||
LocalDate date = LocalDate.parse(searchText.trim());
|
LocalDate date = LocalDate.parse(searchText.trim());
|
||||||
@@ -146,15 +148,14 @@ public class HolidayService implements IEntityService<HolidayTable>, QueryServic
|
|||||||
// 由于HolidayTable只有id和holiday字段,这里无法进行其他字段的模糊搜索
|
// 由于HolidayTable只有id和holiday字段,这里无法进行其他字段的模糊搜索
|
||||||
log.warn("Search text '{}' is not a valid date format", searchText);
|
log.warn("Search text '{}' is not a valid date format", searchText);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
|
return criteriaBuilder.and(predicates.toArray(new Predicate[0]));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HolidayTableVo findById(Integer id) {
|
public HolidayTableVo findById(Integer id) {
|
||||||
throw new UnsupportedOperationException("HolidayTable uses LocalDate as ID, please use findById(Object id) instead");
|
throw new UnsupportedOperationException(
|
||||||
|
"HolidayTable uses LocalDate as ID, please use findById(Object id) instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#id", unless = "#result == null")
|
@Cacheable(key = "#id", unless = "#result == null")
|
||||||
@@ -163,6 +164,21 @@ public class HolidayService implements IEntityService<HolidayTable>, QueryServic
|
|||||||
return entity != null ? entity.toVo() : null;
|
return entity != null ? entity.toVo() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<HolidayTable> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有节假日
|
||||||
|
*
|
||||||
|
* @param pageable 分页参数
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
public Page<HolidayTable> findAll(Pageable pageable) {
|
||||||
|
return holidayTableRepository.findAll(pageable);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<HolidayTableVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
public Page<HolidayTableVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
||||||
// 实现根据JSON参数过滤节假日
|
// 实现根据JSON参数过滤节假日
|
||||||
@@ -216,12 +232,6 @@ public class HolidayService implements IEntityService<HolidayTable>, QueryServic
|
|||||||
return entityPage.map(HolidayTable::toVo);
|
return entityPage.map(HolidayTable::toVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long count(JsonNode paramsNode) {
|
|
||||||
// 简单实现,返回所有节假日数量
|
|
||||||
return holidayTableRepository.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(HolidayTable model, HolidayTableVo vo) {
|
public void updateByVo(HolidayTable model, HolidayTableVo vo) {
|
||||||
if (model == null || vo == null) {
|
if (model == null || vo == null) {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.ecep.contract.ds.company.service;
|
package com.ecep.contract.ds.company.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -9,28 +7,25 @@ import org.springframework.cache.annotation.CacheConfig;
|
|||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.ds.company.repository.InvoiceRepository;
|
|
||||||
import com.ecep.contract.ds.company.model.Company;
|
import com.ecep.contract.ds.company.model.Company;
|
||||||
|
import com.ecep.contract.ds.company.repository.InvoiceRepository;
|
||||||
import com.ecep.contract.ds.other.model.Invoice;
|
import com.ecep.contract.ds.other.model.Invoice;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
|
||||||
import com.ecep.contract.vo.InvoiceVo;
|
import com.ecep.contract.vo.InvoiceVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "invoice")
|
@CacheConfig(cacheNames = "invoice")
|
||||||
public class InvoiceService implements IEntityService<Invoice>, QueryService<InvoiceVo>,
|
public class InvoiceService extends EntityService<Invoice, InvoiceVo, Integer>
|
||||||
|
implements IEntityService<Invoice>, QueryService<InvoiceVo>,
|
||||||
VoableService<Invoice, InvoiceVo> {
|
VoableService<Invoice, InvoiceVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(InvoiceService.class);
|
private static final Logger logger = LoggerFactory.getLogger(InvoiceService.class);
|
||||||
|
|
||||||
@@ -38,8 +33,8 @@ public class InvoiceService implements IEntityService<Invoice>, QueryService<Inv
|
|||||||
private InvoiceRepository repository;
|
private InvoiceRepository repository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Invoice getById(Integer id) {
|
protected InvoiceRepository getRepository() {
|
||||||
return repository.findById(id).orElse(null);
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@@ -49,34 +44,30 @@ public class InvoiceService implements IEntityService<Invoice>, QueryService<Inv
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<Invoice> getSpecification(String searchText) {
|
public Invoice createNewEntity() {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
return new Invoice();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<Invoice> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<Invoice> buildSearchSpecification(String searchText) {
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("code"), "%" + searchText + "%"),
|
builder.like(root.get("code"), "%" + searchText + "%"),
|
||||||
builder.like(root.get("description"), "%" + searchText + "%"));
|
builder.like(root.get("description"), "%" + searchText + "%"));
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<Invoice> findAll(Specification<Invoice> spec, Pageable pageable) {
|
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@CacheEvict(key = "#p0.id")
|
@CacheEvict(key = "#p0.id")
|
||||||
@Override
|
@Override
|
||||||
public void delete(Invoice entity) {
|
public void delete(Invoice entity) {
|
||||||
repository.delete(entity);
|
repository.delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Invoice> findAll(Specification<Invoice> spec, Sort by) {
|
|
||||||
return repository.findAll(spec, by);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Invoice findByCode(String invoiceNumber) {
|
public Invoice findByCode(String invoiceNumber) {
|
||||||
return repository.findByCode(invoiceNumber);
|
return repository.findByCode(invoiceNumber);
|
||||||
}
|
}
|
||||||
@@ -87,18 +78,6 @@ public class InvoiceService implements IEntityService<Invoice>, QueryService<Inv
|
|||||||
return repository.save(invoice);
|
return repository.save(invoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<InvoiceVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<Invoice> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company");
|
|
||||||
return findAll(spec, pageable).map(Invoice::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(Invoice model, InvoiceVo vo) {
|
public void updateByVo(Invoice model, InvoiceVo vo) {
|
||||||
if (model == null || vo == null) {
|
if (model == null || vo == null) {
|
||||||
@@ -115,4 +94,5 @@ public class InvoiceService implements IEntityService<Invoice>, QueryService<Inv
|
|||||||
model.setDescription(vo.getDescription());
|
model.setDescription(vo.getDescription());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,13 @@ package com.ecep.contract.ds.contract.repository;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
||||||
import org.springframework.data.repository.CrudRepository;
|
|
||||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.ecep.contract.ds.MyRepository;
|
||||||
import com.ecep.contract.ds.contract.model.ContractBidVendor;
|
import com.ecep.contract.ds.contract.model.ContractBidVendor;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface ContractBidVendorRepository extends
|
public interface ContractBidVendorRepository extends MyRepository<ContractBidVendor, Integer> {
|
||||||
// JDBC interfaces
|
|
||||||
CrudRepository<ContractBidVendor, Integer>, PagingAndSortingRepository<ContractBidVendor, Integer>,
|
|
||||||
// JPA interfaces
|
|
||||||
JpaRepository<ContractBidVendor, Integer>, JpaSpecificationExecutor<ContractBidVendor> {
|
|
||||||
|
|
||||||
List<ContractBidVendor> findByContractId(Integer contractId);
|
List<ContractBidVendor> findByContractId(Integer contractId);
|
||||||
|
|
||||||
|
|||||||
@@ -2,16 +2,13 @@ package com.ecep.contract.ds.contract.repository;
|
|||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.ecep.contract.ds.MyRepository;
|
||||||
import com.ecep.contract.ds.vendor.model.ExtendVendorInfo;
|
import com.ecep.contract.ds.vendor.model.ExtendVendorInfo;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface ExtendVendorInfoRepository extends
|
public interface ExtendVendorInfoRepository extends MyRepository<ExtendVendorInfo, Integer> {
|
||||||
// JPA interfaces
|
|
||||||
JpaRepository<ExtendVendorInfo, Integer>, JpaSpecificationExecutor<ExtendVendorInfo> {
|
|
||||||
|
|
||||||
Optional<ExtendVendorInfo> findByContractId(Integer contractId);
|
Optional<ExtendVendorInfo> findByContractId(Integer contractId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
@@ -25,7 +26,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-balance")
|
@CacheConfig(cacheNames = "contract-balance")
|
||||||
public class ContractBalanceService implements IEntityService<ContractBalance>, QueryService<ContractBalanceVo>,
|
public class ContractBalanceService extends EntityService<ContractBalance, ContractBalanceVo, Integer>
|
||||||
|
implements IEntityService<ContractBalance>, QueryService<ContractBalanceVo>,
|
||||||
VoableService<ContractBalance, ContractBalanceVo> {
|
VoableService<ContractBalance, ContractBalanceVo> {
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@@ -33,8 +35,8 @@ public class ContractBalanceService implements IEntityService<ContractBalance>,
|
|||||||
private ContractBalanceRepository repository;
|
private ContractBalanceRepository repository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContractBalance getById(Integer id) {
|
protected ContractBalanceRepository getRepository() {
|
||||||
return repository.findById(id).orElse(null);
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@@ -48,10 +50,12 @@ public class ContractBalanceService implements IEntityService<ContractBalance>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<ContractBalance> getSpecification(String searchText) {
|
public ContractBalance createNewEntity() {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
return new ContractBalance();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ContractBalance> buildSearchSpecification(String searchText) {
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("refId"), "%" + searchText + "%"),
|
builder.like(root.get("refId"), "%" + searchText + "%"),
|
||||||
@@ -83,16 +87,11 @@ public class ContractBalanceService implements IEntityService<ContractBalance>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractBalanceVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
protected Specification<ContractBalance> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
Specification<ContractBalance> spec = null;
|
Specification<ContractBalance> spec = null;
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 字段等值查询 - 只包含ContractBalanceVo中存在的字段
|
// 字段等值查询 - 只包含ContractBalanceVo中存在的字段
|
||||||
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "contract", "employee");
|
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "contract", "employee");
|
||||||
|
return spec;
|
||||||
return findAll(spec, pageable).map(ContractBalance::toVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
@@ -32,14 +33,16 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-ven-bid")
|
@CacheConfig(cacheNames = "contract-ven-bid")
|
||||||
public class ContractBidVendorService implements IEntityService<ContractBidVendor>, QueryService<ContractBidVendorVo>, VoableService<ContractBidVendor, ContractBidVendorVo> {
|
public class ContractBidVendorService extends EntityService<ContractBidVendor, ContractBidVendorVo, Integer>
|
||||||
|
implements IEntityService<ContractBidVendor>, QueryService<ContractBidVendorVo>,
|
||||||
|
VoableService<ContractBidVendor, ContractBidVendorVo> {
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private ContractBidVendorRepository repository;
|
private ContractBidVendorRepository repository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContractBidVendor getById(Integer id) {
|
protected ContractBidVendorRepository getRepository() {
|
||||||
return repository.findById(id).orElse(null);
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@@ -53,21 +56,19 @@ public class ContractBidVendorService implements IEntityService<ContractBidVendo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<ContractBidVendor> getSpecification(String searchText) {
|
protected Specification<ContractBidVendor> buildSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("bidName"), "%" + searchText + "%"),
|
builder.like(root.get("bidName"), "%" + searchText + "%"),
|
||||||
builder.like(root.get("memo"), "%" + searchText + "%")
|
builder.like(root.get("memo"), "%" + searchText + "%"));
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractBidVendor> findAll(Specification<ContractBidVendor> spec, Pageable pageable) {
|
protected Specification<ContractBidVendor> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
return repository.findAll(spec, pageable);
|
Specification<ContractBidVendor> spec = null;
|
||||||
|
spec = SpecificationUtils.andParam(spec, paramsNode, "contract", "company");
|
||||||
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "'allbycontract-'+#p0.id")
|
@Cacheable(key = "'allbycontract-'+#p0.id")
|
||||||
@@ -75,6 +76,7 @@ public class ContractBidVendorService implements IEntityService<ContractBidVendo
|
|||||||
return repository.findByContractId(contract.getId()).stream().map(ContractBidVendor::toVo).toList();
|
return repository.findByContractId(contract.getId()).stream().map(ContractBidVendor::toVo).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "#p0.id"),
|
@CacheEvict(key = "#p0.id"),
|
||||||
@CacheEvict(key = "'allbycontract-'+#p0.contract.id")
|
@CacheEvict(key = "'allbycontract-'+#p0.contract.id")
|
||||||
@@ -92,10 +94,6 @@ public class ContractBidVendorService implements IEntityService<ContractBidVendo
|
|||||||
repository.delete(bidVendor);
|
repository.delete(bidVendor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ContractBidVendor> findAll(Specification<ContractBidVendor> spec, Sort sort) {
|
|
||||||
return repository.findAll(spec, sort);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "#p0.id")
|
@CacheEvict(key = "#p0.id")
|
||||||
})
|
})
|
||||||
@@ -108,14 +106,8 @@ public class ContractBidVendorService implements IEntityService<ContractBidVendo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractBidVendorVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
public ContractBidVendor createNewEntity() {
|
||||||
Specification<ContractBidVendor> spec = null;
|
return new ContractBidVendor();
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "contract", "company");
|
|
||||||
return findAll(spec, pageable).map(ContractBidVendor::toVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -142,8 +134,10 @@ public class ContractBidVendorService implements IEntityService<ContractBidVendo
|
|||||||
if (vo.getQuotationSheetFileId() == null) {
|
if (vo.getQuotationSheetFileId() == null) {
|
||||||
model.setQuotationSheet(null);
|
model.setQuotationSheet(null);
|
||||||
} else {
|
} else {
|
||||||
if (model.getQuotationSheet() == null || !model.getQuotationSheet().getId().equals(vo.getQuotationSheetFileId())) {
|
if (model.getQuotationSheet() == null
|
||||||
model.setQuotationSheet(SpringApp.getBean(ContractFileRepository.class).findById(vo.getQuotationSheetFileId()).orElse(null));
|
|| !model.getQuotationSheet().getId().equals(vo.getQuotationSheetFileId())) {
|
||||||
|
model.setQuotationSheet(SpringApp.getBean(ContractFileRepository.class)
|
||||||
|
.findById(vo.getQuotationSheetFileId()).orElse(null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,10 @@ import org.springframework.cache.annotation.CacheEvict;
|
|||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.cache.annotation.Caching;
|
import org.springframework.cache.annotation.Caching;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.ds.contract.repository.ContractCatalogRepository;
|
import com.ecep.contract.ds.contract.repository.ContractCatalogRepository;
|
||||||
@@ -28,12 +26,18 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-catalog")
|
@CacheConfig(cacheNames = "contract-catalog")
|
||||||
public class ContractCatalogService implements IEntityService<ContractCatalog>, QueryService<ContractCatalogVo>,
|
public class ContractCatalogService extends EntityService<ContractCatalog, ContractCatalogVo, Integer>
|
||||||
|
implements IEntityService<ContractCatalog>, QueryService<ContractCatalogVo>,
|
||||||
VoableService<ContractCatalog, ContractCatalogVo> {
|
VoableService<ContractCatalog, ContractCatalogVo> {
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private ContractCatalogRepository repository;
|
private ContractCatalogRepository repository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ContractCatalogRepository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据 id 查找 ContractCatalog
|
* 根据 id 查找 ContractCatalog
|
||||||
*/
|
*/
|
||||||
@@ -43,9 +47,7 @@ public class ContractCatalogService implements IEntityService<ContractCatalog>,
|
|||||||
return repository.findById(id).map(ContractCatalog::toVo).orElse(null);
|
return repository.findById(id).map(ContractCatalog::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContractCatalog getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ContractCatalog findByName(String name) {
|
public ContractCatalog findByName(String name) {
|
||||||
return repository.findByName(name).orElse(null);
|
return repository.findByName(name).orElse(null);
|
||||||
@@ -61,6 +63,7 @@ public class ContractCatalogService implements IEntityService<ContractCatalog>,
|
|||||||
return repository.findAll().stream().map(ContractCatalog::toVo).toList();
|
return repository.findAll().stream().map(ContractCatalog::toVo).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "#p0.id"),
|
@CacheEvict(key = "#p0.id"),
|
||||||
@CacheEvict(key = "'code-'+#p0.code"),
|
@CacheEvict(key = "'code-'+#p0.code"),
|
||||||
@@ -81,10 +84,7 @@ public class ContractCatalogService implements IEntityService<ContractCatalog>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<ContractCatalog> getSpecification(String searchText) {
|
protected Specification<ContractCatalog> buildSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||||
@@ -94,17 +94,8 @@ public class ContractCatalogService implements IEntityService<ContractCatalog>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractCatalog> findAll(Specification<ContractCatalog> spec, Pageable pageable) {
|
protected Specification<ContractCatalog> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
return repository.findAll(spec, pageable);
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ContractCatalogVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<ContractCatalog> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
return findAll(spec, pageable).map(ContractCatalog::toVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -118,4 +109,9 @@ public class ContractCatalogService implements IEntityService<ContractCatalog>,
|
|||||||
model.setParent(vo.getParent());
|
model.setParent(vo.getParent());
|
||||||
model.setUseYear(vo.isUseYear());
|
model.setUseYear(vo.isUseYear());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContractCatalog createNewEntity() {
|
||||||
|
return new ContractCatalog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.ContractFileType;
|
import com.ecep.contract.ContractFileType;
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
@@ -34,18 +35,14 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-file")
|
@CacheConfig(cacheNames = "contract-file")
|
||||||
public class ContractFileService implements IEntityService<ContractFile>, QueryService<ContractFileVo>,
|
public class ContractFileService extends EntityService<ContractFile, ContractFileVo, Integer>
|
||||||
|
implements IEntityService<ContractFile>, QueryService<ContractFileVo>,
|
||||||
VoableService<ContractFile, ContractFileVo> {
|
VoableService<ContractFile, ContractFileVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ContractFileService.class);
|
private static final Logger logger = LoggerFactory.getLogger(ContractFileService.class);
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private ContractFileRepository contractFileRepository;
|
private ContractFileRepository contractFileRepository;
|
||||||
|
|
||||||
@Override
|
|
||||||
public ContractFile getById(Integer id) {
|
|
||||||
return contractFileRepository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
public ContractFileVo findById(Integer id) {
|
public ContractFileVo findById(Integer id) {
|
||||||
@@ -53,10 +50,7 @@ public class ContractFileService implements IEntityService<ContractFile>, QueryS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<ContractFile> getSpecification(String searchText) {
|
public Specification<ContractFile> buildSearchSpecification(String searchText) {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("fileName"), "%" + searchText + "%"),
|
builder.like(root.get("fileName"), "%" + searchText + "%"),
|
||||||
@@ -65,25 +59,20 @@ public class ContractFileService implements IEntityService<ContractFile>, QueryS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractFile> findAll(Specification<ContractFile> spec, Pageable pageable) {
|
protected ContractFileRepository getRepository() {
|
||||||
return contractFileRepository.findAll(spec, pageable);
|
return contractFileRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractFileVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
public ContractFile createNewEntity() {
|
||||||
|
return new ContractFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ContractFile> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
Specification<ContractFile> spec = null;
|
Specification<ContractFile> spec = null;
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "contract", "type");
|
spec = SpecificationUtils.andParam(spec, paramsNode, "contract", "type");
|
||||||
|
return spec;
|
||||||
return findAll(spec, pageable).map(ContractFile::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ContractFile> findAll(Specification<ContractFile> spec, Sort by) {
|
|
||||||
return contractFileRepository.findAll(spec, by);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ContractFile> findAllByContractAndFileType(Contract contract, ContractFileType contractFileType) {
|
public List<ContractFile> findAllByContractAndFileType(Contract contract, ContractFileType contractFileType) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.ecep.contract.constant.ParamConstant;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
@@ -17,9 +18,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import com.ecep.contract.ContractFileType;
|
import com.ecep.contract.ContractFileType;
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.constant.ServiceConstant;
|
|
||||||
import com.ecep.contract.ds.contract.repository.ContractFileTypeLocalRepository;
|
import com.ecep.contract.ds.contract.repository.ContractFileTypeLocalRepository;
|
||||||
import com.ecep.contract.model.ContractFileTypeLocal;
|
import com.ecep.contract.model.ContractFileTypeLocal;
|
||||||
import com.ecep.contract.service.ServiceException;
|
import com.ecep.contract.service.ServiceException;
|
||||||
@@ -31,7 +32,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-file-type")
|
@CacheConfig(cacheNames = "contract-file-type")
|
||||||
public class ContractFileTypeService
|
public class ContractFileTypeService extends EntityService<ContractFileTypeLocal, ContractFileTypeLocalVo, Integer>
|
||||||
implements IEntityService<ContractFileTypeLocal>, QueryService<ContractFileTypeLocalVo>,
|
implements IEntityService<ContractFileTypeLocal>, QueryService<ContractFileTypeLocalVo>,
|
||||||
VoableService<ContractFileTypeLocal, ContractFileTypeLocalVo> {
|
VoableService<ContractFileTypeLocal, ContractFileTypeLocalVo> {
|
||||||
@Lazy
|
@Lazy
|
||||||
@@ -39,20 +40,25 @@ public class ContractFileTypeService
|
|||||||
private ContractFileTypeLocalRepository repository;
|
private ContractFileTypeLocalRepository repository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractFileTypeLocalVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
protected ContractFileTypeLocalRepository getRepository() {
|
||||||
Specification<ContractFileTypeLocal> spec = null;
|
return repository;
|
||||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
|
||||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContractFileTypeLocal createNewEntity() {
|
||||||
|
return new ContractFileTypeLocal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ContractFileTypeLocal> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
Specification<ContractFileTypeLocal> spec = null;
|
||||||
if (paramsNode.has("type")) {
|
if (paramsNode.has("type")) {
|
||||||
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"),
|
spec = SpecificationUtils.and(spec, (root, query, builder) -> builder.equal(root.get("type"),
|
||||||
ContractFileType.valueOf(paramsNode.get("type").asText())));
|
ContractFileType.valueOf(paramsNode.get("type").asText())));
|
||||||
}
|
}
|
||||||
|
|
||||||
// field
|
// field
|
||||||
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "lang", "value", "suggestFileName");
|
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "lang", "value", "suggestFileName");
|
||||||
return findAll(spec, pageable).map(ContractFileTypeLocal::toVo);
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(key = "'all-'+#p0.toLanguageTag()")
|
@Cacheable(key = "'all-'+#p0.toLanguageTag()")
|
||||||
@@ -69,20 +75,8 @@ public class ContractFileTypeService
|
|||||||
return repository.findById(id).map(ContractFileTypeLocal::toVo).orElse(null);
|
return repository.findById(id).map(ContractFileTypeLocal::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContractFileTypeLocal getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractFileTypeLocal> findAll(Specification<ContractFileTypeLocal> spec, Pageable pageable) {
|
protected Specification<ContractFileTypeLocal> buildSearchSpecification(String searchText) {
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<ContractFileTypeLocal> getSpecification(String searchText) {
|
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("type"), "%" + searchText + "%"),
|
builder.like(root.get("type"), "%" + searchText + "%"),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.ecep.contract.ds.contract.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ecep.contract.constant.ParamConstant;
|
||||||
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;
|
||||||
@@ -15,9 +16,10 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.constant.ServiceConstant;
|
import com.ecep.contract.ds.MyRepository;
|
||||||
import com.ecep.contract.ds.contract.repository.ContractGroupRepository;
|
import com.ecep.contract.ds.contract.repository.ContractGroupRepository;
|
||||||
import com.ecep.contract.model.ContractGroup;
|
import com.ecep.contract.model.ContractGroup;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
@@ -30,7 +32,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-group")
|
@CacheConfig(cacheNames = "contract-group")
|
||||||
public class ContractGroupService implements IEntityService<ContractGroup>, QueryService<ContractGroupVo>,
|
public class ContractGroupService extends EntityService<ContractGroup, ContractGroupVo, Integer>
|
||||||
|
implements IEntityService<ContractGroup>, QueryService<ContractGroupVo>,
|
||||||
VoableService<ContractGroup, ContractGroupVo> {
|
VoableService<ContractGroup, ContractGroupVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ContractGroupService.class);
|
private static final Logger logger = LoggerFactory.getLogger(ContractGroupService.class);
|
||||||
|
|
||||||
@@ -39,8 +42,8 @@ public class ContractGroupService implements IEntityService<ContractGroup>, Quer
|
|||||||
private ContractGroupRepository repository;
|
private ContractGroupRepository repository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContractGroup getById(Integer id) {
|
protected ContractGroupRepository getRepository() {
|
||||||
return repository.findById(id).orElse(null);
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,21 +53,7 @@ public class ContractGroupService implements IEntityService<ContractGroup>, Quer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractGroup> findAll(Specification<ContractGroup> spec, Pageable pageable) {
|
protected Specification<ContractGroup> buildSearchSpecification(String searchText) {
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ContractGroupVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<ContractGroup> spec = null;
|
|
||||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
|
||||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
|
||||||
}
|
|
||||||
return findAll(spec, pageable).map(ContractGroup::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<ContractGroup> getSpecification(String searchText) {
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("code"), "%" + searchText + "%"),
|
builder.like(root.get("code"), "%" + searchText + "%"),
|
||||||
@@ -73,6 +62,11 @@ public class ContractGroupService implements IEntityService<ContractGroup>, Quer
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ContractGroup> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public ContractGroup findByName(String name) {
|
public ContractGroup findByName(String name) {
|
||||||
return repository.findByName(name).orElse(null);
|
return repository.findByName(name).orElse(null);
|
||||||
}
|
}
|
||||||
@@ -115,7 +109,8 @@ public class ContractGroupService implements IEntityService<ContractGroup>, Quer
|
|||||||
repository.delete(group);
|
repository.delete(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContractGroup newContractGroup() {
|
@Override
|
||||||
|
public ContractGroup createNewEntity() {
|
||||||
ContractGroup group = new ContractGroup();
|
ContractGroup group = new ContractGroup();
|
||||||
group.setCode("");
|
group.setCode("");
|
||||||
group.setName("");
|
group.setName("");
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
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 org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
@@ -27,7 +29,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-invoice")
|
@CacheConfig(cacheNames = "contract-invoice")
|
||||||
public class ContractInvoiceService implements IEntityService<ContractInvoice>, QueryService<ContractInvoiceVo>,
|
public class ContractInvoiceService extends EntityService<ContractInvoice, ContractInvoiceVo, Integer>
|
||||||
|
implements IEntityService<ContractInvoice>, QueryService<ContractInvoiceVo>,
|
||||||
VoableService<ContractInvoice, ContractInvoiceVo> {
|
VoableService<ContractInvoice, ContractInvoiceVo> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -75,6 +78,7 @@ public class ContractInvoiceService implements IEntityService<ContractInvoice>,
|
|||||||
* @return 保存后的发票VO
|
* @return 保存后的发票VO
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
public ContractInvoice save(ContractInvoice invoice) {
|
public ContractInvoice save(ContractInvoice invoice) {
|
||||||
try {
|
try {
|
||||||
ContractInvoice saved = repository.save(invoice);
|
ContractInvoice saved = repository.save(invoice);
|
||||||
@@ -85,6 +89,11 @@ public class ContractInvoiceService implements IEntityService<ContractInvoice>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContractInvoice createNewEntity() {
|
||||||
|
return new ContractInvoice();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(ContractInvoice entity, ContractInvoiceVo vo) {
|
public void updateByVo(ContractInvoice entity, ContractInvoiceVo vo) {
|
||||||
if (entity == null || vo == null) {
|
if (entity == null || vo == null) {
|
||||||
@@ -135,13 +144,6 @@ public class ContractInvoiceService implements IEntityService<ContractInvoice>,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ContractInvoiceVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<ContractInvoice> spec = buildParameterSpecification(paramsNode);
|
|
||||||
Page<ContractInvoice> page = repository.findAll(spec, pageable);
|
|
||||||
return page.map(ContractInvoice::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建参数规范
|
* 构建参数规范
|
||||||
*
|
*
|
||||||
@@ -161,7 +163,7 @@ public class ContractInvoiceService implements IEntityService<ContractInvoice>,
|
|||||||
if (paramsNode.has("searchText")) {
|
if (paramsNode.has("searchText")) {
|
||||||
String searchText = paramsNode.get("searchText").asText();
|
String searchText = paramsNode.get("searchText").asText();
|
||||||
if (searchText != null && !searchText.isEmpty()) {
|
if (searchText != null && !searchText.isEmpty()) {
|
||||||
spec = SpecificationUtils.and(spec, getSpecification(searchText));
|
spec = SpecificationUtils.and(spec, getSearchSpecification(searchText));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,17 +171,12 @@ public class ContractInvoiceService implements IEntityService<ContractInvoice>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContractInvoice getById(Integer id) {
|
protected ContractInvoiceRepository getRepository() {
|
||||||
return repository.findById(id).orElse(null);
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractInvoice> findAll(Specification<ContractInvoice> spec, Pageable pageable) {
|
protected Specification<ContractInvoice> buildSearchSpecification(String searchText) {
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<ContractInvoice> getSpecification(String searchText) {
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||||
@@ -189,6 +186,7 @@ public class ContractInvoiceService implements IEntityService<ContractInvoice>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
public void delete(ContractInvoice entity) {
|
public void delete(ContractInvoice entity) {
|
||||||
try {
|
try {
|
||||||
repository.delete(entity);
|
repository.delete(entity);
|
||||||
|
|||||||
@@ -2,26 +2,22 @@ package com.ecep.contract.ds.contract.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ecep.contract.vo.ContractVo;
|
|
||||||
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;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.cache.annotation.Caching;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.constant.ServiceConstant;
|
|
||||||
import com.ecep.contract.ds.contract.repository.ContractItemRepository;
|
import com.ecep.contract.ds.contract.repository.ContractItemRepository;
|
||||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||||
import com.ecep.contract.ds.other.service.InventoryService;
|
import com.ecep.contract.ds.other.service.InventoryService;
|
||||||
@@ -31,6 +27,7 @@ import com.ecep.contract.model.Inventory;
|
|||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
import com.ecep.contract.util.SpecificationUtils;
|
||||||
import com.ecep.contract.vo.ContractItemVo;
|
import com.ecep.contract.vo.ContractItemVo;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
import jakarta.persistence.criteria.Path;
|
import jakarta.persistence.criteria.Path;
|
||||||
@@ -38,26 +35,20 @@ import jakarta.persistence.criteria.Path;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-item")
|
@CacheConfig(cacheNames = "contract-item")
|
||||||
public class ContractItemService implements IEntityService<ContractItem>, QueryService<ContractItemVo>,
|
public class ContractItemService extends EntityService<ContractItem, ContractItemVo, Integer>
|
||||||
|
implements IEntityService<ContractItem>, QueryService<ContractItemVo>,
|
||||||
VoableService<ContractItem, ContractItemVo> {
|
VoableService<ContractItem, ContractItemVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ContractItemService.class);
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private ContractItemRepository itemRepository;
|
private ContractItemRepository itemRepository;
|
||||||
|
|
||||||
@Override
|
|
||||||
public ContractItem getById(Integer id) {
|
|
||||||
return itemRepository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
public ContractItemVo findById(Integer id) {
|
public ContractItemVo findById(Integer id) {
|
||||||
return itemRepository.findById(id).map(ContractItem::toVo).orElse(null);
|
return itemRepository.findById(id).map(ContractItem::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<ContractItem> findAllByItemCode(String itemCode) {
|
public List<ContractItem> findAllByItemCode(String itemCode) {
|
||||||
return itemRepository.findAllByItemCode(itemCode);
|
return itemRepository.findAllByItemCode(itemCode);
|
||||||
}
|
}
|
||||||
@@ -66,44 +57,6 @@ public class ContractItemService implements IEntityService<ContractItem>, QueryS
|
|||||||
return itemRepository.findByRowId(rowId).orElse(null);
|
return itemRepository.findByRowId(rowId).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<ContractItem> getSpecification(String searchText) {
|
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
|
||||||
Path<Inventory> inventory = root.get("inventory");
|
|
||||||
return builder.or(
|
|
||||||
builder.like(root.get("itemCode"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("title"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("specification"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("unit"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("remark"), "%" + searchText + "%"),
|
|
||||||
builder.and(
|
|
||||||
inventory.isNotNull(), builder.or(
|
|
||||||
builder.like(inventory.get("name"), "%" + searchText + "%"),
|
|
||||||
builder.like(inventory.get("code"), "%" + searchText + "%"),
|
|
||||||
builder.like(inventory.get("specification"), "%" + searchText + "%"))));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ContractItem> findAll(Specification<ContractItem> spec, Pageable pageable) {
|
|
||||||
return itemRepository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ContractItemVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<ContractItem> spec = null;
|
|
||||||
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
|
|
||||||
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "contract", "inventory", "creator", "updater");
|
|
||||||
spec = SpecificationUtils.andFieldEqualParam(spec, paramsNode, "itemCode", "refId", "title", "specification");
|
|
||||||
return findAll(spec, pageable).map(ContractItem::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ContractItem> findAllByContract(Contract contract) {
|
public List<ContractItem> findAllByContract(Contract contract) {
|
||||||
return itemRepository.findByContractId(contract.getId());
|
return itemRepository.findByContractId(contract.getId());
|
||||||
}
|
}
|
||||||
@@ -116,14 +69,6 @@ public class ContractItemService implements IEntityService<ContractItem>, QueryS
|
|||||||
return itemRepository.findByInventoryId(inventory.getId());
|
return itemRepository.findByInventoryId(inventory.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ContractItem> findAll(Specification<ContractItem> spec, Sort sort) {
|
|
||||||
return itemRepository.findAll(spec, sort);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Caching(evict = {
|
|
||||||
@CacheEvict(key = "#p0.id")
|
|
||||||
})
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(ContractItem model, ContractItemVo vo) {
|
public void updateByVo(ContractItem model, ContractItemVo vo) {
|
||||||
// 更新基本属性
|
// 更新基本属性
|
||||||
@@ -181,16 +126,47 @@ public class ContractItemService implements IEntityService<ContractItem>, QueryS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
public ContractItem save(ContractItem item) {
|
public ContractItem save(ContractItem item) {
|
||||||
return itemRepository.save(item);
|
return itemRepository.save(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = {
|
|
||||||
@CacheEvict(key = "#p0.id")
|
|
||||||
})
|
|
||||||
@Override
|
@Override
|
||||||
|
@CacheEvict(key = "#p0.id")
|
||||||
public void delete(ContractItem item) {
|
public void delete(ContractItem item) {
|
||||||
itemRepository.delete(item);
|
itemRepository.delete(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ContractItemRepository getRepository() {
|
||||||
|
return itemRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContractItem createNewEntity() {
|
||||||
|
return new ContractItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ContractItem> buildSearchSpecification(String searchText) {
|
||||||
|
return (root, query, builder) -> {
|
||||||
|
Path<Inventory> inventory = root.get("inventory");
|
||||||
|
return builder.or(
|
||||||
|
builder.like(root.get("itemCode"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("title"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("specification"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("unit"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("remark"), "%" + searchText + "%"),
|
||||||
|
builder.and(
|
||||||
|
inventory.isNotNull(), builder.or(
|
||||||
|
builder.like(inventory.get("name"), "%" + searchText + "%"),
|
||||||
|
builder.like(inventory.get("code"), "%" + searchText + "%"),
|
||||||
|
builder.like(inventory.get("specification"), "%" + searchText + "%"))));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ContractItem> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.ds.contract.repository.ContractKindRepository;
|
import com.ecep.contract.ds.contract.repository.ContractKindRepository;
|
||||||
@@ -29,7 +30,8 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-kind")
|
@CacheConfig(cacheNames = "contract-kind")
|
||||||
public class ContractKindService implements IEntityService<ContractKind>, QueryService<ContractKindVo>,
|
public class ContractKindService extends EntityService<ContractKind, ContractKindVo, Integer>
|
||||||
|
implements IEntityService<ContractKind>, QueryService<ContractKindVo>,
|
||||||
VoableService<ContractKind, ContractKindVo> {
|
VoableService<ContractKind, ContractKindVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ContractKindService.class);
|
private static final Logger logger = LoggerFactory.getLogger(ContractKindService.class);
|
||||||
|
|
||||||
@@ -43,26 +45,13 @@ public class ContractKindService implements IEntityService<ContractKind>, QueryS
|
|||||||
return repository.findById(id).map(ContractKind::toVo).orElse(null);
|
return repository.findById(id).map(ContractKind::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContractKind getById(Integer id) {
|
@Override
|
||||||
return repository.findById(id).orElse(null);
|
protected Specification<ContractKind> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractKind> findAll(Specification<ContractKind> spec, Pageable pageable) {
|
protected Specification<ContractKind> buildSearchSpecification(String searchText) {
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ContractKindVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<ContractKind> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
return findAll(spec, pageable).map(ContractKind::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<ContractKind> getSpecification(String searchText) {
|
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("code"), "%" + searchText + "%"),
|
builder.like(root.get("code"), "%" + searchText + "%"),
|
||||||
@@ -72,6 +61,10 @@ public class ContractKindService implements IEntityService<ContractKind>, QueryS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Caching(evict = {
|
||||||
|
@CacheEvict(key = "'kinds'"),
|
||||||
|
@CacheEvict(key = "'kind-'+#p0.id"),
|
||||||
|
})
|
||||||
public void delete(ContractKind entity) {
|
public void delete(ContractKind entity) {
|
||||||
repository.delete(entity);
|
repository.delete(entity);
|
||||||
}
|
}
|
||||||
@@ -117,4 +110,15 @@ public class ContractKindService implements IEntityService<ContractKind>, QueryS
|
|||||||
model.setTitle(vo.getTitle());
|
model.setTitle(vo.getTitle());
|
||||||
// model.setActive(vo.isActive());
|
// model.setActive(vo.isActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ContractKindRepository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ContractKind createNewEntity() {
|
||||||
|
return new ContractKind();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
@@ -22,7 +23,7 @@ import com.ecep.contract.ds.contract.repository.ContractPayPlanRepository;
|
|||||||
import com.ecep.contract.ds.contract.model.Contract;
|
import com.ecep.contract.ds.contract.model.Contract;
|
||||||
import com.ecep.contract.ds.contract.model.ContractPayPlan;
|
import com.ecep.contract.ds.contract.model.ContractPayPlan;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
|
||||||
import com.ecep.contract.vo.ContractPayPlanVo;
|
import com.ecep.contract.vo.ContractPayPlanVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
@@ -32,17 +33,13 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-pay-plan")
|
@CacheConfig(cacheNames = "contract-pay-plan")
|
||||||
public class ContractPayPlanService implements IEntityService<ContractPayPlan>, QueryService<ContractPayPlanVo>,
|
public class ContractPayPlanService extends EntityService<ContractPayPlan, ContractPayPlanVo, Integer>
|
||||||
|
implements IEntityService<ContractPayPlan>, QueryService<ContractPayPlanVo>,
|
||||||
VoableService<ContractPayPlan, ContractPayPlanVo> {
|
VoableService<ContractPayPlan, ContractPayPlanVo> {
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private ContractPayPlanRepository repository;
|
private ContractPayPlanRepository repository;
|
||||||
|
|
||||||
@Override
|
|
||||||
public ContractPayPlan getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
public ContractPayPlanVo findById(Integer id) {
|
public ContractPayPlanVo findById(Integer id) {
|
||||||
@@ -50,29 +47,13 @@ public class ContractPayPlanService implements IEntityService<ContractPayPlan>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<ContractPayPlan> getSpecification(String searchText) {
|
protected ContractPayPlanRepository getRepository() {
|
||||||
if (!StringUtils.hasText(searchText)) {
|
return repository;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, cb) -> {
|
|
||||||
return cb.or(cb.like(root.get("payTerm"), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractPayPlan> findAll(Specification<ContractPayPlan> spec, Pageable pageable) {
|
public ContractPayPlan createNewEntity() {
|
||||||
return repository.findAll(spec, pageable);
|
return new ContractPayPlan();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ContractPayPlanVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<ContractPayPlan> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "contract");
|
|
||||||
return findAll(spec, pageable).map(ContractPayPlan::toVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ContractPayPlan> findAllByContract(ContractVo contract) {
|
public List<ContractPayPlan> findAllByContract(ContractVo contract) {
|
||||||
@@ -117,4 +98,17 @@ public class ContractPayPlanService implements IEntityService<ContractPayPlan>,
|
|||||||
model.setUpdateDate(vo.getUpdateDate());
|
model.setUpdateDate(vo.getUpdateDate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ContractPayPlan> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'buildParameterSpecification'");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ContractPayPlan> buildSearchSpecification(String searchText) {
|
||||||
|
return (root, query, cb) -> {
|
||||||
|
return cb.or(cb.like(root.get("payTerm"), "%" + searchText + "%"));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package com.ecep.contract.ds.contract.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
@@ -15,6 +13,7 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.ds.contract.repository.ContractTypeRepository;
|
import com.ecep.contract.ds.contract.repository.ContractTypeRepository;
|
||||||
@@ -29,9 +28,9 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-type")
|
@CacheConfig(cacheNames = "contract-type")
|
||||||
public class ContractTypeService implements IEntityService<ContractType>, QueryService<ContractTypeVo>,
|
public class ContractTypeService extends EntityService<ContractType, ContractTypeVo, Integer>
|
||||||
|
implements IEntityService<ContractType>, QueryService<ContractTypeVo>,
|
||||||
VoableService<ContractType, ContractTypeVo> {
|
VoableService<ContractType, ContractTypeVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ContractTypeService.class);
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -43,22 +42,29 @@ public class ContractTypeService implements IEntityService<ContractType>, QueryS
|
|||||||
return repository.findById(id).map(ContractType::toVo).orElse(null);
|
return repository.findById(id).map(ContractType::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContractType getById(Integer id) {
|
@Override
|
||||||
return repository.findById(id).orElse(null);
|
protected ContractTypeRepository getRepository() {
|
||||||
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractType> findAll(Specification<ContractType> spec, Pageable pageable) {
|
public ContractType createNewEntity() {
|
||||||
return repository.findAll(spec, pageable);
|
return new ContractType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ContractTypeVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
protected Specification<ContractType> buildSearchSpecification(String searchText) {
|
||||||
Specification<ContractType> spec = null;
|
return (root, query, builder) -> {
|
||||||
if (paramsNode.has("searchText")) {
|
return builder.or(
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
builder.like(root.get("code"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("name"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("title"), "%" + searchText + "%"));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return findAll(spec, pageable).map(ContractType::toVo);
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ContractType> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContractType findByName(String name) {
|
public ContractType findByName(String name) {
|
||||||
@@ -75,16 +81,6 @@ public class ContractTypeService implements IEntityService<ContractType>, QueryS
|
|||||||
return repository.findAll().stream().map(ContractType::toVo).toList();
|
return repository.findAll().stream().map(ContractType::toVo).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<ContractType> getSpecification(String searchText) {
|
|
||||||
return (root, query, builder) -> {
|
|
||||||
return builder.or(
|
|
||||||
builder.like(root.get("code"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("title"), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "#p0.id"),
|
@CacheEvict(key = "#p0.id"),
|
||||||
@CacheEvict(key = "'code-'+#p0.code"),
|
@CacheEvict(key = "'code-'+#p0.code"),
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.ds.contract.repository.ExtendVendorInfoRepository;
|
import com.ecep.contract.ds.contract.repository.ExtendVendorInfoRepository;
|
||||||
@@ -25,14 +26,15 @@ import com.ecep.contract.ds.vendor.service.VendorGroupService;
|
|||||||
import com.ecep.contract.ds.contract.model.Contract;
|
import com.ecep.contract.ds.contract.model.Contract;
|
||||||
import com.ecep.contract.ds.vendor.model.ExtendVendorInfo;
|
import com.ecep.contract.ds.vendor.model.ExtendVendorInfo;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
|
||||||
import com.ecep.contract.vo.ExtendVendorInfoVo;
|
import com.ecep.contract.vo.ExtendVendorInfoVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-ext-ven-info")
|
@CacheConfig(cacheNames = "contract-ext-ven-info")
|
||||||
public class ExtendVendorInfoService implements IEntityService<ExtendVendorInfo>, QueryService<ExtendVendorInfoVo>,
|
public class ExtendVendorInfoService extends EntityService<ExtendVendorInfo, ExtendVendorInfoVo, Integer>
|
||||||
|
implements IEntityService<ExtendVendorInfo>, QueryService<ExtendVendorInfoVo>,
|
||||||
VoableService<ExtendVendorInfo, ExtendVendorInfoVo> {
|
VoableService<ExtendVendorInfo, ExtendVendorInfoVo> {
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -45,8 +47,23 @@ public class ExtendVendorInfoService implements IEntityService<ExtendVendorInfo>
|
|||||||
private ContractService contractService;
|
private ContractService contractService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExtendVendorInfo getById(Integer id) {
|
protected ExtendVendorInfoRepository getRepository() {
|
||||||
return repository.findById(id).orElse(null);
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExtendVendorInfo createNewEntity() {
|
||||||
|
return new ExtendVendorInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ExtendVendorInfo> buildSearchSpecification(String searchText) {
|
||||||
|
return (root, query, builder) -> {
|
||||||
|
return builder.or(
|
||||||
|
builder.like(root.get("contract").get("code"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("contract").get("name"), "%" + searchText + "%"),
|
||||||
|
builder.like(root.get("codeSequenceNumber").as(String.class), "%" + searchText + "%"));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -81,35 +98,6 @@ public class ExtendVendorInfoService implements IEntityService<ExtendVendorInfo>
|
|||||||
repository.delete(bidVendor);
|
repository.delete(bidVendor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ExtendVendorInfo> findAll(Specification<ExtendVendorInfo> spec, Pageable pageable) {
|
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<ExtendVendorInfo> getSpecification(String searchText) {
|
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
|
||||||
return builder.or(
|
|
||||||
builder.like(root.get("contract").get("code"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("contract").get("name"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("codeSequenceNumber").as(String.class), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<ExtendVendorInfoVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<ExtendVendorInfo> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "contract");
|
|
||||||
return findAll(spec, pageable).map(ExtendVendorInfo::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ExtendVendorInfo> findAll(Specification<ExtendVendorInfo> spec, Sort sort) {
|
public List<ExtendVendorInfo> findAll(Specification<ExtendVendorInfo> spec, Sort sort) {
|
||||||
return repository.findAll(spec, sort);
|
return repository.findAll(spec, sort);
|
||||||
}
|
}
|
||||||
@@ -167,4 +155,9 @@ public class ExtendVendorInfoService implements IEntityService<ExtendVendorInfo>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<ExtendVendorInfo> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'buildParameterSpecification'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,25 +2,22 @@ package com.ecep.contract.ds.contract.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
|
||||||
import com.ecep.contract.vo.ContractVo;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.cache.annotation.Caching;
|
import org.springframework.cache.annotation.Caching;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.ds.contract.repository.PurchaseBillVoucherItemRepository;
|
import com.ecep.contract.ds.contract.repository.PurchaseBillVoucherItemRepository;
|
||||||
import com.ecep.contract.ds.vendor.model.PurchaseBillVoucherItem;
|
import com.ecep.contract.ds.vendor.model.PurchaseBillVoucherItem;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
|
import com.ecep.contract.vo.ContractVo;
|
||||||
import com.ecep.contract.vo.PurchaseBillVoucherItemVo;
|
import com.ecep.contract.vo.PurchaseBillVoucherItemVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
@@ -28,25 +25,31 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "purchase-bill-voucher-item")
|
@CacheConfig(cacheNames = "purchase-bill-voucher-item")
|
||||||
public class PurchaseBillVoucherItemService
|
public class PurchaseBillVoucherItemService
|
||||||
implements IEntityService<PurchaseBillVoucherItem>, QueryService<PurchaseBillVoucherItem>,
|
extends EntityService<PurchaseBillVoucherItem, PurchaseBillVoucherItemVo, Integer>
|
||||||
|
implements IEntityService<PurchaseBillVoucherItem>, QueryService<PurchaseBillVoucherItemVo>,
|
||||||
VoableService<PurchaseBillVoucherItem, PurchaseBillVoucherItemVo> {
|
VoableService<PurchaseBillVoucherItem, PurchaseBillVoucherItemVo> {
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private PurchaseBillVoucherItemRepository repository;
|
private PurchaseBillVoucherItemRepository repository;
|
||||||
|
|
||||||
@Override
|
|
||||||
public PurchaseBillVoucherItem getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
public PurchaseBillVoucherItem findById(Integer id) {
|
public PurchaseBillVoucherItemVo findById(Integer id) {
|
||||||
return repository.findById(id).orElse(null);
|
return repository.findById(id).map(PurchaseBillVoucherItem::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<PurchaseBillVoucherItem> getSpecification(String searchText) {
|
protected PurchaseBillVoucherItemRepository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PurchaseBillVoucherItem createNewEntity() {
|
||||||
|
return new PurchaseBillVoucherItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<PurchaseBillVoucherItem> buildSearchSpecification(String searchText) {
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("description"), "%" + searchText + "%"));
|
builder.like(root.get("description"), "%" + searchText + "%"));
|
||||||
@@ -54,19 +57,8 @@ public class PurchaseBillVoucherItemService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PurchaseBillVoucherItem> findAll(Specification<PurchaseBillVoucherItem> spec, Pageable pageable) {
|
protected Specification<PurchaseBillVoucherItem> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
return repository.findAll(spec, pageable);
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<PurchaseBillVoucherItem> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<PurchaseBillVoucherItem> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "voucher");
|
|
||||||
return findAll(spec, pageable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@@ -87,10 +79,6 @@ public class PurchaseBillVoucherItemService
|
|||||||
return repository.save(entity);
|
return repository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PurchaseBillVoucherItem> findAll(Specification<PurchaseBillVoucherItem> spec, Sort sort) {
|
|
||||||
return repository.findAll(spec, sort);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(PurchaseBillVoucherItem model, PurchaseBillVoucherItemVo vo) {
|
public void updateByVo(PurchaseBillVoucherItem model, PurchaseBillVoucherItemVo vo) {
|
||||||
model.setId(vo.getId());
|
model.setId(vo.getId());
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
package com.ecep.contract.ds.contract.service;
|
package com.ecep.contract.ds.contract.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.ecep.contract.ds.vendor.model.PurchaseBillVoucherItem;
|
|
||||||
import com.ecep.contract.ds.vendor.model.PurchaseOrderItem;
|
|
||||||
import jakarta.persistence.criteria.Root;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
@@ -18,11 +13,12 @@ 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 org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
|
import com.ecep.contract.ds.MyRepository;
|
||||||
import com.ecep.contract.ds.company.service.CompanyService;
|
import com.ecep.contract.ds.company.service.CompanyService;
|
||||||
import com.ecep.contract.ds.company.service.InvoiceService;
|
import com.ecep.contract.ds.company.service.InvoiceService;
|
||||||
import com.ecep.contract.ds.contract.repository.PurchaseBillVoucherRepository;
|
import com.ecep.contract.ds.contract.repository.PurchaseBillVoucherRepository;
|
||||||
@@ -39,40 +35,21 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "purchase-bill-voucher")
|
@CacheConfig(cacheNames = "purchase-bill-voucher")
|
||||||
public class PurchaseBillVoucherService
|
public class PurchaseBillVoucherService extends EntityService<PurchaseBillVoucher, PurchaseBillVoucherVo, Integer>
|
||||||
implements IEntityService<PurchaseBillVoucher>, QueryService<PurchaseBillVoucherVo>,
|
implements IEntityService<PurchaseBillVoucher>, QueryService<PurchaseBillVoucherVo>,
|
||||||
VoableService<PurchaseBillVoucher, PurchaseBillVoucherVo> {
|
VoableService<PurchaseBillVoucher, PurchaseBillVoucherVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PurchaseBillVoucherService.class);
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private PurchaseBillVoucherRepository repository;
|
private PurchaseBillVoucherRepository repository;
|
||||||
|
|
||||||
@Override
|
|
||||||
public PurchaseBillVoucher getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
public PurchaseBillVoucherVo findById(Integer id) {
|
public PurchaseBillVoucherVo findById(Integer id) {
|
||||||
return repository.findById(id).map(PurchaseBillVoucher::toVo).orElse(null);
|
return repository.findById(id).map(PurchaseBillVoucher::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<PurchaseBillVoucher> getSpecification(String searchText) {
|
|
||||||
// if null
|
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (root, query, builder) -> {
|
|
||||||
return builder.or(
|
|
||||||
builder.like(root.get("code"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("description"), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cacheable(key = "'code-'+#p0")
|
@Cacheable(key = "'code-'+#p0")
|
||||||
public PurchaseBillVoucherVo findByCode(String code) {
|
public PurchaseBillVoucherVo findByCode(String code) {
|
||||||
return repository.findByCode(code).map(PurchaseBillVoucher::toVo).orElse(null);
|
return repository.findByCode(code).map(PurchaseBillVoucher::toVo).orElse(null);
|
||||||
@@ -88,16 +65,17 @@ public class PurchaseBillVoucherService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存实体对象,异步方法
|
* 保存实体对象
|
||||||
*
|
*
|
||||||
* @param voucher 要保存的实体对象
|
* @param voucher 要保存的实体对象
|
||||||
* @return 返回异步调用
|
* @return 返回保存后的实体
|
||||||
*/
|
*/
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "#p0.id"),
|
@CacheEvict(key = "#p0.id"),
|
||||||
@CacheEvict(key = "'code-'+#p0.code"),
|
@CacheEvict(key = "'code-'+#p0.code"),
|
||||||
@CacheEvict(key = "'refId-'+#p0.refId")
|
@CacheEvict(key = "'refId-'+#p0.refId")
|
||||||
})
|
})
|
||||||
|
@Override
|
||||||
public PurchaseBillVoucher save(PurchaseBillVoucher voucher) {
|
public PurchaseBillVoucher save(PurchaseBillVoucher voucher) {
|
||||||
return repository.save(voucher);
|
return repository.save(voucher);
|
||||||
}
|
}
|
||||||
@@ -112,47 +90,30 @@ public class PurchaseBillVoucherService
|
|||||||
repository.delete(order);
|
repository.delete(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long count() {
|
|
||||||
return repository.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long count(Specification<PurchaseBillVoucher> spec) {
|
@Override
|
||||||
return repository.count(spec);
|
protected Specification<PurchaseBillVoucher> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'buildParameterSpecification'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PurchaseBillVoucher> findAll(Specification<PurchaseBillVoucher> spec, Pageable pageable) {
|
protected PurchaseBillVoucherRepository getRepository() {
|
||||||
return repository.findAll(spec, pageable);
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PurchaseBillVoucherVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
public PurchaseBillVoucher createNewEntity() {
|
||||||
Specification<PurchaseBillVoucher> spec = null;
|
return new PurchaseBillVoucher();
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "company", "inventory");
|
|
||||||
if (paramsNode.has("purchaseOrder")) {
|
|
||||||
spec = SpecificationUtils.and(spec, (root, query, cb) -> {
|
|
||||||
Root<PurchaseBillVoucherItem> voucherItemRoot = query.from(PurchaseBillVoucherItem.class);
|
|
||||||
Root<PurchaseOrderItem> orderItemRoot = query.from(PurchaseOrderItem.class);
|
|
||||||
return cb.and(
|
|
||||||
cb.equal(voucherItemRoot.get("orderItem"), orderItemRoot),
|
|
||||||
cb.equal(orderItemRoot.get("order").get("id"), paramsNode.get("purchaseOrder").asInt()),
|
|
||||||
cb.equal(root, voucherItemRoot.get("voucher"))
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return findAll(spec, pageable).map(PurchaseBillVoucher::toVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PurchaseBillVoucher> findAll(Specification<PurchaseBillVoucher> spec, Sort sort) {
|
@Override
|
||||||
return repository.findAll(spec, sort);
|
protected Specification<PurchaseBillVoucher> buildSearchSpecification(String searchText) {
|
||||||
}
|
return (root, query, builder) -> {
|
||||||
|
return builder.or(
|
||||||
public List<PurchaseBillVoucher> search(String searchText) {
|
builder.like(root.get("code"), "%" + searchText + "%"),
|
||||||
return repository.findAll(getSpecification(searchText), Pageable.ofSize(10)).getContent();
|
builder.like(root.get("description"), "%" + searchText + "%"));
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -200,4 +161,5 @@ public class PurchaseBillVoucherService
|
|||||||
model.setVerifier(employeeService.getById(vo.getVerifierId()));
|
model.setVerifier(employeeService.getById(vo.getVerifierId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,6 @@ package com.ecep.contract.ds.contract.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.ecep.contract.ds.vendor.model.PurchaseOrder;
|
|
||||||
import com.ecep.contract.vo.ContractItemVo;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
@@ -15,38 +11,31 @@ import org.springframework.cache.annotation.Caching;
|
|||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
import com.ecep.contract.ds.contract.repository.PurchaseOrderItemRepository;
|
import com.ecep.contract.ds.contract.repository.PurchaseOrderItemRepository;
|
||||||
import com.ecep.contract.ds.other.service.InventoryService;
|
import com.ecep.contract.ds.other.service.InventoryService;
|
||||||
|
import com.ecep.contract.ds.vendor.model.PurchaseOrder;
|
||||||
import com.ecep.contract.ds.vendor.model.PurchaseOrderItem;
|
import com.ecep.contract.ds.vendor.model.PurchaseOrderItem;
|
||||||
import com.ecep.contract.service.ServiceException;
|
import com.ecep.contract.service.ServiceException;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
|
||||||
import com.ecep.contract.vo.PurchaseOrderItemVo;
|
import com.ecep.contract.vo.PurchaseOrderItemVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-purchase-order-item")
|
@CacheConfig(cacheNames = "contract-purchase-order-item")
|
||||||
public class PurchaseOrderItemService implements IEntityService<PurchaseOrderItem>, QueryService<PurchaseOrderItemVo>,
|
public class PurchaseOrderItemService extends EntityService<PurchaseOrderItem, PurchaseOrderItemVo, Integer> implements IEntityService<PurchaseOrderItem>, QueryService<PurchaseOrderItemVo>,
|
||||||
VoableService<PurchaseOrderItem, PurchaseOrderItemVo> {
|
VoableService<PurchaseOrderItem, PurchaseOrderItemVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PurchaseOrderItemService.class);
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private PurchaseOrderItemRepository repository;
|
private PurchaseOrderItemRepository repository;
|
||||||
|
|
||||||
@Override
|
|
||||||
public PurchaseOrderItem getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
public PurchaseOrderItemVo findById(Integer id) {
|
public PurchaseOrderItemVo findById(Integer id) {
|
||||||
@@ -62,61 +51,10 @@ public class PurchaseOrderItemService implements IEntityService<PurchaseOrderIte
|
|||||||
while (list.size() > 1) {
|
while (list.size() > 1) {
|
||||||
PurchaseOrderItem item = list.removeLast();
|
PurchaseOrderItem item = list.removeLast();
|
||||||
repository.delete(item);
|
repository.delete(item);
|
||||||
if (logger.isInfoEnabled()) {
|
|
||||||
logger.info("Duplicate PurchaseOrderItem, Delete {}", item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return list.getFirst().toVo();
|
return list.getFirst().toVo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<PurchaseOrderItem> getSpecification(String searchText) {
|
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (root, query, builder) -> {
|
|
||||||
return builder.or(builder.like(root.get("description"), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<PurchaseOrderItem> findAll(Specification<PurchaseOrderItem> spec, Pageable pageable) {
|
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<PurchaseOrderItemVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<PurchaseOrderItem> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "order", "inventory", "contractItem");
|
|
||||||
|
|
||||||
// if (paramsNode.has("contractItem")) {
|
|
||||||
// ContractItemService itemService = SpringApp.getBean(ContractItemService.class);
|
|
||||||
// var contractItem = itemService.findById(paramsNode.get("contractItem").asInt());
|
|
||||||
//
|
|
||||||
// if (contractItem.getInventoryId() == null) {
|
|
||||||
// spec = SpecificationUtils.and(spec, (root, query, builder) -> {
|
|
||||||
// return builder.and(
|
|
||||||
// builder.equal(root.get("order").get("contract").get("id"), contractItem.getContractId()),
|
|
||||||
// builder.equal(root.get("inventory").get("id"), null)
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// spec = SpecificationUtils.and(spec, (root, query, builder) -> {
|
|
||||||
// return builder.and(
|
|
||||||
// builder.equal(root.get("order").get("contract").get("id"), contractItem.getContractId()),
|
|
||||||
// builder.equal(root.get("inventory").get("id"), contractItem.getInventoryId())
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return findAll(spec, pageable).map(PurchaseOrderItem::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "#p0.id"),
|
@CacheEvict(key = "#p0.id"),
|
||||||
@CacheEvict(key = "'refId-'+#p0.refId")
|
@CacheEvict(key = "'refId-'+#p0.refId")
|
||||||
@@ -134,10 +72,6 @@ public class PurchaseOrderItemService implements IEntityService<PurchaseOrderIte
|
|||||||
return repository.save(entity);
|
return repository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PurchaseOrderItem> findAll(Specification<PurchaseOrderItem> spec, Sort sort) {
|
|
||||||
return repository.findAll(spec, sort);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(PurchaseOrderItem model, PurchaseOrderItemVo vo) {
|
public void updateByVo(PurchaseOrderItem model, PurchaseOrderItemVo vo) {
|
||||||
if (model == null) {
|
if (model == null) {
|
||||||
@@ -183,4 +117,26 @@ public class PurchaseOrderItemService implements IEntityService<PurchaseOrderIte
|
|||||||
public List<PurchaseOrderItem> findAllByOrder(PurchaseOrder order) {
|
public List<PurchaseOrderItem> findAllByOrder(PurchaseOrder order) {
|
||||||
return repository.findAllByOrder(order);
|
return repository.findAllByOrder(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PurchaseOrderItemRepository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PurchaseOrderItem createNewEntity() {
|
||||||
|
return new PurchaseOrderItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<PurchaseOrderItem> buildSearchSpecification(String searchText) {
|
||||||
|
return (root, query, builder) -> {
|
||||||
|
return builder.or(builder.like(root.get("description"), "%" + searchText + "%"));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<PurchaseOrderItem> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'buildParameterSpecification'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,6 @@ package com.ecep.contract.ds.contract.service;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ecep.contract.vo.ContractVo;
|
import com.ecep.contract.vo.ContractVo;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
@@ -13,10 +11,10 @@ import org.springframework.cache.annotation.Caching;
|
|||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.SpringApp;
|
import com.ecep.contract.SpringApp;
|
||||||
@@ -26,7 +24,6 @@ import com.ecep.contract.ds.contract.model.Contract;
|
|||||||
import com.ecep.contract.ds.vendor.model.PurchaseOrder;
|
import com.ecep.contract.ds.vendor.model.PurchaseOrder;
|
||||||
import com.ecep.contract.service.ServiceException;
|
import com.ecep.contract.service.ServiceException;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
|
||||||
import com.ecep.contract.vo.PurchaseOrderVo;
|
import com.ecep.contract.vo.PurchaseOrderVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
@@ -36,31 +33,32 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "contract-purchase-order")
|
@CacheConfig(cacheNames = "contract-purchase-order")
|
||||||
public class PurchaseOrdersService implements IEntityService<PurchaseOrder>, QueryService<PurchaseOrderVo>,
|
public class PurchaseOrdersService extends EntityService<PurchaseOrder, PurchaseOrderVo, Integer>
|
||||||
|
implements IEntityService<PurchaseOrder>, QueryService<PurchaseOrderVo>,
|
||||||
VoableService<PurchaseOrder, PurchaseOrderVo> {
|
VoableService<PurchaseOrder, PurchaseOrderVo> {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PurchaseOrdersService.class);
|
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private PurchaseOrderRepository repository;
|
private PurchaseOrderRepository repository;
|
||||||
|
|
||||||
@Lazy
|
|
||||||
@Autowired
|
|
||||||
private EmployeeService employeeService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PurchaseOrder getById(Integer id) {
|
protected PurchaseOrderRepository getRepository() {
|
||||||
return repository.findById(id).orElse(null);
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
|
@Override
|
||||||
public PurchaseOrderVo findById(Integer id) {
|
public PurchaseOrderVo findById(Integer id) {
|
||||||
return repository.findById(id).map(PurchaseOrder::toVo).orElse(null);
|
return repository.findById(id).map(PurchaseOrder::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<PurchaseOrder> getSpecification(String searchText) {
|
public PurchaseOrder createNewEntity() {
|
||||||
|
return new PurchaseOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<PurchaseOrder> buildSearchSpecification(String searchText) {
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
builder.like(root.get("code"), "%" + searchText + "%"),
|
builder.like(root.get("code"), "%" + searchText + "%"),
|
||||||
@@ -108,31 +106,9 @@ public class PurchaseOrdersService implements IEntityService<PurchaseOrder>, Que
|
|||||||
repository.delete(order);
|
repository.delete(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long count() {
|
|
||||||
return repository.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long count(Specification<PurchaseOrder> spec) {
|
|
||||||
return repository.count(spec);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PurchaseOrder> findAll(Specification<PurchaseOrder> spec, Pageable pageable) {
|
protected Specification<PurchaseOrder> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
return repository.findAll(spec, pageable);
|
throw new UnsupportedOperationException("Unimplemented method 'buildParameterSpecification'");
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<PurchaseOrderVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<PurchaseOrder> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "contract");
|
|
||||||
return findAll(spec, pageable).map(PurchaseOrder::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<PurchaseOrder> findAll(Specification<PurchaseOrder> spec, Sort sort) {
|
|
||||||
return repository.findAll(spec, sort);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PurchaseOrder> findAllByContract(Contract contract) {
|
public List<PurchaseOrder> findAllByContract(Contract contract) {
|
||||||
@@ -143,15 +119,6 @@ public class PurchaseOrdersService implements IEntityService<PurchaseOrder>, Que
|
|||||||
return repository.findAllByContractId(contract.getId());
|
return repository.findAllByContractId(contract.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PurchaseOrder> search(String searchText) {
|
|
||||||
Specification<PurchaseOrder> spec = (root, query, builder) -> {
|
|
||||||
return builder.or(
|
|
||||||
builder.like(root.get("name"), "%" + searchText + "%"),
|
|
||||||
builder.like(root.get("code"), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
return repository.findAll(spec, Pageable.ofSize(10)).getContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(PurchaseOrder model, PurchaseOrderVo vo) {
|
public void updateByVo(PurchaseOrder model, PurchaseOrderVo vo) {
|
||||||
if (model == null || vo == null) {
|
if (model == null || vo == null) {
|
||||||
|
|||||||
@@ -52,10 +52,7 @@ public class SaleOrdersService extends EntityService<SalesOrder, SalesOrderVo, I
|
|||||||
return new SalesOrder();
|
return new SalesOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SalesOrder getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
public SalesOrderVo findById(Integer id) {
|
public SalesOrderVo findById(Integer id) {
|
||||||
|
|||||||
@@ -1,19 +1,15 @@
|
|||||||
package com.ecep.contract.ds.contract.service;
|
package com.ecep.contract.ds.contract.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.cache.annotation.Caching;
|
import org.springframework.cache.annotation.Caching;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
import com.ecep.contract.ds.contract.repository.SalesBillVoucherItemRepository;
|
import com.ecep.contract.ds.contract.repository.SalesBillVoucherItemRepository;
|
||||||
@@ -25,50 +21,19 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "sales-bill-voucher-item")
|
@CacheConfig(cacheNames = "sales-bill-voucher-item")
|
||||||
public class SalesBillVoucherItemService
|
public class SalesBillVoucherItemService extends EntityService<SalesBillVoucherItem, SalesBillVoucherItemVo, Integer>
|
||||||
implements IEntityService<SalesBillVoucherItem>, QueryService<SalesBillVoucherItemVo>,
|
implements IEntityService<SalesBillVoucherItem>, QueryService<SalesBillVoucherItemVo>,
|
||||||
VoableService<SalesBillVoucherItem, SalesBillVoucherItemVo> {
|
VoableService<SalesBillVoucherItem, SalesBillVoucherItemVo> {
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private SalesBillVoucherItemRepository repository;
|
private SalesBillVoucherItemRepository repository;
|
||||||
|
|
||||||
@Override
|
|
||||||
public SalesBillVoucherItem getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
public SalesBillVoucherItemVo findById(Integer id) {
|
public SalesBillVoucherItemVo findById(Integer id) {
|
||||||
return repository.findById(id).map(SalesBillVoucherItem::toVo).orElse(null);
|
return repository.findById(id).map(SalesBillVoucherItem::toVo).orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Specification<SalesBillVoucherItem> getSpecification(String searchText) {
|
|
||||||
return (root, query, builder) -> {
|
|
||||||
return builder.or(
|
|
||||||
builder.like(root.get("description"), "%" + searchText + "%"));
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<SalesBillVoucherItem> findAll(Specification<SalesBillVoucherItem> spec, Pageable pageable) {
|
|
||||||
return repository.findAll(spec, pageable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<SalesBillVoucherItem> findAll(Specification<SalesBillVoucherItem> spec, Sort sort) {
|
|
||||||
return repository.findAll(spec, sort);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<SalesBillVoucherItemVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<SalesBillVoucherItem> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
return findAll(spec, pageable).map(SalesBillVoucherItem::toVo);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@CacheEvict(key = "'item-'+#p0.id")
|
@CacheEvict(key = "'item-'+#p0.id")
|
||||||
})
|
})
|
||||||
@@ -85,12 +50,26 @@ public class SalesBillVoucherItemService
|
|||||||
return repository.save(entity);
|
return repository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countItems() {
|
@Override
|
||||||
return repository.count();
|
protected SalesBillVoucherItemRepository getRepository() {
|
||||||
|
return repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long countItems(Specification<SalesBillVoucherItem> spec) {
|
@Override
|
||||||
return repository.count(spec);
|
public SalesBillVoucherItem createNewEntity() {
|
||||||
|
return new SalesBillVoucherItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<SalesBillVoucherItem> buildSearchSpecification(String searchText) {
|
||||||
|
return (root, query, builder) -> {
|
||||||
|
return builder.or(builder.like(root.get("description"), "%" + searchText + "%"));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<SalesBillVoucherItem> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
|
throw new UnsupportedOperationException("Unimplemented method 'buildParameterSpecification'");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -103,4 +82,5 @@ public class SalesBillVoucherItemService
|
|||||||
model.setPrice(vo.getPrice());
|
model.setPrice(vo.getPrice());
|
||||||
model.setDescription(vo.getDescription());
|
model.setDescription(vo.getDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,24 +2,26 @@ package com.ecep.contract.ds.customer.repository;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.ecep.contract.ds.MyRepository;
|
||||||
import com.ecep.contract.ds.customer.model.CompanyCustomer;
|
import com.ecep.contract.ds.customer.model.CompanyCustomer;
|
||||||
import com.ecep.contract.ds.customer.model.CompanyCustomerEvaluationFormFile;
|
import com.ecep.contract.ds.customer.model.CompanyCustomerEvaluationFormFile;
|
||||||
import com.ecep.contract.ds.customer.model.CompanyCustomerFile;
|
import com.ecep.contract.ds.customer.model.CompanyCustomerFile;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface CompanyCustomerEvaluationFormFileRepository extends JpaRepository<CompanyCustomerEvaluationFormFile, Integer>, JpaSpecificationExecutor<CompanyCustomerEvaluationFormFile> {
|
public interface CompanyCustomerEvaluationFormFileRepository
|
||||||
|
extends MyRepository<CompanyCustomerEvaluationFormFile, Integer> {
|
||||||
|
|
||||||
List<CompanyCustomerEvaluationFormFile> findAllByCustomerFileCustomer(@Param("customer") CompanyCustomer customer);
|
List<CompanyCustomerEvaluationFormFile> findAllByCustomerFileCustomer(@Param("customer") CompanyCustomer customer);
|
||||||
|
|
||||||
@Query(value = "SELECT * FROM COMPANY_CUSTOMER_FILE ccf left join COMPANY_CUSTOMER_EVALUATION_FORM_FILE CCEFF on ccf.ID = CCEFF.ID " +
|
@Query(value = "SELECT * FROM COMPANY_CUSTOMER_FILE ccf left join COMPANY_CUSTOMER_EVALUATION_FORM_FILE CCEFF on ccf.ID = CCEFF.ID "
|
||||||
|
+
|
||||||
"where ccf.CUSTOMER_ID=:customer and ccf.TYPE=:fileType", nativeQuery = true)
|
"where ccf.CUSTOMER_ID=:customer and ccf.TYPE=:fileType", nativeQuery = true)
|
||||||
List<CompanyCustomerEvaluationFormFile> findAllByCustomerAndType(@Param("customer") int companyCustomerId, @Param("fileType") String type);
|
List<CompanyCustomerEvaluationFormFile> findAllByCustomerAndType(@Param("customer") int companyCustomerId,
|
||||||
|
@Param("fileType") String type);
|
||||||
|
|
||||||
CompanyCustomerEvaluationFormFile findByCustomerFile(CompanyCustomerFile customerFile);
|
CompanyCustomerEvaluationFormFile findByCustomerFile(CompanyCustomerFile customerFile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,23 +12,25 @@ import org.springframework.data.domain.Page;
|
|||||||
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 org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
|
import com.ecep.contract.EntityService;
|
||||||
import com.ecep.contract.IEntityService;
|
import com.ecep.contract.IEntityService;
|
||||||
import com.ecep.contract.QueryService;
|
import com.ecep.contract.QueryService;
|
||||||
|
import com.ecep.contract.ds.MyRepository;
|
||||||
import com.ecep.contract.ds.customer.repository.CompanyCustomerEntityRepository;
|
import com.ecep.contract.ds.customer.repository.CompanyCustomerEntityRepository;
|
||||||
import com.ecep.contract.ds.other.service.EmployeeService;
|
import com.ecep.contract.ds.other.service.EmployeeService;
|
||||||
import com.ecep.contract.ds.customer.model.CompanyCustomer;
|
import com.ecep.contract.ds.customer.model.CompanyCustomer;
|
||||||
import com.ecep.contract.ds.customer.model.CompanyCustomerEntity;
|
import com.ecep.contract.ds.customer.model.CompanyCustomerEntity;
|
||||||
import com.ecep.contract.service.VoableService;
|
import com.ecep.contract.service.VoableService;
|
||||||
import com.ecep.contract.util.SpecificationUtils;
|
|
||||||
import com.ecep.contract.vo.CompanyCustomerEntityVo;
|
import com.ecep.contract.vo.CompanyCustomerEntityVo;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Service
|
@Service
|
||||||
@CacheConfig(cacheNames = "company-customer-entity")
|
@CacheConfig(cacheNames = "company-customer-entity")
|
||||||
public class CompanyCustomerEntityService implements IEntityService<CompanyCustomerEntity>, QueryService<CompanyCustomerEntityVo>, VoableService<CompanyCustomerEntity, CompanyCustomerEntityVo> {
|
public class CompanyCustomerEntityService extends EntityService<CompanyCustomerEntity, CompanyCustomerEntityVo, Integer>
|
||||||
|
implements IEntityService<CompanyCustomerEntity>, QueryService<CompanyCustomerEntityVo>,
|
||||||
|
VoableService<CompanyCustomerEntity, CompanyCustomerEntityVo> {
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private CompanyCustomerEntityRepository repository;
|
private CompanyCustomerEntityRepository repository;
|
||||||
@@ -42,11 +44,6 @@ public class CompanyCustomerEntityService implements IEntityService<CompanyCusto
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmployeeService employeeService;
|
private EmployeeService employeeService;
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompanyCustomerEntity getById(Integer id) {
|
|
||||||
return repository.findById(id).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Cacheable(key = "#p0")
|
@Cacheable(key = "#p0")
|
||||||
@Override
|
@Override
|
||||||
public CompanyCustomerEntityVo findById(Integer id) {
|
public CompanyCustomerEntityVo findById(Integer id) {
|
||||||
@@ -54,13 +51,6 @@ public class CompanyCustomerEntityService implements IEntityService<CompanyCusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Specification<CompanyCustomerEntity> getSpecification(String searchText) {
|
|
||||||
if (!StringUtils.hasText(searchText)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return SpecificationUtils.andWith(searchText, this::buildSearchSpecification);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Specification<CompanyCustomerEntity> buildSearchSpecification(String searchText) {
|
protected Specification<CompanyCustomerEntity> buildSearchSpecification(String searchText) {
|
||||||
return (root, query, builder) -> {
|
return (root, query, builder) -> {
|
||||||
return builder.or(
|
return builder.or(
|
||||||
@@ -70,25 +60,9 @@ public class CompanyCustomerEntityService implements IEntityService<CompanyCusto
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CompanyCustomerEntity> search(String searchText) {
|
|
||||||
Specification<CompanyCustomerEntity> spec = getSpecification(searchText);
|
|
||||||
return repository.findAll(spec, Pageable.ofSize(10)).getContent();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CompanyCustomerEntity> findAll(Specification<CompanyCustomerEntity> spec, Pageable pageable) {
|
protected Specification<CompanyCustomerEntity> buildParameterSpecification(JsonNode paramsNode) {
|
||||||
return repository.findAll(spec, pageable);
|
throw new UnsupportedOperationException("Unimplemented method 'buildParameterSpecification'");
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Page<CompanyCustomerEntityVo> findAll(JsonNode paramsNode, Pageable pageable) {
|
|
||||||
Specification<CompanyCustomerEntity> spec = null;
|
|
||||||
if (paramsNode.has("searchText")) {
|
|
||||||
spec = getSpecification(paramsNode.get("searchText").asText());
|
|
||||||
}
|
|
||||||
// field
|
|
||||||
spec = SpecificationUtils.andParam(spec, paramsNode, "customer");
|
|
||||||
return findAll(spec, pageable).map(CompanyCustomerEntity::toVo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Caching(evict = {
|
@Caching(evict = {
|
||||||
@@ -126,6 +100,16 @@ public class CompanyCustomerEntityService implements IEntityService<CompanyCusto
|
|||||||
repository.saveAll(entities);
|
repository.saveAll(entities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected MyRepository<CompanyCustomerEntity, Integer> getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyCustomerEntity createNewEntity() {
|
||||||
|
return new CompanyCustomerEntity();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateByVo(CompanyCustomerEntity entity, CompanyCustomerEntityVo vo) {
|
public void updateByVo(CompanyCustomerEntity entity, CompanyCustomerEntityVo vo) {
|
||||||
// 优化关联实体处理逻辑 - 客户关联
|
// 优化关联实体处理逻辑 - 客户关联
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user