用户管理
This commit is contained in:
parent
041df2aebc
commit
141c300518
@ -103,9 +103,9 @@ public class EmEmployeesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("设置个人信息")
|
@Log("修改员工信息")
|
||||||
@ApiOperation("设置个人信息")
|
@ApiOperation("修改员工信息")
|
||||||
public ResponseEntity<Object> updateEmEmployees(@Validated @RequestBody EmEmployeesVo resources){
|
public ResponseEntity<Object> updateEmEmployees(@Validated @RequestBody EmEmployees resources){
|
||||||
emEmployeesService.update(resources);
|
emEmployeesService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description /
|
* @description /
|
||||||
* @author lhb
|
* @author lhb
|
||||||
@ -67,6 +69,10 @@ public class EmEmployees extends BaseEntity {
|
|||||||
@ApiModelProperty(value = "密码")
|
@ApiModelProperty(value = "密码")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
@ApiModelProperty(value = "用户名称")
|
||||||
|
private String username;
|
||||||
|
|
||||||
public void copy(EmEmployees source){
|
public void copy(EmEmployees source){
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
@ -11,16 +11,6 @@ import java.util.Set;
|
|||||||
@Data
|
@Data
|
||||||
public class EmEmployeesVo extends EmEmployees {
|
public class EmEmployeesVo extends EmEmployees {
|
||||||
|
|
||||||
@ApiModelProperty(value = "登录密码")
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "性别")
|
|
||||||
private String gender;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "区域id")
|
|
||||||
private Long areaId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "景区id")
|
|
||||||
private Long scenicId;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -106,11 +106,11 @@ public class UserController {
|
|||||||
@ApiOperation("新增用户")
|
@ApiOperation("新增用户")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@PreAuthorize("@el.check('user:add')")
|
@PreAuthorize("@el.check('user:add')")
|
||||||
public ResponseEntity<Object> createUser(@Validated @RequestBody User resources){
|
public ResponseEntity<Object> createUser(@Validated @RequestBody User resources) throws Exception {
|
||||||
checkLevel(resources);
|
checkLevel(resources);
|
||||||
// 默认密码 123456
|
// 默认密码 123456
|
||||||
// resources.setPassword(passwordEncoder.encode("123456"));
|
// resources.setPassword(passwordEncoder.encode("123456"));
|
||||||
resources.setPassword(passwordEncoder.encode(resources.getPassword()));
|
resources.setPassword(passwordEncoder.encode(RsaUtils.decryptByPrivateKey(RsaProperties.privateKey,resources.getPassword())));
|
||||||
userService.create(resources);
|
userService.create(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public interface EmEmployeesService extends IService<EmEmployees> {
|
|||||||
* 编辑
|
* 编辑
|
||||||
* @param resources /
|
* @param resources /
|
||||||
*/
|
*/
|
||||||
void update(EmEmployeesVo resources);
|
void update(EmEmployees resources);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多选删除
|
* 多选删除
|
||||||
|
@ -51,9 +51,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
public class EmEmployeesServiceImpl extends ServiceImpl<EmEmployeesMapper, EmEmployees> implements EmEmployeesService {
|
public class EmEmployeesServiceImpl extends ServiceImpl<EmEmployeesMapper, EmEmployees> implements EmEmployeesService {
|
||||||
|
|
||||||
private final EmEmployeesMapper emEmployeesMapper;
|
private final EmEmployeesMapper emEmployeesMapper;
|
||||||
private final RedisUtils redisUtils;
|
|
||||||
private final UserCacheManager userCacheManager;
|
|
||||||
private final UserMapper userMapper;
|
|
||||||
private final EmAreaService areaService;
|
private final EmAreaService areaService;
|
||||||
private final EmScenicService scenicService;
|
private final EmScenicService scenicService;
|
||||||
private final PasswordEncoder passwordEncoder;
|
private final PasswordEncoder passwordEncoder;
|
||||||
@ -81,38 +78,12 @@ public class EmEmployeesServiceImpl extends ServiceImpl<EmEmployeesMapper, EmEmp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(EmEmployeesVo resources) {
|
public void update(EmEmployees resources) {
|
||||||
User user1 = userMapper.findByPhone(resources.getPhone());
|
|
||||||
EmEmployees emEmployees = getById(resources.getId());
|
EmEmployees emEmployees = getById(resources.getId());
|
||||||
emEmployees.copy(resources);
|
emEmployees.copy(resources);
|
||||||
user1.setPassword(passwordEncoder.encode(resources.getPassword()));
|
|
||||||
user1.setPhone(resources.getPhone());
|
|
||||||
user1.setScenicId(resources.getScenicId());
|
|
||||||
user1.setAreaId(resources.getAreaId());
|
|
||||||
user1.setNickName(resources.getName());
|
|
||||||
userMapper.updateById(user1);
|
|
||||||
emEmployeesMapper.updateById(emEmployees);
|
emEmployeesMapper.updateById(emEmployees);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 清理缓存
|
|
||||||
*
|
|
||||||
* @param id /
|
|
||||||
*/
|
|
||||||
public void delCaches(Long id, String username) {
|
|
||||||
redisUtils.del(CacheKey.USER_ID + id);
|
|
||||||
flushCache(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清理 登陆时 用户缓存信息
|
|
||||||
*
|
|
||||||
* @param username /
|
|
||||||
*/
|
|
||||||
private void flushCache(String username) {
|
|
||||||
userCacheManager.cleanUserCache(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteAll(List<Long> ids) {
|
public void deleteAll(List<Long> ids) {
|
||||||
|
@ -4,18 +4,15 @@
|
|||||||
<resultMap id="BaseResultMap" type="com.aircraft.modules.system.domain.EmEmployees">
|
<resultMap id="BaseResultMap" type="com.aircraft.modules.system.domain.EmEmployees">
|
||||||
<id column="id" property="id"/>
|
<id column="id" property="id"/>
|
||||||
<result column="name" property="name"/>
|
<result column="name" property="name"/>
|
||||||
<result column="gender" property="gender"/>
|
|
||||||
<result column="phone" property="phone"/>
|
<result column="phone" property="phone"/>
|
||||||
<result column="department_id" property="departmentId"/>
|
|
||||||
<result column="status" property="status"/>
|
<result column="status" property="status"/>
|
||||||
<result column="create_time" property="createTime"/>
|
<result column="create_time" property="createTime"/>
|
||||||
<result column="update_time" property="updateTime"/>
|
<result column="update_time" property="updateTime"/>
|
||||||
<result column="valid" property="valid"/>
|
|
||||||
<result column="area_id" property="areaId"/>
|
<result column="area_id" property="areaId"/>
|
||||||
<result column="scenic_id" property="scenicId"/>
|
<result column="scenic_id" property="scenicId"/>
|
||||||
<result column="qualification" property="qualification"/>
|
<result column="qualification" property="qualification"/>
|
||||||
<result column="qualification_attachment" property="qualificationAttachment"/>
|
<result column="qualification_attachment" property="qualificationAttachment"/>
|
||||||
<result column="userid" property="userid"/>
|
<result column="username" property="username"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
|
Loading…
Reference in New Issue
Block a user