对接运维部门人员管理
This commit is contained in:
parent
624dc27a41
commit
f5089056b4
@ -29,12 +29,22 @@ public class WorkUserController extends BaseController {
|
||||
LogUserUtils logUserUtils;
|
||||
|
||||
@GetMapping("/getPage")
|
||||
public TableDataInfo getPage(HttpServletRequest request) {
|
||||
public TableDataInfo getPage(HttpServletRequest request,
|
||||
Integer deptId,
|
||||
String userName,
|
||||
String loginName,
|
||||
String phone,
|
||||
String email) {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
startPage();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId", loginUser.getTenantId());
|
||||
params.put("deptId", deptId);
|
||||
params.put("userName", userName);
|
||||
params.put("loginName", loginName);
|
||||
params.put("phone", phone);
|
||||
params.put("email", email);
|
||||
return getDataTable(workUserService.getPage(params));
|
||||
}
|
||||
|
||||
@ -107,6 +117,7 @@ public class WorkUserController extends BaseController {
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setUpdateBy(loginUser.getUserid().toString());
|
||||
domain.setTenantId(loginUser.getTenantId());
|
||||
return R.ok(workUserService.updateDomainStatus(domain));
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ public class XhpcWorkUserDomain implements Serializable {
|
||||
/**
|
||||
* 状态(0-未启用,1-正常)
|
||||
*/
|
||||
private Short status;
|
||||
private Short status = 1;
|
||||
|
||||
/**
|
||||
* 删除(0-正常,2-删除)
|
||||
@ -100,5 +100,7 @@ public class XhpcWorkUserDomain implements Serializable {
|
||||
*/
|
||||
private Long[] roleIds;
|
||||
|
||||
private String roleId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -8,11 +8,17 @@ public interface SysUserMapper {
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param workUserId 运维用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public SysUser selectUserByWorkUserId(@Param("workUserId")String workUserId, @Param("tenantId")String tenantId);
|
||||
|
||||
|
||||
public SysUser selectUserByUserName(@Param("userName")String userName, @Param("tenantId")String tenantId);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
|
||||
@ -36,6 +36,7 @@ import java.io.FileInputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@ -589,9 +590,10 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
|
||||
List<XhpcHistoryOrderDomain> orderDomainList = historyOrderMapper.findListByTimeBetween(startTime, endTime, chargingMode, tenantId);
|
||||
Map<String, XhpcHistoryOrderDomain> orderDomainMap = new HashMap<>();
|
||||
for (XhpcHistoryOrderDomain orderDomain : orderDomainList) {
|
||||
orderDomainMap.put(orderDomain.getInternetSerialNumber(), orderDomain);
|
||||
}
|
||||
// for (XhpcHistoryOrderDomain orderDomain : orderDomainList) {
|
||||
// orderDomainMap.put(orderDomain.getInternetSerialNumber(), orderDomain);
|
||||
// }
|
||||
orderDomainList.stream().collect(Collectors.toMap(XhpcHistoryOrderDomain:: getInternetSerialNumber, d->d));
|
||||
|
||||
for (XhpcTradebillInternetCheckRecordDomain domain : domainList) {
|
||||
XhpcHistoryOrderDomain orderDomain = orderDomainMap.get(domain.getInternetSerialNumber());
|
||||
|
||||
@ -42,7 +42,17 @@ public class WorkDeptServiceImpl implements WorkDeptService {
|
||||
for (Map<String, Object> dept: deptList){
|
||||
params.put("parentDeptId", dept.get("id"));
|
||||
List<Map<String,Object>> childDeptList = deptMapper.selectMapListByParams(params);
|
||||
dept.put("children", childDeptList);
|
||||
if(childDeptList.size() > 0){
|
||||
dept.put("children", childDeptList);
|
||||
}
|
||||
for (Map<String, Object> childMap: childDeptList){
|
||||
params.put("parentDeptId", childMap.get("id"));
|
||||
List<Map<String,Object>> childDeptList1 = deptMapper.selectMapListByParams(params);
|
||||
if(childDeptList1.size() > 0){
|
||||
childMap.put("children", childDeptList1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return deptList;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.activity.service.impl;
|
||||
|
||||
import com.xhpc.activity.domain.SysUserRoleDomain;
|
||||
import com.xhpc.activity.domain.XhpcWorkDeptDomain;
|
||||
import com.xhpc.activity.domain.XhpcWorkUserDomain;
|
||||
import com.xhpc.activity.mapper.SysUserMapper;
|
||||
import com.xhpc.activity.mapper.SysUserRoleMapper;
|
||||
@ -8,20 +9,16 @@ import com.xhpc.activity.mapper.XhpcWorkDeptMapper;
|
||||
import com.xhpc.activity.mapper.XhpcWorkUserMapper;
|
||||
import com.xhpc.activity.service.WorkUserService;
|
||||
import com.xhpc.activity.vo.SysUserResetPasswordVo;
|
||||
import com.xhpc.common.core.constant.UserConstants;
|
||||
import com.xhpc.common.core.exception.CustomException;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.utils.StringUtils;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@Service
|
||||
@ -61,8 +58,8 @@ public class WorkUserServiceImpl implements WorkUserService {
|
||||
public List<Map<String, Object>> getDeptAndUserByMap(Map<String, Object> params){
|
||||
List<Map<String, Object>> deptDomains = deptMapper.selectMapListByParams(params);
|
||||
for(Map<String, Object> deptMap: deptDomains){
|
||||
List<Map<String, Object>> useres = workUserMapper.selectMapListByDeptId(deptMap.get("id").toString());
|
||||
deptMap.put("users", useres);
|
||||
List<Map<String, Object>> users = workUserMapper.selectMapListByDeptId(deptMap.get("id").toString());
|
||||
deptMap.put("users", users);
|
||||
}
|
||||
return deptDomains;
|
||||
}
|
||||
@ -82,6 +79,17 @@ public class WorkUserServiceImpl implements WorkUserService {
|
||||
|
||||
@Override
|
||||
public List<XhpcWorkUserDomain> getPage(Map<String, Object> params){
|
||||
Map<String, Object> deptParams = new HashMap<>();
|
||||
deptParams.put("tenantId", params.get("tenantId"));
|
||||
|
||||
String deptIds = params.get("deptId") + "";
|
||||
for(int i=0; i< 3;i++){
|
||||
deptParams.put("parentDeptIds", params.get("deptId"));
|
||||
List<XhpcWorkDeptDomain> deptDomainList = deptMapper.selectListByParams(deptParams);
|
||||
deptIds = deptDomainList.stream().map(dept->dept.getWorkDeptId().toString()).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
params.put("deptIds", deptIds);
|
||||
return workUserMapper.selectPage(params);
|
||||
}
|
||||
|
||||
@ -152,33 +160,16 @@ public class WorkUserServiceImpl implements WorkUserService {
|
||||
|
||||
workUserMapper.updateByPrimaryKey(domain);
|
||||
userMapper.updateUser(user);
|
||||
// 删除用户与角色关联
|
||||
roleMapper.deleteUserRoleByUserId(user.getUserId());
|
||||
|
||||
Long[] roles = domain.getRoleIds();
|
||||
if (StringUtils.isNotNull(roles))
|
||||
{
|
||||
// 新增用户与角色管理
|
||||
List<SysUserRoleDomain> list = new ArrayList<SysUserRoleDomain>();
|
||||
for (Long roleId : roles)
|
||||
{
|
||||
SysUserRoleDomain ur = new SysUserRoleDomain();
|
||||
ur.setUserId(user.getUserId());
|
||||
ur.setRoleId(roleId);
|
||||
list.add(ur);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
roleMapper.batchUserRole(list);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean updateDomainStatus(XhpcWorkUserDomain domain){
|
||||
SysUser user = userMapper.selectUserByUserName(domain.getLoginName(), domain.getTenantId());
|
||||
SysUser user = userMapper.selectUserByWorkUserId(domain.getWorkUserId().toString(), domain.getTenantId());
|
||||
if(StringUtils.isNull(user)){
|
||||
throw new CustomException("系统用户不存在");
|
||||
}
|
||||
switch (domain.getStatus()){
|
||||
case 0:
|
||||
user.setStatus("1"); break;
|
||||
@ -225,8 +216,11 @@ public class WorkUserServiceImpl implements WorkUserService {
|
||||
user.setEmail(domain.getEmail());
|
||||
user.setPhonenumber(domain.getPhone());
|
||||
user.setDataPowerType(0);
|
||||
user.setStatus(domain.getStatus().toString());
|
||||
|
||||
switch (domain.getStatus()){
|
||||
case 0: user.setStatus("1"); break;
|
||||
case 1: user.setStatus("0"); break;
|
||||
default: user.setStatus("0");break;
|
||||
}
|
||||
user.setAvatar("https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/avatar/logo.png");
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setPassword(SecurityUtils.encryptPassword(domain.getLoginPassword()));
|
||||
|
||||
@ -6,6 +6,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SysUserResetPasswordVo {
|
||||
private String loginName;
|
||||
private String password;
|
||||
private String password = "123456";
|
||||
private String tenantId;
|
||||
}
|
||||
|
||||
@ -95,11 +95,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
|
||||
<select id="selectUserByWorkUserId" parameterType="java.lang.String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
left join xhpc_work_user wu on wu.phone=u.phonenumber
|
||||
where wu.work_user_id = #{workUserId} and u.tenant_id =#{tenantId}
|
||||
</select>
|
||||
|
||||
<select id="selectUserByUserName" parameterType="java.lang.String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_name = #{userName} and u.tenant_id =#{tenantId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id = #{userId}
|
||||
@ -171,7 +178,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update sys_user
|
||||
<set>
|
||||
<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="email != null ">email = #{email},</if>
|
||||
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||
@ -180,11 +186,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="dataPowerType != null and dataPowerType != ''">data_power_type = #{dataPowerType},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_by = sysdate(),
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="tenantId != null and ''!=tenantId">tenant_id = #{tenantId},</if>
|
||||
update_time = sysdate()
|
||||
|
||||
@ -29,6 +29,20 @@
|
||||
<if test="params.tenantId !=null and params.tenantId!=''">
|
||||
and tenant_id=#{params.tenantId}
|
||||
</if>
|
||||
<if test="params.deptId !=null and params.deptId!=''">
|
||||
and work_dept_id=#{params.deptId}
|
||||
</if>
|
||||
<if test="params.parentDeptId !=null and params.parentDeptId!=''">
|
||||
and parent_dept_id=#{params.parentDeptId}
|
||||
</if>
|
||||
<choose>
|
||||
<when test="params.parentDeptIds !=null and params.parentDeptIds!=''">
|
||||
and find_in_set(parent_dept_id, #{params.parentDeptIds})
|
||||
</when>
|
||||
<otherwise>
|
||||
and parent_dept_id is null
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@ -51,10 +51,13 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long"
|
||||
resultType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
<include refid="Base_Column_List" />, su.user_name as 'login_name', GROUP_CONCAT(r.role_id) as 'role_id', "123456" as 'login_password'
|
||||
from xhpc_work_user u
|
||||
left join sys_user su on su.phonenumber = u.phone
|
||||
left join sys_user_role r on r.user_id=su.user_id
|
||||
where u.work_user_id = #{workUserId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
@ -106,12 +109,13 @@
|
||||
|
||||
<select id="selectPage" resultType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
||||
select
|
||||
<include refid="Base_Column_List" />, d.dept_name
|
||||
<include refid="Base_Column_List" />, d.dept_name, su.user_name as 'login_name'
|
||||
from xhpc_work_user u
|
||||
left xhpc_work_dept d on u.dept_id=d.work_dept_id
|
||||
where u.del_flag=0 and d.del_flag=0 and u.status=1 and d.status=1
|
||||
left join xhpc_work_dept d on u.dept_id=d.work_dept_id
|
||||
left join sys_user su on su.phonenumber = u.phone
|
||||
where u.del_flag=0 and d.del_flag=0
|
||||
<if test="params.deptId!=null">
|
||||
and (u.dept_id=#{params.deptId} or u.parent_dept_id=#{params.deptId})
|
||||
and (d.work_dept_id=#{params.deptId} or d.parent_dept_id=#{params.deptId})
|
||||
</if>
|
||||
<if test="params.userName!=null and params.userName!=''">
|
||||
and u.user_name like concat('%', #{params.userName}, '%')
|
||||
@ -122,6 +126,12 @@
|
||||
<if test="params.email!=null and params.email!=''">
|
||||
and u.email like concat('%', #{params.email}, '%')
|
||||
</if>
|
||||
<if test="params.loginName!=null and params.loginName!=''">
|
||||
and su.user_name like concat('%', #{params.loginName}, '%')
|
||||
</if>
|
||||
<if test="params.deptIds!=null and params.deptIds!=''">
|
||||
and find_in_set(u.dept_id, #{params.deptIds})
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user