feat(proxy): 实现代理对象初始化检查与懒加载机制
添加ProxyUtils工具类用于检查代理对象初始化状态 实现代理对象创建和标记初始化功能 添加ProxyObjectDeserializerModifier处理反序列化时的代理对象创建 修改WebSocketService错误消息字段从errorMsg改为message 实现ContractItemService.findAllByInventory方法 优化ContractService查询条件处理并添加缓存支持 重构InventoryTabSkinHistoryPrice的service获取方式
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.ecep.contract.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -12,7 +13,9 @@ import com.ecep.contract.vm.ContractItemViewModel;
|
||||
public class ContractItemService extends QueryService<ContractItem, ContractItemViewModel> {
|
||||
|
||||
public List<ContractItem> findAllByInventory(Inventory parent) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAllByInventory'");
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("inventory", parent.getId());
|
||||
return findAll(params, null).getContent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,14 @@ package com.ecep.contract.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashMap;
|
||||
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.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ecep.contract.MessageHolder;
|
||||
@@ -13,14 +19,42 @@ import com.ecep.contract.model.ContractFile;
|
||||
import com.ecep.contract.model.Project;
|
||||
import com.ecep.contract.vm.ContractViewModel;
|
||||
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "contract")
|
||||
public class ContractService extends QueryService<Contract, ContractViewModel> {
|
||||
|
||||
@Cacheable(key = "#p0")
|
||||
public Contract findById(Integer id) {
|
||||
return super.findById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存实体对象,异步方法
|
||||
*/
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
public Contract save(Contract contract) {
|
||||
return super.save(contract);
|
||||
}
|
||||
|
||||
@Caching(evict = {
|
||||
@CacheEvict(key = "#p0.id"),
|
||||
@CacheEvict(key = "'code-'+#p0.code")
|
||||
})
|
||||
public void delete(Contract contract) {
|
||||
super.delete(contract);
|
||||
}
|
||||
|
||||
public boolean updateParentCode(Contract contract) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'updateParentCode'");
|
||||
}
|
||||
|
||||
@Cacheable(key = "'code-'+#p0")
|
||||
public Contract findByCode(String string) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findByCode'");
|
||||
@@ -31,8 +65,13 @@ public class ContractService extends QueryService<Contract, ContractViewModel> {
|
||||
}
|
||||
|
||||
public List<Contract> findAllBySaleContract(Contract contract) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'findAllBySaleContract'");
|
||||
String parentCode = contract.getCode();
|
||||
if (StringUtils.isEmpty(parentCode)) {
|
||||
return List.of();
|
||||
}
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("parentCode", contract.getCode());
|
||||
return findAll(params, Pageable.unpaged()).getContent();
|
||||
}
|
||||
|
||||
public boolean checkContractPathInBasePath(Contract v) {
|
||||
|
||||
Reference in New Issue
Block a user