1.修改密码 2.禁用租户
parent
b7133bce8e
commit
f2b527d32a
11
pom.xml
11
pom.xml
|
|
@ -30,11 +30,6 @@
|
|||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jjb.saas</groupId>
|
||||
<artifactId>jjb-saas-system-client</artifactId>
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!--Project modules-->
|
||||
<dependency>
|
||||
<groupId>com.zcloud.basic.info</groupId>
|
||||
|
|
@ -66,6 +61,12 @@
|
|||
<artifactId>jjb-saas-system-client</artifactId>
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jjb.saas</groupId>
|
||||
<artifactId>jjb-saas-auth-client</artifactId>
|
||||
<version>1.6.6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<build>
|
||||
|
|
|
|||
|
|
@ -135,5 +135,13 @@ public class UserController {
|
|||
userService.changePassword(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("修改密码")
|
||||
@PostMapping("/updatePassword")
|
||||
public Response updatePassword(@Validated @RequestBody UserUpdatePassWordCmd userUpdatePassWordCmd){
|
||||
|
||||
return userService.updatePassword(userUpdatePassWordCmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.cola.dto.Response;
|
|||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.system.client.tenant.facade.TenantFacade;
|
||||
import com.jjb.saas.system.client.tenant.request.OtaPlatformUserUpdateCmd;
|
||||
import com.jjb.saas.system.client.tenant.request.TenantUpdateStatusCmd;
|
||||
import com.zcloud.basic.info.domain.gateway.CorpInfoGateway;
|
||||
import com.zcloud.basic.info.domain.model.CorpInfoE;
|
||||
import com.zcloud.basic.info.dto.CorpInfoUpdateCmd;
|
||||
|
|
@ -96,6 +97,14 @@ public class CorpInfoUpdateExe {
|
|||
BeanUtils.copyProperties(corpInfoUpdateUseFlagCmd, corpInfoDO);
|
||||
corpInfoRepository.updateById(corpInfoDO);
|
||||
//TODO 通知GBS修改禁用启用标识
|
||||
TenantUpdateStatusCmd tenantUpdateStatusCmd = new TenantUpdateStatusCmd();
|
||||
tenantUpdateStatusCmd.setId(corpInfoUpdateUseFlagCmd.getId());
|
||||
if (corpInfoUpdateUseFlagCmd.getUseFlag() == 1){
|
||||
tenantUpdateStatusCmd.setStatusEnum("TRUE");
|
||||
} else if (corpInfoUpdateUseFlagCmd.getUseFlag() == 0){
|
||||
tenantUpdateStatusCmd.setStatusEnum("FALSE");
|
||||
}
|
||||
tenantFacade.updateStatusEnum(tenantUpdateStatusCmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.system.client.user.facade.UserFacade;
|
||||
import com.zcloud.basic.info.domain.gateway.UserEmploymentLogGateway;
|
||||
|
|
@ -7,11 +8,13 @@ import com.zcloud.basic.info.domain.gateway.UserGateway;
|
|||
import com.zcloud.basic.info.domain.model.UserE;
|
||||
import com.zcloud.basic.info.domain.model.UserEmploymentLogE;
|
||||
import com.zcloud.basic.info.dto.UserUpdateCmd;
|
||||
import com.zcloud.basic.info.dto.UserUpdatePassWordCmd;
|
||||
import com.zcloud.basic.info.persistence.dataobject.CorpInfoDO;
|
||||
import com.zcloud.basic.info.persistence.dataobject.UserDO;
|
||||
import com.zcloud.basic.info.persistence.repository.CorpInfoRepository;
|
||||
import com.zcloud.basic.info.persistence.repository.UserRepository;
|
||||
import com.zcloud.gbscommon.utils.Const;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import com.zcloud.gbscommon.utils.ZcloudRedisUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
|
|
@ -21,6 +24,8 @@ import org.springframework.stereotype.Component;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* web-app
|
||||
|
|
@ -85,5 +90,14 @@ public class UserUpdateExe {
|
|||
userE.resetPassword();
|
||||
userRepository.changePassword(id, userE.getPassword());
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Response executeUpdatePassword(UserUpdatePassWordCmd userUpdatePassWordCmd) {
|
||||
UserE userE = new UserE();
|
||||
BeanUtils.copyProperties(userUpdatePassWordCmd, userE);
|
||||
userE.encryptionPassword();
|
||||
return userGateway.updatePassword(userE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,5 +119,10 @@ public class UserServiceImpl implements UserServiceI {
|
|||
userUpdateExe.executeChangePassword(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response updatePassword(UserUpdatePassWordCmd userUpdatePassWordCmd) {
|
||||
return userUpdateExe.executeUpdatePassword(userUpdatePassWordCmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,5 +49,6 @@ public interface UserServiceI {
|
|||
|
||||
UserCO getInfoByUserId(Long aLong);
|
||||
void changePassword(Long id);
|
||||
Response updatePassword(UserUpdatePassWordCmd userUpdatePassWordCmd);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package com.zcloud.basic.info.dto;
|
||||
|
||||
import com.alibaba.cola.dto.Command;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* web-client
|
||||
*
|
||||
* @Author zhangyue
|
||||
* @Date 2025-11-04 14:07:38
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserUpdatePassWordCmd extends Command {
|
||||
@ApiModelProperty(value = "GBS用户id", name = "id", required = true)
|
||||
@NotNull(message = "GBS用户id不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "原密码", name = "password")
|
||||
@NotEmpty(message = "原密码不能为空")
|
||||
private String password;
|
||||
@ApiModelProperty(value = "新密码", name = "newPassword")
|
||||
@NotEmpty(message = "新密码不能为空")
|
||||
private String newPassword;
|
||||
}
|
||||
|
||||
|
|
@ -32,5 +32,10 @@ public interface UserGateway {
|
|||
Boolean deletedUserByIds(Long[] id);
|
||||
|
||||
Response countUser(Map<String,Object> params);
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
Response updatePassword(UserE userE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ public class UserE extends BaseE {
|
|||
|
||||
//密码
|
||||
private String password;
|
||||
//密码
|
||||
private String newPassword;
|
||||
// 入职状态
|
||||
private Integer employmentFlag;
|
||||
// 父级租户id
|
||||
|
|
@ -360,5 +362,10 @@ public class UserE extends BaseE {
|
|||
String encrypt = Sm2Util.encryptHex(MD5.md5(defaultPassword), publicKey);
|
||||
this.setPassword(encrypt);
|
||||
}
|
||||
|
||||
public void encryptionPassword() {
|
||||
this.setPassword(Sm2Util.encryptHex(MD5.md5(password), publicKey));
|
||||
this.setNewPassword(Sm2Util.encryptHex(MD5.md5(newPassword), publicKey));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.zcloud.basic.info.domain.gateway.UserGateway;
|
|||
import com.zcloud.basic.info.domain.model.UserE;
|
||||
import com.zcloud.basic.info.persistence.dataobject.UserDO;
|
||||
import com.zcloud.basic.info.persistence.repository.UserRepository;
|
||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -55,5 +56,12 @@ public class UserGatewayImpl implements UserGateway {
|
|||
public Response countUser(Map<String,Object> params) {
|
||||
return userRepository.countUser(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response updatePassword(UserE userE) {
|
||||
UserDO userDO = new UserDO();
|
||||
BeanUtils.copyProperties(userE, userDO);
|
||||
return userRepository.updatePassword(userDO);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,10 @@ public class UserDO extends BaseDO {
|
|||
@ApiModelProperty(value = "密码")
|
||||
@TableField(exist = false)
|
||||
private String password;
|
||||
//密码
|
||||
@ApiModelProperty(value = "新密码")
|
||||
@TableField(exist = false)
|
||||
private String newPassword;
|
||||
|
||||
// 年龄
|
||||
@ApiModelProperty(value = "年龄")
|
||||
|
|
|
|||
|
|
@ -56,5 +56,9 @@ public interface UserRepository extends BaseRepository<UserDO> {
|
|||
|
||||
Map<String, Long> getRoleMap();
|
||||
|
||||
|
||||
|
||||
Response updatePassword(UserDO userDO);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,12 +8,16 @@ import com.alibaba.cola.dto.SingleResponse;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jjb.saas.auth.client.account.facade.AccountFacade;
|
||||
import com.jjb.saas.auth.client.account.request.AccountPasswordCheckCmd;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||
import com.jjb.saas.system.client.role.facade.RoleFacade;
|
||||
import com.jjb.saas.system.client.role.response.RoleCO;
|
||||
import com.jjb.saas.system.client.system.facade.SystemFacade;
|
||||
import com.jjb.saas.system.client.tenant.facade.TenantFacade;
|
||||
import com.jjb.saas.system.client.user.facade.UserFacade;
|
||||
import com.jjb.saas.system.client.user.request.RoleDeptAddCmd;
|
||||
import com.jjb.saas.system.client.user.request.UserAddCmd;
|
||||
|
|
@ -55,6 +59,9 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
@DubboReference(check = false)
|
||||
private RoleFacade roleFacade;
|
||||
|
||||
@DubboReference(check = false)
|
||||
private AccountFacade accountFacade;
|
||||
|
||||
@Override
|
||||
public PageResponse<UserDO> listPage(Map<String, Object> params) {
|
||||
IPage<UserDO> iPage = new Query<UserDO>().getPage(params);
|
||||
|
|
@ -62,6 +69,7 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params, "u.");
|
||||
queryWrapper.orderByDesc("u.sort");
|
||||
queryWrapper.eq("u.delete_enum", "FALSE");
|
||||
queryWrapper.apply("u.id != u.corpinfo_id");
|
||||
IPage<UserDO> result = userMapper.selectUserPage(iPage, queryWrapper);
|
||||
return PageHelper.pageToResponse(result, result.getRecords());
|
||||
}
|
||||
|
|
@ -106,6 +114,7 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
|
||||
@Override
|
||||
public UserDO getInfoById(Long id) {
|
||||
|
||||
return userMapper.getInfoById(id);
|
||||
}
|
||||
|
||||
|
|
@ -267,5 +276,22 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response updatePassword(UserDO userDO) {
|
||||
// TODO 验证老密码是否正确
|
||||
AccountPasswordCheckCmd accountPasswordCheckCmd = new AccountPasswordCheckCmd();
|
||||
accountPasswordCheckCmd.setUserId(userDO.getId());
|
||||
accountPasswordCheckCmd.setPassword(userDO.getPassword());
|
||||
SingleResponse<Long> response = accountFacade.checkPassword(accountPasswordCheckCmd);
|
||||
if(!response.isSuccess()){
|
||||
return Response.buildFailure("原密码不正确");
|
||||
}
|
||||
// 更新密码
|
||||
UserUpdatePasswordCmd userUpdatePasswordCmd = new UserUpdatePasswordCmd();
|
||||
userUpdatePasswordCmd.setId(userDO.getId());
|
||||
userUpdatePasswordCmd.setPassword(userDO.getNewPassword());
|
||||
return userFacade.updatePassword(userUpdatePasswordCmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@
|
|||
left join department d on d.id = u.department_id
|
||||
left join post p on p.id = u.post_id
|
||||
<where>
|
||||
u.delete_enum = 'FALSE'
|
||||
u.id != u.corpinfo_id
|
||||
and u.delete_enum = 'FALSE'
|
||||
<if test="params.corpinfoId != null">
|
||||
and u.corpinfo_id = #{params.corpinfoId}
|
||||
</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue