class SetupDataBaseController {

    @RequestMapping(value = "/setupDbCheck")
    public ServiceResult setupDbCheck() {
        try {
            boolean initialized = setupDBService.isInitialized();
            if (initialized) {
                return ServiceResult.success();
            }

            boolean valid = ResourceUtil.getSingleInstance().datasourceXmlValid();
            if (!valid) {
                return ServiceResult.fail("配置信息读取失败！");
            }

            if (valid && !initialized) {
                synchronized (SetupDataBaseService.LOCK) {
                    if (!initialized) {
                        setupDBService.setInitialized(true);
                    }
                }
                return ServiceResult.success("initialized");
            }
            return ServiceResult.success("initialized");
        } catch (Exception e) {
            log.error("SetupDBController.setupDbCheck : {}", StringUtil.getMessage(e));
            return ServiceResult.fail(CommMsg.loginFailMessage);
        }
    }

}