提交 43ae8500 作者: zhenjie

后台用户、小程序用户“删除”字段修改为“禁用”字段

上级 450ed0e1
......@@ -24,8 +24,6 @@ public class UserAccountSimpleDTO implements Serializable {
private Integer id;
@ApiModelProperty(value = "用户类型")
private Integer accountType;
@ApiModelProperty(value = "用户账号")
private String accountNo;
@ApiModelProperty(value = "用户uid")
private String uid;
@ApiModelProperty(value = "手机号")
......
package com.mmc.iuav.user.model.vo;
import com.mmc.iuav.group.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -25,14 +24,12 @@ import java.util.List;
public class UserAccountVO implements Serializable {
private static final long serialVersionUID = 7067111726018678883L;
@ApiModelProperty(value = "用户id")
@NotNull(message = "用户id不能为空",groups = {Update.class})
@NotNull(message = "用户id不能为空", groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "用户类型")
private Integer accountType;
@ApiModelProperty(value = "用户uid")
private String uid;
@ApiModelProperty(value = "用户账号")
private String accountNo;
@ApiModelProperty(value = "手机号")
private String phoneNum;
@ApiModelProperty(value = "用户名称")
......
......@@ -43,11 +43,11 @@ public class BackUserAccountController extends BaseController {
return backUserAccountService.updateBAccount(bUserAccountVO, this.getUserLoginInfoFromRedis(request));
}
@ApiOperation(value = "账号-删除")
@ApiOperation(value = "账号-禁用(原删除)")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("removeBAccount")
public ResultBody removeBAccount(@RequestParam Integer userAccountId, HttpServletRequest request) {
return backUserAccountService.removeBAccount(userAccountId);
public ResultBody disableBAccount(@RequestParam Integer userAccountId, HttpServletRequest request) {
return backUserAccountService.disableBAccount(userAccountId);
}
@ApiOperation(value = "账号-列表")
......
......@@ -105,11 +105,11 @@ public class UserAccountController extends BaseController {
return userAccountService.feignGetUserRcdInfo(userAccountId);
}
@ApiOperation(value = "账号-删除")
@ApiOperation(value = "账号-禁用(原删除)")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("removeAppAccount")
public ResultBody removeAppAccount(@RequestParam Integer userAccountId, HttpServletRequest request) {
return userAccountService.removeAppAccount(userAccountId);
public ResultBody disableAppAccount(@RequestParam Integer userAccountId, HttpServletRequest request) {
return userAccountService.disableAppAccount(userAccountId);
}
}
......@@ -14,18 +14,21 @@ import java.util.List;
public interface BackUserAccountDao {
/**
* 添加后台用户
*
* @param backUserAccountDO
*/
void insertBackUserAccount(BackUserAccountDO backUserAccountDO);
/**
* 修改后台用户
*
* @param backUserAccountDO
*/
void updateBackUserAccount(BackUserAccountDO backUserAccountDO);
/**
* 查看用户详情
*
* @param backUserAccountId
* @return
*/
......@@ -33,6 +36,7 @@ public interface BackUserAccountDao {
/**
* 查询符合条件的用户个数
*
* @param bUserAccountQO
* @return
*/
......@@ -40,19 +44,22 @@ public interface BackUserAccountDao {
/**
* 查询符合条件的用户信息
*
* @param bUserAccountQO
* @return
*/
List<BackUserAccountDO> listBackUserAccount(BUserAccountQO bUserAccountQO);
/**
* 删除用户信息
* 禁用后台用户(原删除信息)
*
* @param id
*/
void removeBackUserAccountDO(Integer id);
void disableBackUserAccountDO(Integer id);
/**
* 远程调用查询用户信息
*
* @param bUserAccountQO
* @return
*/
......@@ -60,6 +67,7 @@ public interface BackUserAccountDao {
/**
* 验证用户密码
*
* @param id
* @return
*/
......@@ -67,6 +75,7 @@ public interface BackUserAccountDao {
/**
* 登录账号密码查询用户信息
*
* @param accountNo
* @param passWord
* @return
......@@ -75,6 +84,7 @@ public interface BackUserAccountDao {
/**
* 修改用户密码
*
* @param id
* @param passWord
*/
......@@ -82,6 +92,7 @@ public interface BackUserAccountDao {
/**
* 根据账号名称查询数量
*
* @param excludeId
* @param accountNo
* @return
......
......@@ -2,7 +2,6 @@ package com.mmc.iuav.user.dao;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.UserRcdDO;
import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.UserAccountQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -56,15 +55,6 @@ public interface UserServiceDao {
List<Integer> listUserAccountIdsByDistrictCode(Integer provinceCode, Integer cityCode, Integer districtCode);
/**
* 登录账号密码查询用户信息
*
* @param accountNo
* @param passWord
* @return
*/
UserAccountDO getUserLoginInfo(String accountNo, String passWord);
/**
* 批量获取用户信息
*
* @param userAccountQO
......@@ -73,53 +63,12 @@ public interface UserServiceDao {
List<UserAccountDO> feignListUserAccount(UserAccountQO userAccountQO);
/**
* 删除用户
* 禁用用户(原删除)
*
* @param removeNO
* @param userAccountId
*/
void removeUserAccount(String removeNO, Integer userAccountId);
/**
* 根据账号名称查询数量
*
* @param excludeId
* @param accountNo
* @return
*/
int countUserAccountNo(Integer excludeId, String accountNo);
/**
* 查询用户数量
*
* @param param
* @return
*/
int countListBAccountPage(BUserAccountQO param);
/**
* 查询用户信息
*
* @param param
* @return
*/
List<UserAccountDO> listBAccountPage(BUserAccountQO param);
/**
* 修改用户密码
*
* @param id
* @param passWord
*/
void updatePassword(Integer id, String passWord);
/**
* 获取用户密码
*
* @param id
* @return
*/
UserAccountDO getUserAuthPwdInfo(Integer id);
void disableUserAccount(String removeNO, Integer userAccountId);
/**
* 根据id查询用户信息
......
......@@ -29,7 +29,7 @@ public class BackUserAccountDO implements Serializable {
private Integer provinceCode;
private Integer cityCode;
private Integer districtCode;
private Integer deleted;
private Integer disable;
private Date createTime;
private Date updateTime;
private String remark;
......
......@@ -20,8 +20,6 @@ import java.util.Date;
public class UserAccountDO implements Serializable {
private static final long serialVersionUID = 5007589179946146721L;
private Integer id;
private String accountNo;
private String password;
private String uid;
private String phoneNum;
private String userName;
......@@ -35,7 +33,7 @@ public class UserAccountDO implements Serializable {
private Integer accountStatus;
private String remark;
private Integer portType;
private Integer deleted;
private Integer disable;
private Date createTime;
private Date updateTime;
private Integer provinceCode;
......@@ -62,7 +60,6 @@ public class UserAccountDO implements Serializable {
public UserAccountDO(BUserAccountVO bUserAccountVO) {
this.id = bUserAccountVO.getId();
this.accountNo = bUserAccountVO.getAccountNo();
this.phoneNum = bUserAccountVO.getPhoneNum();
this.userName = bUserAccountVO.getUserName();
this.email = bUserAccountVO.getEmail();
......@@ -74,14 +71,14 @@ public class UserAccountDO implements Serializable {
}
public UserAccountVO buildUserAccountVO() {
return UserAccountVO.builder().id(this.id).uid(this.uid).accountNo(this.accountNo).phoneNum(this.phoneNum).userName(this.userName).nickName(this.nickName)
return UserAccountVO.builder().id(this.id).uid(this.uid).phoneNum(this.phoneNum).userName(this.userName).nickName(this.nickName)
.userImg(this.userImg).userSex(this.userSex).email(this.email).source(this.source).accountStatus(this.accountStatus).remark(this.remark).portType(this.portType)
.createTime(this.createTime).companyAuthStatus(this.companyAuthStatus == null || this.companyAuthStatus != 1 ? 0 : 1).cooperationTagId(this.cooperationTagId).companyName(this.companyName)
.tagName(this.tagName).build();
}
public UserAccountSimpleDTO buildUserAccountSimpleDTO() {
return UserAccountSimpleDTO.builder().id(this.id).uid(this.uid).accountNo(this.accountNo).phoneNum(this.phoneNum).userName(this.userName).nickName(this.nickName)
return UserAccountSimpleDTO.builder().id(this.id).uid(this.uid).phoneNum(this.phoneNum).userName(this.userName).nickName(this.nickName)
.userImg(this.userImg).openid(this.openId).userSex(this.userSex).email(this.email).source(this.source).accountStatus(this.accountStatus).portType(this.portType)
.companyAuthStatus(this.companyAuthStatus == null || this.companyAuthStatus != 1 ? 0 : 1).cooperationTagId(this.cooperationTagId).companyName(this.companyName)
.build();
......
......@@ -32,12 +32,12 @@ public interface BackUserAccountService {
ResultBody updateBAccount(BUserAccountVO bUserAccountVO, LoginSuccessDTO loginSuccessDTO);
/**
* 删除后台用户
* 禁用后台用户
*
* @param userAccountId
* @return
*/
ResultBody removeBAccount(Integer userAccountId);
ResultBody disableBAccount(Integer userAccountId);
/**
* 后台用户列表
......
......@@ -3,9 +3,7 @@ package com.mmc.iuav.user.service;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.vo.BUserAccountVO;
import com.mmc.iuav.user.model.vo.UserAccountVO;
import java.util.List;
......@@ -65,39 +63,6 @@ public interface UserAccountService {
List<Integer> feignListUserAccountIds(Integer provinceCode, Integer cityCode, Integer districtCode);
/**
* 添加后台用户
*
* @param bUserAccountVO
* @return
*/
ResultBody insertBAccount(BUserAccountVO bUserAccountVO);
/**
* 删除用户信
*
* @param userAccountId
* @return
*/
ResultBody removeBAccount(Integer userAccountId);
/**
* 后台用户列表
*
* @param bUserAccountQO
* @return
*/
ResultBody listBAccountPage(BUserAccountQO bUserAccountQO);
/**
* 登录账号密码查询用户信息
*
* @param accountNo
* @param passWord
* @return
*/
UserAccountDO getUserLoginInfo(String accountNo, String passWord);
/**
* 内部获取用户列表
*
* @param userAccountQO
......@@ -106,31 +71,6 @@ public interface UserAccountService {
List<UserAccountSimpleDTO> feignListUserAccount(UserAccountQO userAccountQO);
/**
* 修改用户信息
*
* @param bUserAccountVO
* @return
*/
ResultBody updateBAccount(BUserAccountVO bUserAccountVO);
/**
* 修改用户密码
*
* @param account
* @return
*/
ResultBody updatePassword(BUserAccountVO account);
/**
* 验证用户密码
*
* @param id
* @param authPwd
* @return
*/
ResultBody feignAuthUserPwd(Integer id, String authPwd);
/**
* 授权手机号
*
* @param id
......@@ -185,7 +125,7 @@ public interface UserAccountService {
* @param userAccountId
* @return
*/
ResultBody removeAppAccount(Integer userAccountId);
ResultBody disableAppAccount(Integer userAccountId);
}
......@@ -120,7 +120,7 @@ public class AuthServiceImpl implements AuthService {
map.put(JwtConstant.TOKEN_TYPE, JwtConstant.IUAV_TOKEN);
String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).accountNo(userAccountVO.getAccountNo()).uid(uid)
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).uid(uid)
.userName(userAccountVO.getUserName()).nickName(userAccountVO.getNickName()).phoneNum(userAccountVO.getPhoneNum()).portType(100).build();
stringRedisTemplate.opsForValue().set(
......@@ -181,7 +181,7 @@ public class AuthServiceImpl implements AuthService {
companyAuthStatus = companyAuthDO.getAuthStatus();
}
String token = JwtUtil.createJwt(map);
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).accountNo(userAccountVO.getAccountNo()).uid(userAccountVO.getUid())
LoginSuccessDTO loginSuccessDTO = LoginSuccessDTO.builder().token(token).userAccountId(userAccountVO.getId()).uid(userAccountVO.getUid())
.userName(userAccountVO.getUserName()).nickName(userAccountVO.getNickName()).phoneNum(userAccountVO.getPhoneNum()).portType(100).build();
stringRedisTemplate.opsForValue().set(
token, JSONObject.toJSONString(loginSuccessDTO),
......
......@@ -113,8 +113,8 @@ public class BackUserAccountServiceImpl implements BackUserAccountService {
}
@Override
public ResultBody removeBAccount(Integer userAccountId) {
backUserAccountDao.removeBackUserAccountDO(userAccountId);
public ResultBody disableBAccount(Integer userAccountId) {
backUserAccountDao.disableBackUserAccountDO(userAccountId);
return ResultBody.success();
}
......
......@@ -4,16 +4,13 @@ import com.mmc.iuav.general.CodeUtil;
import com.mmc.iuav.page.PageResult;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.auth.PwdUtil;
import com.mmc.iuav.user.dao.CooperationDao;
import com.mmc.iuav.user.dao.UserServiceDao;
import com.mmc.iuav.user.entity.CooperationTagDO;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.entity.UserRcdDO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.vo.BUserAccountVO;
import com.mmc.iuav.user.model.vo.CompanyAuthVO;
import com.mmc.iuav.user.model.vo.CooperationTagVO;
import com.mmc.iuav.user.model.vo.UserAccountVO;
......@@ -26,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -124,58 +120,6 @@ public class UserAccountServiceImpl implements UserAccountService {
}
@Override
public ResultBody insertBAccount(BUserAccountVO bUserAccountVO) {
if (!bUserAccountVO.getPassWord().equals(bUserAccountVO.getAlertPwd())) {
// 两次密码不一致
return ResultBody.error(ResultEnum.PWD_ALERT_ERROR);
}
// 获取新增的账户名是否已经存在
int count = userServiceDao.countUserAccountNo(null, bUserAccountVO.getAccountNo());
if (count > 0) {
return ResultBody.error(ResultEnum.ADD_USER_ACCOUNT_NAME_EXISTS);
}
UserAccountDO userAccountDO = new UserAccountDO(bUserAccountVO);
try {
userAccountDO.setPassword(PwdUtil.securityPwd(bUserAccountVO.getPassWord()));
} catch (NoSuchAlgorithmException e) {
return ResultBody.error(ResultEnum.PWD_CREATE_ERROR);
}
userAccountDO.setUid(CodeUtil.generateUserUID());
userAccountDO.setPortType(0);
userAccountDO.setOpenId(userAccountDO.getUid());
userAccountDO.setUnionId(userAccountDO.getUid());
userServiceDao.insertUserAccount(userAccountDO);
return ResultBody.success();
}
@Override
public ResultBody removeBAccount(Integer userAccountId) {
String removeNO = CodeUtil.removeUserAccount();
userServiceDao.removeUserAccount(removeNO, userAccountId);
return ResultBody.success();
}
@Override
public ResultBody listBAccountPage(BUserAccountQO param) {
int count = userServiceDao.countListBAccountPage(param);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<UserAccountDO> users = userServiceDao.listBAccountPage(param);
List<UserAccountVO> collect = users.stream().map(UserAccountDO::buildUserAccountVO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, collect));
}
@Override
public UserAccountDO getUserLoginInfo(String accountNo, String passWord) {
UserAccountDO userAccountDO = userServiceDao.getUserLoginInfo(accountNo, passWord);
return userAccountDO;
}
@Override
public List<UserAccountSimpleDTO> feignListUserAccount(UserAccountQO userAccountQO) {
List<UserAccountDO> list = userServiceDao.feignListUserAccount(userAccountQO);
if (list == null) {
......@@ -203,56 +147,6 @@ public class UserAccountServiceImpl implements UserAccountService {
}
}
@Override
public ResultBody updateBAccount(BUserAccountVO bUserAccountVO) {
// 判断账号是否重复
if (!StringUtils.isEmpty(bUserAccountVO.getAccountNo())) {
// 如果传入的名字不为空,就查找数据库,看名字是否重复
int count = userServiceDao.countUserAccountNo(bUserAccountVO.getId(), bUserAccountVO.getAccountNo());
if (count > 0) {
return ResultBody.error(ResultEnum.UPDATE_USER_ACCOUNT_REPEAT);
}
}
UserAccountDO userAccountDO = new UserAccountDO(bUserAccountVO);
userServiceDao.update(userAccountDO);
return ResultBody.success();
}
@Override
public ResultBody updatePassword(BUserAccountVO account) {
if (!account.getPassWord().equals(account.getAlertPwd())) {
return ResultBody.error(ResultEnum.PASSWORD_INCONSISTENT);
}
try {
account.setPassWord(PwdUtil.securityPwd(account.getPassWord()));
userServiceDao.updatePassword(account.getId(), account.getPassWord());
} catch (NoSuchAlgorithmException e) {
return ResultBody.error(ResultEnum.PWD_CONPARED_ERROR);
}
// RoleInfoDO roleInfo = roleInfoDao.getRoleInfoByUser(account.getId());// 查询账号的角色信息
// this.disableOneToken(account.getId(), roleInfo.getId(), JwtConstant.SXTB_ACCOUNT_TOKEN);
return ResultBody.success();
}
@Override
public ResultBody feignAuthUserPwd(Integer id, String authPwd) {
UserAccountDO account = userServiceDao.getUserAuthPwdInfo(id);
if (account == null) {
return ResultBody.error(ResultEnum.LOGIN_ACCOUNT_NOT_EXIT_ERROR);
}
String pwd = "";
try {
pwd = PwdUtil.securityPwd(authPwd);
} catch (NoSuchAlgorithmException e) {
return ResultBody.error(ResultEnum.PWD_CREATE_ERROR);
}
if (!pwd.equals(account.getPassword())) {
return ResultBody.error(ResultEnum.PWD_CONPARED_ERROR);
}
return ResultBody.success();
}
@Override
public ResultBody getUserPhoneNumber(Integer id, String code) {
String userPhoneNumber = wxService.getUserPhoneNumber(id, code);
......@@ -339,8 +233,8 @@ public class UserAccountServiceImpl implements UserAccountService {
}
@Override
public ResultBody removeAppAccount(Integer userAccountId) {
userServiceDao.removeUserAccount(CodeUtil.removeUserAccount(), userAccountId);
public ResultBody disableAppAccount(Integer userAccountId) {
userServiceDao.disableUserAccount(CodeUtil.removeUserAccount(), userAccountId);
UserAccountVO userAccountVO = new UserAccountVO();
userAccountVO.setId(userAccountId);
userAccountVO.setDeleted(1);
......
......@@ -16,7 +16,7 @@
<result property="districtCode" column="district_code"/>
<result property="address" column="address"/>
<result property="remark" column="remark"/>
<result property="deleted" column="is_deleted"/>
<result property="disable" column="disable"/>
<result property="createTime" column="createTime"/>
<result property="updateTime" column="update_time"/>
<association property="roleInfoDO" javaType="com.mmc.iuav.user.entity.RoleInfoDO">
......@@ -76,10 +76,10 @@
</where>
</update>
<update id="removeBackUserAccountDO">
<update id="disableBackUserAccountDO">
update back_user_account
set is_deleted = 1
where is_deleted = 0
set disable = 1
where disable = 0
and id = #{id}
</update>
......@@ -102,7 +102,7 @@
city_code,
district_code,
address,
is_deleted,
disable,
create_time,
update_time
from back_user_account
......@@ -113,7 +113,7 @@
parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO">
select count(*) from back_user_account bua
left join user_role_rel urr on urr.back_user_account_id = bua.id
where bua.is_deleted = 0
where bua.disable = 0
<if test=" keyword != null and keyword != '' ">
and ( bua.account_no like CONCAT("%",#{keyword},"%") or
bua.user_name like CONCAT("%",#{keyword},"%") )
......@@ -160,7 +160,7 @@
left join user_role_rel urr on urr.back_user_account_id = bua.id
left join role_info ri on ri.id = urr.role_id
WHERE
bua.is_deleted = 0
bua.disable = 0
<if test=" keyword != null and keyword != '' ">
and ( bua.account_no like CONCAT("%",#{keyword},"%") or
bua.user_name like CONCAT("%",#{keyword},"%") )
......@@ -185,9 +185,9 @@
<select id="feignListBackUserAccount" resultMap="backUserAccountResultMap"
parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO">
select ua.id, ua.account_no, ua.phone_num, ua.user_name, ua.user_sex, ua.email, ua.account_status, ua.remark,
ua.is_deleted as deleted, ua.create_time, ua.update_time
ua.disable, ua.create_time, ua.update_time
from back_user_account ua
where ua.is_deleted = 0
where ua.disable = 0
<if test=" userIds != null ">
<foreach collection="userIds" item="id" open="and ua.id in (" close=")" separator=",">
#{id}
......@@ -215,7 +215,7 @@
account_no,
pass_word
from back_user_account
where is_deleted = 0
where disable = 0
and id =
#{id}
</select>
......@@ -228,13 +228,13 @@
bua.account_status,
bua.user_name
from back_user_account bua
where bua.is_deleted = 0
where bua.disable = 0
and BINARY bua.account_no = #{accountNo}
</select>
<select id="countUserAccountNo" resultType="java.lang.Integer">
select count(*) from back_user_account
where account_no = #{accountNo} and is_deleted = 0
where account_no = #{accountNo} and disable = 0
<if test="excludeId != null">
and id != #{excludeId}
</if>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论