feat(config): 修改九公司配置支持多公司ID

komen
zhaokai 2026-07-20 12:18:01 +08:00
parent 2cd65662fc
commit 1eb129d61d
4 changed files with 11 additions and 5 deletions

View File

@ -65,4 +65,4 @@ dahua:
clientSecret: 5ef82f7c-9926-46a3-8d07-136fd054849c clientSecret: 5ef82f7c-9926-46a3-8d07-136fd054849c
nine: nine:
config: config:
companyId: 2008712261453131776 companyId: 2008712261453131776,2046785341004177408

View File

@ -66,4 +66,4 @@ dahua:
clientSecret: 5ef82f7c-9926-46a3-8d07-136fd054849c clientSecret: 5ef82f7c-9926-46a3-8d07-136fd054849c
nine: nine:
config: config:
companyId: 2590800828822460065 companyId: 2590800828822460065,2044322367672422400

View File

@ -241,8 +241,14 @@ public class UserQueryExe {
UserCO userCO = new UserCO(); UserCO userCO = new UserCO();
BeanUtils.copyProperties(userDO, userCO); BeanUtils.copyProperties(userDO, userCO);
try{ try{
Long nineCompanyId = nineCompanyConfig.getCompanyId(); String companyId = nineCompanyConfig.getCompanyId();
userCO.setNineCompanyFlag(nineCompanyId != null && nineCompanyId.equals(userCO.getCorpinfoId())); boolean nineCompanyFlag = companyId != null
&& userCO.getCorpinfoId() != null
&& Arrays.stream(companyId.split(","))
.map(String::trim)
.filter(item -> !item.isEmpty())
.anyMatch(item -> item.equals(String.valueOf(userCO.getCorpinfoId())));
userCO.setNineCompanyFlag(nineCompanyFlag);
}catch (Exception e){ }catch (Exception e){
log.error("获取九公司ID异常", e); log.error("获取九公司ID异常", e);
e.printStackTrace(); e.printStackTrace();

View File

@ -8,5 +8,5 @@ import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "nine.config") @ConfigurationProperties(prefix = "nine.config")
@Data @Data
public class NineCompanyConfig { public class NineCompanyConfig {
private Long companyId; private String companyId;
} }