parent
936a7d3287
commit
ff5cbfb094
|
|
@ -39,7 +39,7 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>com.zcloud.risk.Application</mainClass>
|
||||
<mainClass>com.zcloud.basic.info.Application</mainClass>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
|
|
|||
|
|
@ -128,5 +128,13 @@ public class UserController {
|
|||
userService.importUserTable(file);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("重置密码")
|
||||
@PostMapping("/changePassword/{id}")
|
||||
public SingleResponse changePassword(@PathVariable Long id){
|
||||
userService.changePassword(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import com.zcloud.basic.info.domain.gateway.ImgFilesGateway;
|
|||
import com.zcloud.basic.info.domain.model.ImgFilesE;
|
||||
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
|
||||
import com.zcloud.basic.info.persistence.repository.ImgFilesRepository;
|
||||
import com.zcloud.gbscommon.utils.Smb;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@ public class UserUpdateExe {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void executeChangePassword(Long id) {
|
||||
UserE userE = new UserE();
|
||||
userRepository.changePassword(id);
|
||||
userE.resetPassword();
|
||||
userRepository.changePassword(id, userE.getPassword());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,9 +92,8 @@ public class UserQueryExe {
|
|||
*/
|
||||
public Response executeVerifyUser(UserVerifyQryCmd userVerifyQryCmd) {
|
||||
Map<String, Object> params = PageQueryHelper.toHashMap(userVerifyQryCmd);
|
||||
Long count = userGateway.countUserByUsername(params);
|
||||
UserE userE = new UserE();
|
||||
return userE.verifyUser(count);
|
||||
Response response = userGateway.countUser(params);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ public class CorpInfoServiceImpl implements CorpInfoServiceI {
|
|||
|
||||
@Override
|
||||
public void changePassword(Long id) {
|
||||
//TODO 通知GBS修改密码
|
||||
userUpdateExe.executeChangePassword(id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,5 +114,10 @@ public class UserServiceImpl implements UserServiceI {
|
|||
return userQueryExe.executeGetInfoBySession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changePassword(Long id) {
|
||||
userUpdateExe.executeChangePassword(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,5 +48,6 @@ public interface UserServiceI {
|
|||
SingleResponse<UserCO> getInfoBySession();
|
||||
|
||||
UserCO getInfoByUserId(Long aLong);
|
||||
void changePassword(Long id);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
|
|||
|
|
@ -15,11 +15,16 @@ import javax.validation.constraints.NotNull;
|
|||
*/
|
||||
@Data
|
||||
public class UserVerifyQryCmd {
|
||||
@ApiModelProperty(value = "登录账号", name = "username", required = true)
|
||||
@NotEmpty(message = "登录账号不能为空")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "用户id", name = "id", required = true)
|
||||
@NotNull(message = "用户id不能为空")
|
||||
private Long id;
|
||||
@ApiModelProperty(value = "登录账号", name = "username")
|
||||
private String username;
|
||||
@ApiModelProperty(value = "手机号", name = "phone")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "身份证号", name = "userIdCard")
|
||||
private String userIdCard;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.zcloud.basic.info.domain.gateway;
|
||||
|
||||
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.zcloud.basic.info.domain.model.UserE;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -30,6 +31,6 @@ public interface UserGateway {
|
|||
|
||||
Boolean deletedUserByIds(Long[] id);
|
||||
|
||||
Long countUserByUsername(Map<String,Object> params);
|
||||
Response countUser(Map<String,Object> params);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,8 @@ public class CorpInfoE extends BaseE {
|
|||
private Integer whetherLiquidammoniaFlag;
|
||||
// 父级租户id
|
||||
private final Long parentTenantId = 1989259383784415232L;
|
||||
// sm2公钥
|
||||
private final String publicKey = "0402df2195296d4062ac85ad766994d73e871b887e18efb9a9a06b4cebc72372869b7da6c347c129dee2b46a0f279ff066b01c76208c2a052af75977c722a2ccee";
|
||||
// 默认密码
|
||||
private final String defaultPassword = "Aa12345678";
|
||||
// 密码
|
||||
|
|
@ -169,9 +171,7 @@ public class CorpInfoE extends BaseE {
|
|||
|
||||
|
||||
public void initPassWord() throws Exception {
|
||||
String publicKey = "0402df2195296d4062ac85ad766994d73e871b887e18efb9a9a06b4cebc72372869b7da6c347c129dee2b46a0f279ff066b01c76208c2a052af75977c722a2ccee";
|
||||
String encrypt = Sm2Util.encryptHex(MD5.md5(defaultPassword), publicKey);
|
||||
|
||||
this.setPassword(encrypt);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.zcloud.basic.info.domain.model;
|
|||
|
||||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import com.zcloud.gbscommon.utils.*;
|
||||
//import com.zcloud.gbscommon.utils.Smb;
|
||||
import com.zcloud.basic.info.domain.utils.Smb;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import com.zcloud.basic.info.domain.enums.CorpTypeEnum;
|
|||
import com.zcloud.gbscommon.excelEntity.UserExcelExportEntity;
|
||||
import com.zcloud.gbscommon.excelEntity.UserExcelImportEntity;
|
||||
import com.zcloud.gbscommon.utils.ExcelUtils;
|
||||
import com.zcloud.gbscommon.utils.MD5;
|
||||
import com.zcloud.gbscommon.utils.Sm2Util;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -129,6 +131,12 @@ public class UserE extends BaseE {
|
|||
private String password;
|
||||
// 入职状态
|
||||
private Integer employmentFlag;
|
||||
// 父级租户id
|
||||
private final Long parentTenantId = 1989259383784415232L;
|
||||
// 默认密码
|
||||
private final String defaultPassword = "Aa12345678";
|
||||
|
||||
private final String publicKey = "0402df2195296d4062ac85ad766994d73e871b887e18efb9a9a06b4cebc72372869b7da6c347c129dee2b46a0f279ff066b01c76208c2a052af75977c722a2ccee";
|
||||
|
||||
|
||||
public void initAdd(Long tenantId, UserE userE) {
|
||||
|
|
@ -138,13 +146,6 @@ public class UserE extends BaseE {
|
|||
userE.setEmploymentFlag(1);
|
||||
userE.setPassword("Aa@123456789");
|
||||
}
|
||||
public Response verifyUser(Long userCount) {
|
||||
if (userCount > 0) {
|
||||
return Response.buildFailure("用户名已经存在,请联系管理员");
|
||||
} else {
|
||||
return Response.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员修改过程中,是否存在转岗、入职离职
|
||||
|
|
@ -342,5 +343,9 @@ public class UserE extends BaseE {
|
|||
}
|
||||
}
|
||||
|
||||
public void resetPassword() {
|
||||
String encrypt = Sm2Util.encryptHex(MD5.md5(defaultPassword), publicKey);
|
||||
this.setPassword(encrypt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.basic.info.gatewayimpl;
|
||||
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.zcloud.basic.info.domain.gateway.UserGateway;
|
||||
import com.zcloud.basic.info.domain.model.UserE;
|
||||
|
|
@ -8,6 +9,7 @@ import com.zcloud.basic.info.persistence.repository.UserRepository;
|
|||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
|
@ -50,9 +52,8 @@ public class UserGatewayImpl implements UserGateway {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Long countUserByUsername(Map<String,Object> params) {
|
||||
Long userCount = userRepository.countUserByUsername(params);
|
||||
return userCount;
|
||||
public Response countUser(Map<String,Object> params) {
|
||||
return userRepository.countUser(params);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,5 +26,7 @@ public interface UserMapper extends BaseMapper<UserDO> {
|
|||
UserDO getInfoById(@Param("id") Long id);
|
||||
|
||||
List<DepartmentLeaderStatictiscDO> getDepartmentLeaderByDepartmentId(List<Long> departmentIds);
|
||||
|
||||
Integer countUser(@Param("params") Map<String, Object> params);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.zcloud.basic.info.persistence.repository;
|
|||
|
||||
import com.alibaba.cola.dto.MultiResponse;
|
||||
import com.alibaba.cola.dto.PageResponse;
|
||||
import com.alibaba.cola.dto.Response;
|
||||
import com.baomidou.mybatisplus.core.injector.methods.UpdateById;
|
||||
import com.jjb.saas.framework.repository.repo.BaseRepository;
|
||||
import com.zcloud.basic.info.domain.model.CorpInfoE;
|
||||
|
|
@ -29,7 +30,7 @@ public interface UserRepository extends BaseRepository<UserDO> {
|
|||
Boolean checkUserDepartment(Long[] ids);
|
||||
|
||||
UserDO getInfoById(Long id);
|
||||
Long countUserByUsername(Map<String,Object> params);
|
||||
Response countUser(Map<String,Object> params);
|
||||
|
||||
List<UserDO> listByPostId(Long postId);
|
||||
List<UserDO> listByPostIds(Long[] postIds);
|
||||
|
|
@ -44,7 +45,7 @@ public interface UserRepository extends BaseRepository<UserDO> {
|
|||
|
||||
void deleteUserById(Long id);
|
||||
|
||||
void changePassword(Long id);
|
||||
void changePassword(Long id, String password);
|
||||
|
||||
void updateUserName(UserDO userDO);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -114,11 +115,36 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
}
|
||||
|
||||
@Override
|
||||
public Long countUserByUsername(Map<String, Object> params) {
|
||||
QueryWrapper<UserDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("username", params.get("username"));
|
||||
queryWrapper.ne("id", params.get("id"));
|
||||
return userMapper.selectCount(queryWrapper);
|
||||
public Response countUser(Map<String, Object> params) {
|
||||
if (!ObjectUtils.isEmpty(params.get("username"))){
|
||||
Map<String, Object> verifyParam = new HashMap<>();
|
||||
verifyParam.put("username", params.get("username"));
|
||||
verifyParam.put("id", params.get("id"));
|
||||
Integer count = userMapper.countUser(verifyParam);
|
||||
if (count > 0) {
|
||||
return Response.buildFailure("用户名已经存在,请联系管理员");
|
||||
}
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(params.get("phone"))){
|
||||
Map<String, Object> verifyParam = new HashMap<>();
|
||||
verifyParam.put("phone", params.get("phone"));
|
||||
verifyParam.put("id", params.get("id"));
|
||||
Integer count = userMapper.countUser(verifyParam);
|
||||
if (count > 0) {
|
||||
return Response.buildFailure("手机号已经存在,请联系管理员");
|
||||
}
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(params.get("userIdCard"))){
|
||||
Map<String, Object> verifyParam = new HashMap<>();
|
||||
verifyParam.put("userIdCard", params.get("userIdCard"));
|
||||
verifyParam.put("id", params.get("id"));
|
||||
Integer count = userMapper.countUser(verifyParam);
|
||||
if (count > 0) {
|
||||
return Response.buildFailure("身份证号已经存在,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
return Response.buildSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -196,10 +222,10 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
}
|
||||
|
||||
@Override
|
||||
public void changePassword(Long id) {
|
||||
public void changePassword(Long id, String password) {
|
||||
UserUpdatePasswordCmd userUpdatePasswordCmd = new UserUpdatePasswordCmd();
|
||||
userUpdatePasswordCmd.setId(id);
|
||||
userUpdatePasswordCmd.setPassword(Tools.get32UUID());
|
||||
userUpdatePasswordCmd.setPassword(password);
|
||||
userFacade.updatePassword(userUpdatePasswordCmd);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,5 +216,20 @@
|
|||
</select>
|
||||
|
||||
|
||||
<select id="countUser" resultType="Integer">
|
||||
select count(1)
|
||||
from user
|
||||
where id != #{params.id}
|
||||
<if test="params.username != null">
|
||||
and username = #{params.username}
|
||||
</if>
|
||||
<if test="params.userIdCard != null">
|
||||
and user_id_card = #{params.userIdCard}
|
||||
</if>
|
||||
<if test="params.phone != null">
|
||||
and phone = #{params.phone}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue