dev:app端注销账号
parent
2f839eaca4
commit
73eb9c4db1
|
|
@ -83,6 +83,13 @@ public class AppUserController {
|
||||||
return SingleResponse.of(userService.updatePasswordFromApp(cmd));
|
return SingleResponse.of(userService.updatePasswordFromApp(cmd));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("校验是否还有入职信息")
|
||||||
|
@PostMapping("/checkOnboarding")
|
||||||
|
public Response checkOnboarding(@Validated @RequestBody AppUserLogOutCmd cmd){
|
||||||
|
userService.checkOnboarding(cmd);
|
||||||
|
return SingleResponse.buildSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("注销")
|
@ApiOperation("注销")
|
||||||
@PostMapping("/logOut")
|
@PostMapping("/logOut")
|
||||||
public Response logOut(@Validated @RequestBody AppUserLogOutCmd cmd){
|
public Response logOut(@Validated @RequestBody AppUserLogOutCmd cmd){
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ public class UserAddExe {
|
||||||
/**
|
/**
|
||||||
* 如果是离职的话, 则将离职改为入职
|
* 如果是离职的话, 则将离职改为入职
|
||||||
*/
|
*/
|
||||||
List<UserCorpDO> userCorpDOS = userCorpRepository.listByUserIdAndCorpIdAndNoStatus(cmd.getId(), cmd.getCorpinfoId(), 0);
|
List<UserCorpDO> userCorpDOS = userCorpRepository.listByUserIdAndCorpIdAndStatus(cmd.getId(), cmd.getCorpinfoId(), 0);
|
||||||
if(CollUtil.isNotEmpty(userCorpDOS)){
|
if(CollUtil.isNotEmpty(userCorpDOS)){
|
||||||
throw new BizException("该用户在当前企业存在未离职信息,无法入职");
|
throw new BizException("该用户在当前企业存在未离职信息,无法入职");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
package com.zcloud.basic.info.command;
|
package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
import com.jjb.saas.system.client.user.facade.UserFacade;
|
import com.jjb.saas.system.client.user.facade.UserFacade;
|
||||||
|
import com.zcloud.basic.info.domain.enums.UserEmploymentFlagEnum;
|
||||||
import com.zcloud.basic.info.domain.gateway.UserGateway;
|
import com.zcloud.basic.info.domain.gateway.UserGateway;
|
||||||
import com.zcloud.basic.info.dto.AppUserLogOutCmd;
|
import com.zcloud.basic.info.dto.AppUserLogOutCmd;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.UserCorpDO;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.UserDO;
|
||||||
import com.zcloud.basic.info.persistence.repository.UserCorpRepository;
|
import com.zcloud.basic.info.persistence.repository.UserCorpRepository;
|
||||||
|
import com.zcloud.basic.info.persistence.repository.UserRepository;
|
||||||
import com.zcloud.gbscommon.utils.Const;
|
import com.zcloud.gbscommon.utils.Const;
|
||||||
import com.zcloud.gbscommon.utils.ZcloudRedisUtil;
|
import com.zcloud.gbscommon.utils.ZcloudRedisUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
@ -14,7 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -26,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class UserRemoveExe {
|
public class UserRemoveExe {
|
||||||
private final UserGateway userGateway;
|
private final UserGateway userGateway;
|
||||||
|
private final UserRepository userRepository;
|
||||||
private final UserCorpRepository userCorpRepository;
|
private final UserCorpRepository userCorpRepository;
|
||||||
@DubboReference(check = false)
|
@DubboReference(check = false)
|
||||||
private UserFacade userFacade;
|
private UserFacade userFacade;
|
||||||
|
|
@ -46,6 +52,14 @@ public class UserRemoveExe {
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean execute(AppUserLogOutCmd cmd) {
|
public boolean execute(AppUserLogOutCmd cmd) {
|
||||||
|
|
||||||
|
// 获取redis验证码
|
||||||
|
// Object phoneCodeObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
||||||
|
// if(phoneCodeObj == null || !phoneCodeObj.toString().equals(cmd.getPhoneCode())){
|
||||||
|
// throw new BizException("验证码已过期或错误");
|
||||||
|
// }
|
||||||
|
// zcloudRedisUtil.del(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 删除底座用户信息
|
// 删除底座用户信息
|
||||||
userFacade.delete(cmd.getId());
|
userFacade.delete(cmd.getId());
|
||||||
|
|
@ -58,7 +72,20 @@ public class UserRemoveExe {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new BizException("删除失败");
|
throw new BizException("删除失败");
|
||||||
}
|
}
|
||||||
// zcloudRedisUtil.del(Const.REDIS_USER_PREFIX+id);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean executeCheckOnboarding(AppUserLogOutCmd cmd) {
|
||||||
|
// 校验是否还有入职信息
|
||||||
|
UserDO userDO = userRepository.getInfoById(cmd.getId());
|
||||||
|
if(!UserEmploymentFlagEnum.RESIGNATION.equals(userDO.getEmploymentFlag().toString())){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<UserCorpDO> userCorpDOS = userCorpRepository.listByUserIdAndNoStatus(cmd.getId(), 0);
|
||||||
|
if(CollUtil.isNotEmpty(userCorpDOS)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -202,5 +202,10 @@ public class UserServiceImpl implements UserServiceI {
|
||||||
public void logOut(AppUserLogOutCmd cmd) {
|
public void logOut(AppUserLogOutCmd cmd) {
|
||||||
userRemoveExe.execute(cmd);
|
userRemoveExe.execute(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void checkOnboarding(AppUserLogOutCmd cmd) {
|
||||||
|
userRemoveExe.executeCheckOnboarding(cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,5 +79,7 @@ public interface UserServiceI {
|
||||||
Boolean updatePasswordFromApp(AppUserUpdatePassWordCmd cmd);
|
Boolean updatePasswordFromApp(AppUserUpdatePassWordCmd cmd);
|
||||||
|
|
||||||
void logOut(AppUserLogOutCmd cmd);
|
void logOut(AppUserLogOutCmd cmd);
|
||||||
|
|
||||||
|
void checkOnboarding(AppUserLogOutCmd cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,7 @@ public class AppUserResignationCmd implements Serializable {
|
||||||
@NotNull(message = "企业id不能为空")
|
@NotNull(message = "企业id不能为空")
|
||||||
private Long corpinfoId;
|
private Long corpinfoId;
|
||||||
//离职原因
|
//离职原因
|
||||||
@ApiModelProperty(value = "离职原因", name = "resignationReason", required = true)
|
@ApiModelProperty(value = "离职原因", name = "resignationReason")
|
||||||
@NotEmpty(message = "离职原因不能为空")
|
|
||||||
private String resignationReason;
|
private String resignationReason;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ public interface UserCorpRepository extends BaseRepository<UserCorpDO> {
|
||||||
|
|
||||||
List<UserCorpDO> listByUserIdAndCorpIdAndStatus(Long userId, Long corpinfoId, Integer status);
|
List<UserCorpDO> listByUserIdAndCorpIdAndStatus(Long userId, Long corpinfoId, Integer status);
|
||||||
|
|
||||||
|
List<UserCorpDO> listByUserIdAndNoStatus(Long userId, Integer status);
|
||||||
|
|
||||||
UserE executeResignation(UserCorpDO userCorpDO, Long corpinfoId, Integer employmentFlag);
|
UserE executeResignation(UserCorpDO userCorpDO, Long corpinfoId, Integer employmentFlag);
|
||||||
|
|
||||||
UserE executeReviewStatus(Long id, Long corpinfoId, Integer reviewStatus);
|
UserE executeReviewStatus(Long id, Long corpinfoId, Integer reviewStatus);
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,14 @@ public class UserCorpRepositoryImpl extends BaseRepositoryImpl<UserCorpMapper, U
|
||||||
return list(queryWrapper);
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserCorpDO> listByUserIdAndNoStatus(Long userId, Integer status) {
|
||||||
|
QueryWrapper<UserCorpDO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("user_id", userId);
|
||||||
|
queryWrapper.ne("employment_flag", status);
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserE executeResignation(UserCorpDO userCorpDO, Long corpinfoId, Integer employmentFlag) {
|
public UserE executeResignation(UserCorpDO userCorpDO, Long corpinfoId, Integer employmentFlag) {
|
||||||
userCorpDO.setEmploymentFlag(employmentFlag);
|
userCorpDO.setEmploymentFlag(employmentFlag);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue