工会关系人员
This commit is contained in:
+163
@@ -0,0 +1,163 @@
|
||||
package io.v.nutz.zhgh.specialstaff.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.result.Result;
|
||||
import io.v.nutz.sys.models.Sys_user;
|
||||
import io.v.nutz.sys.models.User;
|
||||
import io.v.nutz.zhgh.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.specialstaff.param.SpecialStaffPageForm;
|
||||
import io.v.nutz.zhgh.specialstaff.service.SpecialStaffManageService;
|
||||
import io.v.nutz.zhgh.specialstaff.vo.SpecialStaffVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
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.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.List;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffManageController
|
||||
* @Date 2024/10/25 9:03
|
||||
* @注释 特殊人员管理
|
||||
*/
|
||||
@Slf4j
|
||||
@IocBean
|
||||
@Ok("json")
|
||||
@At("/platform/staff/special/manage")
|
||||
public class SpecialStaffManageController {
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
|
||||
@Inject
|
||||
private SpecialStaffManageService specialStaffManageService;
|
||||
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/specialstaff/manage/index.html")
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Object pageData(SpecialStaffPageForm pageForm) {
|
||||
Pagination pagination = specialStaffManageService.pageData(pageForm);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result getUserInfo(String userId) {
|
||||
NutMap userInfo = specialStaffManageService.getUserInfo(userId);
|
||||
return Result.success(userInfo);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result getSpecialStaffUserInfo(String userId) {
|
||||
NutMap specialStaffUserInfo = specialStaffManageService.getSpecialStaffUserInfo(userId);
|
||||
return Result.success(specialStaffUserInfo);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result addSpecialStaff(@Param("data") SpecialStaffVo specialStaffVo) {
|
||||
SpecialStaff staff = new SpecialStaff();
|
||||
Sys_user user = dao.fetch(Sys_user.class, specialStaffVo.getUserId());
|
||||
User viewUser = dao.fetch(User.class, Cnd.where("id", "=", specialStaffVo.getUserId()));
|
||||
SpecialStaff specialStaff = dao.fetch(SpecialStaff.class, Cnd.where("userId", "=", specialStaffVo.getUserId()));
|
||||
if (Lang.isNotEmpty(specialStaff)) {
|
||||
staff = specialStaff;
|
||||
}
|
||||
BeanUtil.copyProperties(specialStaffVo, staff);
|
||||
if (specialStaffVo.getIsManyUnit()!=null && specialStaffVo.getIsManyUnit()) {
|
||||
// 如果是多单位人员, 更改单位为工会关系
|
||||
// user.setUnitid(specialStaffVo.getUnionRelationUnitId());
|
||||
// user.setThreeUnitId(specialStaffVo.getUnionRelationThreeUnitId());
|
||||
// user.setIsManyUnit(true);
|
||||
dao.updateIgnoreNull(user);
|
||||
|
||||
staff.setPersonnelRelationUnitId(viewUser.getUnitid());
|
||||
staff.setPersonnelRelationUnitName(viewUser.getUnitname());
|
||||
staff.setPersonnelRelationUnionId(viewUser.getUnionid());
|
||||
staff.setPersonnelRelationUnionName(viewUser.getUnionname());
|
||||
// staff.setPersonnelRelationThreeUnitId(viewUser.getThreeUnitId());
|
||||
// staff.setPersonnelRelationThreeUnitName(viewUser.getThreeUnitName());
|
||||
// staff.setPersonnelRelationUnionGroupId(viewUser.getUnionGroupId());
|
||||
// staff.setPersonnelRelationUnionGroupName(viewUser.getUnionGroupName());
|
||||
}
|
||||
staff.setUserId(user.getId());
|
||||
dao.insertOrUpdate(staff);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@Aop(TransAop.READ_COMMITTED)
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result removeSpecialStaff(@Valid String userId) {
|
||||
SpecialStaff staff = dao.fetch(SpecialStaff.class, Cnd.where("userId", "=", userId));
|
||||
if (staff.getIsManyUnit()) {
|
||||
dao.update(Sys_user.class, Chain.make("unitid", staff.getPersonnelRelationUnitId())
|
||||
.add("threeUnitId", staff.getPersonnelRelationThreeUnitId())
|
||||
.add("isManyUnit", null), Cnd.where("id", "=", userId));
|
||||
}
|
||||
dao.clear(SpecialStaff.class, Cnd.where("userId", "=", userId));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@RequiresPermissions("staff.special.manage")
|
||||
public Result queryUser(String keyWord) {
|
||||
Sql sql = Sqls.create("""
|
||||
select
|
||||
id,
|
||||
username,
|
||||
loginname,
|
||||
unitid AS unitId,
|
||||
unitname AS unitName,
|
||||
unionid AS unionId,
|
||||
unionname AS unionName
|
||||
from
|
||||
`user`
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.where("id", "not in", "(select userId from special_staff)");
|
||||
if (StrUtil.isNotBlank(keyWord)) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("username", keyWord);
|
||||
seg.orLike("loginname", keyWord);
|
||||
cnd.and(seg);
|
||||
}
|
||||
cnd.limit(0, 10);
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = specialStaffManageService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package io.v.nutz.zhgh.specialstaff.model;
|
||||
|
||||
import io.v.nutz.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
import org.nutz.dao.interceptor.annotation.PrevInsert;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaff
|
||||
* @Date 2024/10/25 9:05
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@Comment("特别人员")
|
||||
@Table("special_staff")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SpecialStaff 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("人事关系部门")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String personnelRelationUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系部门名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String personnelRelationUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String personnelRelationUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String personnelRelationUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系三级单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String personnelRelationThreeUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系三级单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String personnelRelationThreeUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系工会小组")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String personnelRelationUnionGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("人事关系工会小组名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String personnelRelationUnionGroupName;
|
||||
|
||||
|
||||
/**
|
||||
* 工会关系
|
||||
*/
|
||||
@Column
|
||||
@Comment("工会关系部门")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionRelationUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系部门名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionRelationUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系工会")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionRelationUnionId;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系工会名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionRelationUnionName;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系三级单位")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionRelationThreeUnitId;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系三级单位名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||
private String unionRelationThreeUnitName;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系小组")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String unionRelationUnionGroupId;
|
||||
|
||||
@Column
|
||||
@Comment("工会关系小组名称")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 100)
|
||||
private String unionRelationUnionGroupName;
|
||||
|
||||
@Column
|
||||
@Comment("特殊人员类型")
|
||||
@ColDefine(type = ColType.BOOLEAN)
|
||||
@Default("0")
|
||||
private Boolean isManyUnit;
|
||||
|
||||
@Column
|
||||
@Comment("特殊人员类型")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||
private String specialStaffType;
|
||||
|
||||
@Column
|
||||
@Comment("特殊人员备注")
|
||||
@ColDefine(type = ColType.VARCHAR, width = 200)
|
||||
private String specialStaffRemark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package io.v.nutz.zhgh.specialstaff.param;
|
||||
|
||||
import io.v.nutz.base.query.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffPageForm
|
||||
* @Date 2024/10/25 9:31
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SpecialStaffPageForm extends PageForm {
|
||||
|
||||
private String unionId;
|
||||
|
||||
private String unitId;
|
||||
|
||||
private String unionGroupId;
|
||||
|
||||
private String threeUnitId;
|
||||
|
||||
private String personType;
|
||||
|
||||
private String userState;
|
||||
|
||||
private String specialStaffType;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.v.nutz.zhgh.specialstaff.service;
|
||||
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.BaseService;
|
||||
import io.v.nutz.zhgh.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.specialstaff.param.SpecialStaffPageForm;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffManageService
|
||||
* @Date 2024/10/25 9:42
|
||||
* @注释
|
||||
*/
|
||||
public interface SpecialStaffManageService extends BaseService<SpecialStaff> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param pageForm
|
||||
* @return
|
||||
*/
|
||||
Pagination pageData(SpecialStaffPageForm pageForm);
|
||||
|
||||
/**
|
||||
* 获取用户信息(人事关系)
|
||||
* @param userId 用户id
|
||||
* @return
|
||||
*/
|
||||
NutMap getUserInfo(String userId);
|
||||
|
||||
/**
|
||||
* 获取用户信息(特殊人员)
|
||||
* @param userId 用户id
|
||||
* @return
|
||||
*/
|
||||
NutMap getSpecialStaffUserInfo(String userId);
|
||||
}
|
||||
+143
@@ -0,0 +1,143 @@
|
||||
package io.v.nutz.zhgh.specialstaff.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.v.nutz.base.page.Pagination;
|
||||
import io.v.nutz.base.service.impl.BaseServiceImpl;
|
||||
import io.v.nutz.base.utils.PageUtil;
|
||||
import io.v.nutz.base.utils.Vi;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import io.v.nutz.zhgh.specialstaff.model.SpecialStaff;
|
||||
import io.v.nutz.zhgh.specialstaff.param.SpecialStaffPageForm;
|
||||
import io.v.nutz.zhgh.specialstaff.service.SpecialStaffManageService;
|
||||
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.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffManageServiceImpl
|
||||
* @Date 2024/10/25 9:43
|
||||
* @注释
|
||||
*/
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class SpecialStaffManageServiceImpl extends BaseServiceImpl<SpecialStaff> implements SpecialStaffManageService {
|
||||
public SpecialStaffManageServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination pageData(SpecialStaffPageForm pageForm) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
s.*,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.member,
|
||||
u.welfareMember,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.mobile,
|
||||
dict.`name` AS distSpecialStaffType,
|
||||
u.birthday
|
||||
FROM
|
||||
`special_staff` s
|
||||
LEFT JOIN `user` u ON s.userId = u.id
|
||||
LEFT JOIN `sys_dict` dict ON dict.`code` = s.specialStaffType
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
|
||||
cnd.and("u.unionId", "=", Vi.getUnionId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(pageForm.getSearchKeyword())) {
|
||||
SqlExpressionGroup seg = new SqlExpressionGroup();
|
||||
seg.orLike("u.username", pageForm.getSearchKeyword());
|
||||
seg.orLike("u.loginname", pageForm.getSearchKeyword());
|
||||
cnd.and(seg);
|
||||
}
|
||||
|
||||
if (StrUtil.isAllNotBlank(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
|
||||
cnd.orderBy(pageForm.getPageOrderName(), PageUtil.getOrder(pageForm.getPageOrderBy()));
|
||||
} else {
|
||||
cnd.asc("u.unitcode");
|
||||
cnd.asc("u.loginname");
|
||||
}
|
||||
|
||||
cnd.andEX("u.unionId", "=", pageForm.getUnionId());
|
||||
cnd.andEX("u.unitId", "=", pageForm.getUnitId());
|
||||
cnd.andEX("u.personType", "=", pageForm.getPersonType());
|
||||
cnd.andEX("u.userState", "=", pageForm.getUserState());
|
||||
cnd.andEX("u.personType", "=", pageForm.getPersonType());
|
||||
cnd.andEX("s.specialStaffType", "=", pageForm.getSpecialStaffType());
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NutMap getUserInfo(String userId) {
|
||||
// threeUnitId AS personnelRelationThreeUnitId,
|
||||
// threeUnitName AS personnelRelationThreeUnitName,
|
||||
// unionGroupId AS personnelRelationUnionGroupId,
|
||||
// unionGroupName AS personnelRelationUnionGroupName,
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
id AS userId,
|
||||
username,
|
||||
loginname,
|
||||
unitid AS personnelRelationUnitId,
|
||||
unitname AS personnelRelationUnitName,
|
||||
unionname AS personnelRelationUnionName,
|
||||
threeUnitId AS personnelRelationThreeUnitId,
|
||||
threeUnitName AS personnelRelationThreeUnitName,
|
||||
unionGroupId AS personnelRelationUnionGroupId,
|
||||
unionGroupName AS personnelRelationUnionGroupName,
|
||||
userState,
|
||||
personType,
|
||||
mobile
|
||||
FROM
|
||||
`user`
|
||||
WHERE
|
||||
id = @userId
|
||||
""");
|
||||
sql.setParam("userId", userId);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao().execute(sql);
|
||||
return (NutMap) sql.getResult();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NutMap getSpecialStaffUserInfo(String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
s.*,
|
||||
u.loginname,
|
||||
u.username,
|
||||
u.sex,
|
||||
u.member,
|
||||
u.welfareMember,
|
||||
u.personType,
|
||||
u.userState,
|
||||
u.unitname AS unionRelationUnitName,
|
||||
u.unionname AS unionRelationUnionName,
|
||||
u.mobile,
|
||||
u.birthday
|
||||
FROM
|
||||
`special_staff` s
|
||||
LEFT JOIN `user` u ON s.userId = u.id
|
||||
WHERE
|
||||
s.userId=@userId
|
||||
""");
|
||||
sql.setParam("userId", userId);
|
||||
sql.setCallback(Sqls.callback.map());
|
||||
dao().execute(sql);
|
||||
return (NutMap) sql.getResult();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package io.v.nutz.zhgh.specialstaff.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @version 1.0
|
||||
* @Author zzr
|
||||
* @name:SpecialStaffVo
|
||||
* @Date 2024/10/25 9:36
|
||||
* @注释
|
||||
*/
|
||||
@Data
|
||||
public class SpecialStaffVo {
|
||||
|
||||
private String id;
|
||||
private String userId;
|
||||
private String personnelRelationUnitId;
|
||||
private String personnelRelationUnitName;
|
||||
private String personnelRelationUnionId;
|
||||
private String personnelRelationUnionName;
|
||||
private String personnelRelationThreeUnitId;
|
||||
private String personnelRelationThreeUnitName;
|
||||
private String personnelRelationUnionGroupId;
|
||||
private String personnelRelationUnionGroupName;
|
||||
private String unionRelationUnitId;
|
||||
private String unionRelationUnitName;
|
||||
private String unionRelationUnionId;
|
||||
private String unionRelationUnionName;
|
||||
private String unionRelationThreeUnitId;
|
||||
private String unionRelationThreeUnitName;
|
||||
private String unionRelationUnionGroupId;
|
||||
private String unionRelationUnionGroupName;
|
||||
private Boolean isManyUnit;
|
||||
private String specialStaffType;
|
||||
private String specialStaffRemark;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user