工厂数量控制

用户数量控制
yun-zuoyi
wei.peng 6 years ago
parent c785735265
commit 3526f9e0b6

@ -82,6 +82,9 @@ public interface ISysUserInfoService {
@ApiOperation(value = "删除用户-批量",notes = "根据UserInfoId 批量删除用户信息")
void deleteSysUserInfoByIds(Long[] ids);
@ApiOperation(value = "获取用户数量",notes = "获取有效用户数量")
int getSysUserInfoCount();
/**
* Key
* @param id

@ -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() {

@ -42,6 +42,9 @@ public class SysOrganizeService implements ISysOrganizeService {
@Autowired
private IPersonnelService personnelService;
@Override
@ApiOperation(value = "更新组织", notes = "传入持久化组织对象,进行更新")
public void updateSysOrganize(SysOrganize organize) {

@ -242,6 +242,15 @@ public class SysUserInfoService implements ISysUserInfoService {
}
@Override
public int getSysUserInfoCount() {
LOGGER.info("用户信息 SysUserInfo Count");
return sysUserInfoRDao.findByPropertyCount(
new String[]{"isDeleted","isValid"},
new Object[]{CommonEnumUtil.IS_DEAL.NO.getValue(),CommonEnumUtil.IS_VAILD.VAILD.getValue()});
}
@Override
@ApiOperation(value = "查询用户信息",notes = "根据 UserInfoId查询用户信息")
public SysUserInfo getSysUserInfoById(Long id) {
return sysUserInfoRDao.getById(id);

Loading…
Cancel
Save