package com.fzzy.init;
|
|
import com.fzzy.igds.domain.Dept;
|
import com.fzzy.igds.service.*;
|
import com.ruoyi.system.service.ISysCompanyService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.core.annotation.Order;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.util.List;
|
|
/**
|
* 配置系统级别的项目启动初始化信息
|
*
|
* @author Andy
|
*/
|
@Service
|
@Slf4j
|
@Order(value = 1)
|
public class SystemRunner implements CommandLineRunner {
|
|
@Resource
|
private ISysCompanyService iSysCompanyService;
|
@Resource
|
private SysDeptService sysDeptService;
|
@Resource
|
private CoreDeptService coreDeptService;
|
@Resource
|
private DicService dicService;
|
@Resource
|
private DepotService depotService;
|
@Resource
|
private DepotConfService depotConfService;
|
@Resource
|
private DeviceSerService deviceSerService;
|
@Resource
|
private InoutConfService inoutConfService;
|
@Resource
|
private SecCameraService secCameraService;
|
@Resource
|
private SnapConfService snapConfService;
|
|
|
@Override
|
public void run(String... args) throws Exception {
|
//组织信息放入缓存
|
iSysCompanyService.resetCompanyCache();
|
List<Dept> list = coreDeptService.listDept(null, null, null);
|
|
for (Dept dept : list) {
|
|
flushCache(dept.getCompanyId(),dept.getId(), "系统调用");
|
}
|
}
|
|
/**
|
* 分组织初始化
|
*
|
* @param companyId
|
* @param name
|
*/
|
public void flushCache(String companyId,String deptId, String name) {
|
|
//初始化用户部门到内存
|
sysDeptService.initUserDeptMap(companyId);
|
|
//初始化常用字典到内存
|
dicService.initDicMap(companyId);
|
|
//初始化流程配置
|
inoutConfService.flushInoutSysConfCache();
|
|
//初始设备配置
|
inoutConfService.flushInoutConfCache(companyId, deptId);
|
|
//初始化仓库缓存
|
depotService.flushCache(companyId);
|
|
//参数配置
|
depotConfService.flushConfCache(companyId);
|
|
//设置分机全部掉线
|
deviceSerService.allOffLine(companyId);
|
|
//刷新分机到缓存
|
deviceSerService.refreshCache(companyId);
|
|
secCameraService.refreshCache(companyId);
|
|
log.info("* ");
|
log.info("* ========================");
|
log.info("* ");
|
log.info("* 组织={},{}初始化缓存完成…………", companyId, name);
|
log.info("* ");
|
log.info("* ========================");
|
log.info("* ");
|
}
|
|
|
}
|