com.invms.x.controllers.basis.BasisController Maven / Gradle / Ivy
The newest version!
package com.invms.x.controllers.basis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.invms.x.builders.ArgsBuilder;
import com.invms.x.controllers.BaseController;
import com.invms.x.entities.basis.IBasisEntity;
import com.invms.x.filters.ActionFilter;
import com.invms.x.filters.FieldFilter;
import com.invms.x.filters.HtmlFilter;
import com.invms.x.filters.IgnoreFilter;
import com.invms.x.filters.LogFilter;
import com.invms.x.models.DataModel;
import com.invms.x.services.basis.AuthorizeService;
import com.invms.x.services.basis.SetupService;
import com.invms.x.utils.ComUtils;
@HtmlFilter(code = IBasisEntity.BASE_CODE, name = "基础管理", sortIndex = IBasisEntity.BASE_SORT_INDEX)
@ActionFilter(code = IBasisEntity.BASE_CODE, name = "基础管理", icon = "fas fa-bars", category = ActionFilter.CATEGORY_LEFT_TOP_MENU, sortIndex = IBasisEntity.BASE_SORT_INDEX)
@FieldFilter(code = IBasisEntity.BASE_CODE, name = "基础", sortIndex = IBasisEntity.BASE_SORT_INDEX)
@LogFilter(message = "基础管理", category = LogFilter.CATEGORY_INFO)
@RestController
@RequestMapping(value = "/basis")
public class BasisController extends BaseController {
@Autowired
private SetupService setupService;
@Autowired
private AuthorizeService authorizeService;
@HtmlFilter(code = IBasisEntity.BASE_CODE + "_home", name = "首页", sortIndex = IBasisEntity.BASE_SORT_INDEX + 100, parentCode = IBasisEntity.BASE_CODE)
@ActionFilter(code = IBasisEntity.BASE_CODE + "_home", name = "首页", script = "x.basis.renderContent('/dist/htm/basis/home/index.html', 'basis_home');", sortIndex = IBasisEntity.BASE_SORT_INDEX +100, parentCode = IBasisEntity.BASE_CODE, category = ActionFilter.CATEGORY_TOP_CENTER_MENU)
@LogFilter(message = "首页", category = LogFilter.CATEGORY_INFO)
@RequestMapping(value = "/home")
public void home() {
}
@IgnoreFilter
@HtmlFilter(code = IBasisEntity.BASE_CODE + "_setup", name = "安装系统", sortIndex = IBasisEntity.BASE_SORT_INDEX + 200, parentCode = IBasisEntity.BASE_CODE)
@LogFilter(message = "安装系统", category = LogFilter.CATEGORY_INFO)
@RequestMapping(value = "/setup")
public Object setup() throws Exception {
ArgsBuilder argsBuilder = createArgsBuilder();
Object data = setupService.updateSystem(argsBuilder);
return DataModel.createTrue(data);
}
@IgnoreFilter
@HtmlFilter(code = IBasisEntity.BASE_CODE + "_login", name = "登入系统", sortIndex = IBasisEntity.BASE_SORT_INDEX + 300, parentCode = IBasisEntity.BASE_CODE)
@LogFilter(message = "登入系统", category = LogFilter.CATEGORY_INFO)
@RequestMapping(value = "/login")
public Object login() throws Exception {
ArgsBuilder argsBuilder = createArgsBuilder();
Object data = authorizeService.userLogin(argsBuilder);
String redirectUrl = argsBuilder.getValue(String.class, "redirectUrl");
if (!ComUtils.empty(redirectUrl)) {
sendRedirect(redirectUrl.replaceAll("\\{token\\}", argsBuilder.getToken()));
}
return DataModel.createTrue(data);
}
@IgnoreFilter
@HtmlFilter(code = IBasisEntity.BASE_CODE + "_logout", name = "登出系统", sortIndex = IBasisEntity.BASE_SORT_INDEX + 400, parentCode = IBasisEntity.BASE_CODE)
@LogFilter(message = "登出系统", category = LogFilter.CATEGORY_INFO)
@RequestMapping(value = "/logout")
public Object logout() throws Exception {
ArgsBuilder argsBuilder = createArgsBuilder();
Object data = authorizeService.userLogout(argsBuilder);
return DataModel.createTrue(data);
}
@IgnoreFilter
@HtmlFilter(code = IBasisEntity.BASE_CODE + "_regist", name = "注册用户", sortIndex = IBasisEntity.BASE_SORT_INDEX + 500, parentCode = IBasisEntity.BASE_CODE)
@LogFilter(message = "注册用户", category = LogFilter.CATEGORY_INFO)
@RequestMapping(value = "/regist")
public Object regist() throws Exception {
ArgsBuilder argsBuilder = createArgsBuilder();
Object data = authorizeService.userRegist(argsBuilder);
return DataModel.createTrue(data);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy