fix:用户数据缓存时因无法序列化导致无法缓存的问题

This commit is contained in:
lulz1 2024-07-16 16:25:08 +08:00
parent ab7e5162c2
commit 443fa819e2
4 changed files with 12 additions and 5 deletions

View File

@ -5,10 +5,15 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class UserLoginParam { public class UserLoginParam implements Serializable {
@Serial
private static final long serialVersionUID = 987611378322125656L;
private String sfno; private String sfno;

View File

@ -41,6 +41,7 @@ public class StaffRankRepositoryImpl implements StaffRankRepository {
return byEmployeeNoAndTag.get(0).getEmployeeLevel(); return byEmployeeNoAndTag.get(0).getEmployeeLevel();
} }
@Cacheable(value = "Ranks::StaffRank", key = "#employeeNo + '-' + #companyCode")
@Override @Override
public Optional<List<StaffRank>> findRankNameByEmployNoAndJTCompany(String employeeNo, String companyCode) { public Optional<List<StaffRank>> findRankNameByEmployNoAndJTCompany(String employeeNo, String companyCode) {
if (jtCompanyDomainService.ifCompanyInJT(null, companyCode, 1L)) { if (jtCompanyDomainService.ifCompanyInJT(null, companyCode, 1L)) {

View File

@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.CommonMessageConstant.EMPLOYEE_NO_NOT_EXIST; import static com.chint.infrastructure.constant.CommonMessageConstant.EMPLOYEE_NO_NOT_EXIST;
import static com.chint.infrastructure.constant.RankConstant.DEFAULT_RANK_NAME; import static com.chint.infrastructure.constant.RankConstant.DEFAULT_RANK_NAME;
@ -121,7 +122,7 @@ public class UserHttpRequestImpl implements UserHttpRequest {
//如果存在自定义职级那么就开始比较职级大小 //如果存在自定义职级那么就开始比较职级大小
//这里执行rank排序规则 //这里执行rank排序规则
Optional<RanksOrder> max = ranksOrderRepository Optional<RanksOrder> max = ranksOrderRepository
.findByRankNameIn(Set.of(rankName, staffRank.get().getEmployeeLevel())) .findByRankNameIn(new HashSet<>(List.of(rankName, staffRank.get().getEmployeeLevel())))
.stream() .stream()
.filter(Objects::nonNull) .filter(Objects::nonNull)
.max(Comparator.comparing(RanksOrder::getRankOrderValue)); .max(Comparator.comparing(RanksOrder::getRankOrderValue));

View File

@ -314,9 +314,9 @@ class RouteApplicationTests {
@Test @Test
void loginSign() { void loginSign() {
String sfno = "220506072"; String sfno = "230615020";
String syscode = "FSSC"; String syscode = "FSSC";
String billcode = "CLSQ240225000099"; String billcode = "CLSQ240225000100";
String companycode = "正泰集团股份有限公司"; String companycode = "正泰集团股份有限公司";
String timespan = "1708908662738"; String timespan = "1708908662738";
String s = Digest.md5(sfno + syscode + billcode + companycode + LOGIN_SECRET_KEY + timespan); String s = Digest.md5(sfno + syscode + billcode + companycode + LOGIN_SECRET_KEY + timespan);
@ -327,7 +327,7 @@ class RouteApplicationTests {
void loginSignProd() { void loginSignProd() {
String sfno = "240102037"; String sfno = "240102037";
String syscode = "FSSC"; String syscode = "FSSC";
String billcode = "CLSQ240225000099"; String billcode = "CLSQ240225000100";
String companycode = "正泰集团股份有限公司"; String companycode = "正泰集团股份有限公司";
String timespan = "1708908662738"; String timespan = "1708908662738";
String key = "ZhengTaiRoute"; String key = "ZhengTaiRoute";