fix:用户数据缓存时因无法序列化导致无法缓存的问题
This commit is contained in:
parent
443fa819e2
commit
f0c87d7f08
|
@ -0,0 +1,91 @@
|
||||||
|
package com.chint.domain.aggregates.approval.platform;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.approval.ApprovalData;
|
||||||
|
import com.chint.domain.aggregates.approval.ApprovalResultData;
|
||||||
|
import com.chint.domain.repository.ApprovalPlatformInfoRepository;
|
||||||
|
import com.chint.domain.repository.SupplierRepository;
|
||||||
|
import com.chint.interfaces.rest.base.PostRequest;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ApprovalPlatformCommon implements ApprovalPlatform {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SupplierRepository supplierRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApprovalPlatformInfoRepository approvalPlatformInfoRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PostRequest postRequest;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, ApprovalPlatformInfo> redisTemplate;
|
||||||
|
|
||||||
|
public static final String platformMark = "COMMON";
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
void init() {
|
||||||
|
approvalPlatformInfoRepository.findByPlatformMark(platformMark)
|
||||||
|
.ifPresent(approvalPlatformInfo -> {
|
||||||
|
String cacheKey = getCacheKey(approvalPlatformInfo.getPlatformName(),
|
||||||
|
approvalPlatformInfo.getPlatformMark());
|
||||||
|
redisTemplate.opsForValue().set(cacheKey, approvalPlatformInfo, 1L, TimeUnit.DAYS);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCacheKey(String platformName, String platformMark) {
|
||||||
|
return "ApprovalPlatform::" + platformName + "::" + platformMark;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitApproval(ApprovalData approvalData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getApprovalPlatformName() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitLegAddApproval(ApprovalData approvalData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitLegChangeApproval(ApprovalData approvalData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitOrderExpenseApproval(ApprovalData approvalData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitOrderChangeApproval(ApprovalData approvalData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitOrderRefundApproval(ApprovalData approvalData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void submitLegAddOrChangeApproval(ApprovalData approvalData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void receiveApprovalResultCustom(ApprovalResultData resultData) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -269,7 +269,7 @@ public class LegDomainService {
|
||||||
// 根据供应商名称查找供应商并进行处理
|
// 根据供应商名称查找供应商并进行处理
|
||||||
return supplierRepository.findBySupplierName(supplierName)
|
return supplierRepository.findBySupplierName(supplierName)
|
||||||
.map(supplier -> {
|
.map(supplier -> {
|
||||||
List<Leg> syncAbleLegItems = ifCanSync(legs, routeOrder, supplier);
|
List<Leg> syncAbleLegItems = ifCanSync(filteredLegItems, routeOrder, supplier);
|
||||||
syncAbleLegItems.forEach(Leg::reloadStatus);
|
syncAbleLegItems.forEach(Leg::reloadStatus);
|
||||||
return syncAbleLegItems;
|
return syncAbleLegItems;
|
||||||
})
|
})
|
||||||
|
|
|
@ -314,7 +314,7 @@ class RouteApplicationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void loginSign() {
|
void loginSign() {
|
||||||
String sfno = "230615020";
|
String sfno = "231213086";
|
||||||
String syscode = "FSSC";
|
String syscode = "FSSC";
|
||||||
String billcode = "CLSQ240225000100";
|
String billcode = "CLSQ240225000100";
|
||||||
String companycode = "正泰集团股份有限公司";
|
String companycode = "正泰集团股份有限公司";
|
||||||
|
|
Loading…
Reference in New Issue