fix:消息增加全部已读接口。部门新增时自动生成编码,用户导入数据时使用部门编码
This commit is contained in:
parent
afc92b8bf6
commit
4d645ef15a
@ -2,6 +2,8 @@ package com.ktg.web.controller.system;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ktg.system.strategy.AutoCodeUtil;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -35,6 +37,9 @@ public class SysDeptController extends BaseController
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysDeptService deptService;
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AutoCodeUtil autoCodeUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取部门列表
|
* 获取部门列表
|
||||||
*/
|
*/
|
||||||
@ -111,6 +116,8 @@ public class SysDeptController extends BaseController
|
|||||||
{
|
{
|
||||||
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
|
String s = autoCodeUtil.genSerialCode("DEPT_CODE", null);
|
||||||
|
dept.setDeptCode(s);
|
||||||
dept.setCreateBy(getUsername());
|
dept.setCreateBy(getUsername());
|
||||||
return toAjax(deptService.insertDept(dept));
|
return toAjax(deptService.insertDept(dept));
|
||||||
}
|
}
|
||||||
|
@ -118,4 +118,14 @@ public class SysMessageController extends BaseController
|
|||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部已读
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:message:READ')")
|
||||||
|
@GetMapping("/read")
|
||||||
|
public AjaxResult allRead() {
|
||||||
|
return sysMessageService.allRead();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package com.ktg.web.controller.system;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ktg.common.core.domain.vo.SysUserExcelVO;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -75,8 +77,8 @@ public class SysUserController extends BaseController
|
|||||||
@PostMapping("/importData")
|
@PostMapping("/importData")
|
||||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||||
{
|
{
|
||||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
ExcelUtil<SysUserExcelVO> util = new ExcelUtil<SysUserExcelVO>(SysUserExcelVO.class);
|
||||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
List<SysUserExcelVO> userList = util.importExcel(file.getInputStream());
|
||||||
String operName = getUsername();
|
String operName = getUsername();
|
||||||
String message = userService.importUser(userList, updateSupport, operName);
|
String message = userService.importUser(userList, updateSupport, operName);
|
||||||
return AjaxResult.success(message);
|
return AjaxResult.success(message);
|
||||||
|
@ -27,6 +27,9 @@ public class SysDept extends BaseEntity
|
|||||||
/** 祖级列表 */
|
/** 祖级列表 */
|
||||||
private String ancestors;
|
private String ancestors;
|
||||||
|
|
||||||
|
/** 部门编码 */
|
||||||
|
private String deptCode;
|
||||||
|
|
||||||
/** 部门名称 */
|
/** 部门名称 */
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
@ -180,12 +183,21 @@ public class SysDept extends BaseEntity
|
|||||||
this.children = children;
|
this.children = children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDeptCode() {
|
||||||
|
return deptCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptCode(String deptCode) {
|
||||||
|
this.deptCode = deptCode;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("deptId", getDeptId())
|
.append("deptId", getDeptId())
|
||||||
.append("parentId", getParentId())
|
.append("parentId", getParentId())
|
||||||
.append("ancestors", getAncestors())
|
.append("ancestors", getAncestors())
|
||||||
|
.append("deptCode", getDeptCode())
|
||||||
.append("deptName", getDeptName())
|
.append("deptName", getDeptName())
|
||||||
.append("orderNum", getOrderNum())
|
.append("orderNum", getOrderNum())
|
||||||
.append("leader", getLeader())
|
.append("leader", getLeader())
|
||||||
|
@ -0,0 +1,276 @@
|
|||||||
|
package com.ktg.common.core.domain.vo;
|
||||||
|
|
||||||
|
import com.ktg.common.annotation.Excel;
|
||||||
|
import com.ktg.common.annotation.Excels;
|
||||||
|
import com.ktg.common.core.domain.BaseEntity;
|
||||||
|
import com.ktg.common.core.domain.entity.SysDept;
|
||||||
|
import com.ktg.common.core.domain.entity.SysRole;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SysUserExcelVO extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
// @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 部门ID */
|
||||||
|
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
/** 部门Code */
|
||||||
|
@Excel(name = "部门编号", type = Excel.Type.IMPORT)
|
||||||
|
private String deptCode;
|
||||||
|
|
||||||
|
/** 用户账号 */
|
||||||
|
@Excel(name = "登录名称")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/** 用户昵称 */
|
||||||
|
@Excel(name = "用户名称")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/** 用户邮箱 */
|
||||||
|
@Excel(name = "用户邮箱")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/** 手机号码 */
|
||||||
|
@Excel(name = "手机号码")
|
||||||
|
private String phonenumber;
|
||||||
|
|
||||||
|
/** 用户性别 */
|
||||||
|
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
/** 用户头像 */
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/** 密码 */
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
/** 盐加密 */
|
||||||
|
private String salt;
|
||||||
|
|
||||||
|
/** 帐号状态(0正常 1停用) */
|
||||||
|
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
/** 最后登录IP */
|
||||||
|
@Excel(name = "最后登录IP", type = Excel.Type.EXPORT)
|
||||||
|
private String loginIp;
|
||||||
|
|
||||||
|
/** 最后登录时间 */
|
||||||
|
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
|
||||||
|
private Date loginDate;
|
||||||
|
|
||||||
|
/** 部门对象 */
|
||||||
|
@Excels({
|
||||||
|
@Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT),
|
||||||
|
@Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT)
|
||||||
|
})
|
||||||
|
private SysDept dept;
|
||||||
|
|
||||||
|
/** 角色对象 */
|
||||||
|
private List<SysRole> roles;
|
||||||
|
|
||||||
|
/** 角色组 */
|
||||||
|
private Long[] roleIds;
|
||||||
|
|
||||||
|
/** 岗位组 */
|
||||||
|
private Long[] postIds;
|
||||||
|
|
||||||
|
/** 角色ID */
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
public String getDeptCode() {
|
||||||
|
return deptCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptCode(String deptCode) {
|
||||||
|
this.deptCode = deptCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SysUserExcelVO{" +
|
||||||
|
"userId=" + userId +
|
||||||
|
", deptId=" + deptId +
|
||||||
|
", deptCode='" + deptCode + '\'' +
|
||||||
|
", userName='" + userName + '\'' +
|
||||||
|
", nickName='" + nickName + '\'' +
|
||||||
|
", email='" + email + '\'' +
|
||||||
|
", phonenumber='" + phonenumber + '\'' +
|
||||||
|
", sex='" + sex + '\'' +
|
||||||
|
", avatar='" + avatar + '\'' +
|
||||||
|
", password='" + password + '\'' +
|
||||||
|
", salt='" + salt + '\'' +
|
||||||
|
", status='" + status + '\'' +
|
||||||
|
", delFlag='" + delFlag + '\'' +
|
||||||
|
", loginIp='" + loginIp + '\'' +
|
||||||
|
", loginDate=" + loginDate +
|
||||||
|
", dept=" + dept +
|
||||||
|
", roles=" + roles +
|
||||||
|
", roleIds=" + Arrays.toString(roleIds) +
|
||||||
|
", postIds=" + Arrays.toString(postIds) +
|
||||||
|
", roleId=" + roleId +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDeptId() {
|
||||||
|
return deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeptId(Long deptId) {
|
||||||
|
this.deptId = deptId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNickName() {
|
||||||
|
return nickName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNickName(String nickName) {
|
||||||
|
this.nickName = nickName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhonenumber() {
|
||||||
|
return phonenumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhonenumber(String phonenumber) {
|
||||||
|
this.phonenumber = phonenumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSex() {
|
||||||
|
return sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSex(String sex) {
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAvatar() {
|
||||||
|
return avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvatar(String avatar) {
|
||||||
|
this.avatar = avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSalt() {
|
||||||
|
return salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSalt(String salt) {
|
||||||
|
this.salt = salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDelFlag() {
|
||||||
|
return delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDelFlag(String delFlag) {
|
||||||
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLoginIp() {
|
||||||
|
return loginIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoginIp(String loginIp) {
|
||||||
|
this.loginIp = loginIp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLoginDate() {
|
||||||
|
return loginDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLoginDate(Date loginDate) {
|
||||||
|
this.loginDate = loginDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysDept getDept() {
|
||||||
|
return dept;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDept(SysDept dept) {
|
||||||
|
this.dept = dept;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SysRole> getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(List<SysRole> roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long[] getRoleIds() {
|
||||||
|
return roleIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleIds(Long[] roleIds) {
|
||||||
|
this.roleIds = roleIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long[] getPostIds() {
|
||||||
|
return postIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostIds(Long[] postIds) {
|
||||||
|
this.postIds = postIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(Long roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
}
|
@ -115,4 +115,10 @@ public interface SysDeptMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeptById(Long deptId);
|
public int deleteDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有部门数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysDept> selectAllDeptList();
|
||||||
}
|
}
|
||||||
|
@ -58,4 +58,6 @@ public interface SysMessageMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteSysMessageByMessageIds(Long[] messageIds);
|
public int deleteSysMessageByMessageIds(Long[] messageIds);
|
||||||
|
|
||||||
|
List<SysMessage> getUnRead();
|
||||||
}
|
}
|
||||||
|
@ -113,4 +113,10 @@ public interface ISysDeptService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeptById(Long deptId);
|
public int deleteDeptById(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有部门数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SysDept> selectAllDeptList();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ktg.system.service;
|
package com.ktg.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
import com.ktg.system.domain.SysMessage;
|
import com.ktg.system.domain.SysMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,4 +60,10 @@ public interface ISysMessageService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteSysMessageByMessageId(Long messageId);
|
public int deleteSysMessageByMessageId(Long messageId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部已读
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult allRead();
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.ktg.system.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ktg.common.core.domain.entity.SysUser;
|
import com.ktg.common.core.domain.entity.SysUser;
|
||||||
|
import com.ktg.common.core.domain.vo.SysUserExcelVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户 业务层
|
* 用户 业务层
|
||||||
@ -209,7 +210,7 @@ public interface ISysUserService
|
|||||||
* @param operName 操作用户
|
* @param operName 操作用户
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
|
public String importUser(List<SysUserExcelVO> userList, Boolean isUpdateSupport, String operName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验昵称是否存在
|
* 校验昵称是否存在
|
||||||
|
@ -284,6 +284,11 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||||||
return deptMapper.deleteDeptById(deptId);
|
return deptMapper.deleteDeptById(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysDept> selectAllDeptList() {
|
||||||
|
return deptMapper.selectAllDeptList();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归列表
|
* 递归列表
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ktg.system.service.impl;
|
package com.ktg.system.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
import com.ktg.common.utils.DateUtils;
|
import com.ktg.common.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -93,4 +95,19 @@ public class SysMessageServiceImpl implements ISysMessageService
|
|||||||
{
|
{
|
||||||
return sysMessageMapper.deleteSysMessageByMessageId(messageId);
|
return sysMessageMapper.deleteSysMessageByMessageId(messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全部已读
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AjaxResult allRead() {
|
||||||
|
// 查询所有未读消息
|
||||||
|
List<SysMessage> messages = sysMessageMapper.getUnRead();
|
||||||
|
messages.forEach(item -> {
|
||||||
|
item.setStatus("READ");
|
||||||
|
sysMessageMapper.updateSysMessage(item);
|
||||||
|
});
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,18 @@ package com.ktg.system.service.impl;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import javax.validation.Validator;
|
import javax.validation.Validator;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.ktg.common.core.domain.entity.SysDept;
|
||||||
|
import com.ktg.common.core.domain.vo.SysUserExcelVO;
|
||||||
|
import com.ktg.system.service.ISysDeptService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -63,6 +69,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected Validator validator;
|
protected Validator validator;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysDeptService deptService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询用户列表
|
* 根据条件分页查询用户列表
|
||||||
*
|
*
|
||||||
@ -508,7 +517,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
|
public String importUser(List<SysUserExcelVO> userList, Boolean isUpdateSupport, String operName)
|
||||||
{
|
{
|
||||||
if (StringUtils.isNull(userList) || userList.size() == 0)
|
if (StringUtils.isNull(userList) || userList.size() == 0)
|
||||||
{
|
{
|
||||||
@ -518,9 +527,17 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
int failureNum = 0;
|
int failureNum = 0;
|
||||||
StringBuilder successMsg = new StringBuilder();
|
StringBuilder successMsg = new StringBuilder();
|
||||||
StringBuilder failureMsg = new StringBuilder();
|
StringBuilder failureMsg = new StringBuilder();
|
||||||
|
// 查询所有部门数据
|
||||||
|
List<SysDept> depts = deptService.selectAllDeptList();
|
||||||
|
Map<String, SysDept> collect = depts.stream().collect(Collectors.toMap(
|
||||||
|
SysDept::getDeptCode,
|
||||||
|
Function.identity()
|
||||||
|
));
|
||||||
String password = configService.selectConfigByKey("sys.user.initPassword");
|
String password = configService.selectConfigByKey("sys.user.initPassword");
|
||||||
for (SysUser user : userList)
|
for (SysUserExcelVO uservo : userList)
|
||||||
{
|
{
|
||||||
|
SysUser user = new SysUser();
|
||||||
|
BeanUtils.copyProperties(uservo, user);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (ObjectUtil.isEmpty(user.getNickName())) {
|
if (ObjectUtil.isEmpty(user.getNickName())) {
|
||||||
@ -533,6 +550,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|||||||
failureMsg.append("<br/>" + "昵称重复");
|
failureMsg.append("<br/>" + "昵称重复");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(uservo.getDeptCode())) {
|
||||||
|
user.setDeptId(collect.get(uservo.getDeptCode()).getDeptId());
|
||||||
|
}
|
||||||
// 验证是否存在这个用户
|
// 验证是否存在这个用户
|
||||||
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
||||||
if (StringUtils.isNull(u))
|
if (StringUtils.isNull(u))
|
||||||
|
@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<id property="deptId" column="dept_id" />
|
<id property="deptId" column="dept_id" />
|
||||||
<result property="parentId" column="parent_id" />
|
<result property="parentId" column="parent_id" />
|
||||||
<result property="ancestors" column="ancestors" />
|
<result property="ancestors" column="ancestors" />
|
||||||
|
<result property="deptCode" column="dept_code" />
|
||||||
<result property="deptName" column="dept_name" />
|
<result property="deptName" column="dept_name" />
|
||||||
<result property="orderNum" column="order_num" />
|
<result property="orderNum" column="order_num" />
|
||||||
<result property="leader" column="leader" />
|
<result property="leader" column="leader" />
|
||||||
@ -23,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeptVo">
|
<sql id="selectDeptVo">
|
||||||
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
|
select d.dept_id, d.parent_id, d.ancestors, d.dept_code, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
|
||||||
from sys_dept d
|
from sys_dept d
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
@ -84,11 +85,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectDeptVo"/>
|
<include refid="selectDeptVo"/>
|
||||||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectAllDeptList" resultType="com.ktg.common.core.domain.entity.SysDept" resultMap="SysDeptResult">
|
||||||
|
<include refid="selectDeptVo"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertDept" parameterType="SysDept">
|
<insert id="insertDept" parameterType="SysDept">
|
||||||
insert into sys_dept(
|
insert into sys_dept(
|
||||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||||
|
<if test="deptCode != null and deptCode != ''">dept_code,</if>
|
||||||
<if test="deptName != null and deptName != ''">dept_name,</if>
|
<if test="deptName != null and deptName != ''">dept_name,</if>
|
||||||
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
||||||
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||||
@ -101,7 +106,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
)values(
|
)values(
|
||||||
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
||||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||||
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
<if test="deptCode != null and deptCode != ''">#{deptCode},</if>
|
||||||
|
<if test="deptCode != null and deptCode != ''">#{deptName},</if>
|
||||||
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
||||||
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||||
<if test="leader != null and leader != ''">#{leader},</if>
|
<if test="leader != null and leader != ''">#{leader},</if>
|
||||||
|
@ -60,6 +60,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectSysMessageVo"/>
|
<include refid="selectSysMessageVo"/>
|
||||||
where message_id = #{messageId}
|
where message_id = #{messageId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getUnRead" resultType="com.ktg.system.domain.SysMessage" resultMap="SysMessageResult">
|
||||||
|
<include refid="selectSysMessageVo"/>
|
||||||
|
where status = 'UNREAD'
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertSysMessage" parameterType="SysMessage" useGeneratedKeys="true" keyProperty="messageId">
|
<insert id="insertSysMessage" parameterType="SysMessage" useGeneratedKeys="true" keyProperty="messageId">
|
||||||
insert into sys_message
|
insert into sys_message
|
||||||
|
Loading…
Reference in New Issue
Block a user