up
This commit is contained in:
@@ -6,12 +6,12 @@
|
||||
<parent>
|
||||
<groupId>com.ecep.contract</groupId>
|
||||
<artifactId>Contract-Manager</artifactId>
|
||||
<version>0.0.134-SNAPSHOT</version>
|
||||
<version>0.0.135-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.ecep.contract</groupId>
|
||||
<artifactId>client</artifactId>
|
||||
<version>0.0.134-SNAPSHOT</version>
|
||||
<version>0.0.135-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
@@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>com.ecep.contract</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>0.0.134-SNAPSHOT</version>
|
||||
<version>0.0.135-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -206,6 +206,12 @@ public class WebSocketClientService {
|
||||
send(objectMapper.writeValueAsString(message));
|
||||
}
|
||||
|
||||
/**
|
||||
* WebSocketServerCallbackManage#onMessage 负责接收处理
|
||||
*
|
||||
* @param msg
|
||||
* @return
|
||||
*/
|
||||
public CompletableFuture<JsonNode> send(SimpleMessage msg) {
|
||||
CompletableFuture<JsonNode> future = new CompletableFuture<>();
|
||||
try {
|
||||
|
||||
@@ -91,27 +91,32 @@ public class YongYouU8ManagerWindowController
|
||||
|
||||
public void onContractGroupSyncAction(ActionEvent event) {
|
||||
ContractGroupSyncTask task = new ContractGroupSyncTask();
|
||||
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
UITools.showTaskDialogAndWait("合同组数据同步", task, null);
|
||||
// Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
}
|
||||
|
||||
public void onContractTypeSyncAction(ActionEvent event) {
|
||||
ContractTypeSyncTask task = new ContractTypeSyncTask();
|
||||
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
UITools.showTaskDialogAndWait("合同类型数据同步", task, null);
|
||||
// Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
}
|
||||
|
||||
public void onContractKindSyncAction(ActionEvent event) {
|
||||
ContractKindSyncTask task = new ContractKindSyncTask();
|
||||
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
UITools.showTaskDialogAndWait("合同类型数据同步", task, null);
|
||||
// Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
}
|
||||
|
||||
public void onVendorClassSyncAction(ActionEvent event) {
|
||||
VendorClassSyncTask task = new VendorClassSyncTask();
|
||||
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
UITools.showTaskDialogAndWait("客户分类数据同步", task, null);
|
||||
// Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
}
|
||||
|
||||
public void onCustomerClassSyncAction(ActionEvent event) {
|
||||
CustomerClassSyncTask task = new CustomerClassSyncTask();
|
||||
Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
UITools.showTaskDialogAndWait("客户分类数据同步", task, null);
|
||||
// Desktop.instance.getTaskMonitorCenter().registerAndStartTask(task);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class EmployeeManagerSkin
|
||||
controller.accountColumn.setCellValueFactory(param -> param.getValue().getAccount());
|
||||
|
||||
controller.departmentColumn.setCellValueFactory(param -> param.getValue().getDepartment());
|
||||
controller.departmentColumn.setCellFactory(param -> new DepartmentTableCell<>(getDepartmentService()));
|
||||
controller.departmentColumn.setCellFactory(DepartmentTableCell.forTableColumn(getDepartmentService()));
|
||||
|
||||
controller.emailColumn.setCellValueFactory(param -> param.getValue().getEmail());
|
||||
controller.createdColumn.setCellValueFactory(param -> param.getValue().getCreated());
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ecep.contract.controller.permission;
|
||||
|
||||
import com.ecep.contract.controller.tab.AbstEntityBasedTabSkin;
|
||||
import com.ecep.contract.service.FunctionService;
|
||||
import com.ecep.contract.service.PermissionService;
|
||||
import com.ecep.contract.vm.FunctionViewModel;
|
||||
import com.ecep.contract.vo.FunctionVo;
|
||||
|
||||
public abstract class AbstEmployeeFunctionBasedTabSkin
|
||||
extends AbstEntityBasedTabSkin<EmployeeFunctionWindowController, FunctionVo, FunctionViewModel> {
|
||||
|
||||
public AbstEmployeeFunctionBasedTabSkin(EmployeeFunctionWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
FunctionService getFunctionService() {
|
||||
return getCachedBean(FunctionService.class);
|
||||
}
|
||||
|
||||
public PermissionService getPermissionService() {
|
||||
return controller.permissionService;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ecep.contract.controller.permission;
|
||||
|
||||
import com.ecep.contract.controller.tab.TabSkin;
|
||||
|
||||
import javafx.scene.control.Tab;
|
||||
|
||||
public class EmployeeFunctionTabSkinBase extends AbstEmployeeFunctionBasedTabSkin implements TabSkin {
|
||||
|
||||
public EmployeeFunctionTabSkinBase(EmployeeFunctionWindowController controller) {
|
||||
super(controller);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tab getTab() {
|
||||
return controller.baseInfoTab;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeTab() {
|
||||
controller.nameField.textProperty().bindBidirectional(viewModel.getName());
|
||||
controller.keyField.textProperty().bindBidirectional(viewModel.getKey());
|
||||
controller.controllerField.textProperty().bindBidirectional(viewModel.getController());
|
||||
controller.iconField.textProperty().bindBidirectional(viewModel.getIcon());
|
||||
controller.descriptionField.textProperty().bindBidirectional(viewModel.getDescription());
|
||||
controller.activeField.selectedProperty().bindBidirectional(viewModel.getActive());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.ecep.contract.controller.permission;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.controller.AbstEntityController;
|
||||
import com.ecep.contract.service.FunctionService;
|
||||
import com.ecep.contract.service.PermissionService;
|
||||
import com.ecep.contract.util.FxmlPath;
|
||||
import com.ecep.contract.vm.FunctionViewModel;
|
||||
import com.ecep.contract.vo.FunctionVo;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TabPane;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.stage.Window;
|
||||
import javafx.stage.WindowEvent;
|
||||
|
||||
|
||||
@Lazy
|
||||
@Scope("prototype")
|
||||
@Component
|
||||
@FxmlPath("/ui/employee/function.fxml")
|
||||
public class EmployeeFunctionWindowController extends AbstEntityController<FunctionVo, FunctionViewModel> {
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmployeeFunctionWindowController.class);
|
||||
|
||||
|
||||
public static void show(FunctionViewModel viewModel, Window window) {
|
||||
show(EmployeeFunctionWindowController.class, viewModel, window);
|
||||
}
|
||||
|
||||
public BorderPane root;
|
||||
public TabPane tabPane;
|
||||
|
||||
/*
|
||||
* 基本信息标签页
|
||||
*/
|
||||
public Tab baseInfoTab;
|
||||
public TextField nameField;
|
||||
public TextField keyField;
|
||||
public TextField controllerField;
|
||||
public TextField iconField;
|
||||
public TextField descriptionField;
|
||||
|
||||
@FXML
|
||||
public CheckBox activeField;
|
||||
public Label versionLabel;
|
||||
|
||||
/*
|
||||
* 权限标签页
|
||||
*/
|
||||
public Tab permissionTab;
|
||||
|
||||
@Autowired
|
||||
PermissionService permissionService;
|
||||
@Autowired
|
||||
FunctionService functionService;
|
||||
|
||||
@Override
|
||||
public void onShown(WindowEvent windowEvent) {
|
||||
super.onShown(windowEvent);
|
||||
getTitle().bind(viewModel.getName().map(name -> "[" + viewModel.getId().get() + "] " + name + " 功能详情"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerTabSkins() {
|
||||
registerTabSkin(baseInfoTab, tab -> new EmployeeFunctionTabSkinBase(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionService getViewModelService() {
|
||||
return functionService;
|
||||
}
|
||||
}
|
||||
@@ -61,8 +61,6 @@ public class EmployeeFunctionsManagerWindowController
|
||||
public void onCreateNewAction(ActionEvent event) {
|
||||
}
|
||||
|
||||
public void onReBuildFilesAction(ActionEvent event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public FunctionService getViewModelService() {
|
||||
|
||||
@@ -54,9 +54,6 @@ public class EmployeeRoleManagerWindowController
|
||||
public void onCreateNewAction(ActionEvent event) {
|
||||
}
|
||||
|
||||
public void onReBuildFilesAction(ActionEvent event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmployeeRoleService getViewModelService() {
|
||||
return employeeRoleService;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
||||
}
|
||||
|
||||
private void loadSelectedRoles() {
|
||||
List<FunctionVo> selectedRoles = getRoleService().getFunctionsByRoleId(viewModel.getId().get());
|
||||
List<FunctionVo> selectedRoles = getRoleService().getFunctionsByRole(getEntity());
|
||||
if (selectedRoles != null) {
|
||||
functionsField.getTargetItems().setAll(selectedRoles);
|
||||
}
|
||||
@@ -100,8 +100,7 @@ public class EmployeeRoleTabSkinFunctions extends AbstEmployeeRoleBasedTabSkin {
|
||||
|
||||
private void saveRoles(ActionEvent event) {
|
||||
EmployeeRoleVo entity = getEntity();
|
||||
entity.setFunctions(functionsField.getTargetItems());
|
||||
save(entity);
|
||||
getRoleService().saveRoleFunctions(entity, functionsField.getTargetItems());
|
||||
loadSelectedRoles();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,12 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.ecep.contract.task.CompanyMergeClientTasker;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.util.UITools;
|
||||
import com.ecep.contract.vo.CompanyOldNameVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -138,53 +142,20 @@ public class CompanyTabSkinOldName
|
||||
}
|
||||
|
||||
private void onTableMergeAction(ActionEvent event) {
|
||||
CompanyVo updater = getParent();
|
||||
HashSet<String> nameSet = new HashSet<>();
|
||||
nameSet.add(updater.getName());
|
||||
// 收集所有曾用名
|
||||
List<String> nameList = dataSet.stream()
|
||||
.map(viewModel -> viewModel.getName().get())
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
|
||||
List<CompanyOldNameViewModel> removes = new ArrayList<>();
|
||||
for (CompanyOldNameViewModel viewModel : dataSet) {
|
||||
// 创建独立的WebSocket客户端任务器
|
||||
CompanyMergeClientTasker task = new CompanyMergeClientTasker();
|
||||
|
||||
if (!nameSet.add(viewModel.getName().get())) {
|
||||
// fixed 曾用名中有重复时,删除重复的
|
||||
deleteRow(viewModel);
|
||||
removes.add(viewModel);
|
||||
}
|
||||
}
|
||||
if (!removes.isEmpty()) {
|
||||
Platform.runLater(() -> {
|
||||
dataSet.removeAll(removes);
|
||||
});
|
||||
setStatus("移除重复的曾用名" + removes.size());
|
||||
}
|
||||
task.setCompany(getParent());
|
||||
task.setNameList(nameList);
|
||||
UITools.showTaskDialogAndWait("合并曾用名", task, null);
|
||||
|
||||
int size = nameSet.size();
|
||||
int count = 1;
|
||||
int merge = 0;
|
||||
for (String name : nameSet) {
|
||||
controller.setRightStatus(count + "/" + size);
|
||||
if (StringUtils.hasText(name)) {
|
||||
List<CompanyVo> list = getParentService().findAllByName(name);
|
||||
for (CompanyVo company : list) {
|
||||
// fixed 曾用名中有可能有 updater 的名字,会导致自己删除自己
|
||||
if (Objects.equals(company.getId(), updater.getId())) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
getCompanyService().merge(company, updater);
|
||||
setStatus("并户 " + company.getName() + "[" + company.getId() + "] 到当前公司");
|
||||
merge++;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("合并 " + company.getName() + " -> " + updater.getName() + " 失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
if (merge == 0) {
|
||||
setStatus("没有需要并户的公司");
|
||||
}
|
||||
controller.setRightStatus("");
|
||||
loadTableDataSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -201,7 +172,7 @@ public class CompanyTabSkinOldName
|
||||
return;
|
||||
}
|
||||
String path = viewModel.getPath().get();
|
||||
if (StringUtils.hasText(path)) {
|
||||
if (org.springframework.util.StringUtils.hasText(path)) {
|
||||
if (item.startsWith(path)) {
|
||||
item = "~" + item.substring(path.length());
|
||||
}
|
||||
@@ -216,4 +187,4 @@ public class CompanyTabSkinOldName
|
||||
}
|
||||
return companyOldNameService;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,15 @@ import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.service.DepartmentService;
|
||||
import com.ecep.contract.vo.DepartmentVo;
|
||||
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.util.Callback;
|
||||
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
public class DepartmentTableCell<T> extends AsyncUpdateTableCell<T, Integer, DepartmentVo> {
|
||||
|
||||
public DepartmentTableCell(DepartmentService service) {
|
||||
setService(service);
|
||||
}
|
||||
@@ -17,4 +22,20 @@ public class DepartmentTableCell<T> extends AsyncUpdateTableCell<T, Integer, Dep
|
||||
return SpringApp.getBean(DepartmentService.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 为表格列创建 DepartmentTableCell 的工厂方法
|
||||
*
|
||||
* @param service 部门服务
|
||||
* @param <T> 表格行数据类型
|
||||
* @return 表格列的回调函数
|
||||
*/
|
||||
public static <T> Callback<TableColumn<T, Integer>, TableCell<T, Integer>> forTableColumn(DepartmentService service) {
|
||||
return column -> new DepartmentTableCell<>(service);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String format(DepartmentVo entity) {
|
||||
return getService().getStringConverter().toString(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,37 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.DepartmentService;
|
||||
import com.ecep.contract.vo.DepartmentVo;
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class DepartmentStringConverter extends EntityStringConverter<DepartmentVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
/**
|
||||
* 部门字符串转换器
|
||||
*/
|
||||
public class DepartmentStringConverter extends StringConverter<DepartmentVo> {
|
||||
private DepartmentService service;
|
||||
|
||||
public DepartmentStringConverter() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(department -> service.findById(department.getId()));
|
||||
setSuggestion(service::search);
|
||||
public DepartmentStringConverter(DepartmentService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(DepartmentVo department) {
|
||||
if (department == null) {
|
||||
return "-";
|
||||
}
|
||||
return department.getCode() + " " + department.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DepartmentVo fromString(String string) {
|
||||
if (service == null || string == null || string.trim().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return service.findByCode(string.trim());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +1,26 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import com.ecep.contract.service.VendorGroupService;
|
||||
import com.ecep.contract.vo.VendorGroupVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class VendorGroupStringConverter extends EntityStringConverter<VendorGroupVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
public class VendorGroupStringConverter extends StringConverter<VendorGroupVo> {
|
||||
private VendorGroupService service;
|
||||
|
||||
public VendorGroupStringConverter() {
|
||||
|
||||
public VendorGroupStringConverter(VendorGroupService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(group -> service.findById(group.getId()));
|
||||
setSuggestion(service::search);
|
||||
@Override
|
||||
public String toString(VendorGroupVo object) {
|
||||
return object == null ? "" : object.getCode() + " " + object.getName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VendorGroupVo fromString(String string) {
|
||||
return service.findByCode(string);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.controlsfx.control.TaskProgressView;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -21,6 +23,8 @@ import lombok.Data;
|
||||
|
||||
@Service
|
||||
public class CloudRkService extends QueryService<CloudRkVo, CloudRkViewModel> {
|
||||
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class EntInfo {
|
||||
@@ -69,6 +73,10 @@ public class CloudRkService extends QueryService<CloudRkVo, CloudRkViewModel> {
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public Page<CloudRkVo> findAllByCompany(CompanyVo company) {
|
||||
return findAll(ParamUtils.builder().equals("company", company.getId()).build(), Pageable.unpaged());
|
||||
}
|
||||
|
||||
public boolean checkBlackListUpdateElapse(CompanyVo company, CloudRkVo cloudRk) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'checkBlackListUpdateElapse'");
|
||||
@@ -78,4 +86,12 @@ public class CloudRkService extends QueryService<CloudRkVo, CloudRkViewModel> {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateBlackList'");
|
||||
}
|
||||
|
||||
public void mergeTo(CompanyVo from, CompanyVo to) {
|
||||
List<CloudRkVo> list = findAllByCompany(from).getContent();
|
||||
for (CloudRkVo item : list) {
|
||||
item.setCompanyId(to.getId());
|
||||
save(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
@@ -77,4 +79,16 @@ public class CloudTycService extends QueryService<CloudTycVo, CloudTycInfoViewMo
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public Page<CloudTycVo> findAllByCompany(CompanyVo company) {
|
||||
return findAll(ParamUtils.builder().equals("company", company.getId()).build(), Pageable.unpaged());
|
||||
}
|
||||
|
||||
public void mergeTo(CompanyVo from, CompanyVo to) {
|
||||
List<CloudTycVo> list = findAllByCompany(from).getContent();
|
||||
for (CloudTycVo item : list) {
|
||||
item.setCompanyId(to.getId());
|
||||
save(item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -32,4 +33,21 @@ public class CompanyContactService extends QueryService<CompanyContactVo, Compan
|
||||
return page.getContent().getFirst();
|
||||
}
|
||||
|
||||
public List<CompanyContactVo> findAllByCompany(CompanyVo company, LocalDate beginDate, LocalDate endDate) {
|
||||
return findAll(ParamUtils.builder()
|
||||
.equals("company", company.getId())
|
||||
.between("setupDate", beginDate, endDate)
|
||||
.build(), Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
public void mergeTo(CompanyVo from, CompanyVo to) {
|
||||
List<CompanyContactVo> contacts = findAllByCompany(from, LocalDate.MIN, LocalDate.MAX);
|
||||
if (contacts == null || contacts.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (CompanyContactVo contact : contacts) {
|
||||
contact.setCompanyId(to.getId());
|
||||
save(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,4 +17,12 @@ public class CompanyCustomerEntityService extends QueryService<CompanyCustomerEn
|
||||
.equals("customer", customer.getId()).build(), Pageable.unpaged())
|
||||
.getContent();
|
||||
}
|
||||
|
||||
public void mergeTo(CustomerVo from, CustomerVo to) {
|
||||
List<CompanyCustomerEntityVo> fromEntities = findAllByCustomer(from);
|
||||
for (CompanyCustomerEntityVo fromEntity : fromEntities) {
|
||||
fromEntity.setCustomerId(to.getId());
|
||||
save(fromEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,4 +121,12 @@ public class CompanyCustomerFileService extends QueryService<CustomerFileVo, Cus
|
||||
public CustomerFileVo save(CustomerFileVo entity) {
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
public void mergeTo(CustomerVo from, CustomerVo to) {
|
||||
List<CustomerFileVo> fromFiles = findAllByCustomer(from);
|
||||
for (CustomerFileVo fromFile : fromFiles) {
|
||||
fromFile.setCustomer(to.getId());
|
||||
save(fromFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.util.MyStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -70,16 +71,7 @@ public class CompanyOldNameService extends QueryService<CompanyOldNameVo, Compan
|
||||
}
|
||||
|
||||
public CompanyOldNameVo findMatchByDate(CompanyVo company, LocalDate localDate) {
|
||||
Page<CompanyOldNameVo> page = findAll(ParamUtils.builder()
|
||||
.equals("ambiguity", false)
|
||||
.equals("company", company.getId())
|
||||
.and(b -> b.isNotNull("beginDate").greaterThan("beginDate", localDate))
|
||||
.and(b -> b.isNotNull("endDate").lessThan("endDate", localDate))
|
||||
.build(), Pageable.ofSize(1));
|
||||
if (page.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return page.getContent().getFirst();
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<CompanyOldNameVo> findAllByCompanyAndName(CompanyVo company, String oldName) {
|
||||
@@ -90,4 +82,13 @@ public class CompanyOldNameService extends QueryService<CompanyOldNameVo, Compan
|
||||
public List<CompanyOldNameVo> findAllByCompany(IdentityEntity company) {
|
||||
return findAll(ParamUtils.equal("company", company.getId()), Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
public void mergeTo(CompanyVo from, CompanyVo to) {
|
||||
List<CompanyOldNameVo> fromOldNames = findAllByCompany(from);
|
||||
for (CompanyOldNameVo fromOldName : fromOldNames) {
|
||||
fromOldName.setMemo(MyStringUtils.appendIfAbsent(fromOldName.getMemo(), "转自 " + from.getId()));
|
||||
fromOldName.setCompanyId(to.getId());
|
||||
save(fromOldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ecep.contract.SpringApp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
@@ -62,9 +63,22 @@ public class CompanyService extends QueryService<CompanyVo, CompanyViewModel> {
|
||||
return findAll(params, Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
public void merge(CompanyVo company, CompanyVo updater) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'merge'");
|
||||
public void merge(CompanyVo from, CompanyVo to) {
|
||||
|
||||
SpringApp.getBean(CloudRkService.class).mergeTo(from, to);
|
||||
SpringApp.getBean(CloudTycService.class).mergeTo(from, to);
|
||||
SpringApp.getBean(YongYouU8Service.class).mergeTo(from, to);
|
||||
|
||||
SpringApp.getBean(CompanyOldNameService.class).mergeTo(from, to);
|
||||
SpringApp.getBean(CompanyContactService.class).mergeTo(from, to);
|
||||
|
||||
// 供应商和客户
|
||||
SpringApp.getBean(VendorService.class).mergeTo(from, to);
|
||||
SpringApp.getBean(CustomerService.class).mergeTo(from, to);
|
||||
|
||||
SpringApp.getBean(ContractService.class).mergeTo(from, to);
|
||||
SpringApp.getBean(CompanyContactService.class).mergeTo(from, to);
|
||||
delete(from);
|
||||
}
|
||||
|
||||
public CompanyVo createNewCompany(String newCompanyName) {
|
||||
|
||||
@@ -5,6 +5,9 @@ import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.util.MyStringUtils;
|
||||
import com.ecep.contract.vo.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -20,10 +23,6 @@ import com.ecep.contract.constant.ContractConstant;
|
||||
import com.ecep.contract.util.ContractUtils;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.ContractViewModel;
|
||||
import com.ecep.contract.vo.ContractFileVo;
|
||||
import com.ecep.contract.vo.ContractVo;
|
||||
import com.ecep.contract.vo.ProjectVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract")
|
||||
@@ -158,10 +157,24 @@ public class ContractService extends QueryService<ContractVo, ContractViewModel>
|
||||
.build(), Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
public List<ContractVo> findAllByCompanyCustomer(CustomerVo customer, LocalDate beginDate, LocalDate endDate) {
|
||||
return findAll(ParamUtils.builder()
|
||||
.equals("company", customer.getCompanyId())
|
||||
.between("setupDate", beginDate, endDate)
|
||||
.build(), Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
public List<ContractVo> findAllByCompany(CompanyVo company, LocalDate beginDate, LocalDate endDate) {
|
||||
return findAll(ParamUtils.builder()
|
||||
.equals("company", company.getId())
|
||||
.between("setupDate", beginDate, endDate)
|
||||
.build(), Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
public List<ContractVo> findAllSalesByProject(ProjectVo project) {
|
||||
return findAll(ParamUtils.builder()
|
||||
.equals("parentCode", "")
|
||||
.equals("project", project.getId()).build(),
|
||||
.equals("parentCode", "")
|
||||
.equals("project", project.getId()).build(),
|
||||
Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
@@ -183,4 +196,18 @@ public class ContractService extends QueryService<ContractVo, ContractViewModel>
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'syncContractFile'");
|
||||
}
|
||||
|
||||
public void mergeTo(CompanyVo from, CompanyVo to) {
|
||||
|
||||
List<ContractVo> contracts = findAllByCompany(from, LocalDate.MIN, LocalDate.MAX);
|
||||
if (contracts == null || contracts.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ContractVo contract : contracts) {
|
||||
contract.setDescription(MyStringUtils.appendIfAbsent(contract.getDescription(), "转自 " + from.getId()));
|
||||
contract.setCompanyId(to.getId());
|
||||
save(contract);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import org.springframework.stereotype.Service;
|
||||
import com.ecep.contract.vm.ContractTypeViewModel;
|
||||
import com.ecep.contract.vo.ContractTypeVo;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract-type")
|
||||
public class ContractTypeService extends QueryService<ContractTypeVo, ContractTypeViewModel> {
|
||||
|
||||
@@ -30,11 +30,7 @@ public class CustomerService extends QueryService<CustomerVo, CompanyCustomerVie
|
||||
}
|
||||
|
||||
public CustomerVo findByCompany(CompanyVo company) {
|
||||
Page<CustomerVo> page = findAll(ParamUtils.equal("company", company.getId()), Pageable.ofSize(1));
|
||||
if (page.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return page.getContent().getFirst();
|
||||
return findOneByProperty("company", company.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,4 +136,43 @@ public class CustomerService extends QueryService<CustomerVo, CompanyCustomerVie
|
||||
// 替换文件名中的非法字符
|
||||
return fileName.replaceAll("[/\\:*?\"<>|]", "_");
|
||||
}
|
||||
|
||||
public void mergeTo(CompanyVo from, CompanyVo to) {
|
||||
CustomerVo fromCustomer = findByCompany(from);
|
||||
if (fromCustomer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
CustomerVo toCustomer = findByCompany(to);
|
||||
if (toCustomer == null) {
|
||||
// 直接修改关联
|
||||
fromCustomer.setCompanyId(to.getId());
|
||||
save(fromCustomer);
|
||||
return;
|
||||
}
|
||||
|
||||
mergeTo(fromCustomer, toCustomer);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并客户
|
||||
* 1. 删除源客户对象
|
||||
* 2. 删除源客户对象关联的文件
|
||||
* 3. 修改目标客户对象的关联公司
|
||||
* 4. 修改目标客户对象的关联文件
|
||||
*
|
||||
* @param from
|
||||
* @param to
|
||||
*/
|
||||
public void mergeTo(CustomerVo from, CustomerVo to) {
|
||||
// file
|
||||
CompanyCustomerFileService companyCustomerFileService = SpringApp.getBean(CompanyCustomerFileService.class);
|
||||
companyCustomerFileService.mergeTo(from, to);
|
||||
// entity
|
||||
CompanyCustomerEntityService companyCustomerEntityService = SpringApp.getBean(CompanyCustomerEntityService.class);
|
||||
companyCustomerEntityService.mergeTo(from, to);
|
||||
// 删除源客户对象
|
||||
delete(from);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,81 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.converter.DepartmentStringConverter;
|
||||
import com.ecep.contract.vm.DepartmentViewModel;
|
||||
import com.ecep.contract.vo.DepartmentVo;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "department")
|
||||
public class DepartmentService extends QueryService<DepartmentVo, DepartmentViewModel> {
|
||||
|
||||
private final DepartmentStringConverter stringConverter = new DepartmentStringConverter(this);
|
||||
|
||||
@Cacheable(key = "#p0")
|
||||
@Override
|
||||
public DepartmentVo findById(Integer id) {
|
||||
return super.findById(id);
|
||||
}
|
||||
|
||||
public DepartmentVo findByName(String name) {
|
||||
try {
|
||||
return async("findByName", name, String.class).handle((response, ex) -> {
|
||||
DepartmentVo newEntity = createNewEntity();
|
||||
return updateValue(newEntity, response);
|
||||
}).get();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("查询实体失败" + name, e);
|
||||
}
|
||||
}
|
||||
|
||||
public DepartmentVo findByCode(String code) {
|
||||
try {
|
||||
return async("findByCode", code, String.class).handle((response, ex) -> {
|
||||
if (ex != null) {
|
||||
throw new RuntimeException("远程方法+findByCode+调用失败", ex);
|
||||
}
|
||||
DepartmentVo newEntity = createNewEntity();
|
||||
return updateValue(newEntity, response);
|
||||
}).get();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("查询实体失败" + code, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Cacheable(key = "'departments'")
|
||||
@Override
|
||||
public List<DepartmentVo> findAll() {
|
||||
return super.findAll();
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"), @CacheEvict(key = "'departments'"),
|
||||
})
|
||||
@Override
|
||||
public void delete(DepartmentVo entity) {
|
||||
super.delete(entity);
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"), @CacheEvict(key = "'departments'"),
|
||||
})
|
||||
@Override
|
||||
public DepartmentVo save(DepartmentVo entity) {
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringConverter<DepartmentVo> getStringConverter() {
|
||||
return stringConverter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.vo.DepartmentVo;
|
||||
import javafx.collections.ObservableList;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.vm.EmployeeRoleViewModel;
|
||||
@@ -11,11 +15,38 @@ import com.ecep.contract.vo.FunctionVo;
|
||||
@Service
|
||||
public class EmployeeRoleService extends QueryService<EmployeeRoleVo, EmployeeRoleViewModel> {
|
||||
|
||||
public List<FunctionVo> getFunctionsByRoleId(int roleId) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getFunctionsByRoleId'");
|
||||
public List<FunctionVo> getFunctionsByRole(EmployeeRoleVo role) {
|
||||
try {
|
||||
return async("getFunctionsByRoleId", role.getId(), Integer.class).handle((response, ex) -> {
|
||||
if (ex != null) {
|
||||
throw new RuntimeException("远程方法+getFunctionsByRoleId+调用失败", ex);
|
||||
}
|
||||
List<FunctionVo> list = new ArrayList<>();
|
||||
try {
|
||||
objectMapper.readerForUpdating(list)
|
||||
.forType(objectMapper.getTypeFactory().constructCollectionType(List.class, FunctionVo.class))
|
||||
.readValue(response);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return list;
|
||||
}).get();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("查询实体失败, Function#" + role.getId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void saveRoleFunctions(EmployeeRoleVo role, List<FunctionVo> functions) {
|
||||
try {
|
||||
async("saveRoleFunctions", new Object[]{role.getId(), functions.stream().mapToInt(FunctionVo::getId).toArray()}, new Object[]{Integer.class, Integer[].class}).handle((response, ex) -> {
|
||||
if (ex != null) {
|
||||
throw new RuntimeException("远程方法+saveRoleFunctions+调用失败", ex);
|
||||
}
|
||||
return null;
|
||||
}).get();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("保存角色的功能失败, 角色#" + role.getId(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.ecep.contract.vm.CompanyVendorEntityViewModel;
|
||||
|
||||
@Service
|
||||
public class VendorEntityService extends QueryService<VendorEntityVo, CompanyVendorEntityViewModel> {
|
||||
|
||||
|
||||
/**
|
||||
* 根据供应商ID查询关联实体列表
|
||||
*/
|
||||
@@ -20,14 +20,14 @@ public class VendorEntityService extends QueryService<VendorEntityVo, CompanyVen
|
||||
return findAll(ParamUtils.builder().equals("vendorId", vendorId).build(), Pageable.unpaged())
|
||||
.getContent();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据CompanyVendor对象查询关联的CompanyVendorEntity列表
|
||||
*/
|
||||
public List<VendorEntityVo> findByVendor(VendorVo vendor) {
|
||||
return findByVendorId(vendor.getId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据供应商ID创建新的CompanyVendorEntity实例
|
||||
*/
|
||||
@@ -43,10 +43,18 @@ public class VendorEntityService extends QueryService<VendorEntityVo, CompanyVen
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getBeanName() {
|
||||
// 确保返回正确的服务名称
|
||||
return "vendorEntityService";
|
||||
}
|
||||
|
||||
public void mergeTo(VendorVo from, VendorVo to) {
|
||||
List<VendorEntityVo> fromEntities = findByVendor(from);
|
||||
for (VendorEntityVo fromEntity : fromEntities) {
|
||||
fromEntity.setVendorId(to.getId());
|
||||
save(fromEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,33 +97,13 @@ public class VendorFileService extends QueryService<VendorFileVo, CompanyVendorF
|
||||
}
|
||||
|
||||
public void verify(VendorVo companyVendor, LocalDate verifyDate, MessageHolder holder) {
|
||||
// 查询所有评价表
|
||||
List<VendorFileVo> files = findAllByVendorAndType(companyVendor, VendorFileType.EvaluationForm);
|
||||
if (files == null || files.isEmpty()) {
|
||||
holder.error("未见供应商评价");
|
||||
return;
|
||||
}
|
||||
|
||||
// 检索 验证日期最近一年内的有效评价表,日期宽限7天
|
||||
LocalDate begin = verifyDate.plusYears(-1);
|
||||
VendorFileVo vendorFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.filter(v -> MyDateTimeUtils.dateValidFilter(v.getSignDate(), begin, verifyDate, 7))
|
||||
.findFirst().orElse(null);
|
||||
if (vendorFile == null) {
|
||||
// 检索最后一个有效评价表
|
||||
VendorFileVo latestFile = files.stream()
|
||||
.filter(v -> v.getSignDate() != null && v.isValid())
|
||||
.max(Comparator.comparing(VendorFileVo::getSignDate))
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
if (latestFile == null) {
|
||||
holder.error("未匹配的供应商评价");
|
||||
return;
|
||||
}
|
||||
// 提示评价表已过期
|
||||
holder.error("供应商评价已过期:" + latestFile.getSignDate() + ", 检测日期:" + verifyDate);
|
||||
}
|
||||
public List<VendorFileVo> findAllByVendor(VendorVo vendor) {
|
||||
return findAll(ParamUtils.builder()
|
||||
.equals("vendor", vendor.getId())
|
||||
.build(), Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
public List<VendorFileVo> findAllByVendorAndType(VendorVo vendor, VendorFileType type) {
|
||||
@@ -132,4 +112,12 @@ public class VendorFileService extends QueryService<VendorFileVo, CompanyVendorF
|
||||
.equals("type", type.name())
|
||||
.build(), Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
public void mergeTo(VendorVo from, VendorVo to) {
|
||||
List<VendorFileVo> fromFiles = findAllByVendor(from);
|
||||
for (VendorFileVo fromFile : fromFiles) {
|
||||
fromFile.setVendorId(to.getId());
|
||||
save(fromFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import com.ecep.contract.converter.VendorGroupStringConverter;
|
||||
import com.ecep.contract.model.VendorGroup;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.VendorGroupViewModel;
|
||||
import com.ecep.contract.vo.VendorGroupVo;
|
||||
import javafx.util.StringConverter;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
@@ -15,6 +17,8 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "vendor-group")
|
||||
public class VendorGroupService extends QueryService<VendorGroupVo, VendorGroupViewModel> {
|
||||
|
||||
private VendorGroupStringConverter stringConverter = new VendorGroupStringConverter(this);
|
||||
@Cacheable(key = "#id")
|
||||
@Override
|
||||
public VendorGroupVo findById(Integer id) {
|
||||
@@ -53,4 +57,9 @@ public class VendorGroupService extends QueryService<VendorGroupVo, VendorGroupV
|
||||
public void delete(VendorGroupVo entity) {
|
||||
super.delete(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VendorGroupStringConverter getStringConverter() {
|
||||
return stringConverter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
|
||||
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.cache.annotation.Caching;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.VendorType;
|
||||
@@ -21,11 +8,20 @@ import com.ecep.contract.model.VendorCatalog;
|
||||
import com.ecep.contract.util.CompanyUtils;
|
||||
import com.ecep.contract.util.FileUtils;
|
||||
import com.ecep.contract.util.MyStringUtils;
|
||||
import com.ecep.contract.util.ParamUtils;
|
||||
import com.ecep.contract.vm.CompanyVendorViewModel;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import com.ecep.contract.vo.ContractVo;
|
||||
import com.ecep.contract.vo.VendorVo;
|
||||
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.cache.annotation.Caching;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "vendor")
|
||||
@@ -46,7 +42,7 @@ public class VendorService extends QueryService<VendorVo, CompanyVendorViewModel
|
||||
}
|
||||
return basePath;
|
||||
}
|
||||
|
||||
|
||||
public File getVendorApprovedListTemplate() {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'getVendorApprovedListTemplate'");
|
||||
@@ -58,11 +54,7 @@ public class VendorService extends QueryService<VendorVo, CompanyVendorViewModel
|
||||
|
||||
@Cacheable(key = "'company-'+#p0.id")
|
||||
public VendorVo findByCompany(CompanyVo company) {
|
||||
Page<VendorVo> page = findAll(ParamUtils.equal("company", company.getId()), Pageable.ofSize(1));
|
||||
if (page.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return page.getContent().getFirst();
|
||||
return findOneByProperty("company", company.getId());
|
||||
}
|
||||
|
||||
public void verify(ContractVo contract, MessageHolder holder) {
|
||||
@@ -189,4 +181,32 @@ public class VendorService extends QueryService<VendorVo, CompanyVendorViewModel
|
||||
public void delete(VendorVo entity) {
|
||||
super.delete(entity);
|
||||
}
|
||||
|
||||
public void mergeTo(CompanyVo from, CompanyVo to) {
|
||||
VendorVo fromCustomer = findByCompany(from);
|
||||
if (fromCustomer == null) {
|
||||
return;
|
||||
}
|
||||
VendorVo toCustomer = findByCompany(to);
|
||||
if (toCustomer == null) {
|
||||
// 直接修改关联
|
||||
fromCustomer.setCompanyId(to.getId());
|
||||
save(fromCustomer);
|
||||
return;
|
||||
}
|
||||
|
||||
mergeTo(fromCustomer, toCustomer);
|
||||
}
|
||||
|
||||
public void mergeTo(VendorVo from, VendorVo to) {
|
||||
// file
|
||||
VendorFileService companyVendorFileService = SpringApp.getBean(VendorFileService.class);
|
||||
companyVendorFileService.mergeTo(from, to);
|
||||
// entity
|
||||
VendorEntityService companyCustomerEntityService = SpringApp.getBean(VendorEntityService.class);
|
||||
companyCustomerEntityService.mergeTo(from, to);
|
||||
// 删除源客户对象
|
||||
delete(from);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.controlsfx.control.TaskProgressView;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -78,4 +81,15 @@ public class YongYouU8Service extends QueryService<CloudYuVo, CloudYuInfoViewMod
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public Page<CloudYuVo> findAllByCompany(CompanyVo company) {
|
||||
return findAll(ParamUtils.builder().equals("company", company.getId()).build(), Pageable.unpaged());
|
||||
}
|
||||
|
||||
public void mergeTo(CompanyVo from, CompanyVo to) {
|
||||
List<CloudYuVo> list = findAllByCompany(from).getContent();
|
||||
for (CloudYuVo item : list) {
|
||||
item.setCompanyId(to.getId());
|
||||
save(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.ecep.contract.task;
|
||||
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
import javafx.application.Platform;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* 公司合并客户端任务器
|
||||
* 通过WebSocket连接与服务器端通信,执行公司合并操作
|
||||
*/
|
||||
|
||||
public class CompanyMergeClientTasker extends Tasker<Object> implements WebSocketClientTasker {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private CompanyVo company;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private List<String> nameList;
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return "CompanyMergeTask";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(long current, long total) {
|
||||
super.updateProgress(current, total);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
return callRemoteTask(holder, getLocale(), company.getId(), nameList.toArray());
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,21 @@
|
||||
package com.ecep.contract.task;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
|
||||
public class ContractGroupSyncTask extends Tasker<Object>{
|
||||
public class ContractGroupSyncTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
@Override
|
||||
public Object execute(MessageHolder holder) {
|
||||
return null;
|
||||
public String getTaskName() {
|
||||
return "ContractGroupSyncTask";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(MessageHolder holder) {
|
||||
return callRemoteTask(holder, getLocale());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(long current, long total) {
|
||||
super.updateProgress(current, total);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,23 @@
|
||||
package com.ecep.contract.task;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
|
||||
public class ContractKindSyncTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
public static final String TASK_NAME = "ContractKindSyncTask";
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return TASK_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(long workDone, long max) {
|
||||
super.updateProgress(workDone, max);
|
||||
}
|
||||
|
||||
public class ContractKindSyncTask extends Tasker<Object> {
|
||||
@Override
|
||||
public Object execute(MessageHolder holder) {
|
||||
return null;
|
||||
return callRemoteTask(holder, getLocale());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.SpringApp;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
import com.ecep.contract.service.YongYouU8Service;
|
||||
|
||||
/**
|
||||
* 合同同步任务
|
||||
@@ -14,15 +12,6 @@ import com.ecep.contract.service.YongYouU8Service;
|
||||
public class ContractSyncTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ContractSyncTask.class);
|
||||
|
||||
private YongYouU8Service yongYouU8Service;
|
||||
|
||||
private YongYouU8Service getYongYouU8Service() {
|
||||
if (yongYouU8Service == null) {
|
||||
yongYouU8Service = SpringApp.getBean(YongYouU8Service.class);
|
||||
}
|
||||
return yongYouU8Service;
|
||||
}
|
||||
|
||||
public String getTaskName() {
|
||||
return "ContractSyncTask";
|
||||
}
|
||||
|
||||
@@ -1,10 +1,27 @@
|
||||
package com.ecep.contract.task;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
|
||||
/**
|
||||
* 合同类型同步任务
|
||||
*/
|
||||
public class ContractTypeSyncTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return "ContractTypeSyncTask";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(long current, long total) {
|
||||
super.updateProgress(current, total);
|
||||
}
|
||||
|
||||
public class ContractTypeSyncTask extends Tasker<Object> {
|
||||
@Override
|
||||
public Object execute(MessageHolder holder) {
|
||||
return null;
|
||||
// 调用远程WebSocket任务
|
||||
return callRemoteTask(holder, Locale.getDefault());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,32 @@
|
||||
package com.ecep.contract.task;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import java.util.Locale;
|
||||
|
||||
public class CustomerClassSyncTask extends Tasker<Object> {
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
|
||||
public class CustomerClassSyncTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
public static final String TASK_NAME = "CustomerClassSyncTask";
|
||||
private static final Logger logger = LoggerFactory.getLogger(CustomerClassSyncTask.class);
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return TASK_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'execute'");
|
||||
updateTitle("用友U8系统-同步客户分类");
|
||||
return callRemoteTask(holder, Locale.getDefault());
|
||||
}
|
||||
|
||||
// 显式重写 updateProgress 以解决方法隐藏冲突
|
||||
@Override
|
||||
public void updateProgress(long workDone, long max) {
|
||||
super.updateProgress(workDone, max);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,36 @@
|
||||
package com.ecep.contract.task;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
|
||||
/**
|
||||
* 同步客户任务
|
||||
*/
|
||||
public class CustomerSyncTask extends Tasker<Object> {
|
||||
public class CustomerSyncTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
|
||||
public static final String TASK_NAME = "CustomerSyncTask";
|
||||
private static final Logger logger = LoggerFactory.getLogger(CustomerSyncTask.class);
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return TASK_NAME;
|
||||
}
|
||||
|
||||
// 显式重写 updateProgress 以解决方法隐藏冲突
|
||||
@Override
|
||||
public void updateProgress(long workDone, long max) {
|
||||
super.updateProgress(workDone, max);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
updateTitle("用友U8系统-同步客户");
|
||||
return null;
|
||||
return callRemoteTask(holder, Locale.getDefault());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,28 @@
|
||||
package com.ecep.contract.task;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
|
||||
public class VendorClassSyncTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
public static final String TASK_NAME = "VendorClassSyncTask";
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return TASK_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(long current, long total) {
|
||||
// 直接使用父类的updateProgress方法
|
||||
super.updateProgress(current, total);
|
||||
}
|
||||
|
||||
public class VendorClassSyncTask extends Tasker<Object> {
|
||||
@Override
|
||||
public Object execute(MessageHolder holder) {
|
||||
return null;
|
||||
// 使用callRemoteTask调用远程任务
|
||||
updateTitle("用友U8系统-同步供应商分类");
|
||||
return callRemoteTask(holder, Locale.getDefault());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,16 +4,28 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
import com.ecep.contract.WebSocketClientTasker;
|
||||
|
||||
/**
|
||||
* 供应商同步任务
|
||||
*/
|
||||
public class VendorSyncTask extends Tasker<Object> {
|
||||
public class VendorSyncTask extends Tasker<Object> implements WebSocketClientTasker {
|
||||
private static final Logger logger = LoggerFactory.getLogger(VendorSyncTask.class);
|
||||
private static final String TASK_NAME = "VendorSyncTask";
|
||||
|
||||
@Override
|
||||
public String getTaskName() {
|
||||
return TASK_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(long current, long total) {
|
||||
super.updateProgress(current, total);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object execute(MessageHolder holder) throws Exception {
|
||||
updateTitle("用友U8系统-同步供应商");
|
||||
return null;
|
||||
return callRemoteTask(holder, getLocale());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<?import javafx.scene.control.*?>
|
||||
<?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"
|
||||
fx:controller="com.ecep.contract.manager.cloud.rk.CloudRkManagerWindowController">
|
||||
fx:controller="com.ecep.contract.controller.cloud.rk.CloudRkManagerWindowController">
|
||||
<children>
|
||||
<MenuBar VBox.vgrow="NEVER">
|
||||
<menus>
|
||||
@@ -39,7 +39,6 @@
|
||||
<Menu mnemonicParsing="false" text="Help">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="数据修复" onAction="#onDataRepairAction"/>
|
||||
<MenuItem mnemonicParsing="false" text="数据迁移" onAction="#onDateTransferAction"/>
|
||||
<MenuItem mnemonicParsing="false" text="About MyHelloApp"/>
|
||||
</items>
|
||||
</Menu>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<?import org.controlsfx.control.ListSelectionView?>
|
||||
<BorderPane fx:id="root" maxHeight="900" maxWidth="1024" minHeight="300" minWidth="200" prefHeight="500.0"
|
||||
prefWidth="800.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.ecep.contract.controller.permission.EmployeeFunctionsManagerWindowController">
|
||||
fx:controller="com.ecep.contract.controller.permission.EmployeeFunctionWindowController">
|
||||
<center>
|
||||
<TabPane fx:id="tabPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minWidth="150.0"
|
||||
tabClosingPolicy="UNAVAILABLE" tabMaxWidth="100.0" tabMinWidth="40.0">
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<Menu text="文件(_F)">
|
||||
<items>
|
||||
<MenuItem onAction="#onCreateNewAction" text="新建…(_N)"/>
|
||||
<MenuItem onAction="#onReBuildFilesAction" text="同步…(_R)"/>
|
||||
<SeparatorMenuItem mnemonicParsing="false"/>
|
||||
<MenuItem mnemonicParsing="false" text="Preferences…"/>
|
||||
</items>
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
<?import javafx.scene.text.Font?>
|
||||
<?import org.controlsfx.control.ListSelectionView?>
|
||||
|
||||
<BorderPane fx:id="root" maxHeight="900" maxWidth="1024" minHeight="300" minWidth="200" prefHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/22" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ecep.contract.controller.permission.EmployeeRoleManagerWindowController">
|
||||
<BorderPane fx:id="root" maxHeight="900" maxWidth="1024" minHeight="300" minWidth="200" prefHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/22"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.ecep.contract.controller.permission.EmployeeRoleWindowController">
|
||||
<center>
|
||||
<TabPane fx:id="tabPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minWidth="150.0" tabClosingPolicy="UNAVAILABLE" tabMaxWidth="100.0" tabMinWidth="40.0">
|
||||
<tabs>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<Menu text="文件(_F)">
|
||||
<items>
|
||||
<MenuItem onAction="#onCreateNewAction" text="新建…(_N)" />
|
||||
<MenuItem onAction="#onReBuildFilesAction" text="同步…(_R)" />
|
||||
<SeparatorMenuItem mnemonicParsing="false" />
|
||||
<MenuItem mnemonicParsing="false" text="Preferences…" />
|
||||
</items>
|
||||
|
||||
Reference in New Issue
Block a user