|
|
|
@ -1,14 +1,20 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.configuration;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysOrganizeService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserInfoService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISystemResourceService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysLocaleLanguage;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysLocaleResource;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ImppRedis;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -30,14 +36,29 @@ public class AppStartSystemInit implements CommandLineRunner {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISystemInitService systemInitService;
|
|
|
|
|
|
|
|
|
|
@Value("${spring.profiles.active}")
|
|
|
|
|
public String SPRING_PROFILES_ACTIVE;
|
|
|
|
|
// 限制组织数量
|
|
|
|
|
public static int organizeCount = 5;
|
|
|
|
|
// 限制账号数量
|
|
|
|
|
public static int userInfoCount = 100;
|
|
|
|
|
|
|
|
|
|
@Resource(name = "redisRes")
|
|
|
|
|
private ImppRedis redisRes;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISystemResourceService systemResourceService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysOrganizeService organizeService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysUserInfoService userInfoService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void run(String... args) throws Exception {
|
|
|
|
|
// checkOrganizeCount();
|
|
|
|
|
// checkUserInfoCount();
|
|
|
|
|
LOGGER.info("【IMPP-Core开始绑定资源信息...】");
|
|
|
|
|
packIMPPResources();
|
|
|
|
|
|
|
|
|
@ -46,6 +67,26 @@ public class AppStartSystemInit implements CommandLineRunner {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查组织数量是否超出
|
|
|
|
|
*/
|
|
|
|
|
public void checkOrganizeCount(){
|
|
|
|
|
if(organizeService.getSysOrganizeCount() > organizeCount){
|
|
|
|
|
LOGGER.info("【启动检查】组织数量已超出授权许可,请联系商务人员");
|
|
|
|
|
System.exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 检查组织数量是否超出
|
|
|
|
|
*/
|
|
|
|
|
public void checkUserInfoCount(){
|
|
|
|
|
if(userInfoService.getSysUserInfoCount() > userInfoCount){
|
|
|
|
|
LOGGER.info("【启动检查】用户数量已超出授权许可,请联系商务人员");
|
|
|
|
|
System.exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 初始化资源信息,并缓存
|
|
|
|
|
*/
|
|
|
|
|
public void packIMPPResources() {
|
|
|
|
|