Merge branch 'dev_xd' of http://62.234.3.186:3000/jiangyq/YZProjectCloud into dev_xd
commit
2aa0013846
|
@ -113,6 +113,29 @@ public class SysUser extends BaseEntity
|
|||
/** 角色ID */
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 用于修改
|
||||
*/
|
||||
private Long oldComId;
|
||||
|
||||
public Long getOldComId() {
|
||||
return oldComId;
|
||||
}
|
||||
|
||||
public void setOldComId(Long oldComId) {
|
||||
this.oldComId = oldComId;
|
||||
}
|
||||
|
||||
private Long isActive;
|
||||
|
||||
public Long getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(Long isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public SysUser()
|
||||
{
|
||||
|
||||
|
|
|
@ -85,7 +85,11 @@ public class SysLoginService
|
|||
|
||||
if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData()))
|
||||
{
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
|
||||
String msg=userResult.getMsg();
|
||||
if(StringUtils.isBlank(msg)){
|
||||
msg="登录用户不存在";
|
||||
}
|
||||
recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, msg);
|
||||
throw new ServiceException("登录用户:" + username + " 不存在");
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ spring:
|
|||
config:
|
||||
# 配置中心地址
|
||||
server-addr: @discovery.server-addr@
|
||||
# 工作空间配置
|
||||
# namespace: a113aa27-4d61-46e0-81d6-9cede0457f0d
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -9,6 +9,9 @@ public class ProDept extends BaseEntity
|
|||
/** 部门ID */
|
||||
private Long deptId;
|
||||
|
||||
|
||||
|
||||
private Long comId;
|
||||
/** 父部门ID */
|
||||
private Long parentId;
|
||||
|
||||
|
@ -38,7 +41,13 @@ public class ProDept extends BaseEntity
|
|||
|
||||
/** 联系电话 */
|
||||
private String phone;
|
||||
public Long getComId() {
|
||||
return comId;
|
||||
}
|
||||
|
||||
public void setComId(Long comId) {
|
||||
this.comId = comId;
|
||||
}
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package com.yanzhu.system.domain;
|
||||
|
||||
import com.yanzhu.common.core.annotation.Excel;
|
||||
import com.yanzhu.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 系统用户扩展对象 sys_user_ext
|
||||
*
|
||||
* @author yanzhu
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public class SysUserCom extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 项目ID */
|
||||
private Long comId;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
private Long isActive;
|
||||
|
||||
private String comName;
|
||||
|
||||
public String getComName() {
|
||||
return comName;
|
||||
}
|
||||
|
||||
public void setComName(String comName) {
|
||||
this.comName = comName;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getComId() {
|
||||
return comId;
|
||||
}
|
||||
|
||||
public void setComId(Long comId) {
|
||||
this.comId = comId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(Long isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.yanzhu.system.domain;
|
||||
|
||||
import com.yanzhu.common.core.annotation.Excel;
|
||||
import com.yanzhu.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 系统用户扩展对象 sys_user_ext
|
||||
*
|
||||
* @author yanzhu
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public class SysUserExt extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 项目ID */
|
||||
private Long projectId;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
|
||||
/** 用户类型(00系统用户) */
|
||||
@Excel(name = "用户类型", readConverterExp = "0=0系统用户")
|
||||
private String userType;
|
||||
|
||||
private Long comId;
|
||||
|
||||
public Long getComId() {
|
||||
return comId;
|
||||
}
|
||||
|
||||
public void setComId(Long comId) {
|
||||
this.comId = comId;
|
||||
}
|
||||
|
||||
public Long getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(Long isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
private Long isActive;
|
||||
|
||||
public void setUserId(Long userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setProjectId(Long projectId)
|
||||
{
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public Long getProjectId()
|
||||
{
|
||||
return projectId;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
public void setUserType(String userType)
|
||||
{
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public String getUserType()
|
||||
{
|
||||
return userType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getUserId())
|
||||
.append("projectId", getProjectId())
|
||||
.append("status", getStatus())
|
||||
.append("userType", getUserType())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -16,6 +16,16 @@ public class SysUserPost
|
|||
/** 岗位ID */
|
||||
private Long postId;
|
||||
|
||||
private Long projectId;
|
||||
|
||||
public Long getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(Long projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.yanzhu.system.mapper;
|
||||
|
||||
import com.yanzhu.system.domain.SysUserCom;
|
||||
import com.yanzhu.system.domain.SysUserExt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统用户扩展Mapper接口
|
||||
*
|
||||
* @author yanzhu
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public interface SysUserComMapper
|
||||
{
|
||||
/**
|
||||
* 查询用户的租户
|
||||
* @param sysUserCom
|
||||
* @return
|
||||
*/
|
||||
public List<SysUserCom> selectUserComs(SysUserCom sysUserCom);
|
||||
|
||||
/**
|
||||
* 激活租户
|
||||
* @param sysUserCom
|
||||
* @return
|
||||
*/
|
||||
public int updateActive (SysUserCom sysUserCom);
|
||||
|
||||
public int insertUserCom(SysUserCom sysUserCom);
|
||||
/**
|
||||
* 更新状态
|
||||
* @param sysUserCom
|
||||
* @return
|
||||
*/
|
||||
public int updateStatus (SysUserCom sysUserCom);
|
||||
|
||||
public int updateActiveTo0(SysUserCom sysUserCom);
|
||||
|
||||
public List<SysUserCom> selectAdminComs();
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.yanzhu.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.yanzhu.system.domain.SysUserExt;
|
||||
|
||||
/**
|
||||
* 系统用户扩展Mapper接口
|
||||
*
|
||||
* @author yanzhu
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public interface SysUserExtMapper
|
||||
{
|
||||
/**
|
||||
* 查询系统用户扩展
|
||||
*
|
||||
* @param userId 系统用户扩展主键
|
||||
* @return 系统用户扩展
|
||||
*/
|
||||
public SysUserExt selectSysUserExtById(SysUserExt userExt);
|
||||
|
||||
/**
|
||||
* 查询系统用户扩展列表
|
||||
*
|
||||
* @param sysUserExt 系统用户扩展
|
||||
* @return 系统用户扩展集合
|
||||
*/
|
||||
public List<SysUserExt> selectSysUserExtList(SysUserExt sysUserExt);
|
||||
|
||||
/**
|
||||
* 新增系统用户扩展
|
||||
*
|
||||
* @param sysUserExt 系统用户扩展
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysUserExt(SysUserExt sysUserExt);
|
||||
|
||||
/**
|
||||
* 修改系统用户扩展
|
||||
*
|
||||
* @param sysUserExt 系统用户扩展
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysUserExt(SysUserExt sysUserExt);
|
||||
|
||||
/**
|
||||
* 删除系统用户扩展
|
||||
*/
|
||||
public int deleteSysUserExtById(SysUserExt sysUserExt);
|
||||
|
||||
|
||||
public int clearAllActive(SysUserExt userExt);
|
||||
|
||||
public int setActive(SysUserExt userExt);
|
||||
}
|
|
@ -45,6 +45,7 @@ public interface SysUserMapper
|
|||
*/
|
||||
public SysUser selectUserByUserName(String userName);
|
||||
|
||||
public SysUser selectByPhone(String phone);
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
|
@ -79,6 +80,8 @@ public interface SysUserMapper
|
|||
*/
|
||||
public SysUser selectUserByUserId(Long userId);
|
||||
|
||||
public SysUser selectUserCom(SysUser user);
|
||||
public List<SysUser> selectUserComs(Long userId);
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
|
@ -87,6 +90,8 @@ public interface SysUserMapper
|
|||
*/
|
||||
public int insertUser(SysUser user);
|
||||
|
||||
public int insertUserCom(SysUser user);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
|
@ -95,6 +100,7 @@ public interface SysUserMapper
|
|||
*/
|
||||
public int updateUser(SysUser user);
|
||||
|
||||
public int updateUserCom(SysUser user);
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
|
@ -121,6 +127,7 @@ public interface SysUserMapper
|
|||
*/
|
||||
public int deleteUserById(Long userId);
|
||||
|
||||
public int deleteUserCom(Long userId);
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.yanzhu.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.yanzhu.system.api.domain.SysUser;
|
||||
import com.yanzhu.system.domain.SysUserPost;
|
||||
|
||||
/**
|
||||
|
@ -41,4 +43,6 @@ public interface SysUserPostMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int batchUserPost(List<SysUserPost> userPostList);
|
||||
|
||||
void deleteUserPostByUser(SysUserPost user);
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and pi.is_del !=2
|
||||
</where>
|
||||
<if test="currentUserId == null "> order by pi.project_sort, pi.id desc</if>
|
||||
<if test="currentUserId != null "> order by pu.sort_by, pi.id desc</if>
|
||||
<if test="currentUserId != null "> order by psu.sort_by, pi.id desc</if>
|
||||
</select>
|
||||
|
||||
<select id="selectProProjectInfoById" parameterType="Long" resultMap="ProProjectInfoResult">
|
||||
|
@ -300,6 +300,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="insertDept" parameterType="ProDept" useGeneratedKeys="true" keyProperty="deptId">
|
||||
insert into sys_dept(
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
<if test="comId != null and comId != 0">com_id,</if>
|
||||
<if test="ancestors != null and ancestors != ''">ancestors,</if>
|
||||
<if test="deptName != null and deptName != ''">dept_name,</if>
|
||||
<if test="deptShortName != null and deptShortName != ''">dept_short_name,</if>
|
||||
|
@ -313,6 +314,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
create_time
|
||||
)values(
|
||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||
<if test="comId != null and comId != 0">#{comId},</if>
|
||||
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
||||
<if test="deptName != null and deptName != ''">#{deptName},</if>
|
||||
<if test="deptShortName != null and deptShortName != ''">#{deptShortName},</if>
|
||||
|
@ -331,6 +333,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update sys_dept
|
||||
<set>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
<if test="comId != null and comId != 0">com_id = #{comId},</if>
|
||||
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
|
||||
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
|
||||
<if test="deptShortName != null and deptShortName != ''">dept_short_name = #{deptShortName},</if>
|
||||
|
@ -347,7 +350,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<select id="selectMyProjectList" parameterType="ProProjectInfo" resultMap="ProProjectInfoResult">
|
||||
select pi.id, pi.com_id, pi.dis_dept_id, pi.project_name,
|
||||
select pi.id, pi.com_id, pi.dis_dept_id, pi.project_name,sd.dept_name com_name,
|
||||
pi.project_code, pi.simple_name, pi.project_type, sdd1.dict_label as project_type_name, pi.project_level, pi.project_regional, pi.project_package, pi.project_address, pi.project_nature,
|
||||
pi.tech_leader,pi.tech_leader_phone,pi.province,pi.city,pi.district,
|
||||
pi.licence_number, pi.project_person, pi.project_person_phone, pi.longitude, pi.latitude, pi.project_time_limit, pi.total_investment,
|
||||
|
@ -357,6 +360,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ps.id ps_id,ps.org_name ps_org_name,ps.org_logo ps_org_logo,ps.org_image ps_org_image,ps.org_video ps_org_video,ps.org_plane ps_org_plane
|
||||
from pro_project_info pi
|
||||
left join pro_project_info_setting ps on pi.id=ps.project_id
|
||||
left join sys_dept sd on pi.com_id=sd.dept_id
|
||||
left join sys_dict_data sdd1 on sdd1.dict_value = pi.project_type and sdd1.dict_type='pro_project_type'
|
||||
<if test="currentUserId != null "> left join pro_project_info_subdepts_users psu on psu.project_id = pi.id </if>
|
||||
<where>
|
||||
|
@ -381,7 +385,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and pi.is_del!= 2
|
||||
</where>
|
||||
<if test="currentUserId == null "> order by pi.project_sort, pi.id desc</if>
|
||||
<if test="currentUserId != null "> order by pu.sort_by, pi.id desc</if>
|
||||
<if test="currentUserId != null "> order by psu.sort_by, pi.id desc</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -340,7 +340,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<update id="editDefaultProjectById">
|
||||
update pro_project_info_subdepts_group set sort_by = project_id where user_id = #{userId}
|
||||
update pro_project_info_subdepts_users set sort_by = project_id where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
|
@ -118,7 +118,8 @@
|
|||
left join sys_user_role ur on rm.role_id = ur.role_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
left join sys_role_dept rd on rd.role_id = r.role_id
|
||||
where m.status = '0' and r.status = '0' and ur.user_id = #{userId} and rd.dept_id = #{deptId}
|
||||
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
|
||||
and rd.dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yanzhu.system.mapper.SysUserComMapper">
|
||||
|
||||
<resultMap type="SysUserCom" id="SysUserComResult">
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="comId" column="com_id" />
|
||||
<result property="comName" column="com_name" />
|
||||
<result property="status" column="status" />
|
||||
<result property="isActive" column="is_active" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<insert id="insertUserCom" parameterType="SysUserCom" >
|
||||
insert into sys_user_com(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="comId != null and comId != 0">com_id,</if>
|
||||
<if test="status != null and status!=''">status,</if>
|
||||
is_active
|
||||
|
||||
)values(
|
||||
<if test="userId != null and userId != 0">#{userId},</if>
|
||||
<if test="comId != null and comId != 0">#{comId},</if>
|
||||
<if test="status != null and status!=''">#{status},</if>
|
||||
#{isActive}
|
||||
)
|
||||
</insert>
|
||||
<select id="selectUserComs" parameterType="SysUserCom" resultMap="SysUserComResult">
|
||||
select uc.*,sd.dept_name com_name
|
||||
from sys_user_com uc left join sys_dept sd on uc.com_id=sd.dept_id
|
||||
<where>
|
||||
<if test="userId != null and userId != 0"> and uc.user_id = #{userId}</if>
|
||||
<if test="comId != null and comId != 0"> and uc.com_id = #{comId}</if>
|
||||
</where>
|
||||
|
||||
</select>
|
||||
<select id="selectAdminComs" resultMap="SysUserComResult">
|
||||
select uc.*, sd.dept_name com_name
|
||||
from (
|
||||
select DISTINCT com_id
|
||||
from pro_project_info) uc
|
||||
left join sys_dept sd on uc.com_id=sd.dept_id
|
||||
</select>
|
||||
<update id="updateActiveTo0" parameterType="SysUserCom">
|
||||
update sys_user_com set is_active=0 where user_id=#{userId}
|
||||
</update>
|
||||
<update id="updateActive" parameterType="SysUserCom">
|
||||
update sys_user_com set is_active=#{isActive} where user_id=#{userId} and com_id=#{comId}
|
||||
</update>
|
||||
<update id="updateStatus" parameterType="SysUserCom">
|
||||
update sys_user_com set status=#{status} where user_id=#{userId} and com_id=#{comId}
|
||||
</update>
|
||||
</mapper>
|
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yanzhu.system.mapper.SysUserExtMapper">
|
||||
|
||||
<resultMap type="SysUserExt" id="SysUserExtResult">
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="comId" column="com_id" />
|
||||
<result property="status" column="status" />
|
||||
<result property="userType" column="user_type" />
|
||||
<result property="isActive" column="is_active" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysUserExtVo">
|
||||
select user_id, project_id, status, user_type,com_id,is_active from sys_user_ext
|
||||
</sql>
|
||||
|
||||
<select id="selectSysUserExtList" parameterType="SysUserExt" resultMap="SysUserExtResult">
|
||||
<include refid="selectSysUserExtVo"/>
|
||||
<where>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="userType != null and userType != ''"> and user_type = #{userType}</if>
|
||||
<if test="userId != null and userId != 0"> and user_id = #{userId}</if>
|
||||
<if test="projectId != null and projectId != 0"> and project_id = #{projectId}</if>
|
||||
<if test="comId != null and comId != 0"> and com_id = #{comId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysUserExtById" parameterType="Long" resultMap="SysUserExtResult">
|
||||
<include refid="selectSysUserExtVo"/>
|
||||
where user_id = #{userId} and project_id=#{projectId}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysUserExt" parameterType="SysUserExt">
|
||||
insert into sys_user_ext
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="userType != null">user_type,</if>
|
||||
<if test="comId != null">com_id,</if>
|
||||
<if test="isActive != null">is_active,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="userType != null">#{userType},</if>
|
||||
<if test="comId != null">#{comId},</if>
|
||||
<if test="isActive != null">#{isActive},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysUserExt" parameterType="SysUserExt">
|
||||
update sys_user_ext
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="userType != null">user_type = #{userType},</if>
|
||||
<if test="comId != null">com_id = #{comId},</if>
|
||||
<if test="isActive != null">is_active = #{isActive},</if>
|
||||
</trim>
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysUserExtById" parameterType="SysUserExt">
|
||||
delete from sys_user_ext where user_id = #{userId} and project_id=#{projectId}
|
||||
</delete>
|
||||
<update id="clearAllActive" parameterType="SysUserExt">
|
||||
update sys_user_ext set is_active=0 where user_id=#{userId} and com_id=#{comId}
|
||||
</update>
|
||||
<update id="setActive" parameterType="SysUserExt">
|
||||
update sys_user_ext set is_active=1 where user_id=#{userId} and com_id=#{comId} and project_id=#{projectId}
|
||||
</update>
|
||||
</mapper>
|
|
@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="userType" column="user_type" />
|
||||
<result property="cardCode" column="card_code" />
|
||||
<result property="email" column="email" />
|
||||
<result property="isActive" column="is_active" />
|
||||
<result property="phonenumber" column="phonenumber" />
|
||||
<result property="sex" column="sex" />
|
||||
<result property="avatar" column="avatar" />
|
||||
|
@ -60,7 +61,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.com_id, com.dept_name as com_name, u.dept_id, u.user_name, u.nick_name, u.user_type, u.card_code, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
select u.user_id, u.com_id, com.dept_name as com_name, u.dept_id, u.user_name, u.nick_name, u.user_type, u.card_code, u.email
|
||||
, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.dept_short_name, d.dept_code, d.dept_type, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,com.dept_name com_dept_name
|
||||
from sys_user u
|
||||
|
@ -71,7 +73,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
|
||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.com_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
select u.user_id, u.com_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
|
||||
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != 0">
|
||||
|
@ -87,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND u.nick_name = #{nickName}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
AND uc.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
|
@ -159,7 +163,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectUserByIdAndDept" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
left join sys_role_dept rd on rd.role_id = r.role_id
|
||||
where u.user_id = #{userId} and rd.dept_id = ${deptId}
|
||||
where u.user_id = #{userId}
|
||||
<if test="deptId != null and deptId != ''">
|
||||
and rd.dept_id = ${deptId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectUserByUserId" parameterType="Long" resultMap="SysUserResult">
|
||||
|
@ -173,6 +180,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
|
||||
</select>
|
||||
<select id="selectByPhone" parameterType="String" resultMap="SysUserResult">
|
||||
select * from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
|
||||
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
||||
|
@ -221,8 +231,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||
<if test="userType != null ">userType = #{userType},</if>
|
||||
<if test="cardCode != null ">cardCode = #{cardCode},</if>
|
||||
<if test="userType != null ">user_Type = #{userType},</if>
|
||||
<if test="cardCode != null ">card_Code = #{cardCode},</if>
|
||||
<if test="email != null ">email = #{email},</if>
|
||||
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
|
@ -239,7 +249,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
|
||||
<update id="updateUserStatus" parameterType="SysUser">
|
||||
update sys_user set status = #{status} where user_id = #{userId}
|
||||
update sys_user_com set status = #{status} where user_id = #{userId} and com_id=#{comId}
|
||||
</update>
|
||||
<update id="updateUserComActive" parameterType="SysUser">
|
||||
update sys_user_com set is_active = #{isActive} where user_id = #{userId} and com_id=#{comId}
|
||||
</update>
|
||||
|
||||
<update id="updateUserAvatar" parameterType="SysUser">
|
||||
|
@ -269,4 +282,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where pu.user_id=#{userId} and pu.approve_status <![CDATA[ >= ]]> 100 and pu.is_del=0 and pu.use_status=0 order by pu.sort_by asc
|
||||
</select>
|
||||
|
||||
<insert id="insertUserCom" parameterType="SysUser" >
|
||||
insert into sys_user_com(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="comId != null and comId != 0">com_id,</if>
|
||||
<if test="status != null and status!=''">status,</if>
|
||||
is_active
|
||||
|
||||
)values(
|
||||
<if test="userId != null and userId != 0">#{userId},</if>
|
||||
<if test="comId != null and comId != 0">#{comId},</if>
|
||||
<if test="status != null and status!=''">#{status},</if>
|
||||
#{isActive}
|
||||
)
|
||||
</insert>
|
||||
<delete id="deleteUserCom" parameterType="SysUser">
|
||||
delete from sys_user_com where user_id=#{userId} and com_id=#{comId}
|
||||
</delete>
|
||||
|
||||
<select id="selectUserCom" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select user_id,com_id,status,is_active from sys_user_com where user_id=#{userId} and com_id=#{comId}
|
||||
</select>
|
||||
<update id="updateUserCom" parameterType="SysUser">
|
||||
update sys_user_com set com_id=#{comId} where user_id=#{userId}
|
||||
</update>
|
||||
<select id="selectUserComs" parameterType="Long" resultMap="SysUserResult">
|
||||
select user_id,com_id,status, is_active from sys_user_com where user_id=#{userId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<resultMap type="SysUserPost" id="SysUserPostResult">
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="postId" column="post_id" />
|
||||
<result property="projectId" column="project_id" />
|
||||
</resultMap>
|
||||
|
||||
<delete id="deleteUserPostByUserId" parameterType="Long">
|
||||
|
@ -24,10 +25,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserPostByUser" parameterType="SysUserPost">
|
||||
delete from sys_user_post where user_id=#{userId} and project_id=#{projectId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchUserPost">
|
||||
insert into sys_user_post(user_id, post_id) values
|
||||
insert into sys_user_post(user_id, post_id,project_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.userId},#{item.postId})
|
||||
(#{item.userId},#{item.postId},#{item.projectId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.yanzhu.common.security.annotation.RequiresPermissions;
|
|||
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||
import com.yanzhu.manage.domain.ProProjectInfo;
|
||||
import com.yanzhu.manage.service.IProProjectInfoService;
|
||||
import com.yanzhu.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -144,20 +145,16 @@ public class ProProjectInfoController extends BaseController
|
|||
public TableDataInfo findMyProjectList(ProProjectInfo proProjectInfo)
|
||||
{
|
||||
startPage();
|
||||
String key="proProjectInfo_findMyProjectList-"+ PageUtils.getLocalPage().getPageNum()+"-"+PageUtils.getLocalPage().getPageSize()+"-"+SecurityUtils.getUserId()+"-"+proProjectInfo.getProjectName();
|
||||
List<ProProjectInfo> list = redisService.getCacheObject(key);
|
||||
if(StringUtils.isNotEmpty(list)){
|
||||
return getDataTable(list);
|
||||
}
|
||||
if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
proProjectInfo.setComId(loginUser.getSysUser().getComId());
|
||||
if(!SecurityUtils.isAdmin(loginUser.getUserid())){
|
||||
if(SecurityUtils.isGSAdmin()){
|
||||
proProjectInfo.setActiveComId(SecurityUtils.getLoginUser().getProjectDeptId());
|
||||
}else{
|
||||
proProjectInfo.setCurrentUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
}
|
||||
list = proProjectInfoService.selectMyProjectList(proProjectInfo);
|
||||
redisService.setCacheObject(key, list, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
List<ProProjectInfo> list = proProjectInfoService.selectMyProjectList(proProjectInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,7 @@ public class ProProjectInfoServiceImpl implements IProProjectInfoService
|
|||
proDept.setDeptName(proProjectInfo.getProjectName());
|
||||
proDept.setDeptShortName(proProjectInfo.getSimpleName());
|
||||
proDept.setDeptType("4");
|
||||
proDept.setComId(sysDept.getComId());
|
||||
proDept.setOrderNum(100);
|
||||
proDept.setLeader(proProjectInfo.getProjectPerson());
|
||||
proDept.setPhone(proProjectInfo.getProjectPersonPhone());
|
||||
|
|
|
@ -22,6 +22,10 @@ import com.yanzhu.security.utils.DictUtils;
|
|||
import com.yanzhu.system.api.RemoteFlowService;
|
||||
import com.yanzhu.system.api.RemoteUserService;
|
||||
import com.yanzhu.system.api.domain.SysUser;
|
||||
import com.yanzhu.system.api.model.LoginUser;
|
||||
import com.yanzhu.system.domain.SysUserExt;
|
||||
import com.yanzhu.system.mapper.SysUserExtMapper;
|
||||
import com.yanzhu.system.mapper.SysUserMapper;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -69,6 +73,11 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu
|
|||
@Autowired
|
||||
private ProProjectInfoSubdeptsUsersMapper proProjectInfoSubdeptsUsersMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserExtMapper sysUserExtMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProProjectInfoSubdeptsUsersServiceImpl.class);
|
||||
|
||||
/**
|
||||
|
@ -844,11 +853,40 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu
|
|||
public int editDefaultProjectById(Long id){
|
||||
int res = proProjectInfoSubdeptsUsersMapper.editDefaultProjectById(SecurityUtils.getUserId());
|
||||
if(res>0){
|
||||
ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersById(id);
|
||||
ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersByParamId(id,SecurityUtils.getUserId());
|
||||
proProjectInfoSubdeptsUsers.setSortBy(0L);
|
||||
res = proProjectInfoSubdeptsUsersMapper.updateProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers);
|
||||
}
|
||||
return res;
|
||||
boolean isAdmin= (SecurityUtils.isAdmin(SecurityUtils.getUserId()) || SecurityUtils.isGSAdmin());
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if(isAdmin){
|
||||
SysUserExt userExt = new SysUserExt();
|
||||
userExt.setUserId(loginUser.getUserid());
|
||||
userExt.setComId(loginUser.getSysUser().getComId());
|
||||
List<SysUserExt> userExts=sysUserExtMapper.selectSysUserExtList(userExt);
|
||||
if(userExts.size()>0){
|
||||
SysUserExt oldExt = userExts.get(0);
|
||||
oldExt.setProjectId(id);
|
||||
oldExt.setIsActive(1l);
|
||||
sysUserExtMapper.updateSysUserExt(oldExt);
|
||||
}else{
|
||||
userExt.setProjectId(id);
|
||||
userExt.setStatus("0");
|
||||
userExt.setIsActive(1l);
|
||||
sysUserExtMapper.insertSysUserExt(userExt);
|
||||
}
|
||||
}else {
|
||||
SysUserExt userExt = new SysUserExt();
|
||||
userExt.setUserId(loginUser.getUserid());
|
||||
userExt.setComId(loginUser.getSysUser().getComId());
|
||||
userExt.setProjectId(id);
|
||||
sysUserExtMapper.clearAllActive(userExt);//清除所有激活状态
|
||||
sysUserExtMapper.setActive(userExt);//设置激活状态
|
||||
}
|
||||
SysUser oldUser=sysUserMapper.selectUserByUserId(loginUser.getUserid());
|
||||
oldUser.setDeptId(id);
|
||||
sysUserMapper.updateUser(oldUser);
|
||||
return res+1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package com.yanzhu.system.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.yanzhu.system.domain.SysUserCom;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.yanzhu.common.core.domain.R;
|
||||
import com.yanzhu.common.core.utils.StringUtils;
|
||||
|
@ -155,4 +151,16 @@ public class SysProfileController extends BaseController
|
|||
}
|
||||
return error("上传图片异常,请联系管理员");
|
||||
}
|
||||
|
||||
@GetMapping("/getUserComps/{userId}")
|
||||
public AjaxResult getUserComs(@PathVariable Long userId){
|
||||
if(userId==null||userId.longValue()==0){
|
||||
userId=SecurityUtils.getLoginUser().getUserid();
|
||||
}
|
||||
boolean isAdmin= (SecurityUtils.isAdmin(SecurityUtils.getUserId()) || SecurityUtils.isGSAdmin());
|
||||
if(isAdmin){
|
||||
return AjaxResult.success(userService.getAdminComs());
|
||||
}
|
||||
return AjaxResult.success(userService.getUserComs(userId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.yanzhu.system.controller;
|
|||
import com.yanzhu.common.core.constant.Constants;
|
||||
import com.yanzhu.common.core.domain.R;
|
||||
import com.yanzhu.common.core.enums.UserTypeEnums;
|
||||
import com.yanzhu.common.core.exception.ServiceException;
|
||||
import com.yanzhu.common.core.text.Convert;
|
||||
import com.yanzhu.common.core.utils.StringUtils;
|
||||
import com.yanzhu.common.core.utils.poi.ExcelUtil;
|
||||
|
@ -14,11 +15,13 @@ import com.yanzhu.common.log.enums.BusinessType;
|
|||
import com.yanzhu.common.redis.service.RedisService;
|
||||
import com.yanzhu.common.security.annotation.InnerAuth;
|
||||
import com.yanzhu.common.security.annotation.RequiresPermissions;
|
||||
import com.yanzhu.common.security.service.TokenService;
|
||||
import com.yanzhu.common.security.utils.SecurityUtils;
|
||||
import com.yanzhu.system.api.domain.SysDept;
|
||||
import com.yanzhu.system.api.domain.SysRole;
|
||||
import com.yanzhu.system.api.domain.SysUser;
|
||||
import com.yanzhu.system.api.model.LoginUser;
|
||||
import com.yanzhu.system.domain.SysUserCom;
|
||||
import com.yanzhu.system.domain.vo.TreeSelect;
|
||||
import com.yanzhu.system.service.*;
|
||||
import com.yanzhu.system.vo.AlertUserPassVo;
|
||||
|
@ -29,6 +32,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
|
@ -65,6 +69,8 @@ public class SysUserController extends BaseController {
|
|||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
|
@ -109,12 +115,22 @@ public class SysUserController extends BaseController {
|
|||
@InnerAuth
|
||||
@GetMapping("/info/{username}")
|
||||
public R<LoginUser> info(@PathVariable("username") String username) {
|
||||
try {
|
||||
LoginUser sysUserVo = getLoginInfo(username);
|
||||
|
||||
return R.ok(sysUserVo);
|
||||
}catch (ServiceException ex){
|
||||
return R.fail(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private LoginUser getLoginInfo(String username){
|
||||
SysUser sysUser = userService.selectUserByUserName(username);
|
||||
if (StringUtils.isNull(sysUser)) {
|
||||
return R.fail("用户名或密码错误");
|
||||
throw new ServiceException("用户名或密码错误");
|
||||
}
|
||||
if (StringUtils.isEmpty(sysUser.getRoles())) {
|
||||
return R.fail("用户未查询到分配角色,请联系管理员!!!");
|
||||
throw new ServiceException("用户未查询到分配角色,请联系管理员!!!");
|
||||
}
|
||||
// 重写登录方法
|
||||
if (!sysUser.isAdmin() && sysUser.getRoles().size() > 1) {
|
||||
|
@ -125,6 +141,7 @@ public class SysUserController extends BaseController {
|
|||
sysUser.setActiveComId(sysUser.getComId());
|
||||
sysUser.setActiveComName(sysUser.getComName());
|
||||
} else {
|
||||
/*
|
||||
// 查询用户绑定项目列表
|
||||
List<Map<String, Object>> list = userService.selectProjectsByUserId(sysUser.getUserId());
|
||||
if (StringUtils.isEmpty(list)) {
|
||||
|
@ -136,6 +153,25 @@ public class SysUserController extends BaseController {
|
|||
sysUser.setActiveComName(Convert.toStr(list.get(0).get("com_name")));
|
||||
sysUser.setActiveProjectId(Convert.toLong(list.get(0).get("project_id")));
|
||||
sysUser.setActiveProjectName(Convert.toStr(list.get(0).get("project_name")));
|
||||
|
||||
*/
|
||||
sysUser.setActiveComId(sysUser.getComId());
|
||||
sysUser.setActiveComName(sysUser.getComName());
|
||||
sysUser.setActiveProjectId(sysUser.getDeptId());
|
||||
if(sysUser.getDept()!=null){
|
||||
sysUser.setActiveProjectName(sysUser.getDept().getDeptName());
|
||||
}else{
|
||||
sysUser.setActiveProjectName("");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
sysUser.setActiveComId(sysUser.getComId());
|
||||
sysUser.setActiveComName(sysUser.getComName());
|
||||
sysUser.setActiveProjectId(sysUser.getDeptId());
|
||||
if(sysUser.getDept()!=null){
|
||||
sysUser.setActiveProjectName(sysUser.getDept().getDeptName());
|
||||
}else{
|
||||
sysUser.setActiveProjectName("");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,10 +191,20 @@ public class SysUserController extends BaseController {
|
|||
roles.add("visitors");
|
||||
sysUserVo.setRoles(roles);
|
||||
}
|
||||
|
||||
return R.ok(sysUserVo);
|
||||
return sysUserVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按电话号码查询用户信息
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("system:user:list")
|
||||
@GetMapping("/selectByPhone/{phone}")
|
||||
public R<SysUser> selectByPhone(@PathVariable("phone") String phone) {
|
||||
SysUser sysUser = userService.selectByPhone(phone);
|
||||
return R.ok(sysUser);
|
||||
}
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
*/
|
||||
|
@ -227,7 +273,7 @@ public class SysUserController extends BaseController {
|
|||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
@GetMapping("/getInfo")
|
||||
public AjaxResult getInfo() {
|
||||
SysUser user = SecurityUtils.getLoginUser().getSysUser();
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
|
@ -265,7 +311,7 @@ public class SysUserController extends BaseController {
|
|||
sysUser = userService.selectUserById(userId);
|
||||
} else {
|
||||
user = userService.selectUserByUserId(userId);
|
||||
sysUser = userService.selectUserByIdAndDept(userId, user.getDeptId());
|
||||
sysUser = user.getDeptId()!=null?userService.selectUserByIdAndDept(userId, user.getDeptId()):null;
|
||||
}
|
||||
if(sysUser!=null) {
|
||||
ajax.put(AjaxResult.DATA_TAG, sysUser);
|
||||
|
@ -286,18 +332,24 @@ public class SysUserController extends BaseController {
|
|||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysUser user) {
|
||||
/*
|
||||
if (StringUtils.isNotEmpty(user.getUserName()) && !userService.checkUserNameUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
}*/
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
@GetMapping("/getUserByName/{userName}")
|
||||
@RequiresPermissions("system:user:query")
|
||||
public AjaxResult getUserByName(@PathVariable(value = "userName", required = true)String userName) {
|
||||
return AjaxResult.success(userService.getUserByName(userName));
|
||||
}
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
|
@ -314,6 +366,17 @@ public class SysUserController extends BaseController {
|
|||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
SysUser where=new SysUser();
|
||||
where.setUserName(user.getUserName());
|
||||
List<SysUser> list=userService.selectUserList(where);
|
||||
if(list.size()>1){
|
||||
return error("此用户名己存在,修改失败!");
|
||||
}
|
||||
if(list.size()==1){
|
||||
if(user.getUserId().intValue()!=list.get(0).getUserId().intValue()){
|
||||
return error("此用户名己存在,修改失败!");
|
||||
}
|
||||
}
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
@ -416,4 +479,36 @@ public class SysUserController extends BaseController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PostMapping("/activeUserCom")
|
||||
public AjaxResult activeUserCom(@RequestBody SysUserCom userCom, HttpServletRequest request){
|
||||
boolean isAdmin= (SecurityUtils.isAdmin(SecurityUtils.getUserId()) || SecurityUtils.isGSAdmin());
|
||||
SysUser user= isAdmin?userService.activeAdminCom(userCom): userService.activeUserCom(userCom);
|
||||
|
||||
LoginUser sysUserVo = getLoginInfo(user.getUserName());
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
loginUser.setSysUser(sysUserVo.getSysUser());
|
||||
loginUser.setProjectId(sysUserVo.getProjectId());
|
||||
loginUser.setProjectName(sysUserVo.getProjectName());
|
||||
loginUser.setProjectDeptId(sysUserVo.getProjectDeptId());
|
||||
loginUser.setProjectDeptName(sysUserVo.getProjectDeptName());
|
||||
loginUser.setRoles(sysUserVo.getRoles());
|
||||
loginUser.setPermissions(sysUserVo.getPermissions());
|
||||
tokenService.refreshToken(loginUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@GetMapping("/reload")
|
||||
public AjaxResult reload(HttpServletRequest request){
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
LoginUser sysUserVo = getLoginInfo(loginUser.getUsername());
|
||||
loginUser.setSysUser(sysUserVo.getSysUser());
|
||||
loginUser.setProjectId(sysUserVo.getProjectId());
|
||||
loginUser.setProjectName(sysUserVo.getProjectName());
|
||||
loginUser.setProjectDeptId(sysUserVo.getProjectDeptId());
|
||||
loginUser.setProjectDeptName(sysUserVo.getProjectDeptName());
|
||||
loginUser.setRoles(sysUserVo.getRoles());
|
||||
loginUser.setPermissions(sysUserVo.getPermissions());
|
||||
tokenService.refreshToken(loginUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.yanzhu.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.yanzhu.system.api.domain.SysUser;
|
||||
import com.yanzhu.system.domain.SysUserExt;
|
||||
|
||||
/**
|
||||
* 系统用户扩展Service接口
|
||||
*
|
||||
* @author yanzhu
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
public interface ISysUserExtService
|
||||
{
|
||||
/**
|
||||
* 查询系统用户扩展
|
||||
*/
|
||||
public SysUserExt selectSysUserExtById(SysUserExt sysUserExt);
|
||||
|
||||
/**
|
||||
* 查询系统用户扩展列表
|
||||
*
|
||||
* @param sysUserExt 系统用户扩展
|
||||
* @return 系统用户扩展集合
|
||||
*/
|
||||
public List<SysUserExt> selectSysUserExtList(SysUserExt sysUserExt);
|
||||
|
||||
/**
|
||||
* 新增系统用户扩展
|
||||
*
|
||||
* @param sysUserExt 系统用户扩展
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysUserExt(SysUserExt sysUserExt);
|
||||
|
||||
/**
|
||||
* 修改系统用户扩展
|
||||
*
|
||||
* @param sysUserExt 系统用户扩展
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysUserExt(SysUserExt sysUserExt);
|
||||
|
||||
|
||||
/**
|
||||
* 删除系统用户扩展信息
|
||||
*/
|
||||
public int deleteSysUserExtById(SysUserExt sysUserExt);
|
||||
|
||||
public void updateBySysUser(SysUser sysUser);
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.yanzhu.system.service;
|
||||
|
||||
import com.yanzhu.system.api.domain.SysUser;
|
||||
import com.yanzhu.system.domain.SysUserCom;
|
||||
import com.yanzhu.system.vo.AlertUserPassVo;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -45,6 +46,12 @@ public interface ISysUserService
|
|||
*/
|
||||
public SysUser selectUserByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 通过电话号码查询用户信息
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
public SysUser selectByPhone(String phone);
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
|
@ -103,6 +110,7 @@ public interface ISysUserService
|
|||
*/
|
||||
public boolean checkUserNameUnique(SysUser user);
|
||||
|
||||
public SysUser getUserByName(String userName);
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
|
@ -254,4 +262,31 @@ public interface ISysUserService
|
|||
* @return
|
||||
*/
|
||||
public int updataUserPassWord(AlertUserPassVo alertUserPassVo);
|
||||
|
||||
/**
|
||||
* 获取普通用户的租户信息
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public List<SysUserCom> getUserComs(Long userId);
|
||||
|
||||
/**
|
||||
* 激活普通用户的租户信息
|
||||
* @param userCom
|
||||
* @return
|
||||
*/
|
||||
public SysUser activeUserCom(SysUserCom userCom);
|
||||
|
||||
/**
|
||||
* 获取管理员的租户信息
|
||||
* @return
|
||||
*/
|
||||
public List<SysUserCom> getAdminComs();
|
||||
|
||||
/**
|
||||
* 激活管理员的租户信息
|
||||
* @param userCom
|
||||
* @return
|
||||
*/
|
||||
public SysUser activeAdminCom(SysUserCom userCom);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
package com.yanzhu.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.yanzhu.system.api.domain.SysUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.yanzhu.system.mapper.SysUserExtMapper;
|
||||
import com.yanzhu.system.domain.SysUserExt;
|
||||
import com.yanzhu.system.service.ISysUserExtService;
|
||||
|
||||
/**
|
||||
* 系统用户扩展Service业务层处理
|
||||
*
|
||||
* @author yanzhu
|
||||
* @date 2025-01-09
|
||||
*/
|
||||
@Service
|
||||
public class SysUserExtServiceImpl implements ISysUserExtService
|
||||
{
|
||||
@Autowired
|
||||
private SysUserExtMapper sysUserExtMapper;
|
||||
|
||||
/**
|
||||
* 查询系统用户扩展
|
||||
*/
|
||||
@Override
|
||||
public SysUserExt selectSysUserExtById(SysUserExt userExt)
|
||||
{
|
||||
return sysUserExtMapper.selectSysUserExtById(userExt );
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询系统用户扩展列表
|
||||
*
|
||||
* @param sysUserExt 系统用户扩展
|
||||
* @return 系统用户扩展
|
||||
*/
|
||||
@Override
|
||||
public List<SysUserExt> selectSysUserExtList(SysUserExt sysUserExt)
|
||||
{
|
||||
return sysUserExtMapper.selectSysUserExtList(sysUserExt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统用户扩展
|
||||
*
|
||||
* @param sysUserExt 系统用户扩展
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysUserExt(SysUserExt sysUserExt)
|
||||
{
|
||||
return sysUserExtMapper.insertSysUserExt(sysUserExt);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统用户扩展
|
||||
*
|
||||
* @param sysUserExt 系统用户扩展
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysUserExt(SysUserExt sysUserExt)
|
||||
{
|
||||
return sysUserExtMapper.updateSysUserExt(sysUserExt);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除系统用户扩展信息
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysUserExtById(SysUserExt sysUserExt)
|
||||
{
|
||||
return sysUserExtMapper.deleteSysUserExtById(sysUserExt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBySysUser(SysUser sysUser) {
|
||||
SysUserExt where=new SysUserExt();
|
||||
where.setUserId(sysUser.getUserId());
|
||||
where.setComId(sysUser.getComId());
|
||||
List<SysUserExt> userExts=sysUserExtMapper.selectSysUserExtList(where);
|
||||
where.setProjectId(sysUser.getDeptId());
|
||||
where.setIsActive(userExts.size()==0?1l:0l);
|
||||
SysUserExt old=selectSysUserExtById(where);
|
||||
if(Objects.nonNull(old)){
|
||||
old.setUserType(sysUser.getUserType());
|
||||
old.setStatus(sysUser.getStatus());
|
||||
updateSysUserExt(old);
|
||||
}else{
|
||||
where.setUserType(sysUser.getUserType());
|
||||
where.setStatus(sysUser.getStatus());
|
||||
insertSysUserExt(where);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,17 +5,23 @@ import java.util.stream.Collectors;
|
|||
import javax.validation.Validator;
|
||||
|
||||
import com.yanzhu.common.core.constant.SecurityConstants;
|
||||
import com.yanzhu.common.core.domain.R;
|
||||
import com.yanzhu.common.core.enums.ShiFouEnums;
|
||||
import com.yanzhu.common.core.enums.UserTypeEnums;
|
||||
import com.yanzhu.common.core.utils.DateUtils;
|
||||
import com.yanzhu.common.core.web.domain.AjaxResult;
|
||||
import com.yanzhu.common.security.service.TokenService;
|
||||
import com.yanzhu.manage.domain.ProProjectInfo;
|
||||
import com.yanzhu.manage.mapper.ProProjectInfoMapper;
|
||||
import com.yanzhu.manage.mapper.ProProjectInfoSubdeptsUsersMapper;
|
||||
import com.yanzhu.system.api.RemoteProService;
|
||||
import com.yanzhu.system.api.RemoteUserService;
|
||||
import com.yanzhu.system.api.domain.SysDept;
|
||||
import com.yanzhu.system.api.domain.SysRoleDept;
|
||||
import com.yanzhu.system.domain.SysPost;
|
||||
import com.yanzhu.system.domain.SysUserPost;
|
||||
import com.yanzhu.system.domain.SysUserRole;
|
||||
import com.yanzhu.system.api.model.LoginUser;
|
||||
import com.yanzhu.system.domain.*;
|
||||
import com.yanzhu.system.mapper.*;
|
||||
import com.yanzhu.system.service.ISysUserExtService;
|
||||
import com.yanzhu.system.vo.AlertUserPassVo;
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||
|
@ -78,6 +84,16 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@Autowired
|
||||
protected Validator validator;
|
||||
|
||||
@Autowired
|
||||
private ISysUserExtService userExtService;
|
||||
@Autowired
|
||||
private SysUserComMapper userComMapper;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private ProProjectInfoMapper proProjectInfoMapper;
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
|
@ -129,6 +145,11 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return userMapper.selectUserByUserName(userName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser selectByPhone(String phone) {
|
||||
return userMapper.selectByPhone(phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
|
@ -228,6 +249,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
public SysUser getUserByName(String userName){
|
||||
return userMapper.checkUserNameUnique(userName);
|
||||
}
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
|
@ -308,27 +332,75 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertUser(SysUser user)
|
||||
{
|
||||
boolean isPrjUser = false;//项目单位人员
|
||||
SysDept sysDept=null;
|
||||
try {
|
||||
if(Objects.equals(user.getUserType(),"99")){
|
||||
// 根据单位递归查询项目信息
|
||||
sysDept = deptMapper.selectDeptById(user.getDeptId());
|
||||
// 是项目单位时,将人员信息加入到花名册
|
||||
if(StringUtils.isNotEmpty(sysDept.getDeptType()) && Objects.equals(sysDept.getDeptType(),"4")){
|
||||
isPrjUser = true;
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 新增用户信息
|
||||
user.setUserName(userNameAndCout(user.getNickName()));
|
||||
//user.setUserName(userNameAndCout(user.getNickName()));
|
||||
SysDept dept = deptMapper.selectDeptById(user.getDeptId());
|
||||
if(Objects.isNull(dept)){
|
||||
throw new ServiceException("所属单位选择异常,必须选择子公司及下属单位");
|
||||
}
|
||||
user.setComId(dept.getComId());
|
||||
int rows = userMapper.insertUser(user);
|
||||
int rows=0;
|
||||
SysUser sysUser = userMapper.selectByPhone(user.getPhonenumber());
|
||||
if(Objects.nonNull(sysUser)){//此电话号码已注册
|
||||
SysUserExt where=new SysUserExt();
|
||||
where.setUserId(sysUser.getUserId());
|
||||
where.setProjectId(user.getDeptId());
|
||||
List<SysUserExt> userExts=userExtService.selectSysUserExtList(where);
|
||||
if(userExts.size()>0){
|
||||
throw new ServiceException("此用户己在此项目中!");
|
||||
}
|
||||
user.setUserId(sysUser.getUserId());
|
||||
user.setIsActive(0l);
|
||||
user.setStatus("0");
|
||||
SysUserCom comWhere=new SysUserCom();
|
||||
comWhere.setUserId(sysUser.getUserId());
|
||||
comWhere.setComId(dept.getComId());
|
||||
List<SysUserCom> userComs= userComMapper.selectUserComs(comWhere);
|
||||
if(userComs.size()==0){
|
||||
userMapper.insertUserCom(user);
|
||||
}
|
||||
sysUser.setUserName(user.getUserName());
|
||||
sysUser.setComId(user.getComId());
|
||||
sysUser.setDeptId(user.getDeptId());
|
||||
sysUser.setPhonenumber(user.getPhonenumber());
|
||||
sysUser.setNickName(user.getNickName());
|
||||
sysUser.setUpdateBy(user.getUpdateBy());
|
||||
sysUser.setUpdateTime(user.getUpdateTime());
|
||||
sysUser.setPassword(user.getPassword());
|
||||
rows=userMapper.updateUser(sysUser);
|
||||
userExtService.updateBySysUser(sysUser);
|
||||
}else{//此电话号码未注册
|
||||
user.setCreateBy(user.getUpdateBy());
|
||||
user.setCreateTime(user.getUpdateTime());
|
||||
user.setUserType("99");
|
||||
rows=userMapper.insertUser(user);
|
||||
user.setIsActive(1l);
|
||||
userMapper.insertUserCom(user);
|
||||
userExtService.updateBySysUser(user);
|
||||
}
|
||||
//int rows = userMapper.insertUser(user);
|
||||
// 新增用户岗位关联
|
||||
insertUserPost(user);
|
||||
// 新增用户与角色管理
|
||||
insertUserRole(user);
|
||||
try {
|
||||
if(Objects.equals(user.getUserType(),"99")){
|
||||
// 根据单位递归查询项目信息
|
||||
SysDept sysDept = deptMapper.selectDeptById(user.getDeptId());
|
||||
// 是项目单位时,将人员信息加入到花名册
|
||||
if(StringUtils.isNotEmpty(sysDept.getDeptType()) && Objects.equals(sysDept.getDeptType(),"4")){
|
||||
Map<String, Object> data = packageSubDeptUsers(user,sysDept);
|
||||
remoteProService.syspushSubDeptsUser(data, SecurityConstants.INNER);
|
||||
}
|
||||
if(isPrjUser) {
|
||||
Map<String, Object> data = packageSubDeptUsers(user, sysDept);
|
||||
R<AjaxResult> res = remoteProService.syspushSubDeptsUser(data, SecurityConstants.INNER);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
@ -365,10 +437,20 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Long registerUser(SysUser user)
|
||||
public Long registerUser(SysUser user) throws ServiceException
|
||||
{
|
||||
SysUser sysUser = userMapper.checkUserNameUnique(user.getUserName());
|
||||
SysUser sysUser = userMapper.selectByPhone(user.getPhonenumber());
|
||||
if(Objects.nonNull(sysUser)){
|
||||
if(user.getComId().equals(sysUser.getOldComId())){
|
||||
SysUser where=new SysUser();
|
||||
where.setUserId(sysUser.getUserId());
|
||||
where.setComId(sysUser.getOldComId());
|
||||
SysUser oldUserCom=userMapper.selectUserCom(where);
|
||||
if(Objects.nonNull(oldUserCom)){
|
||||
throw new ServiceException("此用户己在此项目中!");
|
||||
}
|
||||
userMapper.updateUserCom(sysUser);
|
||||
}
|
||||
user.setUserId(sysUser.getUserId());
|
||||
sysUser.setUserName(user.getUserName());
|
||||
sysUser.setPhonenumber(user.getUserName());
|
||||
|
@ -382,6 +464,13 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
user.setCreateTime(user.getUpdateTime());
|
||||
user.setUserType("99");
|
||||
userMapper.insertUser(user);
|
||||
List<SysUser> userComs=userMapper.selectUserComs(user.getUserId());
|
||||
if(userComs.size()==0){
|
||||
user.setIsActive(1l);
|
||||
}else{
|
||||
user.setIsActive(0l);
|
||||
}
|
||||
userMapper.insertUserCom(user);
|
||||
}
|
||||
Long userId = user.getUserId();
|
||||
if(Objects.nonNull(user.getUserType()) && Objects.nonNull(user.getActiveProjectId())){
|
||||
|
@ -517,6 +606,16 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
throw new ServiceException("所属单位选择异常,必须选择子公司及下属单位");
|
||||
}
|
||||
user.setComId(dept.getComId());
|
||||
if(user.getComId().equals(user.getOldComId())){
|
||||
SysUser where=new SysUser();
|
||||
where.setUserId(user.getUserId());
|
||||
where.setComId(user.getOldComId());
|
||||
SysUser oldUserCom=userMapper.selectUserCom(where);
|
||||
if(Objects.nonNull(oldUserCom)){
|
||||
throw new ServiceException("此用户己在此项目中!");
|
||||
}
|
||||
userMapper.updateUserCom(user);
|
||||
}
|
||||
try {
|
||||
if(Objects.equals(user.getUserType(),"99")){
|
||||
// 根据单位递归查询项目信息
|
||||
|
@ -671,8 +770,13 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
SysUserPost up = new SysUserPost();
|
||||
up.setUserId(user.getUserId());
|
||||
up.setPostId(postId);
|
||||
up.setProjectId(user.getDeptId());
|
||||
list.add(up);
|
||||
}
|
||||
SysUserPost delUp=new SysUserPost();
|
||||
delUp.setUserId(user.getUserId());
|
||||
delUp.setProjectId(user.getDeptId());
|
||||
userPostMapper.deleteUserPostByUser(delUp);
|
||||
userPostMapper.batchUserPost(list);
|
||||
}
|
||||
}
|
||||
|
@ -833,4 +937,82 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return userMapper.updateUser(sysUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUserCom> getUserComs(Long userId) {
|
||||
SysUserCom where=new SysUserCom();
|
||||
where.setUserId(userId);
|
||||
return userComMapper.selectUserComs(where);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser activeUserCom(SysUserCom userCom) {
|
||||
userCom.setIsActive(1l);
|
||||
int cnt= userComMapper.updateActiveTo0(userCom);
|
||||
cnt+= userComMapper.updateActive(userCom);
|
||||
SysUserExt userExtWhere=new SysUserExt();
|
||||
userExtWhere.setUserId(userCom.getUserId());
|
||||
userExtWhere.setComId(userCom.getComId());
|
||||
List<SysUserExt> userExts=userExtService.selectSysUserExtList(userExtWhere);
|
||||
if(userExts.size()==0){
|
||||
throw new ServiceException("此租户下面没有项目");
|
||||
}
|
||||
SysUserExt sysUserExt=findActiveUserExt(userExts);
|
||||
SysUser user=selectUserById(userCom.getUserId());
|
||||
user.setComId(userCom.getComId());
|
||||
user.setDeptId(sysUserExt.getProjectId());
|
||||
cnt+= userMapper.updateUser(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysUser activeAdminCom(SysUserCom userCom) {
|
||||
SysUser old=userMapper.selectUserByUserId(SecurityUtils.getUserId());
|
||||
old.setComId(userCom.getComId());
|
||||
SysUserExt userExtWhere=new SysUserExt();
|
||||
userExtWhere.setUserId(userCom.getUserId());
|
||||
userExtWhere.setComId(userCom.getComId());
|
||||
List<SysUserExt> userExts=userExtService.selectSysUserExtList(userExtWhere);
|
||||
if(userExts.size()==0){
|
||||
ProProjectInfo proWhere=new ProProjectInfo();
|
||||
proWhere.setComId(userCom.getComId());
|
||||
List<ProProjectInfo> list = proProjectInfoMapper.selectMyProjectList(proWhere);
|
||||
if(list.size()>0){
|
||||
old.setDeptId(list.get(0).getId());
|
||||
}
|
||||
}else{
|
||||
old.setDeptId(userExts.get(0).getProjectId());
|
||||
}
|
||||
userMapper.updateUser(old);
|
||||
return old;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUserCom> getAdminComs() {
|
||||
List<SysUserCom> userComs= userComMapper.selectAdminComs();
|
||||
LoginUser loginUser=SecurityUtils.getLoginUser();
|
||||
for (SysUserCom sysUserCom : userComs){
|
||||
if(sysUserCom.getComId().equals(loginUser.getSysUser().getComId())){
|
||||
sysUserCom.setIsActive(1l);
|
||||
}
|
||||
}
|
||||
return userComs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private SysUserExt findActiveUserExt(List<SysUserExt> userExts) {
|
||||
SysUserExt find=null;
|
||||
for(SysUserExt userExt:userExts){
|
||||
if(userExt.getIsActive()==1){
|
||||
find=userExt;
|
||||
}
|
||||
}
|
||||
if(find==null){
|
||||
find=userExts.get(0);
|
||||
find.setIsActive(1l);
|
||||
userExtService.updateSysUserExt(find);
|
||||
}
|
||||
return find;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,15 @@ export function getUser(userId) {
|
|||
})
|
||||
}
|
||||
|
||||
// 按手机号码查询用户
|
||||
export function selectByPhone(phone) {
|
||||
return request({
|
||||
url: '/system/user/selectByPhone/' + phone,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 新增用户
|
||||
export function addUser(data) {
|
||||
return request({
|
||||
|
@ -40,6 +49,8 @@ export function updateUser(data) {
|
|||
status:data.status,
|
||||
postIds:data.postIds,
|
||||
roles:data.roles,
|
||||
comId:data.comId,
|
||||
deptId:data.deptId,
|
||||
roleIds:data.roleIds
|
||||
}
|
||||
})
|
||||
|
@ -153,3 +164,32 @@ export function deptFirTreeSelect() {
|
|||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getUserComs(userId){
|
||||
return request({
|
||||
url: '/system/user/profile/getUserComps/'+userId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function activeUserCom(userCom){
|
||||
return request({
|
||||
url:'/system/user/activeUserCom',
|
||||
method:'post',
|
||||
data:userCom
|
||||
})
|
||||
}
|
||||
|
||||
export function reload(){
|
||||
return request({
|
||||
url: '/system/user/reload',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getUserByName(userName){
|
||||
return request({
|
||||
url: '/system/user/getUserByName/'+userName,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
|
@ -63,7 +63,7 @@ import { OfficeBuilding } from '@element-plus/icons-vue'
|
|||
import { findMyProjectList } from "@/api/publics";
|
||||
import { switchProject, cancelProject } from '@/api/login'
|
||||
import { changeDefaultProject } from "@/api/manage/proProjectInfoSubdeptsUsers";
|
||||
|
||||
import { reload } from "@/api/system/user";
|
||||
const { proxy } = getCurrentInstance();
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
|
@ -117,6 +117,15 @@ function resetQuery() {
|
|||
|
||||
/** 改变默认项目 */
|
||||
function changeDefault(proId) {
|
||||
changeDefaultProject(proId).then(response =>{
|
||||
reload().then(d=>{
|
||||
proxy.$modal.loading("正在切换项目信息,请稍后...");
|
||||
setTimeout("window.location.reload()", 500);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function changeDefaultOld(proId) {
|
||||
if(isAdmin.value){
|
||||
switchProject(proId).then(res =>{
|
||||
if(res.code==200){
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<div class="right-menu">
|
||||
<template v-if="appStore.device !== 'mobile'">
|
||||
<el-tag class="cur-comp" v-if="data.comName">当前租户:{{ data.comName }}</el-tag>
|
||||
<current-project id="current-project" class="right-menu-item"/>
|
||||
|
||||
<header-search id="header-search" class="right-menu-item" />
|
||||
|
@ -57,7 +58,9 @@ import useSettingsStore from '@/store/modules/settings'
|
|||
const appStore = useAppStore()
|
||||
const userStore = useUserStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
const data=reactive({
|
||||
comName:'',
|
||||
})
|
||||
function toggleSideBar() {
|
||||
appStore.toggleSideBar();
|
||||
userStore.getTasks(); // 动态获取用户代办任务
|
||||
|
@ -92,6 +95,8 @@ const emits = defineEmits(['setLayout'])
|
|||
function setLayout() {
|
||||
emits('setLayout');
|
||||
}
|
||||
data.comName=userStore.currentComName
|
||||
console.log("---->",userStore)
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
@ -102,6 +107,12 @@ function setLayout() {
|
|||
background: #fff;
|
||||
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
||||
|
||||
.cur-comp{
|
||||
position: relative;
|
||||
top: 11px;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
.hamburger-container {
|
||||
line-height: 46px;
|
||||
height: 100%;
|
||||
|
|
|
@ -513,7 +513,6 @@ function doSubDeptChange(type) {
|
|||
}
|
||||
|
||||
function doDeptGroupChange() {
|
||||
debugger
|
||||
data.isManager = false
|
||||
if (!form.value.subDeptGroup) {
|
||||
form.value.groupName = "";
|
||||
|
@ -699,7 +698,6 @@ function imgUrl(url) {
|
|||
function submitForm() {
|
||||
proxy.$refs["proProjectInfoSubdeptsUsersRef"].validate(valid => {
|
||||
if (valid) {
|
||||
debugger
|
||||
let depts = data.subdepts.filter(d => d.id == form.value.subDeptId);
|
||||
let groups = data.deptGroups.filter(d => d.id == form.value.subDeptGroup);
|
||||
let info = {
|
||||
|
|
|
@ -130,12 +130,18 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户名称" prop="nickName">
|
||||
<el-input v-model="form.nickName" placeholder="请输入用户名称" maxlength="30" />
|
||||
<el-input v-model="form.nickName" :disabled="data.editUser" placeholder="请输入用户名称" maxlength="30"
|
||||
style="width: 150px;" />
|
||||
<el-button v-if="data.mode == 'add' && !data.editUser" type="primary" style="margin-left: 10px;"
|
||||
@click="doQueryUserByName">查询</el-button>
|
||||
<el-button v-if="data.editUser" type="success" style="margin-left: 10px;"
|
||||
@click="doCleanEditData">清除</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="用户类型" prop="userType">
|
||||
<el-select v-model="form.userType" placeholder="请选择用户类型" style="width: 100%">
|
||||
<el-select v-model="form.userType" placeholder="请选择用户类型" style="width: 100%"
|
||||
@change="doRoleChange">
|
||||
<el-option v-for="dict in sys_user_type" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
|
@ -143,14 +149,18 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="手机号码" prop="phonenumber">
|
||||
<el-input v-model="form.phonenumber" :disabled="form.userId" placeholder="请输入手机号码"
|
||||
maxlength="11" />
|
||||
<el-input v-model="form.phonenumber" :disabled="form.userId || data.editUser" placeholder="请输入手机号码"
|
||||
maxlength="11" style="width: 150px;" autocomplete="off" disableautocomplete />
|
||||
<el-button v-if="data.mode == 'add' && !data.editUser" type="primary" style="margin-left: 10px;"
|
||||
@click="doQueryUser">查询</el-button>
|
||||
<el-button v-if="data.editUser" type="success" style="margin-left: 10px;"
|
||||
@click="doCleanEditData">清除</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="登录密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入登录密码" type="password" maxlength="20"
|
||||
:disabled="form.userId" :show-password="!form.userId" />
|
||||
:disabled="form.userId" :show-password="!form.userId" autocomplete="off" disableautocomplete />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
|
@ -185,12 +195,12 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="form.userType=='99'">
|
||||
<el-col :span="24" v-if="form.userType == '99'">
|
||||
<el-form-item label="证件号码" prop="cardCode">
|
||||
<el-input v-model="form.cardCode" placeholder="请输入证件号码" maxlength="18" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="form.userType=='99'">
|
||||
<el-col :span="24" v-if="form.userType == '99'">
|
||||
<el-form-item label="入场近照" prop="avatar">
|
||||
<image-upload v-model="form.avatar" :limit="1" />
|
||||
</el-form-item>
|
||||
|
@ -236,7 +246,9 @@
|
|||
<script setup name="User">
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { getDeptRole } from "@/api/system/role";
|
||||
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user";
|
||||
import {
|
||||
changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, selectByPhone, deptTreeSelect, getUserByName
|
||||
} from "@/api/system/user";
|
||||
|
||||
const router = useRouter();
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
@ -310,7 +322,9 @@ const data = reactive({
|
|||
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }],
|
||||
cardCode: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
|
||||
avatar: [{ required: true, message: "入场近照不能为空", trigger: "change" }],
|
||||
}
|
||||
},
|
||||
editUser: null,
|
||||
mode: ''
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
@ -331,6 +345,99 @@ function getDeptTree() {
|
|||
defaultEK.value.push(response.data[0].id);
|
||||
});
|
||||
};
|
||||
//用于用户增加的查询
|
||||
function doQueryUser() {
|
||||
selectByPhone(form.value.phonenumber).then(d => {
|
||||
{
|
||||
if (!d.data) {
|
||||
proxy.$modal.msgError("未找到数据!")
|
||||
}
|
||||
data.editUser = d.data || null;
|
||||
showEditUserData();
|
||||
}
|
||||
});
|
||||
}
|
||||
function doQueryUserByName() {
|
||||
getUserByName(form.value.nickName).then(d => {
|
||||
if (!d.data) {
|
||||
proxy.$modal.msgError("未找到数据!")
|
||||
}
|
||||
data.editUser = d.data || null
|
||||
showEditUserData();
|
||||
});
|
||||
}
|
||||
function showEditUserData() {
|
||||
let old = data.editUser
|
||||
if (old) {
|
||||
form.value.nickName = old.nickName;
|
||||
form.value.phonenumber = old.phonenumber;
|
||||
form.value.sex = old.sex;
|
||||
form.value.cardCode = old.cardCode;
|
||||
form.value.avatar = old.avatar;
|
||||
} else {
|
||||
form.value.nickName = "";
|
||||
form.value.phonenumber = "";
|
||||
form.value.sex = "";
|
||||
form.value.cardCode = "";
|
||||
form.value.avatar = "";
|
||||
}
|
||||
}
|
||||
function doCleanEditData() {
|
||||
data.editUser = null;
|
||||
showEditUserData();
|
||||
}
|
||||
|
||||
function doRoleChange() {
|
||||
if (data.mode == 'add') {
|
||||
if (form.value.userType == 99) {
|
||||
data.rules = {
|
||||
deptId: [{ required: true, message: "所属单位不能为空", trigger: "change" }],
|
||||
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
||||
nickName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
|
||||
userType: [{ required: true, message: "用户类型不能为空", trigger: "change" }],
|
||||
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }],
|
||||
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }],
|
||||
cardCode: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
|
||||
avatar: [{ required: true, message: "入场近照不能为空", trigger: "change" }],
|
||||
roleIds: [{ required: true, message: "用户角色不能为空", trigger: "change" }],
|
||||
}
|
||||
} else {
|
||||
data.rules = {
|
||||
deptId: [{ required: true, message: "所属单位不能为空", trigger: "change" }],
|
||||
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
||||
nickName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
|
||||
userType: [{ required: true, message: "用户类型不能为空", trigger: "change" }],
|
||||
roleIds: [{ required: true, message: "用户角色不能为空", trigger: "change" }],
|
||||
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }],
|
||||
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (form.value.userType == 99) {
|
||||
data.rules = {
|
||||
deptId: [{ required: true, message: "所属单位不能为空", trigger: "change" }],
|
||||
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
||||
nickName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
|
||||
userType: [{ required: true, message: "用户类型不能为空", trigger: "change" }],
|
||||
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }],
|
||||
cardCode: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
|
||||
avatar: [{ required: true, message: "入场近照不能为空", trigger: "change" }],
|
||||
roleIds: [{ required: true, message: "用户角色不能为空", trigger: "change" }],
|
||||
}
|
||||
} else {
|
||||
data.rules = {
|
||||
deptId: [{ required: true, message: "所属单位不能为空", trigger: "change" }],
|
||||
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
||||
nickName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
|
||||
userType: [{ required: true, message: "用户类型不能为空", trigger: "change" }],
|
||||
roleIds: [{ required: true, message: "用户角色不能为空", trigger: "change" }],
|
||||
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询用户列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
|
@ -466,6 +573,7 @@ function reset() {
|
|||
roleIds: []
|
||||
};
|
||||
proxy.resetForm("userRef");
|
||||
data.mode = ''
|
||||
};
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
|
@ -476,18 +584,21 @@ function cancel() {
|
|||
function handleAdd() {
|
||||
reset();
|
||||
getUser().then(response => {
|
||||
data.rules={
|
||||
data.rules = {
|
||||
deptId: [{ required: true, message: "所属单位不能为空", trigger: "change" }],
|
||||
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
||||
nickName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
|
||||
userType: [{ required: true, message: "用户类型不能为空", trigger: "change" }],
|
||||
roleIds: [{ required: true, message: "用户角色不能为空", trigger: "change" }],
|
||||
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }],
|
||||
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
||||
}
|
||||
roleOptions.value = [];
|
||||
postOptions.value = response.posts;
|
||||
open.value = true;
|
||||
title.value = "添加用户";
|
||||
form.value.password = initPassword.value;
|
||||
data.mode = 'add'
|
||||
});
|
||||
};
|
||||
/** 修改按钮操作 */
|
||||
|
@ -496,9 +607,10 @@ function handleUpdate(row) {
|
|||
const userId = row.userId || ids.value;
|
||||
getUser(userId).then(response => {
|
||||
|
||||
data.rules={
|
||||
data.rules = {
|
||||
deptId: [{ required: true, message: "所属单位不能为空", trigger: "change" }],
|
||||
userType: [{ required: true, message: "用户类型不能为空", trigger: "change" }],
|
||||
roleIds: [{ required: true, message: "用户角色不能为空", trigger: "change" }],
|
||||
phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
||||
}
|
||||
form.value = response.data;
|
||||
|
@ -508,6 +620,7 @@ function handleUpdate(row) {
|
|||
open.value = true;
|
||||
title.value = "修改用户";
|
||||
form.password = "";
|
||||
data.mode = 'edit'
|
||||
});
|
||||
handleChangeDept(row.deptId);
|
||||
};
|
||||
|
@ -520,22 +633,22 @@ function handleChangeDept(value) {
|
|||
});
|
||||
}
|
||||
|
||||
const getCompId=()=>{
|
||||
const getCompId=n=>{
|
||||
if(n.data.data.deptType==2){
|
||||
const getCompId = () => {
|
||||
const getCompId = n => {
|
||||
if (n.data.data.deptType == 2) {
|
||||
return n.data.id
|
||||
}else{
|
||||
let pnode=node.parent;
|
||||
if(!pnode){
|
||||
} else {
|
||||
let pnode = node.parent;
|
||||
if (!pnode) {
|
||||
return ""
|
||||
}else{
|
||||
} else {
|
||||
return getCompId(pnode);
|
||||
}
|
||||
}
|
||||
}
|
||||
let ndData=selTreeDept.value.getCurrentNode();
|
||||
let node=selTreeDept.value.getNode(ndData.id);
|
||||
let compId=getCompId(node);
|
||||
let ndData = selTreeDept.value.getCurrentNode();
|
||||
let node = selTreeDept.value.getNode(ndData.id);
|
||||
let compId = getCompId(node);
|
||||
return compId;
|
||||
}
|
||||
|
||||
|
@ -549,12 +662,14 @@ function submitForm() {
|
|||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
data.mode = ""
|
||||
});
|
||||
} else {
|
||||
addUser(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
data.mode = ""
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div class="app-container user-profile">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6" :xs="24">
|
||||
<el-card class="box-card">
|
||||
|
@ -27,7 +27,9 @@
|
|||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="tree" />所属部门
|
||||
<div class="pull-right" v-if="state.user.dept">{{ state.user.dept.deptName }} / {{ state.postGroup }}</div>
|
||||
<div class="pull-right" v-if="state.user.dept">
|
||||
{{ state.user.dept.deptName }} / {{ state.postGroup }}
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<svg-icon icon-class="peoples" />所属角色
|
||||
|
@ -57,31 +59,98 @@
|
|||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
|
||||
<el-card style="margin-top: 10px">
|
||||
<template v-slot:header>
|
||||
<div class="clearfix">
|
||||
<span>租户信息</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="user-coms">
|
||||
<div
|
||||
v-for="(it, idx) in state.coms"
|
||||
:key="idx"
|
||||
class="user-com"
|
||||
:class="it.isActive == 1 ? 'is-active' : ''"
|
||||
>
|
||||
<span style="display: inline-block; margin-right: 10px">
|
||||
{{ it.comName }}
|
||||
</span>
|
||||
<el-tag
|
||||
type="success"
|
||||
class="is-active-tag"
|
||||
v-if="it.isActive == 1"
|
||||
>已激活</el-tag
|
||||
>
|
||||
<el-button v-else type="primary" @click="toggleCom(it)"
|
||||
>切换</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Profile">
|
||||
import useUserStore from "@/store/modules/user";
|
||||
import userAvatar from "./userAvatar";
|
||||
import userInfo from "./userInfo";
|
||||
import resetPwd from "./resetPwd";
|
||||
import { getUserProfile } from "@/api/system/user";
|
||||
|
||||
import { getUserProfile, getUserComs, activeUserCom } from "@/api/system/user";
|
||||
import { switchProject } from "@/api/login";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const userStore = useUserStore();
|
||||
const activeTab = ref("userinfo");
|
||||
const state = reactive({
|
||||
user: {},
|
||||
roleGroup: {},
|
||||
postGroup: {}
|
||||
postGroup: {},
|
||||
coms: [],
|
||||
});
|
||||
|
||||
function getUser() {
|
||||
getUserProfile().then(response => {
|
||||
getUserProfile().then((response) => {
|
||||
state.user = response.data;
|
||||
state.roleGroup = response.roleGroup;
|
||||
state.postGroup = response.postGroup;
|
||||
});
|
||||
};
|
||||
}
|
||||
function loadUserComs() {
|
||||
let userId = userStore.uid;
|
||||
if (!userId) {
|
||||
return;
|
||||
}
|
||||
getUserComs(userId).then((d) => {
|
||||
state.coms = d.data || [];
|
||||
});
|
||||
}
|
||||
|
||||
function toggleCom(com) {
|
||||
activeUserCom(com).then((d) => {
|
||||
if (d.code == 200) {
|
||||
proxy.$modal.loading("正在切换项目信息,请稍后...");
|
||||
setTimeout("window.location.reload()", 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
loadUserComs();
|
||||
getUser();
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.app-container.user-profile {
|
||||
.user-coms {
|
||||
.user-com {
|
||||
&.is-active {
|
||||
color: #00a4e6;
|
||||
}
|
||||
line-height: 40px;
|
||||
.is-active-tag {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -44,8 +44,8 @@ export default defineConfig(({ mode, command }) => {
|
|||
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
||||
},
|
||||
'/statics': {
|
||||
//target: `http://localhost:9300`,
|
||||
target: 'http://62.234.3.186',
|
||||
target: VITE_APP_ENV === 'production'?'http://62.234.3.186':`http://localhost:9300`,
|
||||
//target: 'http://62.234.3.186',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
"^/statics": "/",
|
||||
|
|
Loading…
Reference in New Issue