first commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.budwk.app.sys.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
public @interface DataCenterColumn {
|
||||
|
||||
/*
|
||||
* 列名
|
||||
*/
|
||||
String name();
|
||||
|
||||
/*
|
||||
* 列key
|
||||
*/
|
||||
String key();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.services.SysApiService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/24.
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/sys/api")
|
||||
public class SysApiController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysApiService sysApiService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/api/index.html")
|
||||
@SaCheckPermission("sys.manager.api")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.api.add")
|
||||
@SLog(tag = "新建密钥", msg = "应用名称:${name}")
|
||||
public Object addDo(@Param("name") String name, HttpServletRequest req) {
|
||||
try {
|
||||
sysApiService.createAppkey(name, SecurityUtil.getUserId());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.api.delete")
|
||||
@SLog(tag = "删除密钥", msg = "Appid:${appid}")
|
||||
public Object delete(String appid, HttpServletRequest req) {
|
||||
try {
|
||||
sysApiService.deleteAppkey(appid);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/enable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.api.edit")
|
||||
@SLog(tag = "启用密钥", msg = "Appid:${appid}")
|
||||
public Object enable(String appid, HttpServletRequest req) {
|
||||
try {
|
||||
sysApiService.updateAppkey(appid, false);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/disable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.api.edit")
|
||||
@SLog(tag = "禁用密钥", msg = "Appid:${appid}")
|
||||
public Object disable(String appid, HttpServletRequest req) {
|
||||
try {
|
||||
sysApiService.updateAppkey(appid, true);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.api")
|
||||
public Object data(@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) {
|
||||
try {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
}
|
||||
return Result.success().addData(sysApiService.listPage(pageNumber, pageSize, cnd));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.bpm.enums.BpmProcessTaskStatusEnum;
|
||||
import com.budwk.app.bpm.service.BpmService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.sys.vo.SysBranchUnionUserAuthorizationPageVO;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.dayofficework.article.param.ArticleInfoPageParam;
|
||||
import com.budwk.app.zhgh.dayofficework.article.vo.ArticleInfoPageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/branchUnionUser/authorization")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "分工会人员授权")
|
||||
public class SysBranchUnionUserAuthorizationController {
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private BpmService bpmService;
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.branch.union.authorization")
|
||||
@ApiOperation("分页查询")
|
||||
public Result pageData(@Valid ArticleInfoPageParam pageForm, boolean approval) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
info.*,
|
||||
inst.id processInstanceId,
|
||||
inst.processInstanceNodeId,
|
||||
inst.processInstanceNodeName,
|
||||
inst.processInstanceTaskIds,
|
||||
inst.processInstanceStatus,
|
||||
task.id processInstanceTaskId,
|
||||
task.taskStatus processInstanceTaskStatus,
|
||||
COUNT(nt.id) OVER (PARTITION BY task.id) > 0 AS nextTaskIsComplete\s
|
||||
FROM
|
||||
bpm_process_task task
|
||||
INNER JOIN bpm_process_node_define nd ON nd.id = task.processTaskNodeId
|
||||
INNER JOIN bpm_process_instance inst ON inst.id = task.processInstanceId
|
||||
INNER JOIN sys_branch_union_user_permission info ON info.id = inst.processInstanceBusinessId
|
||||
LEFT JOIN bpm_process_task nt ON nt.prevTaskId = task.id AND nt.taskStatus = 'COMPLETE'
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!AuthUtil.hasRole(RoleConstant.SYSADMIN.name())) {
|
||||
cnd.and(new Static("JSON_CONTAINS( task.assignments, '\"%s\"' )".formatted(SecurityUtil.getUserLoginname())));
|
||||
}
|
||||
cnd.and("nd.nodeCode", "=", 20);
|
||||
if (approval) {
|
||||
cnd.and("task.taskStatus", "=", BpmProcessTaskStatusEnum.COMPLETE);
|
||||
} else {
|
||||
cnd.and("task.taskStatus", "=", BpmProcessTaskStatusEnum.ACTIVE);
|
||||
}
|
||||
|
||||
cnd.andEX("YEAR(info.submitTime)", "=", pageForm.getYear());
|
||||
cnd.and(Cnd.likeEX("info.title", pageForm.getTitle()));
|
||||
|
||||
if (StrUtil.isAllBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.desc("info.createdAt");
|
||||
} else {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
Pagination<SysBranchUnionUserAuthorizationPageVO> pageVO = sysUserService.listPageVO(pageForm, sql, SysBranchUnionUserAuthorizationPageVO.class);
|
||||
return Result.success(pageVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.models.Sys_config;
|
||||
import com.budwk.app.sys.services.SysConfigService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.integration.jedis.pubsub.PubSubService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/28.
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/sys/conf")
|
||||
public class SysConfController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysConfigService sysConfigService;
|
||||
@Inject
|
||||
private PubSubService pubSubService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/conf/index.html")
|
||||
@SaCheckPermission("sys.manager.conf")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.conf.add")
|
||||
@SLog(tag = "添加参数", msg = "${conf.configKey}:${conf.configValue}")
|
||||
public Object addDo(@Param("..") Sys_config conf) {
|
||||
try {
|
||||
conf.setCreatedBy(SecurityUtil.getUserId());
|
||||
if (sysConfigService.insert(conf) != null) {
|
||||
pubSubService.fire(RedisConstant.PLATFORM_REDIS_PREFIX + "web:platform", "sys_config");
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/edit/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.conf")
|
||||
public Object edit(String id) {
|
||||
try {
|
||||
return Result.success().addData(sysConfigService.fetch(id));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.conf.edit")
|
||||
@SLog(tag = "修改参数", msg = "${conf.configKey}:${conf.configValue}")
|
||||
public Object editDo(@Param("..") Sys_config conf) {
|
||||
try {
|
||||
conf.setUpdatedBy(SecurityUtil.getUserId());
|
||||
if (sysConfigService.updateIgnoreNull(conf) > 0) {
|
||||
pubSubService.fire(RedisConstant.PLATFORM_REDIS_PREFIX + "web:platform", "sys_config");
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.conf.delete")
|
||||
@SLog(tag = "删除参数", msg = "参数:${configKey}")
|
||||
public Object delete(String configKey) {
|
||||
try {
|
||||
if (Strings.sBlank(configKey).startsWith("App")) {
|
||||
return Result.error("系统参数不可删除");
|
||||
}
|
||||
if (sysConfigService.delete(configKey) > 0) {
|
||||
pubSubService.fire(RedisConstant.PLATFORM_REDIS_PREFIX + "web:platform", "sys_config");
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.conf")
|
||||
public Object data(@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) {
|
||||
try {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
}
|
||||
return Result.success().addData(sysConfigService.listPage(pageNumber, pageSize, cnd));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/data/unit")
|
||||
@Ok("json:full")
|
||||
public class SysDataUnitController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/data/unit/index.html")
|
||||
@SaCheckPermission("sys.data.unit")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.models.Sys_user_source;
|
||||
import com.budwk.app.sys.param.SysDataUserPullPageForm;
|
||||
import com.budwk.app.sys.services.SysDataUserPullService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/data/user/pull")
|
||||
@Ok("json:full")
|
||||
@Api(value = "获取信息中心数据")
|
||||
public class SysDataUserPullController {
|
||||
|
||||
@Inject
|
||||
private SysDataUserPullService sysUserPullService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/data/user/pull.html")
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
@ApiOperation("分页数据")
|
||||
@Ok("json:{locked:'password|idCard|mobile'}")
|
||||
public Result pageData(@Valid SysDataUserPullPageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX(Sys_user_source::getPullTime, "=", pageForm.getPullTime());
|
||||
cnd.and(Cnd.likeEX(Sys_user_source::getUsername, pageForm.getUserName()));
|
||||
cnd.and(Cnd.likeEX(Sys_user_source::getLoginname, pageForm.getLoginName()));
|
||||
cnd.andEX(Sys_user_source::getUnitName, "=", pageForm.getUnitName());
|
||||
cnd.andEX(Sys_user_source::getUserState, "=", pageForm.getUserState());
|
||||
cnd.andEX(Sys_user_source::getPreparedBy, "=", pageForm.getPreparedBy());
|
||||
cnd.andEX(Sys_user_source::getPersonType, "=", pageForm.getPersonType());
|
||||
|
||||
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.desc(Sys_user_source::getPullTime);
|
||||
Pagination pagination = sysUserPullService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
@ApiOperation("拉取用户数据")
|
||||
public Result pullData() {
|
||||
sysUserPullService.pull();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
@ApiOperation("删除用户数据")
|
||||
public Result deleteData() {
|
||||
sysUserPullService.clear();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
@ApiModelProperty("获取下拉框数据(单位、在职状态、人员类型)")
|
||||
public Result searchOptions() {
|
||||
return Result.success(sysUserPullService.searchOptions());
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
@ApiModelProperty("获取数据源拉取时间列表")
|
||||
public Result pullTimeOptions() {
|
||||
return Result.success(sysUserPullService.pullTimeOptions());
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
@ApiOperation("根据拉取时间删除数据")
|
||||
public Result deleteByPullTime(@Param(value = "pullTime") @Valid String[] pullTime) {
|
||||
sysUserPullService.clear(Cnd.where(Sys_user_source::getPullTime, "in", pullTime));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.EnumUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.enums.SysDataUpdateMode;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.models.Sys_user_history;
|
||||
import com.budwk.app.sys.param.SysDataUserUpdatePageForm;
|
||||
import com.budwk.app.sys.param.SysDataUserUpdateParam;
|
||||
import com.budwk.app.sys.services.SysDataUserPullService;
|
||||
import com.budwk.app.sys.services.SysDataUserUpdateService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.Ioc;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/data/user/update")
|
||||
@Ok("json:full")
|
||||
@Api(value = "更新系统用户数据")
|
||||
public class SysDataUserUpdateController {
|
||||
|
||||
@Inject("refer:$ioc")
|
||||
private Ioc ioc;
|
||||
@Inject
|
||||
private SysDataUserPullService sysDataUserPullService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/data/user/update.html")
|
||||
@SaCheckPermission("sys.data.user.update")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
@ApiOperation("分页数据")
|
||||
@Ok("json:{locked:'password|idCard|mobile'}")
|
||||
public Result pageData(@Valid SysDataUserUpdatePageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.*,
|
||||
his.changeTypes,
|
||||
his.changeTime,
|
||||
his.id AS userHistoryId
|
||||
FROM
|
||||
vw_user u
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
*,
|
||||
ROW_NUMBER() OVER (PARTITION BY loginname ORDER BY changeTime DESC) AS rn
|
||||
FROM
|
||||
sys_user_history
|
||||
) his ON his.loginname = u.loginname AND his.rn = 1
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(Cnd.likeEX("u.username", pageForm.getUserName()));
|
||||
cnd.and(Cnd.likeEX("u.loginname", pageForm.getLoginName()));
|
||||
cnd.andEX("u.unitId", "=", pageForm.getUnitId());
|
||||
cnd.andEX("u.userState", "=", pageForm.getUserState());
|
||||
cnd.andEX("u.;preparedBy", "=", pageForm.getPreparedBy());
|
||||
cnd.andEX("u.personType", "=", pageForm.getPersonType());
|
||||
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
cnd.desc("his.changeTime");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
@ApiModelProperty("获取数据源拉取时间列表")
|
||||
public Result pullTimeOptions() {
|
||||
return Result.success(sysDataUserPullService.pullTimeOptions());
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.data.user.pull")
|
||||
@SLog(tag = "更新系统用户数据", msg = "更新数据")
|
||||
@ApiOperation("更新数据")
|
||||
public Result updateUserFormSource(@Valid @Param("param") SysDataUserUpdateParam updateParam) {
|
||||
SysDataUpdateMode updateMode = EnumUtil.getBy(SysDataUpdateMode.class, (val) -> val.name().equals(updateParam.getUpdateMode()));
|
||||
if (ObjectUtil.isNull(updateMode)) {
|
||||
return Result.error("更新模式错误,请传入正确的更新模式。");
|
||||
}
|
||||
SysDataUserUpdateService sysDataUserUpdateService = (SysDataUserUpdateService) ioc.get(updateMode.getClazz());
|
||||
return Result.success(sysDataUserUpdateService.update(updateParam));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/24.
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/sys/dict")
|
||||
public class SysDictController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/dict/index.html")
|
||||
@SaCheckPermission("sys.manager.dict")
|
||||
public Object index() {
|
||||
return sysDictService.query(Cnd.where("parentId", "=", "").or("parentId", "is", null).asc("location").asc("path"));
|
||||
}
|
||||
|
||||
|
||||
@At("/child")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object child(@Param("pid") String pid, HttpServletRequest req) {
|
||||
List<Sys_dict> list = new ArrayList<>();
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and("parentId", "=", "").or("parentId", "is", null);
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
cnd.asc("location").asc("path");
|
||||
list = sysDictService.query(cnd);
|
||||
for (Sys_dict sysDict : list) {
|
||||
if (sysDictService.count(Cnd.where("parentId", "=", sysDict.getId())) > 0) {
|
||||
sysDict.setHasChildren(true);
|
||||
}
|
||||
NutMap map = Lang.obj2nutmap(sysDict);
|
||||
map.addv("expanded", false);
|
||||
map.addv("children", new ArrayList<>());
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
}
|
||||
|
||||
@At("/tree")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object tree(@Param("pid") String pid, HttpServletRequest req) {
|
||||
try {
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
if (Strings.isBlank(pid)) {
|
||||
NutMap root = NutMap.NEW().addv("value", "root").addv("label", "不选择菜单").addv("leaf", true);
|
||||
treeList.add(root);
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and("parentId", "=", "").or("parentId", "is", null);
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
cnd.asc("location").asc("path");
|
||||
List<Sys_dict> list = sysDictService.query(cnd);
|
||||
for (Sys_dict sysDict : list) {
|
||||
NutMap map = NutMap.NEW().addv("value", sysDict.getId()).addv("label", sysDict.getName());
|
||||
if (sysDict.isHasChildren()) {
|
||||
map.addv("children", new ArrayList<>());
|
||||
map.addv("leaf", false);
|
||||
} else {
|
||||
map.addv("leaf", true);
|
||||
}
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.dict.add")
|
||||
@SLog(tag = "新建字典", msg = "字典名称:${args[0].name}")
|
||||
public Object addDo(@Param("..") Sys_dict dict, @Param(value = "parentId", df = "") String parentId, HttpServletRequest req) {
|
||||
try {
|
||||
if ("root".equals(parentId)) {
|
||||
parentId = "";
|
||||
}
|
||||
dict.setHasChildren(false);
|
||||
dict.setCreatedBy(SecurityUtil.getUserId());
|
||||
sysDictService.save(dict, parentId);
|
||||
sysDictService.clearCache();
|
||||
return Result.success("system.success");
|
||||
} catch (Exception e) {
|
||||
return Result.error("system.error");
|
||||
}
|
||||
}
|
||||
|
||||
@At("/edit/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.dict")
|
||||
public Object edit(String id, HttpServletRequest req) {
|
||||
try {
|
||||
return Result.success().addData(sysDictService.fetch(id));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.dict.edit")
|
||||
@SLog(tag = "编辑字典", msg = "字典名称:${args[0].name}")
|
||||
public Object editDo(@Param("..") Sys_dict dict, @Param("parentId") String parentId, HttpServletRequest req) {
|
||||
try {
|
||||
dict.setUpdatedBy(SecurityUtil.getUserId());
|
||||
sysDictService.updateIgnoreNull(dict);
|
||||
sysDictService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.dict.delete")
|
||||
@SLog(tag = "删除字典", msg = "字典名称:${args[1].getAttribute('name')}")
|
||||
public Object delete(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_dict dict = sysDictService.fetch(id);
|
||||
req.setAttribute("name", dict.getName());
|
||||
sysDictService.deleteAndChild(dict);
|
||||
sysDictService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/enable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.dict.edit")
|
||||
@SLog(tag = "启用菜单", msg = "菜单名称:${args[1].getAttribute('name')}")
|
||||
public Object enable(String menuId, HttpServletRequest req) {
|
||||
try {
|
||||
req.setAttribute("name", sysDictService.fetch(menuId).getName());
|
||||
sysDictService.update(org.nutz.dao.Chain.make("disabled", false), Cnd.where("id", "=", menuId));
|
||||
sysDictService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/disable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.dict.edit")
|
||||
@SLog(tag = "禁用菜单", msg = "菜单名称:${args[1].getAttribute('name')}")
|
||||
public Object disable(String menuId, HttpServletRequest req) {
|
||||
try {
|
||||
req.setAttribute("name", sysDictService.fetch(menuId).getName());
|
||||
sysDictService.update(org.nutz.dao.Chain.make("disabled", true), Cnd.where("id", "=", menuId));
|
||||
sysDictService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/menuAll")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.dict")
|
||||
public Object menuAll(HttpServletRequest req) {
|
||||
try {
|
||||
List<Sys_dict> list = sysDictService.query(Cnd.NEW().asc("location").asc("path"));
|
||||
NutMap menuMap = NutMap.NEW();
|
||||
for (Sys_dict unit : list) {
|
||||
List<Sys_dict> list1 = menuMap.getList(unit.getParentId(), Sys_dict.class);
|
||||
if (list1 == null) {
|
||||
list1 = new ArrayList<>();
|
||||
}
|
||||
list1.add(unit);
|
||||
menuMap.put(unit.getParentId(), list1);
|
||||
}
|
||||
return Result.success().addData(getTree(menuMap, ""));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
private List<NutMap> getTree(NutMap menuMap, String pid) {
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
List<Sys_dict> subList = menuMap.getList(pid, Sys_dict.class);
|
||||
for (Sys_dict menu : subList) {
|
||||
NutMap map = Lang.obj2nutmap(menu);
|
||||
map.put("label", menu.getName());
|
||||
if (menu.isHasChildren() || (menuMap.get(menu.getId()) != null)) {
|
||||
map.put("children", getTree(menuMap, menu.getId()));
|
||||
}
|
||||
treeList.add(map);
|
||||
}
|
||||
return treeList;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.dict.edit")
|
||||
public Object sortDo(@Param("ids") String ids, HttpServletRequest req) {
|
||||
try {
|
||||
String[] menuIds = StringUtils.split(ids, ",");
|
||||
int i = 0;
|
||||
sysDictService.execute(Sqls.create("update sys_dict set location=0"));
|
||||
for (String s : menuIds) {
|
||||
if (!Strings.isBlank(s)) {
|
||||
sysDictService.update(org.nutz.dao.Chain.make("location", i), Cnd.where("id", "=", s));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
sysDictService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.enums.SysFileEngineTypeEnum;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import com.budwk.app.sys.services.SysConfigService;
|
||||
import com.budwk.app.sys.services.SysFileService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/file")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "文件管理")
|
||||
public class SysFileController {
|
||||
|
||||
@Inject
|
||||
private SysFileService sysFileService;
|
||||
|
||||
@Inject
|
||||
private SysConfigService sysConfigService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/file/index.html")
|
||||
@SaCheckPermission("sys.manager.file")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态上传文件返回url
|
||||
**/
|
||||
@At
|
||||
@SLog(tag = "文件管理", msg = "动态上传文件返回url")
|
||||
@POST
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@SaCheckLogin
|
||||
public Result uploadDynamicReturnUrl(TempFile file) {
|
||||
try {
|
||||
if (file == null) {
|
||||
return Result.error("文件内容为空");
|
||||
}
|
||||
String id = sysFileService.uploadReturnUrl(SysFileEngineTypeEnum.MINIO.getValue(), file);
|
||||
return Result.success().addData(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件分页列表
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.file")
|
||||
public Result pageData(PageForm pageForm, String name) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(name)) {
|
||||
cnd.where().andLike(Sys_file::getName, name);
|
||||
}
|
||||
cnd.desc(Sys_file::getCreatedAt);
|
||||
Pagination pagination = sysFileService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件列表
|
||||
*/
|
||||
@At
|
||||
@SLog(tag = "文件管理", msg = "获取文件列表")
|
||||
@SaCheckPermission("sys.manager.file")
|
||||
public Result list(Sys_file file) {
|
||||
return Result.success(sysFileService.list());
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
**/
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckLogin
|
||||
public void download(String id, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
sysFileService.download(id, request, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckLogin
|
||||
@ApiOperation("文件管理-转换PDF")
|
||||
public void convertPDF(String id, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
sysFileService.convertPDF(id, request, response);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("文件管理-转换HTML")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Result convertHtml(TempFile file){
|
||||
return Result.success().addData(sysFileService.convertHtml(file));
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("文件管理-删除文件")
|
||||
@SLog(tag = "文件管理", msg = "删除文件")
|
||||
@SaCheckPermission("sys.manager.file")
|
||||
public Result delete(@Param("ids") String[] ids) {
|
||||
sysFileService.delete(ids);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "文件管理", msg = "获取文件详情")
|
||||
@SaCheckPermission("sys.manager.file")
|
||||
@ApiOperation("文件管理-预览单文件文件完整数据")
|
||||
public Result detail(String id) {
|
||||
return Result.success(sysFileService.detail(id));
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("文件管理-前端预览文件完整数据")
|
||||
public Result previewFileData(@Param("ids") String[] ids) {
|
||||
List<Sys_file> files = sysFileService.previewFileData(ids);
|
||||
return Result.success(files);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.FieldFilter;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/h5")
|
||||
@Api(tags = "移动端首页")
|
||||
public class SysH5IndexController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/sys/home/index.html")
|
||||
@SaCheckLogin
|
||||
public void home() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/index/mine/index.html")
|
||||
@SaCheckLogin
|
||||
public void mine() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/index/msg/index.html")
|
||||
@SaCheckLogin
|
||||
public void msg() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/zhghh5/index/work/index.html")
|
||||
@SaCheckLogin
|
||||
public void work() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Ok("json")
|
||||
public Result listHomeActivity() {
|
||||
FieldFilter fieldFilter = FieldFilter.locked(Sys_home_activity.class, "classPath");
|
||||
List<Sys_home_activity> list = Daos.ext(dao,fieldFilter) .query(Sys_home_activity.class, Cnd.where("enable", "=", 1).desc("top"));
|
||||
String userId = SecurityUtil.getUserId();
|
||||
List<Sys_home_activity> allowActivityList = new ArrayList<>();
|
||||
// 今天的时间
|
||||
Date today = DateUtil.date();
|
||||
for (Sys_home_activity activity : list) {
|
||||
// 该活动的时间范围
|
||||
Date startDate = activity.getStartDate();
|
||||
Date endDate = activity.getEndDate();
|
||||
// 判断当前时间是否在活动范围内,不在就过滤掉
|
||||
if (!DateUtil.isIn(today, startDate, endDate)) {
|
||||
continue;
|
||||
}
|
||||
Integer allowUserGroupId = activity.getAllowUserGroupId();
|
||||
String allowUserSql = activity.getAllowUserSql();
|
||||
activity.setAllowUserSql(null);
|
||||
if (allowUserGroupId == null && StrUtil.isBlank(allowUserSql)) {
|
||||
allowActivityList.add(activity);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (allowUserGroupId != null) {
|
||||
int count = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", allowUserGroupId).and("userId", "=", userId));
|
||||
if (count > 0) {
|
||||
allowActivityList.add(activity);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(allowUserSql)){
|
||||
Sql sql = Sqls.create(allowUserSql).setParam("userId", userId);
|
||||
NutMap nutMap = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
|
||||
if (Lang.isNotEmpty(nutMap) && StrUtil.isNotBlank(nutMap.getString("userId"))) {
|
||||
allowActivityList.add(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success(allowActivityList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
/**
|
||||
* @ClassName SysH5IndexMineController
|
||||
* @Description TODO
|
||||
* @Author zhf
|
||||
* @Date 2024/10/15 9:31
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/h5/indexMine")
|
||||
@Api(tags = "移动端首页我的")
|
||||
public class SysH5IndexMineController {
|
||||
|
||||
@At("/userInfo")
|
||||
@Ok("beetl:/platform/zhghh5/sys/userInfo/index.html")
|
||||
public void userInfo() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.enums.SysFileEngineTypeEnum;
|
||||
import com.budwk.app.sys.services.SysFileService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.integration.jedis.pubsub.PubSubService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/h5ScanCodeUploadFile")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "h5扫码上传文件")
|
||||
public class SysH5ScanCodeUploadFileController {
|
||||
|
||||
@Inject
|
||||
private SysFileService sysFileService;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
@Inject
|
||||
private PubSubService pubSubService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/h5upload.html")
|
||||
@SaCheckLogin
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "h5扫码上传文件", msg = "上传")
|
||||
@POST
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@SaCheckLogin
|
||||
public Result upload(@Param("file") TempFile file) {
|
||||
try {
|
||||
if (file == null) {
|
||||
return Result.error("请选择要上传的文件");
|
||||
}
|
||||
String url = sysFileService.uploadReturnUrl(SysFileEngineTypeEnum.MINIO.getValue(), file);
|
||||
return Result.success().addData(url);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SLog(tag = "文件管理", msg = "同步到PC")
|
||||
@SaCheckLogin
|
||||
public Result syncPc(@Param("files") JSONObject[] jsonObject) {
|
||||
try {
|
||||
if(ObjectUtil.isEmpty(jsonObject)){
|
||||
return Result.error("请选择要同步的文件");
|
||||
}
|
||||
|
||||
ScanParams match = new ScanParams().match(RedisConstant.REDIS_KEY_WSROOM + SecurityUtil.getUserLoginname() + ":*");
|
||||
ScanResult<String> scan = null;
|
||||
do {
|
||||
scan = redisService.scan(scan == null ? ScanParams.SCAN_POINTER_START : scan.getStringCursor(), match);
|
||||
for (String key : scan.getResult()) {
|
||||
NutMap data = NutMap.NEW().addv("action", "h5-scan-code-upload-file").addv("files", jsonObject);
|
||||
pubSubService.fire(key, Json.toJson(data));
|
||||
}
|
||||
} while (!scan.isCompleteIteration());
|
||||
|
||||
return Result.success().addData(null);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.param.SysHomeActivityPageForm;
|
||||
import com.budwk.app.sys.services.SysHomeActivityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/homeActivity")
|
||||
@Ok("json:full")
|
||||
@Api(value = "首页活动")
|
||||
public class SysHomeActivityController {
|
||||
|
||||
@Inject
|
||||
private SysHomeActivityService sysHomeActivityService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/homeActivity/index.html")
|
||||
@SaCheckPermission("sys.homeActivity")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.homeActivity")
|
||||
@ApiOperation("分页数据")
|
||||
public Result pageData(@Valid SysHomeActivityPageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(Cnd.likeEX(Sys_home_activity::getName,pageForm.getName()));
|
||||
cnd.desc(Sys_home_activity::getSortNo);
|
||||
Pagination pagination = sysHomeActivityService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.homeActivity")
|
||||
@ApiOperation("启用")
|
||||
public Result enable(@Valid String id) {
|
||||
sysHomeActivityService.update(Chain.make("enable", 1), Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.homeActivity")
|
||||
@ApiOperation("关闭")
|
||||
public Result disable(@Valid String id) {
|
||||
sysHomeActivityService.update(Chain.make("enable", 0), Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.homeActivity")
|
||||
@ApiOperation("置顶")
|
||||
public Result topUp(@Valid String id){
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(id);
|
||||
sysHomeActivity.setTop(true);
|
||||
sysHomeActivityService.updateIgnoreNull(sysHomeActivity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.homeActivity")
|
||||
@ApiOperation("取消置顶")
|
||||
public Result cancelTopUp(@Valid String id){
|
||||
Sys_home_activity sysHomeActivity = new Sys_home_activity();
|
||||
sysHomeActivity.setId(id);
|
||||
sysHomeActivity.setTop(false);
|
||||
sysHomeActivityService.updateIgnoreNull(sysHomeActivity);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,352 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.useragent.UserAgent;
|
||||
import cn.hutool.http.useragent.UserAgentUtil;
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import com.budwk.app.sys.models.Sys_menu;
|
||||
import com.budwk.app.sys.services.SysMenuService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.zhgh.activity.basic.models.ActivityUserScope;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.FieldFilter;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheResult;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@IocBean
|
||||
@At("/platform/home")
|
||||
public class SysHomeController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SysMenuService sysMenuService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
|
||||
@At("")
|
||||
@Ok("re")
|
||||
@SaCheckLogin
|
||||
public String home(HttpSession session, HttpServletRequest req) {
|
||||
String userAgentStr = req.getHeader("User-Agent");
|
||||
UserAgent userAgent = UserAgentUtil.parse(userAgentStr);
|
||||
if (!userAgent.isMobile()) {
|
||||
return "beetl:/platform/sys/home/index.html";
|
||||
} else {
|
||||
return "beetl:/platform/zhghh5/sys/home/index.html";
|
||||
}
|
||||
}
|
||||
|
||||
@At("/platform/h5")
|
||||
@Ok("re")
|
||||
@SaCheckLogin
|
||||
public String h5Home(HttpSession session, HttpServletRequest req) {
|
||||
return "beetl:/platform/zhghh5/sys/home/index.html";
|
||||
}
|
||||
|
||||
|
||||
@At("/403")
|
||||
@Ok("re")
|
||||
public Object error403(HttpServletRequest req) {
|
||||
if (Strings.sNull(req.getAttribute("original_request_uri")).startsWith("/platform")) {
|
||||
if (UserAgentUtil.parse(req.getHeader("User-Agent")).isMobile()) {
|
||||
return ">>:/error/403.html";
|
||||
}
|
||||
return "beetl:/platform/sys/403.html";
|
||||
} else {
|
||||
return ">>:/error/404.html";
|
||||
}
|
||||
}
|
||||
|
||||
@At("/404")
|
||||
@Ok("re")
|
||||
public Object error404(HttpServletRequest req) {
|
||||
if (Strings.sNull(req.getAttribute("original_request_uri")).startsWith("/platform")) {
|
||||
if (UserAgentUtil.parse(req.getHeader("User-Agent")).isMobile()) {
|
||||
return ">>:/error/404.html";
|
||||
}
|
||||
return "beetl:/platform/sys/404.html";
|
||||
} else {
|
||||
return ">>:/error/404.html";
|
||||
}
|
||||
}
|
||||
|
||||
@At("/500")
|
||||
@Ok("re")
|
||||
public Object error500(HttpServletRequest req) {
|
||||
if (Strings.sNull(req.getAttribute("original_request_uri")).startsWith("/platform")) {
|
||||
if (UserAgentUtil.parse(req.getHeader("User-Agent")).isMobile()) {
|
||||
return ">>:/error/500.html";
|
||||
}
|
||||
return "beetl:/platform/sys/500.html";
|
||||
} else {
|
||||
return ">>:/error/500.html";
|
||||
}
|
||||
}
|
||||
|
||||
@At("/unknownAccountError")
|
||||
@Ok("re")
|
||||
@ApiOperation("未知用户页面")
|
||||
public Object unknownAccountError() {
|
||||
return ">>:/error/unknownAccountError.html";
|
||||
}
|
||||
|
||||
|
||||
@At(value = {"/", "/index"}, top = true)
|
||||
@Ok(">>:/platform/home")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At(value = "/platform/h5", top = true)
|
||||
@Ok("re")
|
||||
@SaCheckLogin
|
||||
public String h5Index() {
|
||||
return "beetl:/platform/zhghh5/sys/home/index.html";
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("电脑端快速入口")
|
||||
@Ok("json")
|
||||
public Result listQuickEntry(String platform) {
|
||||
List<Sys_menu> list = sysMenuService.query(Cnd.where(Sys_menu::getIsQuickEntry, "=", 1)
|
||||
.and(Sys_menu::getDisabled, "=", 0)
|
||||
.and(Sys_menu::getShowit, "=", 1)
|
||||
.and(Sys_menu::getPlatform, "=", platform)
|
||||
);
|
||||
List<Sys_menu> menus = sysUserService.getMenus(SecurityUtil.getUserId());
|
||||
List<String> allMenuIds = menus.stream().map(Sys_menu::getId).toList();
|
||||
List<Sys_menu> sysMenus = list.stream().filter(m -> allMenuIds.contains(m.getId())).sorted(Comparator.comparingInt(Sys_menu::getLocation)).toList();
|
||||
return Result.success(sysMenus);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("首页推送活动")
|
||||
@Ok("json")
|
||||
public Result listHomeActivity() {
|
||||
FieldFilter fieldFilter = FieldFilter.locked(Sys_home_activity.class, "classPath");
|
||||
List<Sys_home_activity> list = Daos.ext(dao, fieldFilter).query(Sys_home_activity.class, Cnd.where("enable", "=", 1).desc("top"));
|
||||
String userId = SecurityUtil.getUserId();
|
||||
List<Sys_home_activity> allowActivityList = new ArrayList<>();
|
||||
// 今天的时间
|
||||
Date today = DateUtil.date();
|
||||
for (Sys_home_activity activity : list) {
|
||||
// 该活动的时间范围
|
||||
Date startDate = activity.getStartDate();
|
||||
Date endDate = activity.getEndDate();
|
||||
// 判断当前时间是否在活动范围内,不在就过滤掉
|
||||
// if (!DateUtil.isIn(today, startDate, endDate)) {
|
||||
// continue;
|
||||
// }
|
||||
Integer allowUserGroupId = activity.getAllowUserGroupId();
|
||||
String allowUserSql = activity.getAllowUserSql();
|
||||
activity.setAllowUserSql(null);
|
||||
if (allowUserGroupId == null && StrUtil.isBlank(allowUserSql)) {
|
||||
allowActivityList.add(activity);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (allowUserGroupId != null) {
|
||||
int count = dao.count(ActivityUserScope.class, Cnd.where("groupId", "=", allowUserGroupId).and("userId", "=", userId));
|
||||
if (count > 0) {
|
||||
allowActivityList.add(activity);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(allowUserSql)) {
|
||||
Sql sql = Sqls.create(allowUserSql).setParam("userId", userId);
|
||||
NutMap nutMap = (NutMap) Daos.query(dao, sql.toString(), Sqls.callback.map());
|
||||
if (Lang.isNotEmpty(nutMap) && StrUtil.isNotBlank(nutMap.getString("userId"))) {
|
||||
allowActivityList.add(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success(allowActivityList);
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// FieldFilter fieldFilter = FieldFilter.locked(Sys_home_activity.class, "allowUserSql|classPath");
|
||||
// List<Sys_home_activity> list = Daos.ext(dao, fieldFilter).query(Sys_home_activity.class, Cnd.where("enable", "=", 1).desc("top"));
|
||||
//
|
||||
// List<Sys_menu> menus = sysUserService.getMenus(SecurityUtil.getUserId());
|
||||
// Set<String> hrefs = menus.stream().map(Sys_menu::getHref).collect(Collectors.toSet());
|
||||
//
|
||||
// List<Sys_home_activity> hasPermisiionList = list.stream().filter(activity -> {
|
||||
// String url = activity.getUrl();
|
||||
// String h5Url = activity.getH5Url();
|
||||
// return hrefs.contains(url) || hrefs.contains(h5Url);
|
||||
// }).toList().stream().toList();
|
||||
// return Result.success(hasPermisiionList);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("待办列表")
|
||||
@Ok("json")
|
||||
public Result listTodo(@Valid PageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
task.id,
|
||||
inst.processInstanceName,
|
||||
inst.processInstanceInitiatorName,
|
||||
inst.processInstanceNodeName,
|
||||
task.formUrl AS taskFormUrl,
|
||||
task.formMobileUrl AS taskFormMobileUrl
|
||||
FROM
|
||||
`bpm_process_task` task
|
||||
INNER JOIN bpm_process_instance inst ON inst.id = task.processInstanceId
|
||||
WHERE
|
||||
JSON_CONTAINS( task.assignments, @loginName )
|
||||
AND task.taskStatus = 'ACTIVE'
|
||||
GROUP BY
|
||||
task.id
|
||||
ORDER BY
|
||||
task.createdOn DESC
|
||||
""");
|
||||
sql.setParam("loginName", "\"" + SecurityUtil.getUserLoginname() + "\"");
|
||||
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("已办列表")
|
||||
@Ok("json")
|
||||
public Result listDone(@Valid PageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
task.id,
|
||||
inst.processInstanceName,
|
||||
inst.processInstanceInitiatorName,
|
||||
inst.processInstanceNodeName,
|
||||
task.formUrl AS taskFormUrl,
|
||||
task.formMobileUrl AS taskFormMobileUrl
|
||||
FROM
|
||||
`bpm_process_task` task
|
||||
INNER JOIN bpm_process_instance inst ON inst.id = task.processInstanceId
|
||||
WHERE
|
||||
JSON_CONTAINS( task.assignments, @loginName )
|
||||
AND task.taskStatus in ('COMPLETE','TRANSFER')
|
||||
GROUP BY
|
||||
task.id
|
||||
ORDER BY
|
||||
task.createdOn DESC
|
||||
""");
|
||||
sql.setParam("loginName", "\"" + SecurityUtil.getUserLoginname() + "\"");
|
||||
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("我的发起")
|
||||
@Ok("json")
|
||||
public Result listMyInitiation(@Valid PageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id,
|
||||
processInstanceName,
|
||||
processInstanceInitiatorName,
|
||||
processInstanceNodeName,
|
||||
processInstanceUrl
|
||||
FROM
|
||||
bpm_process_instance
|
||||
WHERE
|
||||
processInstanceInitiatorLoginName = @loginName
|
||||
ORDER BY processInstanceInitiationTime DESC
|
||||
""");
|
||||
sql.setParam("loginName", SecurityUtil.getUserLoginname());
|
||||
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取新闻")
|
||||
@Ok("json")
|
||||
@CacheDefaults(cacheName = RedisConstant.PLATFORM_REDIS_WKCACHE_PREFIX + "web_news", isHash = true)
|
||||
@CacheResult(cacheKey = "news", ignoreNull = true, cacheLiveTime = 60 * 60 * 24)
|
||||
public Result getNews() {
|
||||
// 定义要爬取的URL
|
||||
String domain = "http://nsdgh.njnu.edu.cn";
|
||||
try {
|
||||
// 使用Jsoup连接到URL并获取页面内容
|
||||
Document document = Jsoup.connect(domain).get();
|
||||
List<NutMap> results = new ArrayList<>();
|
||||
|
||||
// 最新新闻
|
||||
Element newsElement = document.getElementById("news");
|
||||
// 获取所有li元素下的a标签
|
||||
Elements links = newsElement.select("li a");
|
||||
List<NutMap> list = links.stream().map(a -> {
|
||||
NutMap map = new NutMap();
|
||||
map.put("href", domain + "/" + a.attr("href"));
|
||||
map.put("text", a.text());
|
||||
return map;
|
||||
}).toList();
|
||||
results.add(NutMap.NEW().addv("label", "最新新闻").addv("value", list));
|
||||
|
||||
// 通知公告
|
||||
Elements newsSections = document.select("div.news1");
|
||||
for (Element section : newsSections) {
|
||||
String category = section.selectFirst("h6").ownText(); // 获取"通知公告"或"分工会"
|
||||
Elements items = section.select("li a");
|
||||
List<NutMap> list1 = items.stream().map(a -> {
|
||||
NutMap map = new NutMap();
|
||||
map.put("href", domain + "/" + a.attr("href"));
|
||||
map.put("text", a.text());
|
||||
return map;
|
||||
}).toList();
|
||||
results.add(NutMap.NEW().addv("label", category).addv("value", list1));
|
||||
}
|
||||
|
||||
return Result.success(results);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.DateUtil;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.services.SysLogService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/29.
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/sys/log")
|
||||
public class SysLogController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysLogService sysLogService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/log/index.html")
|
||||
@SaCheckPermission("sys.manager.log")
|
||||
public void index(HttpServletRequest req) {
|
||||
req.setAttribute("today", DateUtil.getDate());
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.log")
|
||||
public Object data(@Param("searchDate") String searchDate, @Param("searchType") String searchType, @Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) {
|
||||
try {
|
||||
String[] date = StringUtils.split(searchDate, ",");
|
||||
return Result.success().addData(sysLogService.data(date, searchType, pageOrderName, PageUtil.getOrder(pageOrderBy), pageNumber, pageSize));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
import com.budwk.app.base.enums.LoginType;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.interceptor.sLog.SLogService;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_log;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.web.commons.auth.service.ValidateService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jasig.cas.client.util.AbstractCasFilter;
|
||||
import org.jasig.cas.client.validation.Assertion;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.impl.PropertiesProxy;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Filters;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
||||
@IocBean
|
||||
@At("/platform/login")
|
||||
@Ok("json:{locked:'password|createAt',ignoreNull:true}") // 忽略password和createAt属性,忽略空属性的json输出
|
||||
@Api(tags = "登录")
|
||||
public class SysLoginController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
@Inject
|
||||
private SLogService sLogService;
|
||||
@Inject
|
||||
private ValidateService validateService;
|
||||
@Inject
|
||||
protected PropertiesProxy conf;
|
||||
|
||||
@At("")
|
||||
@Ok("re")
|
||||
@ApiOperation("用户本地登录页面")
|
||||
@Filters
|
||||
public String login(HttpServletRequest req, HttpSession session) {
|
||||
return "beetl:/platform/sys/login.html";
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("re")
|
||||
@Filters
|
||||
public String h5() {
|
||||
return "beetl:/platform/sys/login.html";
|
||||
}
|
||||
|
||||
|
||||
@At("/noPermission")
|
||||
@Ok("beetl:/platform/sys/noPermission.html")
|
||||
@Filters
|
||||
public void noPermission() {
|
||||
|
||||
}
|
||||
|
||||
@At("/doLogin")
|
||||
@Ok("json")
|
||||
@ApiOperation("用户本地账号密码登录")
|
||||
public Object doLogin(@Param("username") String username, @Param("password") String password, @Param("platformKey") String captchaKey, @Param("platformCaptcha") String captchaCode, HttpServletRequest req, HttpServletResponse response, HttpSession session) {
|
||||
if (StrUtil.isBlank(username)) {
|
||||
return Result.error("用户名不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(password)) {
|
||||
return Result.error("密码不能为空");
|
||||
}
|
||||
|
||||
String lockKey = RedisConstant.USER_LOGIN_LOCK_PREFIX + username;
|
||||
int errCount = Convert.toInt(StrUtil.blankToDefault(redisService.get(lockKey), "0"));
|
||||
log.info("用户名:" + username + "登录失败次数:" + errCount);
|
||||
|
||||
if (errCount > 5) {
|
||||
redisService.setex(lockKey, 5 * 60, String.valueOf(errCount + 1));
|
||||
return Result.error("登录失败次数过多,请5分钟后再试");
|
||||
}
|
||||
try {
|
||||
// 验证码校验
|
||||
try {
|
||||
validateService.checkCode(captchaKey, captchaCode);
|
||||
} catch (BaseException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
|
||||
// 用户名密码校验
|
||||
Sys_user user = sysUserService.loginByPassword(username, password);
|
||||
if (user == null) {
|
||||
throw new BaseException("用户登录失败");
|
||||
}
|
||||
|
||||
// 成功登录
|
||||
sysUserService.loginPlus(user, LoginType.PC_LOCAL, req);
|
||||
return Result.success("login.success");
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
redisService.set(lockKey, Convert.toStr(errCount + 1));
|
||||
String message = e.getMessage();
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@At(value = "/platform/sso/login", top = true)
|
||||
@Ok("re")
|
||||
@ApiOperation("用户cas登录统一入口")
|
||||
public String ssoLogin(HttpSession httpSession, HttpServletRequest request, HttpServletResponse response) {
|
||||
Assertion assertion = (Assertion) request.getSession().getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
|
||||
if (null == assertion || assertion.getPrincipal() == null) {
|
||||
return ">>:/platform/home";
|
||||
}
|
||||
String loginName = assertion.getPrincipal().getName();
|
||||
sysUserService.checkThirdPlatformLoginName(loginName);
|
||||
Sys_user sysUser = sysUserService.loginByLoginName(loginName);
|
||||
|
||||
return ">>:" + sysUserService.loginPlus(sysUser, LoginType.CAS, request);
|
||||
}
|
||||
|
||||
@At(value = "/platform/wxwork/oauth2/callback", top = true)
|
||||
@Ok("re")
|
||||
@ApiOperation("企业微信登录回调")
|
||||
public String wxworkOAuth2(@Param("code") String code, @Param("redirect") String redirect, HttpServletRequest request) {
|
||||
if (StrUtil.isBlank(code)) {
|
||||
return ">>:/platform/home";
|
||||
}
|
||||
String token = redisService.get(RedisConstant.REDIS_KEY_WX_WORK_TOKEN);
|
||||
if (StrUtil.isBlank(token)) {
|
||||
return ">>:/platform/home";
|
||||
}
|
||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?access_token=ACCESS_TOKEN&code=CODE";
|
||||
url = url.replace("ACCESS_TOKEN", token).replace("CODE", code);
|
||||
String response = HttpUtil.get(url);
|
||||
JSONObject jsonObject = JSONUtil.parseObj(response);
|
||||
if (jsonObject.getInt("errcode") == 0) {
|
||||
String loginName = jsonObject.getStr("userid");
|
||||
sysUserService.checkThirdPlatformLoginName(loginName);
|
||||
Sys_user sysUser = sysUserService.loginByLoginName(loginName);
|
||||
return ">>:" + sysUserService.loginPlus(sysUser, LoginType.QI_YE_WECHAT, request);
|
||||
} else {
|
||||
return ">>:/platform/home/500";
|
||||
}
|
||||
}
|
||||
|
||||
@At(value = "/platform/wx/oauth2/callback", top = true)
|
||||
@Ok("re")
|
||||
@ApiOperation("微信登录回调")
|
||||
public String wxOauth2(@Param("code") String code, HttpServletRequest request) {
|
||||
if (StrUtil.isBlank(code)) {
|
||||
return ">>:/platform/home";
|
||||
}
|
||||
try {
|
||||
String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
|
||||
url = url.replace("APPID", conf.get("wx.appID")).replace("SECRET", conf.get("wx.appSecret")).replace("CODE", code);
|
||||
String response = HttpUtil.get(url);
|
||||
JSONObject jsonObject = JSONUtil.parseObj(response);
|
||||
String openid = jsonObject.getStr("openid");
|
||||
Sys_user sysUser = sysUserService.fetch(Cnd.where(Sys_user::getWxOpenId, "=", openid));
|
||||
if (sysUser == null) {
|
||||
//没有绑定统一身份认证账号 跳过去绑定
|
||||
String redirect = request.getParameter("redirect");
|
||||
String callBackUrl = conf.get("cas.client-host-url") + conf.get("cas.client-call-back-url") + "?redirect=" + URLEncoder.encode(redirect, StandardCharsets.UTF_8) + "&wxOpenId=" + openid;
|
||||
String authUrl = conf.get("cas.server-login-url") + "?service=" + URLEncoder.encode(callBackUrl, StandardCharsets.UTF_8);
|
||||
return ">>:" + authUrl;
|
||||
} else {
|
||||
//直接登录
|
||||
return ">>:" + sysUserService.loginPlus(sysUser, LoginType.WECHAT, request);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ">>:/platform/home/500";
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("re")
|
||||
@ApiOperation("用户退出系统")
|
||||
public void logout(HttpSession session, HttpServletRequest req, HttpServletResponse response) {
|
||||
try {
|
||||
if (StrUtil.isNotBlank(SecurityUtil.getUserId())) {
|
||||
Sys_user user = sysUserService.getUserById(SecurityUtil.getUserId());
|
||||
StpUtil.logout();
|
||||
if (user != null) {
|
||||
Sys_log sysLog = new Sys_log();
|
||||
sysLog.setType("info");
|
||||
sysLog.setTag("用户登出");
|
||||
sysLog.setSrc(this.getClass().getName() + "#logout");
|
||||
sysLog.setMsg("成功退出系统!");
|
||||
sysLog.setIp(Lang.getIP(req));
|
||||
sysLog.setCreatedBy(user.getId());
|
||||
sysLog.setUsername(user.getUsername());
|
||||
sysLog.setLoginname(user.getLoginname());
|
||||
sLogService.async(sysLog);
|
||||
}
|
||||
}
|
||||
session.invalidate();
|
||||
if (conf.getBoolean("cas.enable", false)) {
|
||||
response.sendRedirect(conf.get("cas.server-url-prefix") + "/logout?service=" + URLEncoder.encode(Globals.AppDomain, StandardCharsets.UTF_8));
|
||||
} else {
|
||||
response.sendRedirect(Globals.AppDomain);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.debug("Logout error", e);
|
||||
}
|
||||
}
|
||||
|
||||
@At("/captcha")
|
||||
@Ok("json")
|
||||
@ApiOperation("获取验证码")
|
||||
public Object next() {
|
||||
return Result.success(validateService.getCaptcha());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,430 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_menu;
|
||||
import com.budwk.app.sys.models.Sys_module;
|
||||
import com.budwk.app.sys.services.SysMenuService;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/menu")
|
||||
public class SysMenuController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysMenuService sysMenuService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/menu/index.html")
|
||||
@SaCheckPermission("sys.manager.menu")
|
||||
public void index(HttpServletRequest req) {
|
||||
}
|
||||
|
||||
|
||||
@At("/child")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object child(@Param("pid") String pid, String menuName, String platform, String moduleId, HttpServletRequest req) {
|
||||
List<Sys_menu> list;
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and(Cnd.exps("parentId", "=", "").or("parentId", "is", null));
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
if (StrUtil.isNotBlank(menuName)) {
|
||||
cnd.and(Cnd.likeEX("`name`", menuName));
|
||||
}
|
||||
cnd.andEX(Sys_menu::getPlatform, "=", platform);
|
||||
cnd.andEX(Sys_menu::getModuleId, "=", moduleId);
|
||||
|
||||
|
||||
cnd.asc("location").asc("path");
|
||||
list = sysMenuService.query(cnd);
|
||||
for (Sys_menu menu : list) {
|
||||
if (sysMenuService.count(Cnd.where("parentId", "=", menu.getId())) > 0) {
|
||||
menu.setHasChildren(true);
|
||||
}
|
||||
NutMap map = Lang.obj2nutmap(menu);
|
||||
map.put("expanded", false);
|
||||
map.put("children", new ArrayList<>());
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
}
|
||||
|
||||
@At("/tree")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object tree(@Param("pid") String pid, @Valid @Param("platform") String platform, HttpServletRequest req) {
|
||||
try {
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
if (Strings.isBlank(pid)) {
|
||||
NutMap root = NutMap.NEW().addv("value", "root").addv("label", "不选择菜单").addv("leaf", true);
|
||||
treeList.add(root);
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and(Cnd.exps("parentId", "=", "").or("parentId", "is", null));
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
cnd.and("type", "=", "menu");
|
||||
cnd.asc("location").asc("path");
|
||||
List<Sys_menu> list = sysMenuService.query(cnd);
|
||||
for (Sys_menu menu : list) {
|
||||
NutMap map = NutMap.NEW().addv("value", menu.getId()).addv("label", menu.getName());
|
||||
if (menu.isHasChildren()) {
|
||||
map.addv("children", new ArrayList<>());
|
||||
map.addv("leaf", false);
|
||||
} else {
|
||||
map.addv("leaf", true);
|
||||
}
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu")
|
||||
public Result fullTree(@Valid String platform) {
|
||||
List<Sys_menu> menus = sysMenuService.query(Cnd.where(Sys_menu::getPlatform, "=", platform)
|
||||
.and(Sys_menu::getType, "=", "menu")
|
||||
.and(Sys_menu::getPlatform, "=", platform)
|
||||
.asc(Sys_menu::getLocation)
|
||||
);
|
||||
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
|
||||
for (int i = 0; i < menus.size(); i++) {
|
||||
nodeList.add(new TreeNode<>(menus.get(i).getId(), menus.get(i).getParentId(), menus.get(i).getName(), i));
|
||||
}
|
||||
List<Tree<String>> treeList = TreeUtil.build(nodeList, "");
|
||||
return Result.success(treeList);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu.add")
|
||||
@SLog(tag = "新建菜单", msg = "菜单名称:${args[1].getAttribute('name')}")
|
||||
public Object addDo(@Param("menu") Sys_menu sysMenu, @Valid String platform, HttpServletRequest req) {
|
||||
try {
|
||||
int num = sysMenuService.count(Cnd.where("permission", "=", sysMenu.getPermission().trim()));
|
||||
if (num > 0) {
|
||||
return Result.error("sys.role.code");
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(sysMenu.getButtons())) {
|
||||
for (Sys_menu button : sysMenu.getButtons()) {
|
||||
int buttonNum = sysMenuService.count(Cnd.where("permission", "=", button.getPermission()));
|
||||
if (buttonNum > 0) {
|
||||
return Result.error("sys.role.code");
|
||||
}
|
||||
}
|
||||
}
|
||||
String parentId = sysMenu.getParentId();
|
||||
if ("root".equals(sysMenu.getParentId())) {
|
||||
parentId = "";
|
||||
}
|
||||
sysMenu.setType("menu");
|
||||
sysMenu.setPlatform(platform);
|
||||
sysMenu.setHasChildren(false);
|
||||
sysMenu.setShowit(true);
|
||||
sysMenu.setDisabled(false);
|
||||
sysMenu.setCreatedBy(SecurityUtil.getUserId());
|
||||
sysMenuService.savePlus(sysMenu, Strings.sNull(parentId), sysMenu.getButtons());
|
||||
// sysMenuService.save(sysMenu, Strings.sNull(parentId), buttons);
|
||||
sysMenuService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
//编辑菜单,组装一下js表单数据
|
||||
@At("/editMenu/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu")
|
||||
public Object editMenu(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_menu menu = sysMenuService.fetch(id);
|
||||
NutMap map = Lang.obj2nutmap(menu);
|
||||
map.put("moduleId", menu.getModuleId());
|
||||
map.put("parentName", "无");
|
||||
map.put("children", "false");
|
||||
if (Strings.isNotBlank(menu.getParentId())) {
|
||||
map.put("parentName", sysMenuService.fetch(menu.getParentId()).getName());
|
||||
//找出所有的父节点id
|
||||
List<String> parentIds = new ArrayList<>();
|
||||
while (Strings.isNotBlank(menu.getParentId())) {
|
||||
menu = sysMenuService.fetch(menu.getParentId());
|
||||
//始终加到第一个 element要求这样
|
||||
parentIds.add(0, menu.getId());
|
||||
}
|
||||
map.put("parentIds", parentIds);
|
||||
}
|
||||
List<Sys_menu> list = sysMenuService.query(Cnd.where("parentId", "=", id).and("type", "=", "data").asc("location").asc("path"));
|
||||
List<NutMap> buttons = new ArrayList<>();
|
||||
if (list != null && list.size() > 0) {
|
||||
map.put("children", "true");
|
||||
for (Sys_menu m : list) {
|
||||
buttons.add(NutMap.NEW().addv("key", m.getId()).addv("id", m.getId()).addv("name", m.getName()).addv("permission", m.getPermission()));
|
||||
}
|
||||
}
|
||||
map.put("buttons", buttons);
|
||||
return Result.success().addData(map);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu.edit")
|
||||
@SLog(tag = "修改菜单")
|
||||
public Object editMenuDo(@Param("menu") Sys_menu sysMenu, @Valid String platform) {
|
||||
try {
|
||||
if (StrUtil.isNotBlank(sysMenu.getParentId()) && sysMenu.getId().equals(sysMenu.getParentId())) {
|
||||
return Result.error("禁止套娃");
|
||||
}
|
||||
|
||||
List<Sys_menu> buttons = sysMenu.getButtons();
|
||||
//如果权限标识不是自己的,并且被其他记录占用
|
||||
int num = sysMenuService.count(Cnd.where(Sys_menu::getPermission, "=", sysMenu.getPermission().trim()).and("id", "<>", sysMenu.getId()));
|
||||
if (num > 0) {
|
||||
return Result.error("sys.role.code");
|
||||
}
|
||||
for (Sys_menu button : buttons) {
|
||||
num = sysMenuService.count(Cnd.where("permission", "=", button.getPermission()).and("id", "<>", StrUtil.blankToDefault(button.getId(), "")));
|
||||
if (num > 0) {
|
||||
return Result.error("sys.role.code");
|
||||
}
|
||||
}
|
||||
sysMenu.setType("menu");
|
||||
sysMenu.setPlatform(platform);
|
||||
sysMenu.setHasChildren(false);
|
||||
sysMenu.setShowit(true);
|
||||
sysMenu.setDisabled(false);
|
||||
sysMenu.setCreatedBy(SecurityUtil.getUserId());
|
||||
|
||||
sysMenuService.editPlus(sysMenu, sysMenu.getParentId(), buttons);
|
||||
sysMenuService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/editData/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu")
|
||||
public Object editData(String id, HttpServletRequest req) {
|
||||
try {
|
||||
return Result.success().addData(sysMenuService.fetch(id));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu.edit")
|
||||
@SLog(tag = "修改权限", msg = "权限名称:${args[0].name}")
|
||||
public Object editDataDo(@Param("..") Sys_menu menu, HttpServletRequest req) {
|
||||
try {
|
||||
int num = sysMenuService.count(Cnd.where("permission", "=", menu.getPermission().trim()).and("id", "<>", menu.getId()));
|
||||
if (num > 0) {
|
||||
return Result.error("sys.role.code");
|
||||
}
|
||||
sysMenuService.updateIgnoreNull(menu);
|
||||
sysMenuService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu.delete")
|
||||
@SLog(tag = "删除菜单", msg = "菜单名称:${args[1].getAttribute('name')}")
|
||||
public Object delete(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_menu menu = sysMenuService.fetch(id);
|
||||
req.setAttribute("name", menu.getName());
|
||||
if (menu.getPath().startsWith("0001")) {
|
||||
return Result.error("system.not.allow");
|
||||
}
|
||||
sysMenuService.deleteAndChild(menu);
|
||||
sysMenuService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/enable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu.edit")
|
||||
@SLog(tag = "启用菜单", msg = "菜单名称:${args[1].getAttribute('name')}")
|
||||
public Object enable(String menuId, HttpServletRequest req) {
|
||||
try {
|
||||
req.setAttribute("name", sysMenuService.fetch(menuId).getName());
|
||||
sysMenuService.update(org.nutz.dao.Chain.make("disabled", false), Cnd.where("id", "=", menuId));
|
||||
sysMenuService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/disable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu.edit")
|
||||
@SLog(tag = "禁用菜单", msg = "菜单名称:${args[1].getAttribute('name')}")
|
||||
public Object disable(String menuId, HttpServletRequest req) {
|
||||
try {
|
||||
req.setAttribute("name", sysMenuService.fetch(menuId).getName());
|
||||
sysMenuService.update(org.nutz.dao.Chain.make("disabled", true), Cnd.where("id", "=", menuId));
|
||||
sysMenuService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/menuAll")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu")
|
||||
public Object menuAll(@Valid String platform, HttpServletRequest req) {
|
||||
try {
|
||||
List<Sys_menu> list = sysMenuService.query(
|
||||
Cnd.where(Sys_menu::getType, "=", "menu")
|
||||
.and(Sys_menu::getPlatform, "=", platform)
|
||||
.asc(Sys_menu::getLocation).asc("path"));
|
||||
NutMap menuMap = NutMap.NEW();
|
||||
for (Sys_menu unit : list) {
|
||||
List<Sys_menu> list1 = menuMap.getList(unit.getParentId(), Sys_menu.class);
|
||||
if (list1 == null) {
|
||||
list1 = new ArrayList<>();
|
||||
}
|
||||
list1.add(unit);
|
||||
menuMap.put(unit.getParentId(), list1);
|
||||
}
|
||||
return Result.success().addData(getTree(menuMap, ""));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
private List<NutMap> getTree(NutMap menuMap, String pid) {
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
List<Sys_menu> subList = menuMap.getList(pid, Sys_menu.class);
|
||||
for (Sys_menu menu : subList) {
|
||||
NutMap map = Lang.obj2nutmap(menu);
|
||||
map.put("label", menu.getName());
|
||||
if (menu.isHasChildren() || (menuMap.get(menu.getId()) != null)) {
|
||||
map.put("children", getTree(menuMap, menu.getId()));
|
||||
}
|
||||
treeList.add(map);
|
||||
}
|
||||
return treeList;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu.edit")
|
||||
public Object sortDo(@Param("ids") String ids, HttpServletRequest req) {
|
||||
try {
|
||||
String[] menuIds = StringUtils.split(ids, ",");
|
||||
int i = 0;
|
||||
sysMenuService.execute(Sqls.create("update sys_menu set location=0"));
|
||||
for (String s : menuIds) {
|
||||
if (!Strings.isBlank(s)) {
|
||||
sysMenuService.update(org.nutz.dao.Chain.make("location", i), Cnd.where("id", "=", s));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
sysMenuService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu")
|
||||
public Result listModule(String platform) {
|
||||
List<Sys_module> list = sysMenuService.dao().query(Sys_module.class, Cnd.where(Sys_module::getPlatform, "=", platform).asc(Sys_module::getSortNum));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu")
|
||||
@ApiOperation("更新快捷入口")
|
||||
public Result updateQuickEntry(@Param("menuIds") String[] menuIds, String platform) {
|
||||
sysMenuService.update(Chain.make("isQuickEntry", 0), Cnd.where("id", "is not", null).and("platform", "=", platform));
|
||||
if (ArrayUtil.isNotEmpty(menuIds)) {
|
||||
sysMenuService.update(Chain.make("isQuickEntry", 1), Cnd.where("id", "in", menuIds).and("platform", "=", platform));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_module;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Api(tags = "系统模块管理")
|
||||
@IocBean
|
||||
@At("/platform/sys/module")
|
||||
@Ok("json:full")
|
||||
public class SysModuleController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/module/index.html")
|
||||
@SaCheckPermission("sys.manager.module")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@SaCheckPermission("sys.manager.module")
|
||||
public Object pageData(@Valid PageForm pageForm, @Valid String platform) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.where().andLike(Sys_module::getName, pageForm.getSearchKeyword());
|
||||
}
|
||||
cnd.and(Sys_module::getPlatform, "=", platform);
|
||||
cnd.asc(Sys_module::getSortNum);
|
||||
Pagination<Sys_module> pagination = baseService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), Sys_module.class, cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.module")
|
||||
public Object insert(Sys_module module) {
|
||||
Integer maxNum = (Integer) dao.func2(Sys_module.class, "max", "sortNum");
|
||||
if (maxNum == null) {
|
||||
maxNum = 0;
|
||||
}
|
||||
module.setSortNum(maxNum + 1);
|
||||
dao.insert(module);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.module")
|
||||
public Object update(Sys_module module) {
|
||||
dao.update(module);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.module")
|
||||
public Object delete(@Valid String id) {
|
||||
dao.delete(Sys_module.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.RepeatSubmit;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.models.Sys_msg;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.services.SysMsgService;
|
||||
import com.budwk.app.sys.services.SysMsgUserService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/msg")
|
||||
@Api(tags = "系统消息")
|
||||
@Slf4j
|
||||
public class SysMsgController {
|
||||
@Inject
|
||||
private SysMsgService sysMsgService;
|
||||
@Inject
|
||||
private SysMsgUserService sysMsgUserService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@At({"/", "/list/?"})
|
||||
@Ok("beetl:/platform/sys/msg/index.html")
|
||||
@SaCheckPermission("sys.manager.msg")
|
||||
public void index(String type, HttpServletRequest req) {
|
||||
req.setAttribute("type", Strings.isBlank(type) ? "all" : type);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.msg")
|
||||
public Object data(@Param("searchType") String searchType, @Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
msg.*,
|
||||
u.username,
|
||||
count( msgu.id ) all_num,
|
||||
sum( CASE WHEN msgu.STATUS = 0 THEN 1 ELSE 0 END ) unread_num
|
||||
FROM
|
||||
sys_msg msg
|
||||
LEFT JOIN sys_user u ON u.id = msg.createdBy
|
||||
LEFT JOIN sys_msg_user msgu ON msgu.msgId = msg.id
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.groupBy("msg.id");
|
||||
if (Strings.isNotBlank(searchType) && !"all".equals(searchType)) {
|
||||
cnd.and("msg.type", "=", searchType);
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
}
|
||||
cnd.and("msg.sendType", "!=", "hide");
|
||||
cnd.desc("msg.sendAt");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysMsgService.listPageMap(pageNumber, pageSize, sql);
|
||||
return Result.success().addData(pagination);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.msg")
|
||||
public Object getRoleList() {
|
||||
List<Sys_role> roles = sysUserService.dao().query(Sys_role.class, Cnd.NEW());
|
||||
return Result.success(roles);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.msg")
|
||||
public Object user_view_data(PageForm pageForm,
|
||||
@Param("type") String type,
|
||||
@Param("unionId") String unionId,
|
||||
@Param("unitId") String unitId,
|
||||
@Param("id") String id) {
|
||||
try {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.mobile,
|
||||
u.email,
|
||||
u.unitid,
|
||||
u.unitname,
|
||||
u.unionname,
|
||||
m.STATUS,
|
||||
m.readat
|
||||
FROM
|
||||
vw_user u, sys_msg_user m
|
||||
$condition
|
||||
""");
|
||||
cnd.and(new Static("u.loginname = m.loginname"));
|
||||
cnd.and("m.msgId", "=", id);
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
cnd.andEX("u.unitId", "=", unitId);
|
||||
if (Strings.isNotBlank(type) && "unread".equals(type)) {
|
||||
cnd.and("m.status", "=", 0);
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.desc("unitId");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(sysMsgService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/addDo")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.msg.add")
|
||||
@SLog(tag = "站内消息", msg = "${args[0].title}")
|
||||
@ApiOperation("发送站内消息")
|
||||
@RepeatSubmit
|
||||
public Object addDo(@Param("msg") @Valid Sys_msg msg, @Param("users") String[] users) {
|
||||
try {
|
||||
if (ObjectUtil.isEmpty(users)) {
|
||||
return Result.error("请选择用户");
|
||||
}
|
||||
|
||||
if (users.length > 100) {
|
||||
return Result.error("单条消息最多发送100人,请分批次发送。");
|
||||
}
|
||||
|
||||
msg.setType("user");
|
||||
if ("user".equalsIgnoreCase(msg.getType()) && ObjectUtil.isEmpty(users)) {
|
||||
return Result.error("请选择用户");
|
||||
}
|
||||
msg.setSendType("show");
|
||||
msg.setSendAt(DateUtil.current());
|
||||
msg.setCreatedBy(SecurityUtil.getUserId());
|
||||
sysMsgService.saveMsg(msg, users,true);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:{locked:'password|salt',ignoreNull:false}")
|
||||
@SaCheckLogin
|
||||
public Object user_data(@Valid PageForm pageForm, String unionId, String unitId, String roleId, String sex) {
|
||||
try {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
select u.id,u.username,u.loginname,u.sex,u.mobile,u.unitname,u.unionname,u.userState,u.personType,u.preparedBy from vw_user u $condition
|
||||
""");
|
||||
cnd.andEX("u.unionId", "=", unionId);
|
||||
cnd.andEX("u.unitId", "=", unitId);
|
||||
cnd.andEX("u.sex", "=", sex);
|
||||
if (StrUtil.isNotBlank(roleId)) {
|
||||
cnd.and(new Static("u.id in (select userId from sys_user_role where roleId = '%s')".formatted(roleId)));
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
if (Strings.isNotBlank(pageForm.getPageOrderName()) && Strings.isNotBlank(pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At({"/delete/?"})
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.msg.delete")
|
||||
@SLog(tag = "站内消息", msg = "站内信标题:${req.getAttribute('title')}")
|
||||
public Object delete(String id, HttpServletRequest req) {
|
||||
try {
|
||||
req.setAttribute("title", sysMsgService.fetch(id).getTitle());
|
||||
sysMsgService.deleteMsg(id);
|
||||
sysMsgUserService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_msg;
|
||||
import com.budwk.app.sys.param.SysMsgSummaryPageForm;
|
||||
import com.budwk.app.sys.services.SysMsgUserSummaryService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/sys/msg/summary")
|
||||
@Api(tags = "消息统计")
|
||||
public class SysMsgSummaryController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private SysMsgUserSummaryService sysMsgUserSummaryService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/msg/summary/index.html")
|
||||
@SaCheckPermission("sys.msg.summary")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.msg.summary")
|
||||
public Result pageData(@Valid PageForm pageForm, String msgId, String unionId, String unitId, Integer readStatus) {
|
||||
if (StrUtil.isBlank(msgId)) {
|
||||
return Result.success(new Pagination<>());
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
mu.*,
|
||||
m.needBack
|
||||
FROM
|
||||
sys_msg_user mu
|
||||
LEFT JOIN sys_msg m ON m.id = mu.msgId
|
||||
$condition
|
||||
""");
|
||||
cnd.and("mu.msgId", "=", msgId);
|
||||
// cnd.and("m.createdBy", "=", SecurityUtil.getUserId());
|
||||
cnd.andEX("mu.unionId", "=", unionId);
|
||||
cnd.andEX("mu.unitId", "=", unitId);
|
||||
cnd.andEX("mu.status", "=", readStatus);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("mu.status").asc("mu.unionId");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.msg.summary")
|
||||
public Result getMsg(String searchType) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StrUtil.isNotBlank(searchType) && !"all".equals(searchType)) {
|
||||
cnd.and("type", "=", searchType);
|
||||
}
|
||||
cnd.and("sendType","!=","hide");
|
||||
List<Sys_msg> sysMsgs = dao.query(Sys_msg.class, cnd);
|
||||
return Result.success(sysMsgs);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("sys.msg.summary")
|
||||
@ApiOperation("导出反馈附件压缩包")
|
||||
public void exportMultipleAsZip(@Valid SysMsgSummaryPageForm pageForm, HttpServletResponse response) {
|
||||
sysMsgUserSummaryService.exportMultipleAsZip(pageForm, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaMode;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_msg_user;
|
||||
import com.budwk.app.sys.services.SysMsgService;
|
||||
import com.budwk.app.sys.services.SysMsgUserService;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.Times;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/msg/user")
|
||||
public class SysMsgUserController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysMsgUserService sysMsgUserService;
|
||||
@Inject
|
||||
private SysMsgService sysMsgService;
|
||||
|
||||
@At("/all")
|
||||
@Ok("beetl:/platform/sys/msg/user/indexAll.html")
|
||||
@SaCheckPermission("sys.msg.all")
|
||||
public void index(@Param("type") String type, HttpServletRequest req) {
|
||||
req.setAttribute("type", Strings.isBlank(type) ? "all" : type);
|
||||
}
|
||||
|
||||
@At("/read")
|
||||
@Ok("beetl:/platform/sys/msg/user/indexRead.html")
|
||||
@SaCheckPermission("sys.msg.read")
|
||||
@ApiOperation("已读消息页面")
|
||||
public void read(@Param("type") String type, HttpServletRequest req) {
|
||||
req.setAttribute("type", Strings.isBlank(type) ? "all" : type);
|
||||
|
||||
}
|
||||
|
||||
@At("/unread")
|
||||
@Ok("beetl:/platform/sys/msg/user/indexUnread.html")
|
||||
@SaCheckPermission("sys.msg.unread")
|
||||
@ApiOperation("未读消息页面")
|
||||
public void unread(@Param("type") String type, HttpServletRequest req) {
|
||||
req.setAttribute("type", Strings.isBlank(type) ? "all" : type);
|
||||
}
|
||||
|
||||
@At("/data/?")
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
public Object data(String status, @Param("searchType") String type, PageForm pageForm) {
|
||||
try {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(status) && "read".equals(status)) {
|
||||
cnd.and("a.status", "in", List.of(1, 2));
|
||||
}
|
||||
if (Strings.isNotBlank(status) && "unread".equals(status)) {
|
||||
cnd.and("a.status", "=", 0);
|
||||
}
|
||||
cnd.and("a.loginname", "=", SecurityUtil.getUserLoginname());
|
||||
cnd.and("a.delFlag", "=", false);
|
||||
cnd.desc("a.createdAt");
|
||||
if (Strings.isNotBlank(type) && !"all".equals(type)) {
|
||||
cnd.and("b.type", "=", type);
|
||||
}
|
||||
if (!AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name())) {
|
||||
cnd.and("a.loginname", "=", SecurityUtil.getUserLoginname());
|
||||
}
|
||||
Sql sql = Sqls.create("SELECT b.needBack,b.type,b.title,b.note,b.url,b.sendAt,a.* FROM sys_msg b LEFT JOIN sys_msg_user a ON b.id=a.msgid $condition");
|
||||
sql.setCondition(cnd);
|
||||
Sql sqlCount = Sqls.create("SELECT count(*) FROM sys_msg b LEFT JOIN sys_msg_user a ON b.id=a.msgid $condition");
|
||||
sqlCount.setCondition(cnd);
|
||||
return Result.success().addData(sysMsgService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql, sqlCount));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At({"/delete/?", "/delete"})
|
||||
@Ok("json")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
@SLog(tag = "站内消息", msg = "${req.getAttribute('id')}")
|
||||
public Object delete(String id, @Param("ids") String[] ids, HttpServletRequest req) {
|
||||
try {
|
||||
if (ids != null && ids.length > 0) {
|
||||
sysMsgUserService.update(Chain.make("delFlag", true)
|
||||
.add("updatedAt", System.currentTimeMillis())
|
||||
.add("updatedBy", SecurityUtil.getUserId()), Cnd.where("id", "in", ids).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
req.setAttribute("id", Arrays.toString(ids));
|
||||
} else {
|
||||
sysMsgUserService.update(Chain.make("delFlag", true)
|
||||
.add("updatedAt", System.currentTimeMillis())
|
||||
.add("updatedBy", SecurityUtil.getUserId()), Cnd.where("id", "=", id).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
req.setAttribute("id", id);
|
||||
}
|
||||
sysMsgUserService.deleteCache(SecurityUtil.getUserLoginname());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
@ApiOperation("未读消息数")
|
||||
public Object unread_num() {
|
||||
try {
|
||||
int num = sysMsgUserService.getUnreadNum(SecurityUtil.getUserLoginname());
|
||||
return Result.success().addData(num);
|
||||
// NutMap nutMap = NutMap.NEW();
|
||||
// nutMap.put("system", sysMsgUserService.count(Sqls.create("SELECT count(*) from sys_msg a,sys_msg_user b WHERE a.id=b.msgId AND a.type='system' AND a.delFlag=false AND b.status=0 AND b.delFlag=false AND b.loginname=@loginname").setParam("loginname", SecurityUtil.getUserLoginname())));
|
||||
// nutMap.put("user", sysMsgUserService.count(Sqls.create("SELECT count(*) from sys_msg a,sys_msg_user b WHERE a.id=b.msgId AND a.type='user' AND a.delFlag=false AND b.status=0 AND b.delFlag=false AND b.loginname=@loginname").setParam("loginname", SecurityUtil.getUserLoginname())));
|
||||
// return Result.success().addData(nutMap);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/status/read")
|
||||
@Ok("json")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
@SLog(tag = "站内消息", msg = "${req.getAttribute('id')}")
|
||||
public Object read(@Param("ids") String[] ids, HttpServletRequest req) {
|
||||
try {
|
||||
sysMsgUserService.update(Chain.make("status", 1).add("readAt", Times.getTS())
|
||||
.add("createdAt", System.currentTimeMillis())
|
||||
.add("createdBy", SecurityUtil.getUserId()), Cnd.where("id", "in", ids).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
sysMsgUserService.deleteCache(SecurityUtil.getUserLoginname());
|
||||
req.setAttribute("id", Arrays.toString(ids));
|
||||
return Result.success("system.success");
|
||||
} catch (Exception e) {
|
||||
return Result.error("system.error");
|
||||
}
|
||||
}
|
||||
|
||||
@At("/status/readAll")
|
||||
@Ok("json")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
@SLog(tag = "站内消息", msg = "readAll")
|
||||
public Object readAll(HttpServletRequest req) {
|
||||
try {
|
||||
sysMsgUserService.update(Chain.make("status", 1).add("readAt", Times.getTS())
|
||||
.add("createdAt", System.currentTimeMillis()).add("createdBy", SecurityUtil.getUserId()), Cnd.where("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
sysMsgUserService.deleteCache(SecurityUtil.getUserLoginname());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/findOne")
|
||||
@Ok("json")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
public Result findOne(String id) {
|
||||
if (StrUtil.isBlank(id)) {
|
||||
return Result.error("参数为空");
|
||||
}
|
||||
Sys_msg_user msgUser = sysMsgUserService.fetch(Cnd.where("msgid", "=", id).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
if (msgUser != null) {
|
||||
if (msgUser.getStatus() != 2) {
|
||||
sysMsgUserService.update(Chain.make("status", 1), Cnd.where("msgid", "=", id).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
}
|
||||
sysMsgUserService.deleteCache(SecurityUtil.getUserLoginname());
|
||||
// sysMsgService.getMsg(SecurityUtil.getUserLoginname());
|
||||
return Result.success(sysMsgService.fetch(id));
|
||||
} else {
|
||||
return Result.error("暂无消息可查看");
|
||||
}
|
||||
}
|
||||
|
||||
@At("/backDo")
|
||||
@Ok("json")
|
||||
@ApiOperation("反馈附件")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
public Result backDo(@Valid String id, String backText, String files) {
|
||||
List<JSONObject> fileList = StrUtil.isNotBlank(files) ? Json.fromJsonAsList(JSONObject.class, files) : List.of();
|
||||
sysMsgUserService.update(
|
||||
Chain.make("backFiles", fileList)
|
||||
.add("backText", backText)
|
||||
.add("status", 2), Cnd.where("id", "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At("/all/detail/?")
|
||||
@Ok("beetl:/platform/sys/msg/user/detailAll.html")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
public void allDetail(String id, HttpServletRequest req) {
|
||||
if (!Strings.isBlank(id)) {
|
||||
//判断用户是否是正常获取消息
|
||||
int num = sysMsgUserService.count(Cnd.where("msgid", "=", id).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
if (num > 0) {
|
||||
req.setAttribute("obj", sysMsgService.fetch(id));
|
||||
sysMsgUserService.update(Chain.make("status", 1), Cnd.where("msgid", "=", id).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
sysMsgUserService.deleteCache(SecurityUtil.getUserLoginname());
|
||||
} else {
|
||||
req.setAttribute("obj", null);
|
||||
}
|
||||
} else {
|
||||
req.setAttribute("obj", null);
|
||||
}
|
||||
}
|
||||
|
||||
@At("/read/detail/?")
|
||||
@Ok("beetl:/platform/sys/msg/user/detailRead.html")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
public void readDetail(String id, HttpServletRequest req) {
|
||||
if (!Strings.isBlank(id)) {
|
||||
//判断用户是否是正常获取消息
|
||||
int num = sysMsgUserService.count(Cnd.where("msgid", "=", id).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
if (num > 0) {
|
||||
req.setAttribute("obj", sysMsgService.fetch(id));
|
||||
sysMsgUserService.update(Chain.make("status", 1), Cnd.where("msgid", "=", id).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
sysMsgUserService.deleteCache(SecurityUtil.getUserLoginname());
|
||||
} else {
|
||||
req.setAttribute("obj", null);
|
||||
}
|
||||
} else {
|
||||
req.setAttribute("obj", null);
|
||||
}
|
||||
}
|
||||
|
||||
@At("/unread/detail/?")
|
||||
@Ok("beetl:/platform/sys/msg/user/detailUnread.html")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
public void unreadDetail(String id, HttpServletRequest req) {
|
||||
if (!Strings.isBlank(id)) {
|
||||
//判断用户是否是正常获取消息
|
||||
int num = sysMsgUserService.count(Cnd.where("msgid", "=", id).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
if (num > 0) {
|
||||
req.setAttribute("obj", sysMsgService.fetch(id));
|
||||
sysMsgUserService.update(Chain.make("status", 1), Cnd.where("msgid", "=", id).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
sysMsgUserService.deleteCache(SecurityUtil.getUserLoginname());
|
||||
} else {
|
||||
req.setAttribute("obj", null);
|
||||
}
|
||||
} else {
|
||||
req.setAttribute("obj", null);
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission(value = {"sys.msg.all", "sys.msg.read", "sys.msg.unread"}, mode = SaMode.OR)
|
||||
@ApiOperation("读取消息")
|
||||
public Result readMsg(@Valid String msgId) {
|
||||
sysMsgUserService.update(Chain.make("status", 1), Cnd.where("msgId", "=", msgId).and("loginname", "=", SecurityUtil.getUserLoginname()));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_office_template;
|
||||
import com.budwk.app.sys.services.SysOfficeTemplateService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.boot.starter.ftp.FtpService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* office模板
|
||||
*
|
||||
* @author jug
|
||||
* @date 2023/07/07
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/sys/officeTemplate")
|
||||
@Ok("json:full")
|
||||
@Slf4j
|
||||
public class SysOfficeTemplateController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private FtpService ftpService;
|
||||
@Inject
|
||||
private BaseService baseService;
|
||||
@Inject
|
||||
private SysOfficeTemplateService sysOfficeTemplateService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/officeTemplate/index.html")
|
||||
@SaCheckPermission("sys.manager.officeTemplate")
|
||||
public void index(HttpServletRequest req) {
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.officeTemplate")
|
||||
public Object pageData(PageForm pageForm,
|
||||
String templateName,
|
||||
String templateCode) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(Cnd.likeEX("templateCode", templateCode));
|
||||
Pagination pagination = sysOfficeTemplateService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.officeTemplate")
|
||||
public Object save(@Param("officeTemplate") Sys_office_template sysOfficeTemplate) {
|
||||
if (StrUtil.isBlank(sysOfficeTemplate.getId())) {
|
||||
int count = dao.count(Sys_office_template.class, Cnd.where("templateCode", "=", sysOfficeTemplate.getTemplateCode()));
|
||||
if (count > 0) {
|
||||
return Result.error("模板代码已存在!");
|
||||
}
|
||||
}
|
||||
dao.insertOrUpdate(sysOfficeTemplate);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.officeTemplate")
|
||||
public Object delete(@Valid String id) {
|
||||
// Sys_file sysFile = dao.fetch(Sys_file.class, Cnd.where("filepath", "=", sysOfficeTemplate.getTemplatePath()));
|
||||
// if (Lang.isNotEmpty(sysFile)) {
|
||||
// boolean delete = ftpService.delete(sysFile.getFilepath());
|
||||
// if (!delete) {
|
||||
// log.error("模板管理:文件删除失败,记录id:{}", sysOfficeTemplate.getId());
|
||||
// throw new BaseException("模板管理:文件删除失败");
|
||||
// }
|
||||
// }
|
||||
dao.delete(Sys_office_template.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/quickEntry")
|
||||
@Slf4j
|
||||
@Ok("json:full")
|
||||
@Api(tags = "系统首页快速入口管理")
|
||||
public class SysQuickEntryController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/quickEntry/index.html")
|
||||
@SaCheckPermission("sys.manager.quickEntry")
|
||||
public void index() {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,493 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.models.Sys_menu;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.models.Sys_unit;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.services.SysMenuService;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.sys.services.SysUnitService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/28.
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/sys/role")
|
||||
public class SysRoleController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private SysMenuService sysMenuService;
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/role/index.html")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At("/tree")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object tree(@Param("pid") String pid, HttpServletRequest req) {
|
||||
try {
|
||||
List<Sys_unit> list = new ArrayList<>();
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
if (Strings.isBlank(pid)) {
|
||||
NutMap root = NutMap.NEW().addv("value", "root").addv("label", "不选择单位");
|
||||
treeList.add(root);
|
||||
|
||||
}
|
||||
if (StpUtil.hasRole("SYSADMIN")) {
|
||||
if (Strings.isBlank(pid)) {
|
||||
NutMap sys = NutMap.NEW().addv("value", "system").addv("label", "系统角色");
|
||||
treeList.add(sys);
|
||||
}
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and("parentId", "=", "").or("parentId", "is", null);
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
cnd.asc("location").asc("path");
|
||||
list = sysUnitService.query(cnd);
|
||||
} else {
|
||||
Sys_user user = sysUserService.getUserById(SecurityUtil.getUserId());
|
||||
if (user != null && Strings.isBlank(pid)) {
|
||||
list = sysUnitService.query(Cnd.where("id", "=", user.getUnitId()).asc("path"));
|
||||
} else {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and("parentId", "=", "").or("parentId", "is", null);
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
cnd.asc("location").asc("path");
|
||||
list = sysUnitService.query(cnd);
|
||||
}
|
||||
}
|
||||
for (Sys_unit unit : list) {
|
||||
NutMap map = NutMap.NEW().addv("value", unit.getId()).addv("label", unit.getName());
|
||||
if (unit.isHasChildren()) {
|
||||
map.addv("children", new ArrayList<>());
|
||||
}
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
public Object pageData(@Param("searchUnit") String searchUnit,
|
||||
@Param("searchName") String searchName,
|
||||
@Param("searchKeyword") String searchKeyword,
|
||||
@Param("searchName2") String searchName2,
|
||||
@Param("searchKeyword2") String searchKeyword2,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize,
|
||||
@Param("pageOrderName") String pageOrderName,
|
||||
@Param("pageOrderBy") String pageOrderBy) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
role.*
|
||||
FROM
|
||||
sys_role role
|
||||
LEFT JOIN sys_user_role ur ON role.id = ur.roleId
|
||||
LEFT JOIN sys_user u ON u.id = ur.userId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (StpUtil.hasRole("SYSADMIN")) {
|
||||
if ("system".equals(searchUnit)) {
|
||||
cnd.and("u.unitId", "=", "");
|
||||
} else if (Strings.isNotBlank(searchUnit)) {
|
||||
cnd.and("u.unitId", "=", searchUnit);
|
||||
}
|
||||
} else {
|
||||
Sys_user user = sysUserService.getUserById(SecurityUtil.getUserId());
|
||||
if (Strings.isNotBlank(searchUnit)) {
|
||||
Sys_unit unit = sysUnitService.fetch(searchUnit);
|
||||
if (unit == null || !unit.getPath().startsWith(user.getUnit().getPath())) {
|
||||
//防止有人越级访问
|
||||
return Result.error("非法操作");
|
||||
} else
|
||||
cnd.and("u.unitId", "=", searchUnit);
|
||||
} else {
|
||||
cnd.and("u.unitId", "=", user.getUnitId());
|
||||
}
|
||||
}
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.and("role." + searchName, "like", "%" + searchKeyword + "%");
|
||||
}
|
||||
if (StrUtil.isAllNotBlank(searchName2, searchKeyword2)) {
|
||||
cnd.and("u." + searchName2, "like", "%" + searchKeyword2 + "%");
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
} else {
|
||||
cnd.asc("role.sort");
|
||||
}
|
||||
cnd.groupBy("role.id");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(sysRoleService.listPageMap(pageNumber, pageSize, sql));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/enable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role.edit")
|
||||
@SLog(tag = "启用角色", msg = "角色名称:${args[1].getAttribute('name')}")
|
||||
public Object enable(String roleId, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_role role = sysRoleService.fetch(roleId);
|
||||
sysRoleService.update(org.nutz.dao.Chain.make("disabled", false), Cnd.where("id", "=", roleId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
req.setAttribute("name", role.getName());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/disable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role.edit")
|
||||
@SLog(tag = "禁用角色", msg = "角色名称:${args[1].getAttribute('name')}")
|
||||
public Object disable(String roleId, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_role role = sysRoleService.fetch(roleId);
|
||||
sysRoleService.update(org.nutz.dao.Chain.make("disabled", true), Cnd.where("id", "=", roleId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
req.setAttribute("name", role.getName());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
//加载当前用户所拥有的所有权限菜单
|
||||
@At("/menuAll")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
public Object menuAll(HttpServletRequest req) {
|
||||
try {
|
||||
List<Sys_menu> list;
|
||||
if (StpUtil.hasRole("SYSADMIN")) {
|
||||
list = sysMenuService.query(Cnd.orderBy().asc("location").asc("path"));
|
||||
} else {
|
||||
list = sysUserService.getMenusAndButtons(SecurityUtil.getUserId());
|
||||
}
|
||||
NutMap menuMap = NutMap.NEW();
|
||||
for (Sys_menu unit : list) {
|
||||
List<Sys_menu> list1 = menuMap.getList(unit.getParentId(), Sys_menu.class);
|
||||
if (list1 == null) {
|
||||
list1 = new ArrayList<>();
|
||||
}
|
||||
list1.add(unit);
|
||||
menuMap.put(unit.getParentId(), list1);
|
||||
}
|
||||
return Result.success().addData(getTree(menuMap, ""));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
//加载可分配的权限菜单
|
||||
@At("/menuRole/?/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
public Object menuRole(@Valid String roleId, @Valid String platform, HttpServletRequest req) {
|
||||
try {
|
||||
List<Sys_menu> hasList = sysRoleService.getMenusAndButtons(roleId, platform);
|
||||
List<Sys_menu> list;
|
||||
if (StpUtil.hasRole("SYSADMIN")) {
|
||||
list = sysMenuService.query(Cnd.where(Sys_menu::getPlatform, "=", platform).asc("location").asc("path"));
|
||||
} else {
|
||||
list = sysUserService.getMenusAndButtons(SecurityUtil.getUserId());
|
||||
}
|
||||
NutMap menuMap = NutMap.NEW();
|
||||
for (Sys_menu unit : list) {
|
||||
List<Sys_menu> list1 = menuMap.getList(unit.getParentId(), Sys_menu.class);
|
||||
if (list1 == null) {
|
||||
list1 = new ArrayList<>();
|
||||
}
|
||||
list1.add(unit);
|
||||
menuMap.put(unit.getParentId(), list1);
|
||||
}
|
||||
List<String> cmenu = new ArrayList<>();
|
||||
for (Sys_menu menu : hasList) {
|
||||
cmenu.add(menu.getId());
|
||||
}
|
||||
return Result.success().addData(NutMap.NEW().addv("menu", getTree(menuMap, "")).addv("cmenu", cmenu));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
private List<NutMap> getTree(NutMap menuMap, String pid) {
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
List<Sys_menu> subList = menuMap.getList(pid, Sys_menu.class);
|
||||
for (Sys_menu menu : subList) {
|
||||
NutMap map = Lang.obj2nutmap(menu);
|
||||
map.put("label", menu.getName());
|
||||
if (menu.isHasChildren() || (menuMap.get(menu.getId()) != null)) {
|
||||
map.put("children", getTree(menuMap, menu.getId()));
|
||||
}
|
||||
treeList.add(map);
|
||||
}
|
||||
return treeList;
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role.add")
|
||||
@SLog(tag = "添加角色", msg = "角色名称:${args[1].name}")
|
||||
public Object addDo(@Param("..") Sys_role role, HttpServletRequest req) {
|
||||
try {
|
||||
int num = sysRoleService.count(Cnd.where("code", "=", role.getCode().trim()));
|
||||
if (num > 0) {
|
||||
return Result.error("角色编码已存在");
|
||||
}
|
||||
role.setCreatedBy(SecurityUtil.getUserId());
|
||||
sysRoleService.insert(role);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
//查看角色拥有的权限
|
||||
@At("/menu/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
public Object menu(String id, @Param("pid") String pid) {
|
||||
try {
|
||||
List<Sys_menu> list = sysRoleService.getRoleMenus(id, pid);
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
for (Sys_menu unit : list) {
|
||||
if (!unit.isHasChildren() && sysRoleService.hasChildren(id, unit.getId())) {
|
||||
unit.setHasChildren(true);
|
||||
}
|
||||
NutMap map = Lang.obj2nutmap(unit);
|
||||
map.addv("expanded", false);
|
||||
map.addv("children", new ArrayList<>());
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role.delete")
|
||||
@SLog(tag = "删除角色", msg = "角色名称:${args[1].getAttribute('name')}")
|
||||
public Object delete(String roleId, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_role role = sysRoleService.fetch(roleId);
|
||||
if ("SYSADMIN".equals(role.getCode()) || "PUBLIC".equals(role.getCode())) {
|
||||
return Result.error("system.not.allow");
|
||||
}
|
||||
sysRoleService.del(roleId);
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
req.setAttribute("name", role.getName());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/edit/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
public Object edit(String roleId, HttpServletRequest req) {
|
||||
try {
|
||||
return Result.success().addData(sysRoleService.fetch(roleId));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
//修改角色
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role.edit")
|
||||
@SLog(tag = "修改角色", msg = "角色名称:${args[0].name}")
|
||||
public Object editDo(@Param("..") Sys_role role, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_role oldRole = sysRoleService.fetch(role.getId());
|
||||
if (oldRole != null && !Strings.sBlank(oldRole.getCode()).equalsIgnoreCase(role.getCode())) {
|
||||
int num = sysRoleService.count(Cnd.where("code", "=", role.getCode().trim()));
|
||||
if (num > 0) {
|
||||
return Result.error("sys.role.code");
|
||||
}
|
||||
}
|
||||
role.setUpdatedBy(SecurityUtil.getUserId());
|
||||
sysRoleService.updateIgnoreNull(role);
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role.menu")
|
||||
@SLog(tag = "分配角色菜单", msg = "角色名称:${args[3].getAttribute('name')}")
|
||||
public Object menuDo(@Param("menuIds") String menuIds, @Param("platform") String platform, @Param("roleId") String roleId, HttpServletRequest req) {
|
||||
try {
|
||||
String[] ids = StringUtils.split(menuIds, ",");
|
||||
sysRoleService.saveMenu(ids, roleId, platform);
|
||||
Sys_role role = sysRoleService.fetch(roleId);
|
||||
req.setAttribute("name", role.getName());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
public Object user(@Param("roleId") String roleId, @Param("searchName") String searchName, @Param("searchKeyword") String searchKeyword,
|
||||
@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) {
|
||||
try {
|
||||
Sql sql = Sqls.create("SELECT a.*,c.name as unitname FROM sys_user a,sys_user_role b,sys_unit c WHERE a.unitid=c.id and a.id=b.userId and b.roleId=@roleId $s $o");
|
||||
sql.params().set("roleId", roleId);
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
sql.vars().set("s", " and a." + searchName + " like '%" + searchKeyword + "%'");
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
sql.vars().set("o", " order by a." + pageOrderName + " " + PageUtil.getOrder(pageOrderBy));
|
||||
|
||||
}
|
||||
return Result.success().addData(sysUserService.listPage(pageNumber, pageSize, sql));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
public Object userSearch(@Param("query") String keyword, @Param("roleId") String roleId) {
|
||||
try {
|
||||
Sys_user user = sysUserService.getUserById(SecurityUtil.getUserId());
|
||||
return Result.success().addData(sysRoleService.userSearch(roleId, keyword, StpUtil.hasRole("SYSADMIN"), user.getUnit()));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role.user")
|
||||
@SLog(tag = "添加用户到角色", msg = "角色名称:${args[2].getAttribute('name')},用户ID:${args[0]}")
|
||||
public Object usersAdd(@Param("users") String users, @Param("roleId") String roleId, HttpServletRequest req) {
|
||||
try {
|
||||
String[] ids = StringUtils.split(users, ",");
|
||||
for (String s : ids) {
|
||||
sysRoleService.insert("sys_user_role", org.nutz.dao.Chain.make("roleId", roleId).add("userId", s));
|
||||
}
|
||||
Sys_role role = sysRoleService.fetch(roleId);
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
req.setAttribute("name", role.getName());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role.user")
|
||||
@SLog(tag = "从角色中移除用户", msg = "角色名称:${args[2].getAttribute('name')},用户ID:${args[0]}")
|
||||
public Object usersDel(@Param("users") String users, @Param("roleId") String roleId, HttpServletRequest req) {
|
||||
try {
|
||||
String superadminId = sysUserService.fetch(Cnd.where("loginname", "=", "superadmin")).getId();
|
||||
String sysadminRoleid = sysRoleService.fetch(Cnd.where("code", "=", "SYSADMIN")).getId();
|
||||
String[] ids = StringUtils.split(users, ",");
|
||||
if (Lang.contains(ids, superadminId) && roleId.equals(sysadminRoleid)) {
|
||||
return Result.error("超级管理员不能从[系统管理员]角色里删除");
|
||||
}
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("userId", "in", ids).and("roleId", "=", roleId));
|
||||
Sys_role role = sysRoleService.fetch(roleId);
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
req.setAttribute("name", role.getName());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
@ApiOperation("排序数据")
|
||||
public Result sortData() {
|
||||
List<Sys_role> list = sysRoleService.query(Cnd.NEW().asc("sort"));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.role")
|
||||
@ApiOperation("排序")
|
||||
public Result doSort(@Param("roles") Sys_role[] roles) {
|
||||
for (int i = 0; i < roles.length; i++) {
|
||||
roles[i].setSort(i + 1);
|
||||
}
|
||||
sysRoleService.dao().update(roles, "sort");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.models.Sys_route;
|
||||
import com.budwk.app.sys.services.SysRouteService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.integration.jedis.pubsub.PubSubService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/route")
|
||||
public class SysRouteController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysRouteService routeService;
|
||||
@Inject
|
||||
private PubSubService pubSubService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/route/index.html")
|
||||
@SaCheckPermission("sys.manager.route")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.route")
|
||||
public Object data(@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) {
|
||||
try {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
}
|
||||
return Result.success().addData(routeService.listPage(pageNumber, pageSize, cnd));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SLog(tag = "新建路由", msg = "URL:${args[0].url}")
|
||||
@SaCheckPermission("sys.manager.route.add")
|
||||
public Object addDo(@Param("..") Sys_route route, HttpServletRequest req) {
|
||||
try {
|
||||
route.setCreatedBy(SecurityUtil.getUserId());
|
||||
routeService.insert(route);
|
||||
pubSubService.fire(RedisConstant.PLATFORM_REDIS_PREFIX + "web:platform", "sys_route");
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/edit/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.route")
|
||||
public Object edit(String id) {
|
||||
try {
|
||||
return Result.success().addData(routeService.fetch(id));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SLog(tag = "修改路由", msg = "URL:${args[0].url}")
|
||||
@SaCheckPermission("sys.manager.route.edit")
|
||||
public Object editDo(@Param("..") Sys_route route, HttpServletRequest req) {
|
||||
try {
|
||||
route.setUpdatedBy(SecurityUtil.getUserId());
|
||||
routeService.updateIgnoreNull(route);
|
||||
pubSubService.fire(RedisConstant.PLATFORM_REDIS_PREFIX + "web:platform", "sys_route");
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json")
|
||||
@SLog(tag = "删除路由", msg = "路由ID:${args[0]}")
|
||||
@SaCheckPermission("sys.manager.route.delete")
|
||||
public Object delete(String id, HttpServletRequest req) {
|
||||
try {
|
||||
routeService.delete(id);
|
||||
pubSubService.fire(RedisConstant.PLATFORM_REDIS_PREFIX + "web:platform", "sys_route");
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/enable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.route.edit")
|
||||
@SLog(tag = "启用路由", msg = "URL:${args[1].getAttribute('url')}")
|
||||
public Object enable(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_route route = routeService.fetch(id);
|
||||
req.setAttribute("url", route.getUrl());
|
||||
routeService.update(Chain.make("disabled", false), Cnd.where("id", "=", id));
|
||||
pubSubService.fire(RedisConstant.PLATFORM_REDIS_PREFIX + "web:platform", "sys_route");
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/disable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.route.edit")
|
||||
@SLog(tag = "禁用路由", msg = "URL:${args[1].getAttribute('name')}")
|
||||
public Object disable(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_route route = routeService.fetch(id);
|
||||
req.setAttribute("url", route.getUrl());
|
||||
routeService.update(Chain.make("disabled", true), Cnd.where("id", "=", id));
|
||||
pubSubService.fire(RedisConstant.PLATFORM_REDIS_PREFIX + "web:platform", "sys_route");
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.enums.SysFileEngineTypeEnum;
|
||||
import com.budwk.app.sys.models.Sys_user_signature;
|
||||
import com.budwk.app.sys.services.SysFileService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.commons.ext.websocket.WkWebSocketUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.integration.jedis.pubsub.PubSubService;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
import org.nutz.mvc.upload.UploadAdaptor;
|
||||
import redis.clients.jedis.ScanParams;
|
||||
import redis.clients.jedis.ScanResult;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/signature")
|
||||
@Ok("json")
|
||||
@Slf4j
|
||||
@Api("签字")
|
||||
public class SysSignatureController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private RedisService redisService;
|
||||
@Inject
|
||||
private SysFileService sysFileService;
|
||||
@Inject
|
||||
private PubSubService pubSubService;
|
||||
@Inject
|
||||
private WkWebSocketUtil wkWebSocketUtil;
|
||||
|
||||
@At
|
||||
@Ok("re")
|
||||
@Filters
|
||||
@SaCheckLogin
|
||||
@ApiOperation("手机扫描电脑端二维码签字页面")
|
||||
public String scanPcCode() {
|
||||
return "beetl:/platform/sys/signature.html";
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Ok("beetl:/platform/zhghh5/sys/signature/index.html")
|
||||
@ApiOperation("电脑端我的签名管理")
|
||||
public void pc() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@Ok("beetl:/platform/zhghh5/sys/signature/index.html")
|
||||
@ApiOperation("手机端我的签名管理")
|
||||
public void h5() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("手机扫描电脑端二维码签字-保存签字信息")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Result saveSignature(@Valid String id, @Param("file") TempFile tempFile) {
|
||||
if (ObjectUtil.isEmpty(tempFile)) {
|
||||
return Result.error("保存错误,请联系管理员");
|
||||
}
|
||||
String url = sysFileService.uploadReturnUrl(SysFileEngineTypeEnum.MINIO.getValue(), tempFile);
|
||||
redisService.setex(RedisConstant.SIGNATURE_PREFIX + SecurityUtil.getUserId() + ":" + id, 60 * 10, url);
|
||||
|
||||
ScanParams match = new ScanParams().match(RedisConstant.REDIS_KEY_WSROOM + SecurityUtil.getUserLoginname() + ":*");
|
||||
ScanResult<String> scan = null;
|
||||
do {
|
||||
scan = redisService.scan(scan == null ? ScanParams.SCAN_POINTER_START : scan.getStringCursor(), match);
|
||||
for (String key : scan.getResult()) {
|
||||
NutMap data = NutMap.NEW().addv("action", "h5-scan-code-signature").addv("value", url).addv("id", id);
|
||||
pubSubService.fire(key, Json.toJson(data));
|
||||
}
|
||||
} while (!scan.isCompleteIteration());
|
||||
// wkWebSocketUtil.fire(SecurityUtil.getUserLoginname(),Json.toJson(NutMap.NEW().addv("action","h5-scan-code-signature").addv("value", url).addv("id", id)));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("手机扫描电脑端二维码签字-电脑端获取签字信息")
|
||||
public Result getSignature(@Valid String id) {
|
||||
String signature = redisService.get(RedisConstant.SIGNATURE_PREFIX + SecurityUtil.getUserId() + ":" + id);
|
||||
return Result.success().addData(signature);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("手机扫描电脑端二维码签字-电脑端清除签字信息")
|
||||
public Result clearSignature(@Valid String id) {
|
||||
redisService.del(RedisConstant.SIGNATURE_PREFIX + SecurityUtil.getUserId() + ":" + id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("手机端签字-保存签字信息(直接返回url)")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
public Result saveH5Signature(@Param("file") TempFile tempFile) {
|
||||
String url = sysFileService.uploadReturnUrl(SysFileEngineTypeEnum.MINIO.getValue(), tempFile);
|
||||
return Result.success().addData(url);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("更新用户签字")
|
||||
@SLog(tag = "用户签字管理", msg = "更新用户签字")
|
||||
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result update(@Param("file") TempFile tempFile) {
|
||||
String url = sysFileService.uploadReturnUrl(SysFileEngineTypeEnum.MINIO.getValue(), tempFile);
|
||||
Sys_user_signature sysUserSignature = dao.fetch(Sys_user_signature.class);
|
||||
if (ObjectUtil.isNull(sysUserSignature)) {
|
||||
sysUserSignature = new Sys_user_signature();
|
||||
}
|
||||
sysUserSignature.setSignature(url);
|
||||
sysUserSignature.setUserId(SecurityUtil.getUserId());
|
||||
dao.insertOrUpdate(sysUserSignature);
|
||||
|
||||
wkWebSocketUtil.fire(SecurityUtil.getUserLoginname(),Json.toJson(NutMap.NEW().addv("action","pc-scan-code-manage-signature").addv("url",url)));
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("电脑端我的电子签名获取用户签字")
|
||||
public Result get() {
|
||||
Sys_user_signature sysUserSignature = dao.fetch(Sys_user_signature.class, Cnd.where(Sys_user_signature::getUserId, "=", SecurityUtil.getUserId()));
|
||||
return Result.success(sysUserSignature);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.sys.models.Sys_task;
|
||||
import com.budwk.app.sys.services.SysTaskService;
|
||||
import com.budwk.app.task.services.TaskPlatformService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/task")
|
||||
public class SysTaskController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysTaskService sysTaskService;
|
||||
@Inject
|
||||
private TaskPlatformService taskPlatformService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/task/index.html")
|
||||
@SaCheckPermission("sys.manager.task")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/sys/task/cron.html")
|
||||
@SaCheckPermission("sys.manager.task")
|
||||
public void cron() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.task")
|
||||
public Object cronExp(@Param("cron") String cron) {
|
||||
try {
|
||||
return Result.success().addData(taskPlatformService.getCronExeTimes(cron));
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:full")
|
||||
@SaCheckPermission("sys.manager.task")
|
||||
public Object data(@Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) {
|
||||
try {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
}
|
||||
return Result.success().addData(sysTaskService.listPage(pageNumber, pageSize, cnd));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SLog(tag = "新建任务", msg = "任务名称:${args[0].name}")
|
||||
@SaCheckPermission("sys.manager.task.add")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Object addDo(@Param("..") Sys_task task, HttpServletRequest req) {
|
||||
try {
|
||||
task.setCreatedBy(SecurityUtil.getUserId());
|
||||
Sys_task sysTask = sysTaskService.insert(task);
|
||||
taskPlatformService.add(sysTask.getId(), sysTask.getId(), sysTask.getJobClass(), sysTask.getCron(),
|
||||
sysTask.getNote(), sysTask.getData());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/edit/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.task")
|
||||
public Object edit(String id) {
|
||||
try {
|
||||
return Result.success().addData(sysTaskService.fetch(id));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SLog(tag = "修改任务", msg = "任务名称:${args[0].name}")
|
||||
@SaCheckPermission("sys.manager.task.edit")
|
||||
public Object editDo(@Param("..") Sys_task task, HttpServletRequest req) {
|
||||
try {
|
||||
task.setUpdatedBy(SecurityUtil.getUserId());
|
||||
sysTaskService.updateIgnoreNull(task);
|
||||
if (taskPlatformService.isExist(task.getId(), task.getId())) {
|
||||
taskPlatformService.delete(task.getId(), task.getId());
|
||||
}
|
||||
if (!task.isDisabled()) {
|
||||
taskPlatformService.add(task.getId(), task.getId(), task.getJobClass(), task.getCron(),
|
||||
task.getNote(), task.getData());
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json")
|
||||
@SLog(tag = "删除任务", msg = "任务名称:${args[1].getAttribute('name')}")
|
||||
@SaCheckPermission("sys.manager.task.delete")
|
||||
public Object delete(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_task sysTask = sysTaskService.fetch(id);
|
||||
try {
|
||||
if (taskPlatformService.isExist(sysTask.getId(), sysTask.getId())) {
|
||||
taskPlatformService.delete(sysTask.getId(), sysTask.getId());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
sysTaskService.delete(id);
|
||||
req.setAttribute("name", sysTask.getName());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/enable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.task.edit")
|
||||
@SLog(tag = "启用任务", msg = "任务名:${args[1].getAttribute('name')}")
|
||||
public Object enable(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_task sysTask = sysTaskService.fetch(id);
|
||||
req.setAttribute("name", sysTask.getName());
|
||||
sysTaskService.update(org.nutz.dao.Chain.make("disabled", false), Cnd.where("id", "=", id));
|
||||
if (!taskPlatformService.isExist(sysTask.getId(), sysTask.getId())) {
|
||||
taskPlatformService.add(sysTask.getId(), sysTask.getId(), sysTask.getJobClass(), sysTask.getCron(),
|
||||
sysTask.getNote(), sysTask.getData());
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/disable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.task.edit")
|
||||
@SLog(tag = "禁用任务", msg = "任务名:${args[1].getAttribute('name')}")
|
||||
public Object disable(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_task sysTask = sysTaskService.fetch(id);
|
||||
req.setAttribute("name", sysTask.getName());
|
||||
sysTaskService.update(org.nutz.dao.Chain.make("disabled", true), Cnd.where("id", "=", id));
|
||||
if (taskPlatformService.isExist(sysTask.getId(), sysTask.getId())) {
|
||||
taskPlatformService.delete(sysTask.getId(), sysTask.getId());
|
||||
}
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.constant.BpmProcessConstant;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.bpm.service.BpmService;
|
||||
import com.budwk.app.sys.models.*;
|
||||
import com.budwk.app.sys.services.*;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.dao.util.cri.Static;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/union")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "分工会管理")
|
||||
public class SysUnionController {
|
||||
|
||||
@Inject
|
||||
private SysUnionService sysUnionService;
|
||||
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
|
||||
@Inject
|
||||
private BpmService bpmService;
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/union/index.html")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.add")
|
||||
@ApiOperation("新增分工会")
|
||||
public Result insert(Sys_union union) {
|
||||
try {
|
||||
dao.insert(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.edit")
|
||||
@ApiOperation("编辑分工会")
|
||||
public Result update(Sys_union union) {
|
||||
try {
|
||||
dao.updateIgnoreNull(union);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result findOne(String id) {
|
||||
Sys_union union = dao.fetch(Sys_union.class, id);
|
||||
return Result.success(union);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("删除分工会")
|
||||
@SaCheckPermission("sys.manager.union.delete")
|
||||
public Result doDelete(String id) {
|
||||
dao.delete(Sys_union.class, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result tree() {
|
||||
List<Tree<String>> treeList = null;
|
||||
try {
|
||||
boolean schoolUnionAdmin = AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name());
|
||||
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
|
||||
nodeList.add(new TreeNode<>("工会委员会", "0", "工会委员会", 1000));
|
||||
|
||||
List<Sys_union> list = new ArrayList<>();
|
||||
|
||||
if (schoolUnionAdmin) {
|
||||
list = dao.query(Sys_union.class, Cnd.NEW().asc("unionCode"));
|
||||
} else {
|
||||
list = dao.query(Sys_union.class, Cnd.NEW().and("id", "=", SecurityUtil.getUnionId()));
|
||||
}
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
nodeList.add(new TreeNode<>(list.get(i).getId(), "工会委员会", list.get(i).getName(), i));
|
||||
}
|
||||
treeList = TreeUtil.build(nodeList, "0");
|
||||
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result pageData(@Valid PageForm pageForm) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
gh.*,
|
||||
GROUP_CONCAT( u.username,'(',u.mobile,')' ) AS chairman
|
||||
FROM
|
||||
sys_union gh
|
||||
LEFT JOIN sys_user_role sur ON sur.unionId = gh.id
|
||||
AND sur.roleId = 'fd753e8a8c5a404e8e00ef8e0b0c69da'
|
||||
LEFT JOIN sys_user u ON u.id = sur.userId
|
||||
$condition
|
||||
""");
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(Cnd.likeEX("gh.name", pageForm.getSearchKeyword()));
|
||||
}
|
||||
cnd.asc("gh.unionCode");
|
||||
cnd.groupBy("gh.id");
|
||||
|
||||
if (AuthUtil.hasRole(RoleConstant.BRANCH_UNION_CHAIRMAN.name())) {
|
||||
cnd.and("gh.id", "=", SecurityUtil.getUnionId());
|
||||
}
|
||||
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result schoolUnionUserPageData(PageForm pageForm) {
|
||||
List<Sys_dict> schoolRoles = sysDictService.getSubListByCode("SCHOOL_UNION_ROLES");
|
||||
List<String> schoolRoleCodes = schoolRoles.stream().map(Sys_dict::getCode).toList();
|
||||
|
||||
if (Lang.isEmpty(schoolRoles)) {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.userId,
|
||||
t2.username,
|
||||
t2.loginname,
|
||||
t3.`code` AS roleCode,
|
||||
t3.`name` AS roleName
|
||||
FROM
|
||||
sys_user_role t1
|
||||
LEFT JOIN sys_user t2 ON t2.id = t1.userId
|
||||
LEFT JOIN sys_role t3 ON t3.id = t1.roleId
|
||||
LEFT JOIN sys_dict t4 ON t4.code = t3.code
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.where("t3.`code`", "in", schoolRoleCodes);
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
switch (pageForm.getSearchName()) {
|
||||
case "loginname" -> cnd.where().andLike("t2.loginname", pageForm.getSearchKeyword());
|
||||
case "username" -> cnd.where().andLike("t2.username", pageForm.getSearchKeyword());
|
||||
case "roleName" -> cnd.where().andLike("t3.`name`", pageForm.getSearchKeyword());
|
||||
}
|
||||
}
|
||||
cnd.asc("t4.location");
|
||||
cnd.asc("t2.username");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysUserService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.schoolOfficer")
|
||||
@ApiModelProperty("添加校工会人员角色")
|
||||
public Result insertSchoolUnionUserRole(String userId, String roleCode) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
return Result.error("无法找到" + roleCode + "对应编码的角色");
|
||||
}
|
||||
int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
if (count > 0) {
|
||||
return Result.error("请勿重复添加");
|
||||
}
|
||||
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.schoolOfficer")
|
||||
@ApiOperation("删除校工会人员角色")
|
||||
public Result deleteSchoolUnionUserRole(String userId, String roleCode) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
throw new BaseException("无法找到{}对应编码的角色", roleCode);
|
||||
}
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分工会干部
|
||||
*
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result branchUnionUserPageData(PageForm pageForm, String unionId) {
|
||||
List<Sys_dict> branchUnionRoles = sysDictService.getSubListByCode("BRANCH_UNION_ROLES");
|
||||
if (Lang.isEmpty(branchUnionRoles)) {
|
||||
return Result.success();
|
||||
}
|
||||
List<String> branchUnionRoleCodes = branchUnionRoles.stream().map(Sys_dict::getCode).toList();
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.userId,
|
||||
t2.username,
|
||||
t2.loginname,
|
||||
t3.`code` AS roleCode,
|
||||
t3.`name` AS roleName
|
||||
FROM
|
||||
sys_user_role t1
|
||||
LEFT JOIN sys_user t2 ON t2.id = t1.userId
|
||||
LEFT JOIN sys_role t3 ON t3.id = t1.roleId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.where("t3.`code`", "in", branchUnionRoleCodes);
|
||||
cnd.and("t1.unionId", "=", unionId);
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
switch (pageForm.getSearchName()) {
|
||||
case "loginname" -> cnd.where().andLike("t2.loginname", pageForm.getSearchKeyword());
|
||||
case "username" -> cnd.where().andLike("t2.username", pageForm.getSearchKeyword());
|
||||
case "roleName" -> cnd.where().andLike("t3.`name`", pageForm.getSearchKeyword());
|
||||
}
|
||||
}
|
||||
// cnd.asc("t2.username");
|
||||
cnd.and(new Static("1=1 order by field(t3.code," + branchUnionRoleCodes.stream().map(code -> "'" + code + "'").collect(Collectors.joining(",")) + ")"));
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysUserService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.branchOfficer")
|
||||
@ApiOperation("添加分工会人员角色")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result insertBranchUnionUserRole(String userId, String roleCode, String unionId) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
return Result.success("无法找到" + roleCode + "对应编码的角色");
|
||||
}
|
||||
int count = dao.count(Sys_user_role.class, Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId));
|
||||
if (count > 0) {
|
||||
return Result.error("请勿重复添加");
|
||||
}
|
||||
|
||||
// Sys_branch_union_user_permission permission = new Sys_branch_union_user_permission();
|
||||
// permission.setUserId(userId);
|
||||
// permission.setRoleId(role.getId());
|
||||
// permission.setUnionId(unionId);
|
||||
// dao.insert(permission);
|
||||
|
||||
// Sys_union union = dao.fetch(Sys_union.class, unionId);
|
||||
// Sys_user user = dao.fetch(Sys_user.class, userId);
|
||||
// String instanceName = union.getName() + user.getUsername() + role.getName() + "的授权申请";
|
||||
|
||||
// bpmService.startSubmitProcessInstance(BpmProcessConstant.BRANCH_UNION_WEIYUAN_AUTHORIZATION.name(), instanceName, permission.getId(), List.of("24017"), null);
|
||||
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unionId", "=", unionId));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId).add("unionId", unionId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union.branchOfficer")
|
||||
@ApiOperation("删除分工会人员角色")
|
||||
public Result deleteBranchUnionUserRole(String userId, String roleCode, String unionId) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
throw new BaseException("无法找到{}对应编码的角色", roleCode);
|
||||
}
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unionId", "=", unionId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@ApiOperation("分工会组成单位分页")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
public Result branchUnionPartUnitPageData(PageForm pageForm, String unionId) {
|
||||
List<Sys_unit> list = dao.query(Sys_unit.class, Cnd.where("unionId", "=", unionId).asc("unitcode"));
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("分工会组成单位穿梭框数据")
|
||||
@SaCheckPermission("sys.manager.union.partUnit")
|
||||
public Result branchUnionPartUnitTransferData(String unionId) {
|
||||
List<Sys_unit> units = dao.query(Sys_unit.class, Cnd.where("unitLevel", "=", 2).asc("unitcode"));
|
||||
List<String> selectUnitIds = units.stream().filter(unit -> StrUtil.isNotBlank(unit.getUnionId()) && unit.getUnionId().equals(unionId)).map(Sys_unit::getId).toList();
|
||||
List<Sys_unit> matchUnits = units.stream().filter(unit -> StrUtil.isBlank(unit.getUnionId()) || (StrUtil.isNotBlank(unit.getUnionId()) && unit.getUnionId().equals(unionId))).toList();
|
||||
NutMap transferData = NutMap.NEW().addv("selectUnitIds", selectUnitIds).addv("allUnits", matchUnits);
|
||||
return Result.success(transferData);
|
||||
}
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("删除分工会组成单位")
|
||||
@SaCheckPermission("sys.manager.union.partUnit")
|
||||
public Result branchUnionPartUnitSet(String unionId, @Param("unitIds") String[] unitIds) {
|
||||
sysUnitService.update(Chain.make("unionId", null), Cnd.where("unionId", "=", unionId));
|
||||
if (Lang.isNotEmpty(unitIds)) {
|
||||
sysUnitService.update(Chain.make("unionId", unionId), Cnd.where("id", "in", unitIds));
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("按关键字查询分工会下的人员")
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
@SaCheckPermission("sys.manager.union.partUnit")
|
||||
public Result listUserSelect(@Valid String unionId, @Valid String keyWord) {
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitname from vw_user $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(View_user::getUnionId, "=", unionId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike(View_user::getLoginname, keyWord, true);
|
||||
seg.orLike(View_user::getUsername, keyWord, true);
|
||||
cnd.and(seg);
|
||||
cnd.limit(1, 10);
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.entities());
|
||||
sql.setEntity(dao.getEntity(View_user.class));
|
||||
dao.execute(sql);
|
||||
List<View_user> list = sql.getList(View_user.class);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_union_group;
|
||||
import com.budwk.app.sys.services.SysUnionGroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/unionGroup")
|
||||
@Ok("json:full")
|
||||
@Api(value = "工会小组")
|
||||
@Slf4j
|
||||
public class SysUnionGroupController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SysUnionGroupService sysUnionGroupService;
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@ApiOperation("添加工会小组")
|
||||
public Result insert(Sys_union_group group) {
|
||||
sysUnionGroupService.insert(group);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
@ApiOperation("修改工会小组")
|
||||
public Result update(Sys_union_group group) {
|
||||
sysUnionGroupService.update(group);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
@ApiOperation("删除工会小组")
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public Result delete(String id) {
|
||||
sysUnionGroupService.delete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At("/detail/?")
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
@ApiOperation("获取工会小组详情")
|
||||
public Result detail(String id) {
|
||||
Sys_union_group group = dao.fetch(Sys_union_group.class, id);
|
||||
return Result.success().addData(group);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
@ApiOperation("获取工会小组列表")
|
||||
public Result pageData(@Valid PageForm pageForm, @Valid String unionId) {
|
||||
Pagination pagination = sysUnionGroupService.pageData(pageForm, unionId);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckPermission("sys.manager.union")
|
||||
@ApiOperation("获取非工会小组组长人员")
|
||||
public Result listUser(@Valid String unionId, String keyword) {
|
||||
List<NutMap> list = sysUnionGroupService.listNotLeader(unionId, keyword);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,383 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import cn.hutool.core.lang.tree.TreeNode;
|
||||
import cn.hutool.core.lang.tree.TreeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.*;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.sys.services.SysUnitService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import com.budwk.app.web.commons.auth.utils.AuthUtil;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/24.
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/sys/unit")
|
||||
public class SysUnitController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/unit/index.html")
|
||||
@SaCheckPermission("sys.manager.unit")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At("/pageData")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object pageData(PageForm pageForm, String unitName, Integer unitLevel) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("parentId", "is not", null).andEX("unitLevel", "=", unitLevel).asc("unitLevel").asc("unitcode");
|
||||
cnd.and(Cnd.likeEX("name", unitName));
|
||||
|
||||
Pagination<Sys_unit> listPage = sysUnitService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), Sys_unit.class, cnd);
|
||||
return Result.success(listPage);
|
||||
}
|
||||
|
||||
@At("/userPageData")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object userPageData(PageForm pageForm, String unitId) {
|
||||
Sql sql = Sqls.create("""
|
||||
select username,loginname,sex,mobile,if(member = 1, '是', '否') as member from vw_user $condition
|
||||
""").setParam("unitId", unitId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("unitid", "=", unitId);
|
||||
if (Strings.isNotBlank(pageForm.getSearchName()) && Strings.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
cnd.and(pageForm.getSearchName(), "like", "%" + pageForm.getSearchKeyword() + "%");
|
||||
}
|
||||
cnd.asc("member");
|
||||
sql.setCondition(cnd);
|
||||
return Result.success(sysUnitService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql));
|
||||
}
|
||||
|
||||
@At("/leaderPageData")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object leaderPageData(PageForm pageForm, String unitId) {
|
||||
List<Sys_dict> unitRoles = sysDictService.getSubListByCode("UNIT_ROLES");
|
||||
if (Lang.isEmpty(unitRoles)) {
|
||||
return Result.success();
|
||||
}
|
||||
List<String> unitRoleCodes = unitRoles.stream().map(Sys_dict::getCode).toList();
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.userId,
|
||||
t2.username,
|
||||
t2.loginname,
|
||||
t3.`code` AS roleCode,
|
||||
t3.`name` AS roleName
|
||||
FROM
|
||||
sys_user_role t1
|
||||
LEFT JOIN sys_user t2 ON t2.id = t1.userId
|
||||
LEFT JOIN sys_role t3 ON t3.id = t1.roleId
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.where("t3.`code`", "in", unitRoleCodes);
|
||||
cnd.and("t1.unitId", "=", unitId);
|
||||
if (StrUtil.isAllNotBlank(pageForm.getSearchName(), pageForm.getSearchKeyword())) {
|
||||
switch (pageForm.getSearchName()) {
|
||||
case "loginname" -> cnd.where().andLike("t2.loginname", pageForm.getSearchKeyword());
|
||||
case "username" -> cnd.where().andLike("t2.username", pageForm.getSearchKeyword());
|
||||
case "roleName" -> cnd.where().andLike("t3.`name`", pageForm.getSearchKeyword());
|
||||
}
|
||||
}
|
||||
cnd.asc("t2.username");
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = sysUserService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("按关键字查询单位下的人员")
|
||||
@Ok("json:{ignoreNull:true}")
|
||||
public Result listUserSelect(@Valid String unitId, @Valid String keyWord) {
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitname from vw_user $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and(View_user::getUnitId, "=", unitId);
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike(View_user::getLoginname, keyWord, true);
|
||||
seg.orLike(View_user::getUsername, keyWord, true);
|
||||
cnd.and(seg);
|
||||
cnd.limit(1, 10);
|
||||
sql.setCondition(cnd);
|
||||
sql.setCallback(Sqls.callback.entities());
|
||||
sql.setEntity(sysUnitService.dao().getEntity(View_user.class));
|
||||
sysUnitService.dao().execute(sql);
|
||||
List<View_user> list = sql.getList(View_user.class);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
public Result insertUnitUserRole(String userId, String roleCode, String unitId) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
throw new BaseException("无法找到{}对应编码的角色", roleCode);
|
||||
}
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unitId", "=", unitId));
|
||||
sysRoleService.insert("sys_user_role", Chain.make("roleId", role.getId()).add("userId", userId).add("unitId", unitId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
public Result deleteUnitUserRole(String userId, String roleCode, String unitId) {
|
||||
Sys_role role = sysRoleService.fetch(Cnd.where("code", "=", roleCode));
|
||||
if (Lang.isEmpty(role)) {
|
||||
throw new BaseException("无法找到{}对应编码的角色", roleCode);
|
||||
}
|
||||
sysRoleService.clear("sys_user_role", Cnd.where("roleId", "=", role.getId()).and("userId", "=", userId).and("unitId", "=", unitId));
|
||||
sysRoleService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At("/child")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object child(@Param("pid") String pid, HttpServletRequest req) {
|
||||
List<Sys_unit> list = new ArrayList<>();
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
if (AuthUtil.hasRoleOr(RoleConstant.SYSADMIN.name(), RoleConstant.SCHOOL_UNION_ADMIN.name())) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and("parentId", "=", "").or("parentId", "is", null);
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
cnd.asc("location").asc("path");
|
||||
list = sysUnitService.query(cnd);
|
||||
} else {
|
||||
Sys_user user = sysUserService.getUserById(SecurityUtil.getUserId());
|
||||
if (user != null && Strings.isBlank(pid)) {
|
||||
list = sysUnitService.query(Cnd.where("id", "=", user.getUnitId()).asc("path"));
|
||||
} else {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and("parentId", "=", "").or("parentId", "is", null);
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
cnd.asc("location").asc("path");
|
||||
list = sysUnitService.query(cnd);
|
||||
}
|
||||
}
|
||||
for (Sys_unit unit : list) {
|
||||
NutMap map = Lang.obj2nutmap(unit);
|
||||
map.addv("expanded", false);
|
||||
map.addv("children", new ArrayList<>());
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
}
|
||||
|
||||
@At("/cascaderData")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object cascaderData(@Param("pid") String pid, HttpServletRequest req) {
|
||||
try {
|
||||
List<Sys_unit> list = new ArrayList<>();
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
if (Strings.isBlank(pid)) {
|
||||
NutMap root = NutMap.NEW().addv("value", "root").addv("label", "不选择单位").addv("leaf", true);
|
||||
treeList.add(root);
|
||||
}
|
||||
if (StpUtil.hasRole("SYSADMIN")) {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and("parentId", "=", "").or("parentId", "is", null);
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
cnd.asc("location").asc("path");
|
||||
list = sysUnitService.query(cnd);
|
||||
} else {
|
||||
Sys_user user = sysUserService.getUserById(SecurityUtil.getUserId());
|
||||
if (user != null && Strings.isBlank(pid)) {
|
||||
list = sysUnitService.query(Cnd.where("id", "=", user.getUnitId()).asc("path"));
|
||||
} else {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isBlank(pid)) {
|
||||
cnd.and("parentId", "=", "").or("parentId", "is", null);
|
||||
} else {
|
||||
cnd.and("parentId", "=", pid);
|
||||
}
|
||||
cnd.asc("location").asc("path");
|
||||
list = sysUnitService.query(cnd);
|
||||
}
|
||||
}
|
||||
for (Sys_unit unit : list) {
|
||||
NutMap map = NutMap.NEW().addv("value", unit.getId()).addv("label", unit.getName());
|
||||
if (unit.isHasChildren()) {
|
||||
map.addv("children", new ArrayList<>());
|
||||
map.addv("leaf", false);
|
||||
} else {
|
||||
map.addv("leaf", true);
|
||||
}
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/tree")
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object tree(@Param("pid") String pid, HttpServletRequest req) {
|
||||
try {
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("id", "=", pid);
|
||||
cnd.asc("unitcode");
|
||||
List<Sys_unit> list = sysUnitService.query(cnd);
|
||||
|
||||
List<TreeNode<String>> nodeList = CollUtil.newArrayList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
nodeList.add(new TreeNode<>(list.get(i).getId(), list.get(i).getParentId(), list.get(i).getName(), i));
|
||||
}
|
||||
List<Tree<String>> treeList = TreeUtil.build(nodeList, "1");
|
||||
|
||||
// NutMap menuMap = NutMap.NEW();
|
||||
// for (Sys_unit unit : list) {
|
||||
// List<Sys_unit> list1 = menuMap.getList(unit.getParentId(), Sys_unit.class);
|
||||
// if (list1 == null) {
|
||||
// list1 = new ArrayList<>();
|
||||
// }
|
||||
// list1.add(unit);
|
||||
// menuMap.put(unit.getParentId(), list1);
|
||||
// }
|
||||
// return Result.success().addData(getTree(menuMap, null));
|
||||
|
||||
return Result.success(treeList);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.unit.add")
|
||||
@SLog(tag = "新建单位", msg = "单位名称:${args[0].name}")
|
||||
public Object addDo(@Param("..") Sys_unit unit, @Param("parentId") String parentId, HttpServletRequest req) {
|
||||
try {
|
||||
if ("root".equals(parentId)) {
|
||||
parentId = "";
|
||||
}
|
||||
unit.setCreatedBy(SecurityUtil.getUserId());
|
||||
sysUnitService.save(unit, parentId);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
private List<NutMap> getTree(NutMap menuMap, String pid) {
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
List<Sys_unit> subList = menuMap.getList(pid, Sys_unit.class);
|
||||
for (Sys_unit menu : subList) {
|
||||
NutMap map = Lang.obj2nutmap(menu);
|
||||
map.put("label", menu.getName());
|
||||
if (menu.isHasChildren() || (menuMap.get(menu.getId()) != null)) {
|
||||
map.put("children", getTree(menuMap, menu.getId()));
|
||||
}
|
||||
treeList.add(map);
|
||||
}
|
||||
return treeList;
|
||||
}
|
||||
|
||||
@At("/edit/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.unit")
|
||||
public Object edit(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_unit unit = sysUnitService.fetch(id);
|
||||
return Result.success().addData(unit);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.unit.edit")
|
||||
@SLog(tag = "编辑单位", msg = "单位名称:${args[0].name}")
|
||||
public Object editDo(@Param("..") Sys_unit unit, @Param("parentId") String parentId, HttpServletRequest req) {
|
||||
try {
|
||||
unit.setUpdatedBy(SecurityUtil.getUserId());
|
||||
sysUnitService.updateIgnoreNull(unit);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.unit.delete")
|
||||
@SLog(tag = "删除单位", msg = "单位名称:${args[1].getAttribute('name')}")
|
||||
public Object delete(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_unit unit = sysUnitService.fetch(id);
|
||||
req.setAttribute("name", unit.getName());
|
||||
if ("0001".equals(unit.getPath())) {
|
||||
return Result.error("system.not.allow");
|
||||
}
|
||||
sysUnitService.deleteAndChild(unit);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.FieldFilter;
|
||||
import org.nutz.dao.util.Daos;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean
|
||||
@At("/platform/sys/userApproval/opinion")
|
||||
@Ok("json:full")
|
||||
@Api(tags = "用户审批意见")
|
||||
public class SysUserApprovalOpinionController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("保存审批意见")
|
||||
public Result update(@Param("opinions")JSONObject[] opinions){
|
||||
boolean hasBlank = Arrays.stream(opinions).anyMatch(v -> StrUtil.isBlank(v.getStr("text").trim()));
|
||||
if(hasBlank){
|
||||
return Result.error("内容不能为空,请删除后再提交!");
|
||||
}
|
||||
|
||||
Set<String> opinionTexts = Arrays.stream(opinions).map(v -> v.getStr("text").trim()).collect(Collectors.toSet());
|
||||
if(opinionTexts.size() != opinions.length){
|
||||
return Result.error("内容重复,请删除后再提交!");
|
||||
}
|
||||
|
||||
boolean text = Arrays.stream(opinions).anyMatch(v -> v.getStr("text").trim().length() > 50);
|
||||
if(text){
|
||||
return Result.error("单条内容不能超过50个字!");
|
||||
}
|
||||
|
||||
if(opinions.length > 5){
|
||||
return Result.error("最多可添加10条审批意见!");
|
||||
}
|
||||
|
||||
for (int i = 0; i < opinions.length; i++) {
|
||||
opinions[i].set("id",i+1);
|
||||
}
|
||||
|
||||
dao.update(Sys_user.class, Chain.make("customApprovalOpinions", Arrays.asList(opinions)), Cnd.where(Sys_user::getId,"=", SecurityUtil.getUserId()));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取审批意见")
|
||||
public Result list(){
|
||||
FieldFilter fieldFilter = FieldFilter.create(Sys_user.class, "^customApprovalOpinions");
|
||||
Sys_user sysUser = Daos.ext(dao, fieldFilter).fetch(Sys_user.class, Cnd.where(Sys_user::getId, "=", SecurityUtil.getUserId()));
|
||||
return Result.success(sysUser.getCustomApprovalOpinions());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
package com.budwk.app.sys.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import com.budwk.app.base.annotation.SLog;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.base.utils.PageUtil;
|
||||
import com.budwk.app.base.utils.PwdUtil;
|
||||
import com.budwk.app.sys.models.Sys_menu;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.sys.services.SysMenuService;
|
||||
import com.budwk.app.sys.services.SysUnitService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
|
||||
import com.budwk.app.web.commons.base.Globals;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.log.Log;
|
||||
import org.nutz.log.Logs;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/23.
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/sys/user")
|
||||
public class SysUserController {
|
||||
private static final Log log = Logs.get();
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private SysMenuService sysMenuService;
|
||||
@Inject
|
||||
private SysUnitService sysUnitService;
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/sys/user/index.html")
|
||||
@SaCheckPermission("sys.manager.user")
|
||||
public void index() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.user.add")
|
||||
@SLog(tag = "新建用户", msg = "用户名:${user.loginname}")
|
||||
public Object addDo(@Param("..") Sys_user user, HttpServletRequest req) {
|
||||
try {
|
||||
if (Strings.isNotBlank(user.getLoginname())) {
|
||||
int num = sysUserService.count(Cnd.where("loginname", "=", Strings.trim(user.getLoginname())));
|
||||
if (num > 0) {
|
||||
return Result.error("用户名已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
if (!ReUtil.isMatch("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*()\\-_=+{};:,<.>]).{8,20}$", user.getPassword())) {
|
||||
return Result.error("密码必须包含大小写字母、数字和特殊符号,且长度在8-20位之间!");
|
||||
}
|
||||
|
||||
String salt = R.UU32();
|
||||
user.setSalt(salt);
|
||||
user.setPassword(PwdUtil.getPassword(user.getPassword(), salt));
|
||||
user.setLoginCount(0);
|
||||
user.setUnitPath(sysUnitService.fetch(user.getUnitId()).getPath());
|
||||
sysUserService.insert(user);
|
||||
sysUserService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/edit/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.user")
|
||||
public Object edit(@Valid String id) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
n.`name` AS unitName
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN sys_unit n ON n.id = u.unitid
|
||||
WHERE u.id = @id
|
||||
""");
|
||||
sql.setParam("id", id);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
sysUserService.execute(sql);
|
||||
return Result.success().addData(sql.getResult());
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.user.edit")
|
||||
@SLog(tag = "修改用户", msg = "用户名:${user.loginname}")
|
||||
public Object editDo(@Param("..") Sys_user user, HttpServletRequest req) {
|
||||
try {
|
||||
// sysUserService.updateIgnoreNull(user);
|
||||
sysUserService.dao().update(user, "username");
|
||||
sysUserService.deleteCache(user.getId());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/resetPwd/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.user.edit")
|
||||
@SLog(tag = "重置密码", msg = "用户名:${args[1].getAttribute('loginname')}")
|
||||
public Object resetPwd(String id, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_user user = sysUserService.fetch(id);
|
||||
String pwd = PwdUtil.generate(12);
|
||||
String salt = R.UU32();
|
||||
String encryptPwd = PwdUtil.getPassword(pwd, salt);
|
||||
sysUserService.update(Chain.make("password", encryptPwd).add("salt", salt), Cnd.where("id", "=", id));
|
||||
sysUserService.deleteCache(user.getId());
|
||||
req.setAttribute("loginname", user.getLoginname());
|
||||
return Result.success().addData(pwd);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/delete/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.user.delete")
|
||||
@SLog(tag = "删除用户", msg = "用户名:${args[1].getAttribute('loginname')}")
|
||||
public Object delete(String userId, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_user user = sysUserService.fetch(userId);
|
||||
if ("superadmin".equals(user.getLoginname())) {
|
||||
return Result.error("system.not.allow");
|
||||
}
|
||||
sysUserService.deleteById(userId);
|
||||
sysUserService.deleteCache(user.getId());
|
||||
req.setAttribute("loginname", user.getLoginname());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/delete")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.user.delete")
|
||||
@SLog(tag = "批量删除用户", msg = "用户ID:${args[1].getAttribute('ids')}")
|
||||
public Object deletes(@Param("ids") String[] userIds, HttpServletRequest req) {
|
||||
try {
|
||||
Sys_user user = sysUserService.fetch(Cnd.where("loginname", "=", "superadmin"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : userIds) {
|
||||
if (s.equals(user.getId())) {
|
||||
return Result.error("system.not.allow");
|
||||
}
|
||||
sb.append(s).append(",");
|
||||
}
|
||||
sysUserService.deleteByIds(userIds);
|
||||
sysUserService.clearCache();
|
||||
req.setAttribute("ids", sb.toString());
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/enable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.user.edit")
|
||||
@SLog(tag = "启用用户", msg = "用户名:${args[1].getAttribute('loginname')}")
|
||||
public Object enable(String userId, HttpServletRequest req) {
|
||||
try {
|
||||
req.setAttribute("loginname", sysUserService.fetch(userId).getLoginname());
|
||||
sysUserService.update(Chain.make("disabled", false), Cnd.where("id", "=", userId));
|
||||
sysUserService.deleteCache(userId);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/disable/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.user.edit")
|
||||
@SLog(tag = "禁用用户", msg = "用户名:${req.getAttribute('loginname')}")
|
||||
public Object disable(String userId, HttpServletRequest req) {
|
||||
try {
|
||||
String loginname = sysUserService.fetch(userId).getLoginname();
|
||||
if ("superadmin".equals(loginname)) {
|
||||
return Result.error("system.not.allow");
|
||||
}
|
||||
req.setAttribute("loginname", loginname);
|
||||
sysUserService.update(Chain.make("disabled", true), Cnd.where("id", "=", userId));
|
||||
sysUserService.deleteCache(userId);
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At("/menu/?")
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.user")
|
||||
public Object menu(String id, @Param("pid") String pid, HttpServletRequest req) {
|
||||
try {
|
||||
List<Sys_menu> list = sysUserService.getRoleMenus(id, pid);
|
||||
List<NutMap> treeList = new ArrayList<>();
|
||||
for (Sys_menu unit : list) {
|
||||
if (!unit.isHasChildren() && sysUserService.hasChildren(id, unit.getId())) {
|
||||
unit.setHasChildren(true);
|
||||
}
|
||||
NutMap map = Lang.obj2nutmap(unit);
|
||||
map.addv("expanded", false);
|
||||
map.addv("children", new ArrayList<>());
|
||||
treeList.add(map);
|
||||
}
|
||||
return Result.success().addData(treeList);
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json:{locked:'password|salt',ignoreNull:false}")
|
||||
@SaCheckPermission("sys.manager.user")
|
||||
public Object pageData(@Param("searchUnit") String searchUnit, @Param("searchName") String searchName, @Param("searchKeyword") String searchKeyword, @Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy) {
|
||||
try {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
n.`name` AS unitName
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN sys_unit n ON n.id = u.unitid
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.andEX("u.unitid", "=", searchUnit);
|
||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||
cnd.and(searchName, "like", "%" + searchKeyword + "%");
|
||||
}
|
||||
if (Strings.isNotBlank(pageOrderName) && Strings.isNotBlank(pageOrderBy)) {
|
||||
cnd.orderBy(pageOrderName, PageUtil.getOrder(pageOrderBy));
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return Result.success().addData(sysUserService.listPageMap(pageNumber, pageSize, sql));
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("void")
|
||||
@SaCheckPermission("sys.manager.user")
|
||||
public void export(@Param("searchUnit") String searchUnit, @Param("searchName") String searchName, @Param("searchKeyword") String searchKeyword, @Param("pageOrderName") String pageOrderName, @Param("pageOrderBy") String pageOrderBy, HttpServletResponse response) {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("beetl:/platform/sys/user/pass.html")
|
||||
@SaCheckLogin
|
||||
public void pass() {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object doChangePassword(@Param("oldPassword") String oldPassword, @Param("newPassword") String newPassword, HttpServletRequest req) {
|
||||
if ("superadmin".equals(SecurityUtil.getUserLoginname()) && Globals.MyConfig.getBoolean("AppDemoEnv")) {
|
||||
return Result.error("演示环境,不予操作");
|
||||
}
|
||||
// Sys_user user = sysUserService.getUserById(SecurityUtil.getUserId());
|
||||
// String old = PwdUtil.getPassword(oldPassword, user.getSalt());
|
||||
// if (old.equals(user.getPassword())) {
|
||||
// String salt = R.UU32();
|
||||
// String hashedPasswordBase64 = PwdUtil.getPassword(newPassword, salt);
|
||||
// user.setSalt(salt);
|
||||
// user.setPassword(hashedPasswordBase64);
|
||||
// sysUserService.update(Chain.make("salt", salt).add("password", hashedPasswordBase64), Cnd.where("id", "=", user.getId()));
|
||||
// sysUserService.deleteCache(user.getId());
|
||||
// return Result.success();
|
||||
// } else {
|
||||
// return Result.error();
|
||||
// }
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckLogin
|
||||
public Object doChangeInfo(@Param("username") String username, @Param("mobile") String mobile, @Param("email") String email, HttpServletRequest req) {
|
||||
if ("superadmin".equals(SecurityUtil.getUserLoginname()) && Globals.MyConfig.getBoolean("AppDemoEnv")) {
|
||||
return Result.error("演示环境,不予操作");
|
||||
}
|
||||
sysUserService.update(Chain.make("username", username).add("mobile", mobile).add("email", email), Cnd.where("id", "=", SecurityUtil.getUserId()));
|
||||
sysUserService.deleteCache(SecurityUtil.getUserId());
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.budwk.app.sys.enums;
|
||||
|
||||
import com.budwk.app.base.annotation.DictEnum;
|
||||
import com.budwk.app.sys.services.impl.SysDataUserAllUpdateServiceImpl;
|
||||
import com.budwk.app.sys.services.impl.SysDataUserIncrUpdateServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Getter
|
||||
@DictEnum(key = "sysDataUpdateMode", name = "系统数据更新")
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public enum SysDataUpdateMode {
|
||||
|
||||
ALL("全量更新", SysDataUserAllUpdateServiceImpl.class),
|
||||
INCR("增量更新", SysDataUserIncrUpdateServiceImpl.class);
|
||||
|
||||
private final String desc;
|
||||
private final Class<?> clazz;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.sys.enums;
|
||||
|
||||
/**
|
||||
* 文件存储桶的权限策略枚举
|
||||
*
|
||||
*/
|
||||
public enum SysFileBucketAuthEnum {
|
||||
|
||||
/**
|
||||
* 私有的(仅有 owner 可以读写)
|
||||
*/
|
||||
PRIVATE,
|
||||
|
||||
/**
|
||||
* 公有读,私有写( owner 可以读写, 其他客户可以读)
|
||||
*/
|
||||
PUBLIC_READ,
|
||||
|
||||
/**
|
||||
* 公共读写(即所有人都可以读写,慎用)
|
||||
*/
|
||||
PUBLIC_READ_WRITE
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.budwk.app.sys.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 文件存储引擎类型枚举
|
||||
*
|
||||
* @author xuyuxiang
|
||||
* @date 2022/6/16 16:14
|
||||
**/
|
||||
@Getter
|
||||
public enum SysFileEngineTypeEnum {
|
||||
|
||||
/** 本地 */
|
||||
LOCAL("LOCAL"),
|
||||
|
||||
/** 阿里云 */
|
||||
ALIYUN("ALIYUN"),
|
||||
|
||||
/** 腾讯云 */
|
||||
TENCENT("TENCENT"),
|
||||
|
||||
/** MINIO */
|
||||
MINIO("MINIO");
|
||||
|
||||
private final String value;
|
||||
|
||||
SysFileEngineTypeEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* API密钥管理
|
||||
* Created by wizzer on 2019/2/26.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_api")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_api extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String appid;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String appkey;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 应用管理--配置文件表
|
||||
* Created by wizzer on 2019/2/27.
|
||||
*/
|
||||
@Table("sys_app_conf")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_app_conf extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("实例名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String confName;
|
||||
|
||||
@Column
|
||||
@Comment("版本号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String confVersion;
|
||||
|
||||
@Column
|
||||
@Comment("配置内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String confData;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
|
||||
@One(field = "createdBy")
|
||||
private Sys_user user;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getConfName() {
|
||||
return confName;
|
||||
}
|
||||
|
||||
public void setConfName(String confName) {
|
||||
this.confName = confName;
|
||||
}
|
||||
|
||||
public String getConfVersion() {
|
||||
return confVersion;
|
||||
}
|
||||
|
||||
public void setConfVersion(String confVersion) {
|
||||
this.confVersion = confVersion;
|
||||
}
|
||||
|
||||
public String getConfData() {
|
||||
return confData;
|
||||
}
|
||||
|
||||
public void setConfData(String confData) {
|
||||
this.confData = confData;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled) {
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
public Sys_user getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(Sys_user user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 应用管理--应用实例表
|
||||
* Created by wizzer on 2019/2/27.
|
||||
*/
|
||||
@Data
|
||||
@Table("sys_app_list")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_app_list extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("实例名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String appName;
|
||||
|
||||
@Column
|
||||
@Comment("版本号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String appVersion;
|
||||
|
||||
@Column
|
||||
@Comment("文件大小")
|
||||
private Long fileSize;
|
||||
|
||||
@Column
|
||||
@Comment("文件路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String filePath;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
|
||||
@One(field = "createdBy")
|
||||
private Sys_user user;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 应用管理--推送任务表
|
||||
* Created by wizzer on 2019/2/27.
|
||||
*/
|
||||
@Data
|
||||
@Table("sys_app_task")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_app_task extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Prev(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("实例名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("执行动作")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String action;
|
||||
|
||||
@Column
|
||||
@Comment("APP版本")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String appVersion;
|
||||
|
||||
@Column
|
||||
@Comment("配置版本")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String confVersion;
|
||||
|
||||
@Column
|
||||
@Comment("进程ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String processId;
|
||||
|
||||
@Column
|
||||
@Comment("推送主机")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String hostName;//主机名 如果是推送给全部主机则为多条
|
||||
|
||||
@Column
|
||||
@Comment("主机IP")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String hostAddress;//只为展示用
|
||||
|
||||
@Column
|
||||
@Comment("推送状态")
|
||||
@ColDefine(type = ColType.INT, width = 1)
|
||||
private Integer status;//0-待执行,1-执行中,2-执行成功,3-执行失败,4-撤销任务
|
||||
|
||||
@Column
|
||||
@Comment("反馈时间")
|
||||
private Long pushAt;
|
||||
|
||||
@Column
|
||||
@Comment("反馈结果")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String pushResult;
|
||||
|
||||
@One(field = "createdBy")
|
||||
private Sys_user user;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table("sys_branch_union_user_permission")
|
||||
@Comment("分工会人员权限")
|
||||
public class Sys_branch_union_user_permission extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@PrevInsert(uu32 = true)
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("权限id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String roleId;
|
||||
|
||||
@Column
|
||||
@Comment("分工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_config")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_config extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Name
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String configKey;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String configValue;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String note;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_dict")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes({@Index(name = "INDEX_SYS_DICT_PATH", fields = {"path"}, unique = true)})
|
||||
public class Sys_dict extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("父级ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String parentId;
|
||||
|
||||
@Column
|
||||
@Comment("树路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String path;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@Comment("启用状态")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@SQL(db= DB.MYSQL,value = "SELECT IFNULL(MAX(location),0)+1 FROM sys_dict"),
|
||||
@SQL(db= DB.ORACLE,value = "SELECT COALESCE(MAX(location),0)+1 FROM sys_dict")
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
@Column
|
||||
@Comment("有子节点")
|
||||
private boolean hasChildren;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Table("sys_file")
|
||||
@Comment("系统文件管理")
|
||||
public class Sys_file extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("存储引擎")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String engine;
|
||||
|
||||
@Column
|
||||
@Comment("存储桶")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String bucket;
|
||||
|
||||
@Column
|
||||
@Comment("文件名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("文件后缀")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String suffix;
|
||||
|
||||
@Column
|
||||
@Comment("文件大小kb")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String sizeKb;
|
||||
|
||||
@Column
|
||||
@Comment("文件大小(格式化后)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String sizeInfo;
|
||||
|
||||
@Column
|
||||
@Comment("文件的对象名(唯一名称)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
private String objName;
|
||||
|
||||
@Column
|
||||
@Comment("文件存储路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
private String storagePath;
|
||||
|
||||
@Column
|
||||
@Comment("文件下载路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
private String downloadPath;
|
||||
|
||||
@Column
|
||||
@Comment("图片缩略图")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String thumbnail;
|
||||
|
||||
@Column
|
||||
@Comment("扩展信息")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private JSONObject extJson;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table
|
||||
@Comment("首页活动")
|
||||
public class Sys_home_activity extends BaseModel {
|
||||
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("主键ID,和业务ID保持一致")
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("活动名称")
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
@Comment("活动封面")
|
||||
private String cover;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
@Comment("活动链接")
|
||||
private String url;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
@Comment("h5活动链接")
|
||||
private String h5Url;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("面向人员分组ID")
|
||||
private Integer allowUserGroupId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 1000)
|
||||
@Comment("允许查看的人员sql")
|
||||
private String allowUserSql;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Comment("是否启用")
|
||||
@Default("0")
|
||||
private Boolean enable;
|
||||
|
||||
@Column
|
||||
@Comment("类路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String classPath;
|
||||
|
||||
@Column
|
||||
@Comment("是否置顶")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean top;
|
||||
|
||||
@Column
|
||||
@Comment("排序号")
|
||||
@Default("0")
|
||||
private Integer sortNo;
|
||||
|
||||
@Column
|
||||
@Comment("开始时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date startDate;
|
||||
|
||||
@Column
|
||||
@Comment("结束时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date endDate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_log_${month}")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_log extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Column
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("操作人姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String username;
|
||||
|
||||
@Column
|
||||
@Comment("操作人用户名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("日志类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("日志标识")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String tag;
|
||||
|
||||
@Column
|
||||
@Comment("执行类")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String src;
|
||||
|
||||
@Column
|
||||
@Comment("来源IP")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String ip;
|
||||
|
||||
@Column
|
||||
@Comment("日志内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String msg;
|
||||
|
||||
@Column
|
||||
@Comment("请求结果")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String param;
|
||||
|
||||
@Column
|
||||
@Comment("执行结果")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String result;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_menu")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes({@Index(name = "INDEX_SYS_MENU_PATH", fields = {"path"}, unique = true), @Index(name = "INDEX_SYS_MENU_PREM", fields = {"permission"}, unique = true)})
|
||||
public class Sys_menu extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("父级ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String parentId;
|
||||
|
||||
@Column
|
||||
@Comment("树路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String path;
|
||||
|
||||
@Column
|
||||
@Comment("菜单名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("菜单别名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String aliasName;
|
||||
|
||||
@Column
|
||||
@Comment("资源类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("菜单链接")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String href;
|
||||
|
||||
@Column
|
||||
@Comment("打开方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String target;
|
||||
|
||||
@Column
|
||||
@Comment("菜单图标")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String icon;
|
||||
|
||||
@Column
|
||||
@Comment("是否显示")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("1")
|
||||
private Boolean showit;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean disabled;
|
||||
|
||||
@Column
|
||||
@Comment("权限标识")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String permission;
|
||||
|
||||
@Column
|
||||
@Comment("菜单介绍")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM sys_menu"), @SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM sys_menu")})
|
||||
private Integer location;
|
||||
|
||||
@Column
|
||||
@Comment("有子节点")
|
||||
private boolean hasChildren;
|
||||
|
||||
@Column
|
||||
@Comment("所属平台(pc、h5)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String platform;
|
||||
|
||||
@Column
|
||||
@Comment("所属模块")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String moduleId;
|
||||
|
||||
@Column
|
||||
@Comment("是否是快捷入口")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isQuickEntry;
|
||||
|
||||
//按钮权限
|
||||
private List<Sys_menu> buttons;
|
||||
|
||||
//子菜单
|
||||
private List<Sys_menu> children = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 前端菜单数据
|
||||
*
|
||||
* @param menus
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
public static List<Sys_menu> createTreeMenus(List<Sys_menu> menus, String parentId) {
|
||||
List<Sys_menu> filterMenus = menus.stream().filter(v -> StringUtils.defaultString(v.getParentId(), "").equals(StringUtils.defaultString(parentId, ""))).collect(Collectors.toList());
|
||||
for (Sys_menu menu : filterMenus) {
|
||||
List<Sys_menu> childMenus = createTreeMenus(menus, menu.getId());
|
||||
menu.setChildren(childMenus);
|
||||
}
|
||||
return new ArrayList<>(filterMenus);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_module")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("系统模块")
|
||||
public class Sys_module extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("所属平台(pc、h5)")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String platform;
|
||||
|
||||
@Column
|
||||
@Comment("模块名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 8)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("图标")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String icon;
|
||||
|
||||
@Column
|
||||
@Comment("排序编号")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer sortNum;
|
||||
|
||||
//菜单
|
||||
private List<Sys_menu> menus;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_msg")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("系统消息")
|
||||
public class Sys_msg extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("消息类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@NotBlank(message = "消息类型不能为空")
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("消息标题")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
@NotBlank(message = "消息标题不能为空")
|
||||
private String title;
|
||||
|
||||
@Column
|
||||
@Comment("消息内容")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
@NotBlank(message = "消息内容不能为空")
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@Comment("消息URL")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String url;
|
||||
|
||||
@Column
|
||||
@Comment("发送时间")
|
||||
//Long不要用ColDefine定义,兼容oracle/mysql,支持2038年以后的时间戳
|
||||
private Long sendAt;
|
||||
|
||||
@Many(field = "msgId")
|
||||
private List<Sys_msg_user> userList;
|
||||
|
||||
@Column
|
||||
@Comment("是否需要反馈")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean needBack;
|
||||
|
||||
@Column
|
||||
@Comment("附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> files;
|
||||
|
||||
@Column
|
||||
@Comment("发送模式(显示、隐式)show hide")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String sendType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2018/6/29.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_msg_user")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_msg_user extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("消息ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String msgId;
|
||||
|
||||
@Column
|
||||
@Comment("用户名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("用户名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String userName;
|
||||
|
||||
@Column
|
||||
@Comment("单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("分工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("消息状态")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private int status;//0--未读 1--已读
|
||||
|
||||
@Column
|
||||
@Comment("读取时间")
|
||||
//Long不要用ColDefine定义,兼容oracle/mysql,支持2038年以后的时间戳
|
||||
private Long readAt;
|
||||
|
||||
@One(field = "msgId")
|
||||
private Sys_msg msg;
|
||||
|
||||
@Column
|
||||
@Comment("反馈内容")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 500)
|
||||
private String backText;
|
||||
|
||||
@Column
|
||||
@Comment("反馈附件")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> backFiles;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Table
|
||||
@Comment("导出模板")
|
||||
public class Sys_office_template extends BaseModel {
|
||||
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("模板名称")
|
||||
private String templateName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("模板代码")
|
||||
private String templateCode;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@Comment("模板大小")
|
||||
private String templateSize;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
@Comment("模板路径")
|
||||
private String templatePath;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
@Comment("模板对象")
|
||||
private List<JSONObject> file;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@Comment("模板说明")
|
||||
private String templateDesc;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_quick_entry")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
//@TableIndexes({@Index(name = "INDEX_SYS_QUICK_ENTRY_USERID", fields = {"userId"})})
|
||||
public class Sys_quick_entry extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_role")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes({@Index(name = "INDEX_SYS_ROLE_CODE", fields = {"code"}, unique = true)})
|
||||
public class Sys_role extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Column
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String code;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String aliasName;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitid;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Comment("排序")
|
||||
private Integer sort;
|
||||
|
||||
@One(field = "unitid")
|
||||
public Sys_unit unit;
|
||||
|
||||
@ManyMany(from = "roleId", relation = "sys_role_menu", to = "menuId")
|
||||
protected List<Sys_menu> menus;
|
||||
|
||||
@ManyMany(from = "roleId", relation = "sys_user_role", to = "userId")
|
||||
private List<Sys_user> users;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Wizzer on 2016/7/31.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_route")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_route extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Column
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("原始路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String url;
|
||||
|
||||
@Column
|
||||
@Comment("跳转路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String toUrl;
|
||||
|
||||
@Column
|
||||
@Comment("转发类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String type;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Wizzer on 2016/7/30.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_task")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_task extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Column
|
||||
@Name
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(els = {@EL("uuid()")})
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("任务名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("执行类")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String jobClass;
|
||||
|
||||
@Column
|
||||
@Comment("任务说明")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@Comment("定时规则")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String cron;
|
||||
|
||||
@Column
|
||||
@Comment("执行参数")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String data;
|
||||
|
||||
@Column
|
||||
@Comment("执行时间")
|
||||
private Long exeAt;
|
||||
|
||||
@Column
|
||||
@Comment("执行结果")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String exeResult;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_union")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
//@TableIndexes({@Index(name = "INDEX_SYS_UNIT_PATH", fields = {"path"}, unique = true),
|
||||
// @Index(name = "INDEX_SYS_UNIT_UNITCODE", fields = {"unitcode"}, unique = true)
|
||||
//})
|
||||
public class Sys_union extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unionCode;
|
||||
|
||||
@Column
|
||||
@Comment("联系电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String telephone;
|
||||
|
||||
@Column
|
||||
@Comment("校区")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String campus;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_union_group")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("工会小组")
|
||||
public class Sys_union_group extends BaseModel {
|
||||
|
||||
@Comment("ID")
|
||||
@Name
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Comment("所属分工会ID")
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Comment("名称")
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Comment("编码")
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
private String code;
|
||||
|
||||
@Comment("小组长")
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String leader;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.DB;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_unit")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes({@Index(name = "INDEX_SYS_UNIT_PATH", fields = {"path"}, unique = true),
|
||||
@Index(name = "INDEX_SYS_UNIT_UNITCODE", fields = {"unitcode"}, unique = true)
|
||||
})
|
||||
public class Sys_unit extends BaseModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("父级ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String parentId;
|
||||
|
||||
@Column
|
||||
@Comment("树路径")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String path;
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String name;
|
||||
|
||||
@Column
|
||||
@Comment("单位别名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String aliasName;
|
||||
|
||||
@Column
|
||||
@Comment("机构编码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitcode;
|
||||
|
||||
@Column
|
||||
@Comment("单位介绍")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String note;
|
||||
|
||||
@Column
|
||||
@Comment("单位地址")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String address;
|
||||
|
||||
@Column
|
||||
@Comment("联系电话")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String telephone;
|
||||
|
||||
@Column
|
||||
@Comment("单位邮箱")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String email;
|
||||
|
||||
@Column
|
||||
@Comment("单位网站")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String website;
|
||||
|
||||
@Column
|
||||
@Comment("排序字段")
|
||||
@Prev({
|
||||
@SQL(db = DB.MYSQL, value = "SELECT IFNULL(MAX(location),0)+1 FROM sys_unit"),
|
||||
@SQL(db = DB.ORACLE, value = "SELECT COALESCE(MAX(location),0)+1 FROM sys_unit")
|
||||
})
|
||||
private Integer location;
|
||||
|
||||
@Column
|
||||
@Comment("有子节点")
|
||||
private boolean hasChildren;
|
||||
|
||||
@Column
|
||||
@Comment("单位logo")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String logo;
|
||||
|
||||
@Column
|
||||
@Comment("等级")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer unitLevel;
|
||||
|
||||
@Column
|
||||
@Comment("工会id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("小组id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionGroupId;
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import com.budwk.app.sys.annotation.DataCenterColumn;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.json.JsonField;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/6/21.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@Table("sys_user")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes({@Index(name = "INDEX_SYS_USER_LOGINNAMAE", fields = {"loginname"})})
|
||||
public class Sys_user extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
@DataCenterColumn(name = "工号", key = "zgh")
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@DataCenterColumn(name = "姓名", key = "xm")
|
||||
private String username;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@DataCenterColumn(name = "性别", key = "xbmc")
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("密码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String password;
|
||||
|
||||
@Column
|
||||
@Comment("密码盐")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String salt;
|
||||
|
||||
@Column
|
||||
@Comment("出生日期")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
@DataCenterColumn(name = "出生日期", key = "csrq")
|
||||
private Date birthday;
|
||||
|
||||
@Column
|
||||
@Comment("政治面貌")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@DataCenterColumn(name = "政治面貌", key = "zzmmmc")
|
||||
private String political;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.DATE)
|
||||
@Comment("入党时间")
|
||||
@DataCenterColumn(name = "入党时间", key = "rdsj")
|
||||
private Date joinPartyDate;
|
||||
|
||||
@Column
|
||||
@Comment("民族")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@DataCenterColumn(name = "民族", key = "mzmc")
|
||||
private String nation;
|
||||
|
||||
@Column
|
||||
@Comment("籍贯")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@DataCenterColumn(name = "籍贯", key = "jgmc")
|
||||
private String nativePlace;
|
||||
|
||||
@Column
|
||||
@Comment("国籍")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@DataCenterColumn(name = "国籍", key = "gjdqmc")
|
||||
private String nationality;
|
||||
|
||||
@Column
|
||||
@Comment("证件类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@DataCenterColumn(name = "证件类型", key = "sfzjlxmc")
|
||||
private String idCardType;
|
||||
|
||||
@Column
|
||||
@Comment("证件号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@DataCenterColumn(name = "证件号码", key = "sfzjh")
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("手机号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@DataCenterColumn(name = "手机号码", key = "sjh")
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("学历")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
@DataCenterColumn(name = "学历", key = "zgxlmc")
|
||||
private String education;
|
||||
|
||||
@Column
|
||||
@Comment("学位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@DataCenterColumn(name = "学位", key = "zgxwmc")
|
||||
private String academicDegree;
|
||||
|
||||
@Column
|
||||
@Comment("技术职称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@DataCenterColumn(name = "技术职称", key = "zyjszwmc")
|
||||
private String technicalTitle;
|
||||
|
||||
@Column
|
||||
@Comment("技术职称级别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@DataCenterColumn(name = "技术职称级别", key = "zyjszwjbmc")
|
||||
private String technicalTitleLevel;
|
||||
|
||||
@Column
|
||||
@Comment("职务")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@DataCenterColumn(name = "职务", key = "gbzw")
|
||||
private String position;
|
||||
|
||||
@Column
|
||||
@Comment("职务级别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@DataCenterColumn(name = "职务级别", key = "gbzwjbmc")
|
||||
private String positionLevel;
|
||||
|
||||
@Column
|
||||
@Comment("职员级别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
@DataCenterColumn(name = "职员级别", key = "zydjmc")
|
||||
private String employeeLevel;
|
||||
|
||||
@Column
|
||||
@Comment("来校时间")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 10)
|
||||
@DataCenterColumn(name = "来校时间", key = "lxny")
|
||||
private String arrivalAtSchoolDate;
|
||||
|
||||
@Column
|
||||
@Comment("身份类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@DataCenterColumn(name = "身份类型", key = "grsfmc")
|
||||
private String identityType;
|
||||
|
||||
@Column
|
||||
@Comment("在职状态")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@DataCenterColumn(name = "在职状态", key = "jzgdqztmc")
|
||||
private String userState;
|
||||
|
||||
@Column
|
||||
@Comment("人员类别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@DataCenterColumn(name = "人员类别", key = "jzglbmc")
|
||||
private String personType;
|
||||
|
||||
@Column
|
||||
@Comment("聘用方式")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
@DataCenterColumn(name = "聘用方式", key = "yrfsmc")
|
||||
private String preparedBy;
|
||||
|
||||
@Column
|
||||
@Comment("退休时间")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private Date retireDate;
|
||||
|
||||
@Column
|
||||
@Comment("博士后进站时间")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
@DataCenterColumn(name = "博士后进站时间", key = "bhzjzsj")
|
||||
private Date postDoctoralJoinDate;
|
||||
|
||||
@Column
|
||||
@Comment("头像")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String avatar;
|
||||
|
||||
@Column
|
||||
@Comment("电子邮箱")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String email;
|
||||
|
||||
@Column
|
||||
@Comment("创建时间")
|
||||
@PrevInsert(now = true)
|
||||
private Long createAt;
|
||||
|
||||
@Column
|
||||
@Comment("登陆时间")
|
||||
private Long loginAt;
|
||||
|
||||
@Column
|
||||
@Comment("登陆次数")
|
||||
@ColDefine(type = ColType.INT)
|
||||
@Default(value = "0")
|
||||
private Integer loginCount;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unitPath;
|
||||
|
||||
@Column
|
||||
@Comment("是否双肩挑")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean manyUnit;
|
||||
|
||||
@Column
|
||||
@Comment("是否会员")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean member;
|
||||
|
||||
@Column
|
||||
@Comment("是否福利会员")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean welfareMember;
|
||||
|
||||
@Column
|
||||
@Comment("是否大病基金会员")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean aidFundMember;
|
||||
|
||||
@Column
|
||||
@Comment("家庭主要成员及其工作单位")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> families;
|
||||
|
||||
@Column
|
||||
@Comment("是否愿意加入大病互助基金会")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean wantJoinLoveMutualAidAssociation;
|
||||
|
||||
@Column
|
||||
@Comment("个人简况")
|
||||
@ColDefine(type = ColType.VARCHAR, customType = "text")
|
||||
private String personalData;
|
||||
|
||||
@Column
|
||||
@Comment("是否是劳模")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default(value = "0")
|
||||
private Boolean isModelWorker;
|
||||
|
||||
@Column
|
||||
@Comment("劳模资料")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> modelWorkerFiles;
|
||||
|
||||
@Column
|
||||
@Comment("常用审批意见")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> customApprovalOpinions;
|
||||
|
||||
@Column
|
||||
@Comment("微信openId")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String wxOpenId;
|
||||
|
||||
@One(field = "unitId")
|
||||
private Sys_unit unit;
|
||||
|
||||
//分工会
|
||||
private Sys_union union;
|
||||
|
||||
@ManyMany(from = "userId", relation = "sys_user_role", to = "roleId")
|
||||
private List<Sys_role> roles;
|
||||
|
||||
@ManyMany(from = "userId", relation = "sys_user_unit", to = "unitId")
|
||||
protected List<Sys_unit> units;
|
||||
|
||||
//全部菜单
|
||||
protected List<Sys_menu> menus;
|
||||
|
||||
//常用菜单
|
||||
private List<Sys_menu> customMenus;
|
||||
|
||||
//前端树形菜单
|
||||
private List<Sys_menu> treeMenus;
|
||||
|
||||
//权限
|
||||
private List<String> permissions;
|
||||
|
||||
//新版模块菜单
|
||||
private List<Sys_module> pcModuleMenus;
|
||||
private List<Sys_module> h5ModuleMenus;
|
||||
|
||||
@Column
|
||||
@Comment("总积分")
|
||||
@Default(value = "0")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Integer totalIntegral;
|
||||
|
||||
@Column
|
||||
@Comment("是否禁用")
|
||||
@Default(value = "0")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private boolean disabled;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:Sys_user_change_info
|
||||
* @Date 2024/10/30 10:59
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@Table
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Sys_user_change_info extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("用户ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("工号")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
@NotBlank(message = "工号不能为空")
|
||||
@Size(max = 100)
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("用户名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String username;
|
||||
|
||||
@Column
|
||||
@Comment("人员历史记录id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userHistoryId;
|
||||
|
||||
@Column
|
||||
@Comment("申请时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
@PrevInsert(now = true)
|
||||
private Date changeTime;
|
||||
|
||||
@Column
|
||||
@Comment("变更来源")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String changeOrigin;
|
||||
|
||||
@Column
|
||||
@Comment("详细变更记录,用于查询、列表展示")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> changeInfos;
|
||||
|
||||
@Column
|
||||
@Comment("详细变更记录,文本类型,可用于导出")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String changeInfosStr;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Sys_user_entrance extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("默认模块id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String defaultModuleId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class Sys_user_entrance_module extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("用户id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@Comment("默认模块id")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String defaultModuleId;
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("sys_user_history")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes({@Index(name = "INDEX_SYS_USER_HISTORY_LOGINNAMAE", fields = {"loginname"}, unique = false)})
|
||||
@Comment("用户历史记录")
|
||||
public class Sys_user_history extends BaseModel implements Serializable {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("用户名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 120)
|
||||
private String loginname;
|
||||
|
||||
@Column
|
||||
@Comment("姓名")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String username;
|
||||
|
||||
@Column
|
||||
@Comment("性别")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String sex;
|
||||
|
||||
@Column
|
||||
@Comment("电子邮箱")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String email;
|
||||
|
||||
@Column
|
||||
@Comment("手机号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String mobile;
|
||||
|
||||
@Column
|
||||
@Comment("工会ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@Comment("工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String unionName;
|
||||
|
||||
@Column
|
||||
@Comment("单位ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("在职状态")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String userState;
|
||||
|
||||
@Column
|
||||
@Comment("人事编制")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String preparedBy;
|
||||
|
||||
@Column
|
||||
@Comment("人员类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String personType;
|
||||
|
||||
@Column
|
||||
@Comment("来校年月")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String comeSchoolDate;
|
||||
|
||||
@Column
|
||||
@Comment("出生日期")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private Date birthday;
|
||||
|
||||
@Column
|
||||
@Comment("党政职务")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String governmentPosition;
|
||||
|
||||
@Column
|
||||
@Comment("技术职称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String technicalTitle;
|
||||
|
||||
@Column
|
||||
@Comment("民族")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 15)
|
||||
private String nation;
|
||||
|
||||
@Column
|
||||
@Comment("国籍")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String nationality;
|
||||
|
||||
@Column
|
||||
@Comment("证件类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String icCardType;
|
||||
|
||||
@Column
|
||||
@Comment("证件号码")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 30)
|
||||
private String idCard;
|
||||
|
||||
@Column
|
||||
@Comment("政治面貌")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String political;
|
||||
|
||||
@Column
|
||||
@Comment("学历")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String education;
|
||||
|
||||
@Column
|
||||
@Comment("学位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String academicDegree;
|
||||
|
||||
@Column
|
||||
@Comment("个人简况")
|
||||
@ColDefine(type = ColType.VARCHAR, customType = "text")
|
||||
private String personalData;
|
||||
|
||||
@Column
|
||||
@Comment("是否双肩挑")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean manyUnit;
|
||||
|
||||
@Column
|
||||
@Comment("是否会员")
|
||||
@ColDefine(type = ColType.AUTO)
|
||||
private Boolean member;
|
||||
|
||||
@Column
|
||||
@Comment("是否愿意加入重大疾病爱心基金互助会")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
private Boolean wantJoinLoveMutualAidAssociation;
|
||||
|
||||
@Column
|
||||
@Comment("是否福利会员")
|
||||
@ColDefine(type = ColType.AUTO)
|
||||
private Boolean welfareMember;
|
||||
|
||||
@Column
|
||||
@Comment("异动类型")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<String> changeTypes;
|
||||
|
||||
@Column
|
||||
@Comment("家庭成员")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<JSONObject> families;
|
||||
|
||||
@Column
|
||||
@Comment("博士后进站时间")
|
||||
@ColDefine(type = ColType.DATE)
|
||||
private Date postDoctoralJoinDate;
|
||||
|
||||
@Column
|
||||
@Comment("异动时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date changeTime;
|
||||
|
||||
@Column
|
||||
@Comment("异动来源")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||
private String changeOrigin;
|
||||
|
||||
@Column
|
||||
@Comment("详细变更记录,用于查询、列表展示")
|
||||
@ColDefine(type = ColType.MYSQL_JSON)
|
||||
private List<NutMap> changeInfos;
|
||||
|
||||
@Column
|
||||
@Comment("详细变更记录,文本类型,可用于导出")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String changeInfosStr;
|
||||
|
||||
@Column
|
||||
@Comment("变更原因")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String changeReason;
|
||||
|
||||
@Column
|
||||
@Comment("会员变更记录表")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String recordId;
|
||||
|
||||
@Column
|
||||
@Comment("变更说明")
|
||||
@ColDefine(type = ColType.TEXT)
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
@Table("sys_user_role")
|
||||
@Data
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_user_role {
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String roleId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unitId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("工会小组ID")
|
||||
private String unionGroupId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("教代会代表团ID")
|
||||
private String tcDelegationId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("教代会届次ID")
|
||||
private String tcSessionId;
|
||||
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("工代会代表团ID")
|
||||
private String wcDelegationId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("工代会届次ID")
|
||||
private String wcSessionId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("协会ID")
|
||||
private String clubId;
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@Comment("承办单位ID")
|
||||
private String underTakeId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@Table("sys_user_signature")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
public class Sys_user_signature extends BaseModel {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 32)
|
||||
@Comment("用户id")
|
||||
private String userId;
|
||||
|
||||
@Column
|
||||
@ColDefine(type = ColType.VARCHAR,width = 255)
|
||||
@Comment("签字数据路径")
|
||||
private String signature;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.budwk.app.sys.models;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Table("sys_user_source")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@TableIndexes({
|
||||
@Index(name = "INDEX_SYS_USER_SOURCE_LOGINNAMAE", fields = {"loginname"}, unique = false),
|
||||
@Index(name = "INDEX_SYS_USER_SOURCE_PULLTIME", fields = {"pullTime"}, unique = false)
|
||||
})
|
||||
@Comment("系统用户拉取数据表")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class Sys_user_source extends Sys_user {
|
||||
|
||||
@Name
|
||||
@Comment("ID")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
@PrevInsert(uu32 = true)
|
||||
private String id;
|
||||
|
||||
@Column
|
||||
@Comment("单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 255)
|
||||
private String unitName;
|
||||
|
||||
@Column
|
||||
@Comment("拉取时间")
|
||||
@ColDefine(type = ColType.DATETIME)
|
||||
private Date pullTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.budwk.app.sys.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.sys.models.Sys_user_source;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("用户数据拉取分页参数")
|
||||
public class SysDataUserPullPageForm extends PageForm<Sys_user_source> {
|
||||
|
||||
@ApiModelProperty("拉取日期")
|
||||
private String pullTime;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("工号")
|
||||
private String loginName;
|
||||
|
||||
@ApiModelProperty("单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty("在职状态")
|
||||
private String userState;
|
||||
|
||||
@ApiModelProperty("教职工类别")
|
||||
private String personType;
|
||||
|
||||
@ApiModelProperty("用人方式")
|
||||
private String preparedBy;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.budwk.app.sys.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.sys.views.View_user;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("用户数据更新分页参数")
|
||||
public class SysDataUserUpdatePageForm extends PageForm<View_user> {
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("工号")
|
||||
private String loginName;
|
||||
|
||||
@ApiModelProperty("单位")
|
||||
private String unitId;
|
||||
|
||||
@ApiModelProperty("人员类型")
|
||||
private String personType;
|
||||
|
||||
@ApiModelProperty("人事编制")
|
||||
private String preparedBy;
|
||||
|
||||
@ApiModelProperty("在职状态")
|
||||
private String userState;
|
||||
|
||||
@ApiModelProperty("异动类型")
|
||||
private String changeTime;
|
||||
|
||||
@ApiModelProperty("异动类型")
|
||||
private String changeType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.budwk.app.sys.param;
|
||||
|
||||
import com.budwk.app.base.param.ConditionGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
@ApiModel("用户数据更新参数")
|
||||
public class SysDataUserUpdateParam {
|
||||
|
||||
@ApiModelProperty("拉取时间")
|
||||
@NotBlank(message = "数据源不能为空")
|
||||
private String pullTime;
|
||||
|
||||
@ApiModelProperty("更新方式")
|
||||
@NotBlank(message = "更新方式不能为空")
|
||||
private String updateMode;
|
||||
|
||||
@ApiModelProperty("条件组 (可选)")
|
||||
private ConditionGroup conditionGroup;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.sys.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("系统首页活动管理查询参数")
|
||||
public class SysHomeActivityPageForm extends PageForm<Sys_home_activity> {
|
||||
|
||||
@ApiModelProperty("活动名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.budwk.app.sys.param;
|
||||
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(description = "消息统计参数")
|
||||
public class SysMsgSummaryPageForm extends PageForm {
|
||||
|
||||
@ApiModelProperty("消息ID")
|
||||
private String msgId;
|
||||
|
||||
@ApiModelProperty("工会ID")
|
||||
private String unionId;
|
||||
|
||||
@ApiModelProperty("单位ID")
|
||||
private String unitId;
|
||||
|
||||
@ApiModelProperty("阅读状态")
|
||||
private Integer readStatus;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.sys.models.Sys_api;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
|
||||
public interface SysApiService extends BaseService<Sys_api> {
|
||||
/**
|
||||
* 创建密钥
|
||||
*/
|
||||
void createAppkey(String name, String userId) throws Exception;
|
||||
|
||||
/**
|
||||
* 删除密钥
|
||||
*/
|
||||
void deleteAppkey(String appid) throws Exception;
|
||||
|
||||
/**
|
||||
* 启用禁用
|
||||
*/
|
||||
void updateAppkey(String appid, boolean disabled) throws Exception;
|
||||
|
||||
/**
|
||||
* 通过appid获取appkey
|
||||
*
|
||||
* @param appid appid
|
||||
* @return Sys_api
|
||||
*/
|
||||
String getAppkey(String appid);
|
||||
|
||||
/**
|
||||
* 删除缓存
|
||||
*
|
||||
* @param appid appid
|
||||
*/
|
||||
void deleteCache(String appid);
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
void clearCache();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_app_conf;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysAppConfService extends BaseService<Sys_app_conf> {
|
||||
List<String> getConfNameList();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_app_list;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysAppListService extends BaseService<Sys_app_list> {
|
||||
List<String> getAppNameList();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_app_task;
|
||||
|
||||
public interface SysAppTaskService extends BaseService<Sys_app_task> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.sys.models.Sys_config;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/23.
|
||||
*/
|
||||
public interface SysConfigService extends BaseService<Sys_config> {
|
||||
/**
|
||||
* 查询所有数据
|
||||
* @return
|
||||
*/
|
||||
List<Sys_config> getAllList();
|
||||
|
||||
Sys_config getValueByKey(String key);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_user_source;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface SysDataUserPullService extends BaseService<Sys_user_source> {
|
||||
|
||||
/**
|
||||
* 从信息中心拉取数据
|
||||
*/
|
||||
Date pull();
|
||||
|
||||
/**
|
||||
* 拉取人员博士后的信息
|
||||
*/
|
||||
Map<String, Date> pullPostDoctoral();
|
||||
|
||||
/**
|
||||
* 获取下拉框数据(单位、在职状态、人事编制、人员类型)
|
||||
*/
|
||||
NutMap searchOptions();
|
||||
|
||||
/**
|
||||
* 获取数据源拉取时间列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<NutMap> pullTimeOptions();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.sys.param.SysDataUserUpdateParam;
|
||||
|
||||
/**
|
||||
* 信息中心数据更新
|
||||
*/
|
||||
public interface SysDataUserUpdateService {
|
||||
String update(SysDataUserUpdateParam updateParam);
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_dict;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface SysDictService extends BaseService<Sys_dict> {
|
||||
/**
|
||||
* 通过code获取名称
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
String getNameByCode(String code);
|
||||
|
||||
/**
|
||||
* 通过ID获取名称
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
String getNameById(String id);
|
||||
|
||||
/**
|
||||
* 通过树PATH获取子级
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
List<Sys_dict> getSubListByPath(String path);
|
||||
|
||||
/**
|
||||
* 通过ID获取子级
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Sys_dict> getSubListById(String id);
|
||||
|
||||
/**
|
||||
* 通过code获取子级
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
List<Sys_dict> getSubListByCode(String code);
|
||||
|
||||
/**
|
||||
* 通过树PATH获取子级
|
||||
*
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
Map getSubMapByPath(String path);
|
||||
|
||||
/**
|
||||
* 通过ID获取子级
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Map getSubMapById(String id);
|
||||
|
||||
/**
|
||||
* 通过code获取子级
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
Map getSubMapByCode(String code);
|
||||
|
||||
/**
|
||||
* 保存数据字典
|
||||
*
|
||||
* @param dict
|
||||
* @param pid
|
||||
*/
|
||||
void save(Sys_dict dict, String pid);
|
||||
|
||||
/**
|
||||
* 保存数据字典
|
||||
*
|
||||
* @param dict dict
|
||||
* @param parentCode parentCode
|
||||
*/
|
||||
void saveByParentCode(Sys_dict dict, String parentCode);
|
||||
|
||||
/**
|
||||
* 级联删除数据
|
||||
*
|
||||
* @param dict
|
||||
*/
|
||||
void deleteAndChild(Sys_dict dict);
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
void clearCache();
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_file;
|
||||
import org.nutz.mvc.upload.TempFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件Service接口
|
||||
**/
|
||||
public interface SysFileService extends BaseService<Sys_file> {
|
||||
|
||||
/**
|
||||
* 文件上传,返回文件id
|
||||
*/
|
||||
String uploadReturnId(String engine, TempFile file);
|
||||
|
||||
/**
|
||||
* 文件上传,返回文件Url
|
||||
*/
|
||||
String uploadReturnUrl(String engine, TempFile file);
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
Pagination page(Sys_file file);
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
List<Sys_file> list();
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
void download(String id, HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
* @param id
|
||||
* @throws IOException
|
||||
*/
|
||||
byte[] download(String id) throws IOException;
|
||||
|
||||
/**
|
||||
* 转换为PDF
|
||||
*/
|
||||
void convertPDF(String id, HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*/
|
||||
void delete(List<String> id);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
Sys_file detail(String id);
|
||||
|
||||
/**
|
||||
* 预览详情
|
||||
*/
|
||||
List<Sys_file> previewFileData(String[] ids);
|
||||
|
||||
/**
|
||||
* 转换为HTML
|
||||
*/
|
||||
String convertHtml(TempFile file);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
|
||||
public interface SysHomeActivityService extends BaseService<Sys_home_activity> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.sys.models.Sys_home_activity;
|
||||
|
||||
public interface SysHomeConvert {
|
||||
|
||||
Sys_home_activity covertToSysHomeActivity();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.base.page.datatable.DataTableColumn;
|
||||
import com.budwk.app.base.page.datatable.DataTableOrder;
|
||||
import com.budwk.app.sys.models.Sys_log;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/22.
|
||||
*/
|
||||
public interface SysLogService extends BaseService<Sys_log> {
|
||||
/**
|
||||
* 快速插入日志
|
||||
*
|
||||
* @param syslog
|
||||
*/
|
||||
void fastInsertSysLog(Sys_log syslog);
|
||||
|
||||
/**
|
||||
* 分表查询数据
|
||||
*
|
||||
* @param tableName
|
||||
* @param length
|
||||
* @param start
|
||||
* @param draw
|
||||
* @param orders
|
||||
* @param columns
|
||||
* @param cnd
|
||||
* @param linkName
|
||||
* @return
|
||||
*/
|
||||
NutMap logData(String tableName, int length, int start, int draw, List<DataTableOrder> orders, List<DataTableColumn> columns, Cnd cnd, String linkName);
|
||||
|
||||
/**
|
||||
* 查询日期
|
||||
*
|
||||
* @param tablaeName 分表名称
|
||||
* @param pageNumber 页码
|
||||
* @param pageSize 页大小
|
||||
* @param cnd 查询条件
|
||||
* @return
|
||||
*/
|
||||
Pagination data(String tablaeName, int pageNumber, int pageSize, Cnd cnd);
|
||||
|
||||
/**
|
||||
* 多月日志条件查询
|
||||
*
|
||||
* @param date 时间范围
|
||||
* @param type 日志类型
|
||||
* @param pageOrderName 排序字段名称
|
||||
* @param pageOrderBy 排序方式
|
||||
* @param pageNumber 页码
|
||||
* @param pageSize 页大小
|
||||
* @return
|
||||
*/
|
||||
Pagination data(String[] date, String type, String pageOrderName, String pageOrderBy, int pageNumber, int pageSize);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_menu;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/22.
|
||||
*/
|
||||
public interface SysMenuService extends BaseService<Sys_menu> {
|
||||
/**
|
||||
* 保存菜单
|
||||
*
|
||||
* @param menu
|
||||
* @param pid
|
||||
*/
|
||||
void save(Sys_menu menu, String pid, List<NutMap> datas);
|
||||
|
||||
|
||||
void savePlus(Sys_menu menu, String pid, List<Sys_menu> permissions);
|
||||
|
||||
/**
|
||||
* 编辑菜单
|
||||
*
|
||||
* @param menu
|
||||
* @param pid
|
||||
*/
|
||||
void edit(Sys_menu menu, String pid, List<NutMap> datas);
|
||||
|
||||
void editPlus(Sys_menu menu, String pid, List<Sys_menu> permissions);
|
||||
|
||||
/**
|
||||
* 级联删除菜单
|
||||
*
|
||||
* @param menu
|
||||
*/
|
||||
void deleteAndChild(Sys_menu menu);
|
||||
|
||||
/**
|
||||
* 获取左侧菜单
|
||||
*
|
||||
* @param href
|
||||
* @return
|
||||
*/
|
||||
Sys_menu getLeftMenu(String href);
|
||||
|
||||
/**
|
||||
* 获取左侧菜单路径
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
Sys_menu getLeftPathMenu(List<String> list);
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
void clearCache();
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_msg;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysMsgService extends BaseService<Sys_msg> {
|
||||
/**
|
||||
* 保存信息同时发送
|
||||
*
|
||||
* @param sysMsg 消息体
|
||||
* @param users 接收人
|
||||
* @param isExternal 是否发送到外部消息(学校通讯平台)
|
||||
*/
|
||||
Sys_msg saveMsg(Sys_msg sysMsg, String[] users, boolean isExternal);
|
||||
|
||||
/**
|
||||
* 删除消息及消息用户表数据
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteMsg(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 通知客户端弹窗
|
||||
*
|
||||
* @param innerMsg
|
||||
* @param rooms
|
||||
*/
|
||||
void notify(Sys_msg innerMsg, String rooms[]);
|
||||
|
||||
/**
|
||||
* 通知客户端有新消息及消息数量
|
||||
*
|
||||
* @param room 用户名
|
||||
* @param size
|
||||
* @param list
|
||||
*/
|
||||
void innerMsg(String room, int size, List<NutMap> list);
|
||||
|
||||
/**
|
||||
* 获取某用户的未读消息数量及列表
|
||||
*
|
||||
* @param loginname 用户名
|
||||
*/
|
||||
void getMsg(String loginname);
|
||||
|
||||
/**
|
||||
* 通知下线
|
||||
*
|
||||
* @param loginname 用户名
|
||||
* @param httpSessionId
|
||||
*/
|
||||
void offline(String loginname, String httpSessionId);
|
||||
|
||||
/**
|
||||
* 向用户发送站内消息
|
||||
*
|
||||
* @param loginname 用户名
|
||||
* @param title 标题
|
||||
* @param body 内容
|
||||
* @param sender 发送者
|
||||
*/
|
||||
void sendMsg(String loginname, String title, String body, String sender);
|
||||
|
||||
/**
|
||||
* 向用户发送站内消息
|
||||
*
|
||||
* @param loginNames 用户名
|
||||
* @param title 标题
|
||||
* @param body 内容
|
||||
* @param sender 发送者
|
||||
*/
|
||||
void sendMsg(List<String> loginNames, String title, String body, String sender);
|
||||
|
||||
/**
|
||||
* 向用户发送站内消息
|
||||
*
|
||||
* @param loginNames 工号
|
||||
* @param title 标题
|
||||
* @param body 内容
|
||||
* @param sender 发送者
|
||||
*/
|
||||
void sendMsgInSys(List<String> loginNames, String title, String body, String sender);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_msg_user;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysMsgUserService extends BaseService<Sys_msg_user> {
|
||||
|
||||
/**
|
||||
* 获取未读消息数量
|
||||
*
|
||||
* @param loginname
|
||||
* @return
|
||||
*/
|
||||
int getUnreadNum(String loginname);
|
||||
|
||||
/**
|
||||
* 获取未读消息列表
|
||||
*
|
||||
* @param loginname
|
||||
* @param pageNumber
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
List<Sys_msg_user> getUnreadList(String loginname, int pageNumber, int pageSize);
|
||||
|
||||
/**
|
||||
* 删除用户缓存
|
||||
*
|
||||
* @param loginname
|
||||
*/
|
||||
void deleteCache(String loginname);
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
void clearCache();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_msg_user;
|
||||
import com.budwk.app.sys.param.SysMsgSummaryPageForm;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
public interface SysMsgUserSummaryService extends BaseService<Sys_msg_user> {
|
||||
|
||||
void exportMultipleAsZip(SysMsgSummaryPageForm pageForm, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 单个导出
|
||||
* @param id
|
||||
* @param response
|
||||
*/
|
||||
void exportSingleAsZip(String id, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 单个导出
|
||||
* @param id
|
||||
* @param byteArrayOutputStream
|
||||
*/
|
||||
void exportSingleAsFolder(String id, ByteArrayOutputStream byteArrayOutputStream);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_office_template;
|
||||
|
||||
public interface SysOfficeTemplateService extends BaseService<Sys_office_template> {
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_menu;
|
||||
import com.budwk.app.sys.models.Sys_role;
|
||||
import com.budwk.app.sys.models.Sys_unit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/22.
|
||||
*/
|
||||
public interface SysRoleService extends BaseService<Sys_role> {
|
||||
/**
|
||||
* 获取角色权限
|
||||
*
|
||||
* @param role 角色对象
|
||||
* @return
|
||||
*/
|
||||
List<String> getPermissionList(Sys_role role);
|
||||
|
||||
/**
|
||||
* 通过角色ID获取菜单及数据权限
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<Sys_menu> getMenusAndButtons(String roleId);
|
||||
|
||||
List<Sys_menu> getMenusAndButtons(String roleId, String platform);
|
||||
|
||||
/**
|
||||
* 通过角色ID获取菜单数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Sys_menu> getDatas(String roleId);
|
||||
|
||||
/**
|
||||
* 获取所有菜单数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Sys_menu> getDatas();
|
||||
|
||||
/**
|
||||
* 通过角色获取权限标识符
|
||||
*
|
||||
* @param role
|
||||
* @return
|
||||
*/
|
||||
List<String> getPermissionNameList(Sys_role role);
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*
|
||||
* @param roleid
|
||||
*/
|
||||
void del(String roleid);
|
||||
|
||||
/**
|
||||
* 批量删除角色
|
||||
*
|
||||
* @param roleids
|
||||
*/
|
||||
void del(String[] roleids);
|
||||
|
||||
/**
|
||||
* 保存菜单数据
|
||||
*
|
||||
* @param menuIds
|
||||
* @param roleId
|
||||
*/
|
||||
void saveMenu(String[] menuIds, String roleId);
|
||||
|
||||
void saveMenu(String[] menuIds, String roleId, String platform);
|
||||
|
||||
/**
|
||||
* 通过角色ID和菜单父ID获取下级权限菜单
|
||||
*
|
||||
* @param roleId
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
List<Sys_menu> getRoleMenus(String roleId, String pid);
|
||||
|
||||
/**
|
||||
* 判断角色是否有下级数据权限
|
||||
*
|
||||
* @param roleId
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
boolean hasChildren(String roleId, String pid);
|
||||
|
||||
/**
|
||||
* 查询用户
|
||||
*
|
||||
* @param roleId
|
||||
* @param keyword
|
||||
* @param isAdmin
|
||||
* @param sysUnit
|
||||
* @return
|
||||
*/
|
||||
Pagination userSearch(String roleId, String keyword, boolean isAdmin, Sys_unit sysUnit);
|
||||
|
||||
/**
|
||||
* 根据code获取角色
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
Sys_role getByCode(String code);
|
||||
|
||||
Sys_role getByCode(RoleConstant roleConstant);
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
void clearCache();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_route;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/23.
|
||||
*/
|
||||
public interface SysRouteService extends BaseService<Sys_route> {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_task;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/22.
|
||||
*/
|
||||
public interface SysTaskService extends BaseService<Sys_task> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.param.PageForm;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
import com.budwk.app.sys.models.Sys_union_group;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
public interface SysUnionGroupService extends BaseService<Sys_union_group> {
|
||||
|
||||
void insert(Sys_union_group group);
|
||||
|
||||
void update(Sys_union_group group);
|
||||
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 查询非组长的成员
|
||||
* @param unionId 分工会id
|
||||
* @param keyword 关键字
|
||||
*/
|
||||
List<NutMap> listNotLeader(String unionId, String keyword);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param pageForm 分页
|
||||
* @param unionId 分工会id
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(PageForm pageForm, String unionId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_union;
|
||||
|
||||
public interface SysUnionService extends BaseService<Sys_union> {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_unit;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/22.
|
||||
*/
|
||||
public interface SysUnitService extends BaseService<Sys_unit> {
|
||||
/**
|
||||
* 保存单位
|
||||
*
|
||||
* @param unit
|
||||
* @param pid
|
||||
*/
|
||||
void save(Sys_unit unit, String pid);
|
||||
|
||||
/**
|
||||
* 级联删除单位及单位下用户
|
||||
*
|
||||
* @param unit
|
||||
*/
|
||||
void deleteAndChild(Sys_unit unit);
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
void clearCache();
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.budwk.app.sys.services;
|
||||
|
||||
|
||||
import com.budwk.app.base.enums.LoginType;
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.exception.UnknownAccountException;
|
||||
import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.sys.models.Sys_menu;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/22.
|
||||
*/
|
||||
public interface SysUserService extends BaseService<Sys_user> {
|
||||
/**
|
||||
* 获取用户权限标识
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<String> getPermissionList(String userId);
|
||||
|
||||
/**
|
||||
* 查询用户的角色
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
List<String> getRoleCodeList(Sys_user user);
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户的菜单
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Sys_menu> getMenus(String userId);
|
||||
|
||||
/**
|
||||
* 通过用户ID获取菜单及权限
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Sys_menu> getMenusAndButtons(String userId);
|
||||
|
||||
List<Sys_menu> getMenusAndButtons(String userId, String platform);
|
||||
|
||||
/**
|
||||
* 通过用户ID获取菜单
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<Sys_menu> getDatas(String userId);
|
||||
|
||||
/**
|
||||
* 绑定菜单到用户
|
||||
*
|
||||
* @param user
|
||||
*/
|
||||
Sys_user fillMenu(Sys_user user);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void deleteById(String userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
*
|
||||
* @param userIds
|
||||
*/
|
||||
void deleteByIds(String[] userIds);
|
||||
|
||||
/**
|
||||
* 通过用户ID和菜单父ID获取下级权限菜单
|
||||
*
|
||||
* @param userId
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
List<Sys_menu> getRoleMenus(String userId, String pid);
|
||||
|
||||
/**
|
||||
* 判断用户是否有下级数据权限
|
||||
*
|
||||
* @param userId
|
||||
* @param pid
|
||||
* @return
|
||||
*/
|
||||
boolean hasChildren(String userId, String pid);
|
||||
|
||||
/**
|
||||
* 清除一个用户的缓存
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void deleteCache(String userId);
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
void clearCache();
|
||||
|
||||
/**
|
||||
* 检查用户是否存在
|
||||
*
|
||||
* @param loginname 用户名
|
||||
*/
|
||||
void checkLoginname(String loginname) throws BaseException;
|
||||
|
||||
/**
|
||||
* 检查第三方平台用户名是否存在系统中
|
||||
* 同上区别是这个会抛出UnknownAccountException
|
||||
*/
|
||||
void checkThirdPlatformLoginName(String loginname) throws UnknownAccountException;
|
||||
|
||||
/**
|
||||
* 检查用户是否存在
|
||||
*
|
||||
* @param mobile 手机号码
|
||||
*/
|
||||
void checkMobile(String mobile) throws BaseException;
|
||||
|
||||
/**
|
||||
* 通过用户名和密码获取用户信息
|
||||
*
|
||||
* @param loginname 用户名
|
||||
* @param passowrd 密码
|
||||
* @return
|
||||
* @throws BaseException
|
||||
*/
|
||||
Sys_user loginByPassword(String loginname, String passowrd) throws BaseException;
|
||||
|
||||
/**
|
||||
* 通过短信验证码登录
|
||||
*
|
||||
* @param mobile 手机号
|
||||
* @return
|
||||
* @throws BaseException
|
||||
*/
|
||||
Sys_user loginByMobile(String mobile) throws BaseException;
|
||||
|
||||
/**
|
||||
* 通过用户名获取用户信息
|
||||
* @param loginname
|
||||
* @return
|
||||
*/
|
||||
Sys_user loginByLoginName(String loginname);
|
||||
|
||||
/**
|
||||
* 通过用户名获取用户信息
|
||||
*
|
||||
* @param loginname 用户名
|
||||
* @return
|
||||
* @throws BaseException
|
||||
*/
|
||||
Sys_user getUserByLoginname(String loginname) throws BaseException;
|
||||
|
||||
/**
|
||||
* 通过用户ID获取用户信息
|
||||
*
|
||||
* @param id 用户ID
|
||||
* @return
|
||||
* @throws BaseException
|
||||
*/
|
||||
Sys_user getUserById(String id) throws BaseException;
|
||||
|
||||
/**
|
||||
* 获取登录用户及菜单信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return
|
||||
*/
|
||||
Sys_user getUserAndMenuById(String userId);
|
||||
|
||||
/**
|
||||
* 更新用户登录信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param ip IP地址
|
||||
*/
|
||||
void setLoginInfo(String userId, String ip);
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param user 用户
|
||||
* @param loginType 登录类型
|
||||
* @param request 请求
|
||||
* @return 跳转地址
|
||||
*/
|
||||
String loginPlus(Sys_user user, LoginType loginType, HttpServletRequest request);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.budwk.app.sys.services.impl;
|
||||
|
||||
import com.budwk.app.base.constant.RedisConstant;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_api;
|
||||
import com.budwk.app.sys.services.SysApiService;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheDefaults;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheRemove;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheRemoveAll;
|
||||
import org.nutz.plugins.wkcache.annotation.CacheResult;
|
||||
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
@CacheDefaults(cacheName = RedisConstant.PLATFORM_REDIS_WKCACHE_PREFIX + "sys_api",isHash = true)
|
||||
public class SysApiServiceImpl extends BaseServiceImpl<Sys_api> implements SysApiService {
|
||||
public SysApiServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
private String getAppid() {
|
||||
String appid = R.sg(16).next().replaceAll("_", "z");
|
||||
if (this.count(Cnd.where("appid", "=", appid)) > 0) {
|
||||
return getAppid();
|
||||
}
|
||||
return appid;
|
||||
}
|
||||
|
||||
public void createAppkey(String name, String userId) throws Exception {
|
||||
String appid = getAppid();
|
||||
Sys_api sysApi = new Sys_api();
|
||||
sysApi.setName(name);
|
||||
sysApi.setDisabled(false);
|
||||
sysApi.setAppid(appid);
|
||||
sysApi.setAppkey(R.sg(30).next().replaceAll("_", "z"));
|
||||
sysApi.setCreatedBy(userId);
|
||||
sysApi.setCreatedAt(System.currentTimeMillis());
|
||||
this.insert(sysApi);
|
||||
this.getAppkey(appid);//调用生成缓存
|
||||
}
|
||||
|
||||
public void deleteAppkey(String appid) throws Exception {
|
||||
this.delete(appid);
|
||||
this.deleteCache(appid);
|
||||
}
|
||||
|
||||
public void updateAppkey(String appid, boolean disabled) throws Exception {
|
||||
this.update(Chain.make("disabled", disabled), Cnd.where("appid", "=", appid));
|
||||
this.deleteCache(appid);
|
||||
this.getAppkey(appid);//调用生成缓存
|
||||
}
|
||||
|
||||
//注意这个cacheKey 是和 web-api 对应一致的,便于直接从redis取值,而不用依赖sys模块
|
||||
@CacheResult(cacheKey = "${appid}_appkey")
|
||||
public String getAppkey(String appid) {
|
||||
Sys_api sysApi = this.fetch(Cnd.where("appid", "=", appid).and("disabled", "=", false));
|
||||
if (sysApi != null) {
|
||||
return sysApi.getAppkey();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@CacheRemove(cacheKey = "${appid}_*")
|
||||
//可以通过el表达式加 * 通配符来批量删除一批缓存
|
||||
public void deleteCache(String appid) {
|
||||
|
||||
}
|
||||
|
||||
@CacheRemoveAll
|
||||
public void clearCache() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.budwk.app.sys.services.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_app_conf;
|
||||
import com.budwk.app.sys.services.SysAppConfService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2019/2/27.
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SysAppConfServiceImpl extends BaseServiceImpl<Sys_app_conf> implements SysAppConfService {
|
||||
public SysAppConfServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
public List<String> getConfNameList() {
|
||||
Sql sql = Sqls.create("SELECT DISTINCT confName FROM sys_app_conf");
|
||||
sql.setCallback(Sqls.callback.strs());
|
||||
this.dao().execute(sql);
|
||||
return sql.getList(String.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.budwk.app.sys.services.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_app_list;
|
||||
import com.budwk.app.sys.services.SysAppListService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2019/2/27.
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SysAppListServiceImpl extends BaseServiceImpl<Sys_app_list> implements SysAppListService {
|
||||
public SysAppListServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
public List<String> getAppNameList() {
|
||||
Sql sql = Sqls.create("SELECT DISTINCT appName FROM sys_app_list");
|
||||
sql.setCallback(Sqls.callback.strs());
|
||||
this.dao().execute(sql);
|
||||
return sql.getList(String.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.sys.services.impl;
|
||||
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_app_task;
|
||||
import com.budwk.app.sys.services.SysAppTaskService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2019/2/27.
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SysAppTaskServiceImpl extends BaseServiceImpl<Sys_app_task> implements SysAppTaskService {
|
||||
public SysAppTaskServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.budwk.app.sys.services.impl;
|
||||
|
||||
import com.budwk.app.base.exception.BaseException;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_config;
|
||||
import com.budwk.app.sys.services.SysConfigService;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by wizzer on 2016/12/23.
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SysConfigServiceImpl extends BaseServiceImpl<Sys_config> implements SysConfigService {
|
||||
public SysConfigServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
public List<Sys_config> getAllList() {
|
||||
return this.query(Cnd.where("delFlag", "=", false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sys_config getValueByKey(String key) {
|
||||
Sys_config sys_config = fetch(key);
|
||||
if (Lang.isEmpty(sys_config)) {
|
||||
throw new BaseException("系统参数{}键不存在", key);
|
||||
}
|
||||
return sys_config;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,500 @@
|
||||
package com.budwk.app.sys.services.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.thread.AsyncUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HtmlUtil;
|
||||
import com.budwk.app.base.constant.RoleConstant;
|
||||
import com.budwk.app.base.event.user.SysUserEvent;
|
||||
import com.budwk.app.base.event.user.SysUserPublisher;
|
||||
import com.budwk.app.base.utils.ConditionGroupUtil;
|
||||
import com.budwk.app.base.utils.ManyAddOrRenewUtil;
|
||||
import com.budwk.app.base.utils.PwdUtil;
|
||||
import com.budwk.app.sys.annotation.DataCenterColumn;
|
||||
import com.budwk.app.sys.models.*;
|
||||
import com.budwk.app.sys.param.SysDataUserUpdateParam;
|
||||
import com.budwk.app.sys.services.SysDataUserUpdateService;
|
||||
import com.budwk.app.sys.services.SysDictService;
|
||||
import com.budwk.app.sys.services.SysRoleService;
|
||||
import com.budwk.app.sys.services.SysUserService;
|
||||
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeOrigin;
|
||||
import com.budwk.app.zhgh.staffmanage.member.constant.MemberChangeType;
|
||||
import com.budwk.app.zhgh.staffmanage.member.service.MemberManageService;
|
||||
import com.budwk.app.zhgh.staffmanage.specialstaff.model.SpecialStaff;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.aop.Aop;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.random.R;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.Mvcs;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 全量更新系统用户数据
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
public class SysDataUserAllUpdateServiceImpl implements SysDataUserUpdateService {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private SysDictService sysDictService;
|
||||
@Inject
|
||||
private SysRoleService sysRoleService;
|
||||
@Inject
|
||||
private SysUserService sysUserService;
|
||||
@Inject
|
||||
private ThreadPoolTaskExecutor executorService;
|
||||
|
||||
/**
|
||||
* 字段映射类,用于缓存反射结果
|
||||
*/
|
||||
private static class FieldMapping {
|
||||
final Field field;
|
||||
final String key;
|
||||
final String name;
|
||||
|
||||
FieldMapping(Field field, DataCenterColumn annotation) {
|
||||
this.field = field;
|
||||
this.key = annotation.key();
|
||||
this.name = annotation.name();
|
||||
field.setAccessible(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 字段映射缓存
|
||||
*/
|
||||
private static List<FieldMapping> fieldMappings;
|
||||
|
||||
/**
|
||||
* 获取带有DataCenterColumn注解的字段映射,使用懒加载模式
|
||||
*
|
||||
* @return 字段映射列表
|
||||
*/
|
||||
private static List<FieldMapping> getFieldMappings() {
|
||||
if (fieldMappings == null) {
|
||||
synchronized (SysDataUserAllUpdateServiceImpl.class) {
|
||||
if (fieldMappings == null) {
|
||||
List<FieldMapping> mappings = new ArrayList<>();
|
||||
// 使用HuTool的反射工具获取所有字段,包括继承的字段
|
||||
Field[] fields = cn.hutool.core.util.ReflectUtil.getFields(Sys_user.class);
|
||||
for (Field field : fields) {
|
||||
DataCenterColumn annotation = field.getAnnotation(DataCenterColumn.class);
|
||||
if (annotation != null) {
|
||||
mappings.add(new FieldMapping(field, annotation));
|
||||
}
|
||||
}
|
||||
fieldMappings = mappings;
|
||||
}
|
||||
}
|
||||
}
|
||||
return fieldMappings;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否符合会员条件
|
||||
*
|
||||
* @param userState 用户状态
|
||||
* @param preparedBy 聘用方式
|
||||
* @param postDoctoralJoinDate 博士后进站时间
|
||||
* @return 是否符合会员条件
|
||||
*/
|
||||
private boolean checkMembershipEligibility(String userState, String preparedBy, Date postDoctoralJoinDate) {
|
||||
// 博士后单独判断:只要进站时间在两年内就是会员
|
||||
if ("博士后".equals(preparedBy)) {
|
||||
if (postDoctoralJoinDate != null) {
|
||||
Date twoYearsAgo = DateUtil.offset(DateUtil.date(), DateField.YEAR, -2).toJdkDate();
|
||||
return postDoctoralJoinDate.after(twoYearsAgo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// 其他人员需要判断在岗状态和聘用方式
|
||||
if (!"在岗".equals(userState)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 判断聘用方式
|
||||
Set<String> memberPreparedByTypes = new HashSet<>(Arrays.asList("新人事代理", "校聘合同制", "事业编制"));
|
||||
return memberPreparedByTypes.contains(preparedBy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 全量更新用户数据
|
||||
*
|
||||
* @param updateParam 更新参数
|
||||
* @return 更新结果描述
|
||||
*/
|
||||
@Override
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
public String update(SysDataUserUpdateParam updateParam) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
log.info("开始全量更新用户数据");
|
||||
|
||||
// 获取角色信息
|
||||
Sys_role publicRole = sysRoleService.getByCode(RoleConstant.PUBLIC);
|
||||
Sys_role memberRole = sysRoleService.getByCode(RoleConstant.MEMBER);
|
||||
|
||||
// 查询数据源
|
||||
Cnd cnd = Cnd.where(Sys_user_source::getPullTime, "=", updateParam.getPullTime());
|
||||
|
||||
// 处理复杂条件
|
||||
if (updateParam.getConditionGroup() != null) {
|
||||
cnd = ConditionGroupUtil.applyConditionGroup(cnd, updateParam.getConditionGroup());
|
||||
}
|
||||
|
||||
List<Sys_user_source> sources = dao.query(Sys_user_source.class, cnd.groupBy("loginname"));
|
||||
log.info("符合条件的数据源记录数: {}", sources.size());
|
||||
|
||||
// 查询系统用户
|
||||
List<Sys_user> sysUsers = dao.query(Sys_user.class, Cnd.NEW().groupBy("loginname"));
|
||||
Map<String, Sys_user> userMap = sysUsers.stream().collect(Collectors.toMap(Sys_user::getLoginname, sysUser -> sysUser));
|
||||
|
||||
// 准备数据集合
|
||||
List<Sys_user> needDoUpdateList = new ArrayList<>();
|
||||
List<Sys_user> needInitUserList = new ArrayList<>();
|
||||
List<Sys_user_history> histories = new ArrayList<>();
|
||||
List<String> addMemberUserIds = Collections.synchronizedList(new ArrayList<>());
|
||||
List<String> removeMemberUserIds = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
// 处理每条数据
|
||||
for (Sys_user_source source : sources) {
|
||||
Sys_user user = userMap.get(source.getLoginname());
|
||||
|
||||
// 创建用户对象
|
||||
Sys_user u = new Sys_user();
|
||||
BeanUtils.copyProperties(source, u);
|
||||
|
||||
if (user == null) {
|
||||
// 新增用户,初始化数据
|
||||
String salt = R.UU32();
|
||||
u.setSalt(salt);
|
||||
u.setPassword(PwdUtil.getPassword(PwdUtil.generate(12), salt));
|
||||
|
||||
// 检查是否符合会员条件
|
||||
boolean shouldBeMember = checkMembershipEligibility(
|
||||
source.getUserState(),
|
||||
source.getPreparedBy(),
|
||||
source.getPostDoctoralJoinDate()
|
||||
);
|
||||
|
||||
if (shouldBeMember) {
|
||||
u.setMember(true);
|
||||
addMemberUserIds.add(u.getId());
|
||||
} else {
|
||||
u.setMember(false);
|
||||
}
|
||||
|
||||
needInitUserList.add(u);
|
||||
} else {
|
||||
// 修改现有用户
|
||||
u.setId(user.getId());
|
||||
|
||||
// 检查会员资格
|
||||
boolean shouldBeMember = checkMembershipEligibility(
|
||||
source.getUserState(),
|
||||
source.getPreparedBy(),
|
||||
source.getPostDoctoralJoinDate()
|
||||
);
|
||||
|
||||
// 更新会员状态
|
||||
boolean currentIsMember = user.getMember() != null && user.getMember();
|
||||
|
||||
if (shouldBeMember && !currentIsMember) {
|
||||
// 添加会员
|
||||
u.setMember(true);
|
||||
addMemberUserIds.add(user.getId());
|
||||
} else if (!shouldBeMember && currentIsMember) {
|
||||
// 移除会员
|
||||
u.setMember(false);
|
||||
removeMemberUserIds.add(user.getId());
|
||||
}
|
||||
|
||||
needDoUpdateList.add(u);
|
||||
}
|
||||
|
||||
// 创建历史记录
|
||||
Sys_user_history history = createHistory(source, user);
|
||||
if (Lang.isNotEmpty(history)) {
|
||||
if (user != null) {
|
||||
histories.add(history);
|
||||
} else if (Lang.isNotEmpty(history.getChangeTypes()) && history.getChangeTypes().contains(MemberChangeType.NEW.name())) {
|
||||
histories.add(history);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 使用CompletableFuture处理并行任务
|
||||
List<CompletableFuture<Void>> updateTasks = new ArrayList<>();
|
||||
|
||||
// 1. 新增用户 - 使用批量处理
|
||||
if (Lang.isNotEmpty(needInitUserList)) {
|
||||
CompletableFuture<Void> insertTask = CompletableFuture.runAsync(() -> {
|
||||
log.info("新增用户: {} 个", needInitUserList.size());
|
||||
// 分批处理,每批200条
|
||||
List<List<Sys_user>> batches = ListUtil.split(needInitUserList, 500);
|
||||
batches.forEach(batch -> {
|
||||
try {
|
||||
dao.fastInsert(batch);
|
||||
} catch (Exception e) {
|
||||
log.error("批量新增用户异常", e);
|
||||
}
|
||||
});
|
||||
}, executorService);
|
||||
updateTasks.add(insertTask);
|
||||
|
||||
// 异步处理公共角色分配
|
||||
if (!needInitUserList.isEmpty()) {
|
||||
CompletableFuture<Void> roleTask = CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
log.info("为新用户分配公共角色");
|
||||
List<Sys_user_role> roleList = needInitUserList.stream().map(item -> {
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setRoleId(publicRole.getId());
|
||||
userRole.setUserId(item.getId());
|
||||
return userRole;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (!roleList.isEmpty()) {
|
||||
// 分批处理角色分配
|
||||
List<List<Sys_user_role>> roleBatches = ListUtil.split(roleList, 500);
|
||||
roleBatches.forEach(batch -> {
|
||||
try {
|
||||
dao.fastInsert(batch);
|
||||
} catch (Exception e) {
|
||||
log.error("批量分配角色异常", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("分配公共角色异常", e);
|
||||
}
|
||||
}, executorService);
|
||||
// 不等待角色分配完成
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 更新现有用户 - 使用批量处理
|
||||
if (Lang.isNotEmpty(needDoUpdateList)) {
|
||||
CompletableFuture<Void> updateTask = CompletableFuture.runAsync(() -> {
|
||||
log.info("更新用户: {} 个", needDoUpdateList.size());
|
||||
// 分批处理,每批200条
|
||||
List<List<Sys_user>> batches = ListUtil.split(needDoUpdateList, 500);
|
||||
batches.forEach(batch -> {
|
||||
try {
|
||||
dao.updateIgnoreNull(batch);
|
||||
} catch (Exception e) {
|
||||
log.error("批量更新用户异常", e);
|
||||
}
|
||||
});
|
||||
}, executorService);
|
||||
updateTasks.add(updateTask);
|
||||
}
|
||||
|
||||
// 等待用户数据更新完成
|
||||
try {
|
||||
// 设置超时时间,避免无限等待
|
||||
CompletableFuture.allOf(updateTasks.toArray(new CompletableFuture[0]))
|
||||
.get(5, TimeUnit.MINUTES);
|
||||
} catch (TimeoutException e) {
|
||||
log.warn("更新用户数据超时");
|
||||
return "更新超时,请检查数据处理情况";
|
||||
} catch (Exception e) {
|
||||
log.error("更新用户数据异常", e);
|
||||
return "更新失败: " + e.getMessage();
|
||||
}
|
||||
|
||||
// 3. 异步添加历史记录 - 不等待完成
|
||||
if (Lang.isNotEmpty(histories)) {
|
||||
executorService.execute(() -> {
|
||||
log.info("添加历史记录: {} 条", histories.size());
|
||||
// 分批处理历史记录
|
||||
List<List<Sys_user_history>> batches = ListUtil.split(histories, 500);
|
||||
batches.forEach(batch -> {
|
||||
try {
|
||||
dao.fastInsert(batch);
|
||||
} catch (Exception e) {
|
||||
log.error("批量添加历史记录异常", e);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 4. 异步添加会员角色 - 不等待完成
|
||||
if (Lang.isNotEmpty(addMemberUserIds)) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
log.info("添加会员角色: {} 个", addMemberUserIds.size());
|
||||
List<Sys_user_role> roleList = addMemberUserIds.stream().map(id -> {
|
||||
Sys_user_role userRole = new Sys_user_role();
|
||||
userRole.setRoleId(memberRole.getId());
|
||||
userRole.setUserId(id);
|
||||
return userRole;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (!roleList.isEmpty()) {
|
||||
// 分批处理角色分配
|
||||
List<List<Sys_user_role>> batches = ListUtil.split(roleList, 500);
|
||||
batches.forEach(batch -> {
|
||||
try {
|
||||
dao.fastInsert(batch);
|
||||
} catch (Exception e) {
|
||||
log.error("批量添加会员角色异常", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("添加会员角色异常", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 5. 异步移除会员角色 - 不等待完成
|
||||
if (Lang.isNotEmpty(removeMemberUserIds)) {
|
||||
executorService.execute(() -> {
|
||||
try {
|
||||
log.info("移除会员角色: {} 个", removeMemberUserIds.size());
|
||||
// 批量处理,避免IN子句过长
|
||||
List<List<String>> batches = ListUtil.split(removeMemberUserIds, 500);
|
||||
for (List<String> batch : batches) {
|
||||
try {
|
||||
dao.update(Sys_user.class, Chain.make("member", false), Cnd.where("id", "in", batch));
|
||||
dao.clear(Sys_user_role.class, Cnd.where("userId", "in", batch).and("roleId", "=", memberRole.getId()));
|
||||
} catch (Exception e) {
|
||||
log.error("批量移除会员角色异常", e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("移除会员角色异常", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info("全量更新用户数据完成,耗时: {} 毫秒", (endTime - startTime));
|
||||
|
||||
return "更新完成: 新增用户 " + needInitUserList.size() + " 个, 更新用户 " + needDoUpdateList.size()
|
||||
+ " 个, 待添加会员 " + addMemberUserIds.size() + " 个, 待移除会员 " + removeMemberUserIds.size() + " 个";
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建变更的历史数据
|
||||
*
|
||||
* @param source 数据源用户
|
||||
* @param user 系统用户
|
||||
* @return 历史记录
|
||||
*/
|
||||
private Sys_user_history createHistory(Sys_user_source source, Sys_user user) {
|
||||
List<String> changeTypes = new ArrayList<>();
|
||||
List<NutMap> changeList = new ArrayList<>();
|
||||
|
||||
// 初始化历史记录
|
||||
Sys_user_history history = new Sys_user_history();
|
||||
BeanUtil.copyProperties(source, history);
|
||||
history.setId(R.UU32());
|
||||
history.setChangeTime(DateUtil.date());
|
||||
history.setChangeOrigin(MemberChangeOrigin.SYSTEM.name());
|
||||
|
||||
// 新用户直接返回NEW类型
|
||||
if (user == null) {
|
||||
changeTypes.add(MemberChangeType.NEW.name());
|
||||
history.setChangeTypes(changeTypes);
|
||||
return history;
|
||||
}
|
||||
|
||||
// 遍历带有DataCenterColumn注解的字段进行比较
|
||||
for (FieldMapping mapping : getFieldMappings()) {
|
||||
try {
|
||||
Object sourceValue = mapping.field.get(source);
|
||||
Object userValue = mapping.field.get(user);
|
||||
|
||||
// 如果值不相等,记录变更
|
||||
if (!ObjectUtil.equals(sourceValue, userValue)) {
|
||||
NutMap change = NutMap.NEW();
|
||||
change.put("name", mapping.name);
|
||||
change.put("field", mapping.field.getName());
|
||||
change.put("value", userValue == null ? "" : userValue.toString());
|
||||
change.put("newValue", sourceValue == null ? "" : sourceValue.toString());
|
||||
changeList.add(change);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
log.error("字段比较失败: {}", mapping.field.getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果有任何字段变更,添加基本信息变更类型
|
||||
if (!changeList.isEmpty()) {
|
||||
changeTypes.add(MemberChangeType.BASIC_CHANGE.name());
|
||||
}
|
||||
|
||||
// 特殊字段变更处理
|
||||
// 1. 会员状态变更
|
||||
// if (!ObjectUtil.equals(user.getMember(), source.getMember())) {
|
||||
// if (source.getMember()) {
|
||||
// changeTypes.add(MemberChangeType.RESTORE.name());
|
||||
// } else {
|
||||
// changeTypes.add(MemberChangeType.WITHDRAWAL.name());
|
||||
// }
|
||||
// }
|
||||
|
||||
// 2. 单位变更
|
||||
if (!ObjectUtil.equals(user.getUnitId(), source.getUnitId())) {
|
||||
changeTypes.add(MemberChangeType.UNIT_CHANGE.name());
|
||||
NutMap change = NutMap.NEW();
|
||||
change.put("name", "单位");
|
||||
change.put("field", "unitId");
|
||||
change.put("value", user.getUnitId());
|
||||
change.put("newValue", source.getUnitId());
|
||||
changeList.add(change);
|
||||
}
|
||||
|
||||
// 如果没有任何变更,返回null
|
||||
if (changeTypes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 生成变更信息描述
|
||||
String changeInfos = changeList.stream()
|
||||
.map(v -> v.getString("name") + ":" +
|
||||
HtmlUtil.cleanHtmlTag(v.getString("value")) + "→" +
|
||||
HtmlUtil.cleanHtmlTag(v.getString("newValue")))
|
||||
.collect(Collectors.joining(";"));
|
||||
|
||||
// 设置历史记录信息
|
||||
history.setChangeTypes(changeTypes);
|
||||
history.setChangeInfos(changeList);
|
||||
history.setChangeInfosStr(changeInfos);
|
||||
|
||||
return history;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user