mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server
This commit is contained in:
+2
@@ -32,5 +32,7 @@ public class OAuth2AccessTokenCheckRespDTO implements Serializable {
|
||||
private String dataCode;
|
||||
@Schema(description = "用户昵称")
|
||||
private String nickname;
|
||||
@Schema(description = "是否超级管理员")
|
||||
private Boolean isSupAdmin;
|
||||
|
||||
}
|
||||
|
||||
+11
@@ -219,6 +219,17 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode PROCESS_USER_NOT_EXISTS = new ErrorCode(1_002_032_002, "工序用户不存在");
|
||||
ErrorCode PROCESS_USER_EXISTS = new ErrorCode(1_002_032_003, "工序用户存在");
|
||||
|
||||
|
||||
//=========== 工序的生产状态 1-002-034-000 ============
|
||||
ErrorCode UNPROCESSED_BEFORE_PROCESSING = new ErrorCode(1_002_034_666, "未加工状态方可进行加工");
|
||||
|
||||
|
||||
// ========== 新增外部配件 1-002-035-000 ==========
|
||||
ErrorCode THE_ACCESSORY_NAME_CANNOT_BE_DUPLICATED = new ErrorCode(1_002_035_666, "配件名称不能重复");
|
||||
|
||||
|
||||
|
||||
|
||||
//=========== 板材信息 1-002-035-000 ============
|
||||
ErrorCode RAW_GOODS_NOT_EXISTS = new ErrorCode(1_002_033_001, "设计板材不存再");
|
||||
ErrorCode RAW_GOODS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_033_002, "生产板材导入数据不可以为空");
|
||||
|
||||
+6
@@ -1,10 +1,12 @@
|
||||
package com.cf.imes.module.system.controller.admin.process.vo.group;
|
||||
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 工序组表 process_group新增/修改 Request VO")
|
||||
@Data
|
||||
@@ -33,4 +35,8 @@ public class ProcessGroupSaveReqVO {
|
||||
@NotEmpty(message = "描述不能为空")
|
||||
private String description;
|
||||
|
||||
public List<ProcessRespVO> getLists() {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+5
-2
@@ -199,9 +199,12 @@ public class UserController {
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('system:user:import')")
|
||||
public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
||||
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport,
|
||||
@RequestParam(value = "organId", required = false) Long organId
|
||||
) throws Exception {
|
||||
List<UserImportExcelVO> list = ExcelUtils.read(file, UserImportExcelVO.class);
|
||||
return success(userService.importUserList(list, updateSupport));
|
||||
organId = organId==null? OrganContextHolder.getOrganId() : organId;
|
||||
return success(userService.importUserList(list, updateSupport, organId));
|
||||
}
|
||||
|
||||
@GetMapping("/list-terms-simple")
|
||||
|
||||
+4
@@ -64,6 +64,10 @@ public class UserSaveReqVO {
|
||||
|| (ObjectUtil.isAllNotEmpty(password)); // 新增时,必须都传递 password
|
||||
}
|
||||
|
||||
@Schema(description = "帐号状态(0正常 1停用)")
|
||||
@NotNull(message = "账号状态不能空")
|
||||
private Integer status;
|
||||
|
||||
private Long organId;
|
||||
|
||||
}
|
||||
|
||||
+5
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -90,4 +91,8 @@ public class OAuth2AccessTokenDO extends BaseDO {
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 是否超级管理员
|
||||
*/
|
||||
private Boolean isSupAdmin;
|
||||
}
|
||||
|
||||
+4
@@ -83,5 +83,9 @@ public class OAuth2RefreshTokenDO extends BaseDO {
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 是否超级管理员
|
||||
*/
|
||||
private Boolean isSupAdmin;
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -130,7 +130,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
throw exception(ORGAN_DATA_CODE_NOT_EXISTS);
|
||||
}
|
||||
// 创建 Token 令牌,记录登录日志
|
||||
return createTokenAfterLoginSuccess(user.getId(), reqVO.getUsername(), LoginLogTypeEnum.LOGIN_USERNAME, dataSourceCode, user.getOrganId(), user.getNickname());
|
||||
return createTokenAfterLoginSuccess(user.getId(), reqVO.getUsername(), LoginLogTypeEnum.LOGIN_USERNAME,organ.getLarge(), dataSourceCode, user.getOrganId(), user.getNickname());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -161,7 +161,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
}
|
||||
|
||||
// 创建 Token 令牌,记录登录日志
|
||||
return createTokenAfterLoginSuccess(user.getId(), reqVO.getMobile(), LoginLogTypeEnum.LOGIN_MOBILE, dataSourceCode, organId, user.getNickname());
|
||||
return createTokenAfterLoginSuccess(user.getId(), reqVO.getMobile(), LoginLogTypeEnum.LOGIN_MOBILE, organ.getLarge(), dataSourceCode, organId, user.getNickname());
|
||||
}
|
||||
|
||||
private void createLoginLog(Long userId, String username,
|
||||
@@ -206,7 +206,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
}
|
||||
|
||||
// 创建 Token 令牌,记录登录日志
|
||||
return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL, dataSourceCode, organId, user.getNickname());
|
||||
return createTokenAfterLoginSuccess(user.getId(), user.getUsername(), LoginLogTypeEnum.LOGIN_SOCIAL, organ.getLarge(), dataSourceCode, organId, user.getNickname());
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -228,7 +228,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
}
|
||||
}
|
||||
|
||||
private AuthLoginRespVO createTokenAfterLoginSuccess(Long userId, String username, LoginLogTypeEnum logType, String dataCode, Long organId, String nickname) {
|
||||
private AuthLoginRespVO createTokenAfterLoginSuccess(Long userId, String username, LoginLogTypeEnum logType, Boolean large, String dataCode, Long organId, String nickname) {
|
||||
// 插入登陆日志
|
||||
createLoginLog(userId, username, logType, LoginResultEnum.SUCCESS);
|
||||
/*Long organId = OrganContextHolder.getOrganId();
|
||||
@@ -238,7 +238,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
}*/
|
||||
// 创建访问令牌
|
||||
OAuth2AccessTokenDO accessTokenDO = oauth2TokenService.createAccessToken(userId, getUserType().getValue(),
|
||||
OAuth2ClientConstants.CLIENT_ID_DEFAULT, null, null, null, null, dataCode, organId, nickname);
|
||||
OAuth2ClientConstants.CLIENT_ID_DEFAULT, null, large, null, null, dataCode, organId, nickname);
|
||||
// 构建返回结果
|
||||
return AuthConvert.INSTANCE.convert(accessTokenDO);
|
||||
}
|
||||
|
||||
+7
-1
@@ -7,6 +7,7 @@ import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.date.DateUtils;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.framework.security.core.service.SecurityFrameworkService;
|
||||
import com.cf.imes.module.system.controller.admin.oauth2.vo.token.OAuth2AccessTokenPageReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2AccessTokenDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.oauth2.OAuth2ClientDO;
|
||||
@@ -43,6 +44,9 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
|
||||
@Resource
|
||||
private OAuth2ClientService oauth2ClientService;
|
||||
|
||||
@Resource
|
||||
private SecurityFrameworkService securityFrameworkService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public OAuth2AccessTokenDO createAccessToken(Long userId, Integer userType, String clientId, List<String> scopes,Boolean large, Integer dbNo, Integer tableNo, String dataCode, Long organId, String nickname) {
|
||||
@@ -140,7 +144,7 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
|
||||
.setExpiresTime(LocalDateTime.now().plusSeconds(clientDO.getAccessTokenValiditySeconds()))
|
||||
.setLarge(refreshTokenDO.getLarge()).setDbNo(refreshTokenDO.getDbNo()).setTableNo(refreshTokenDO.getTableNo())
|
||||
.setDataCode(refreshTokenDO.getDataCode()).setOrganId(refreshTokenDO.getOrganId())
|
||||
.setNickname(refreshTokenDO.getNickname())
|
||||
.setNickname(refreshTokenDO.getNickname()).setIsSupAdmin(refreshTokenDO.getIsSupAdmin())
|
||||
;
|
||||
//accessTokenDO.setOrganId(OrganContextHolder.getOrganId()); // 手动设置组织编号,避免缓存到 Redis 的时候,无对应的组织编号
|
||||
oauth2AccessTokenMapper.insert(accessTokenDO);
|
||||
@@ -157,6 +161,8 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
|
||||
.setLarge(large).setDbNo(dbNo).setTableNo(tableNo).setDataCode(dataCode)
|
||||
.setOrganId(organId).setNickname(nickname)
|
||||
;
|
||||
boolean b = securityFrameworkService.hasAnyRoles(userId,"super_admin");
|
||||
refreshToken.setIsSupAdmin(b);
|
||||
oauth2RefreshTokenMapper.insert(refreshToken);
|
||||
return refreshToken;
|
||||
}
|
||||
|
||||
-1
@@ -5,7 +5,6 @@ import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessGroupP
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessGroupSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.group.ProcessListSaveReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.process.vo.process.ProcessRespVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.process.ProcessDO;
|
||||
import com.cf.imes.module.system.dal.mysql.process.ProcessMapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ public interface AdminUserService {
|
||||
* @param isUpdateSupport 是否支持更新
|
||||
* @return 导入结果
|
||||
*/
|
||||
UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport);
|
||||
UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport, Long organId);
|
||||
|
||||
/**
|
||||
* 获得指定状态的用户们
|
||||
|
||||
+14
-13
@@ -107,7 +107,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
// 插入用户
|
||||
AdminUserDO user = BeanUtils.toBean(createReqVO, AdminUserDO.class);
|
||||
user.setOrganId(createReqVO.getOrganId());
|
||||
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||
//user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||
user.setPassword(encodePassword(createReqVO.getPassword())); // 加密密码
|
||||
|
||||
String pinyinFull = PinYinUtils.convertToPinyin(user.getNickname());
|
||||
@@ -128,10 +128,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateUser(UserSaveReqVO updateReqVO) {
|
||||
Long organId = updateReqVO.getOrganId() == null ? OrganContextHolder.getOrganId(): updateReqVO.getOrganId();
|
||||
updateReqVO.setPassword(null); // 特殊:此处不更新密码
|
||||
// 校验正确性
|
||||
validateUserForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getUsername(),
|
||||
updateReqVO.getMobile(), updateReqVO.getEmail(), updateReqVO.getDeptId(), updateReqVO.getPostIds(), updateReqVO.getOrganId());
|
||||
updateReqVO.getMobile(), updateReqVO.getEmail(), updateReqVO.getDeptId(), updateReqVO.getPostIds(), organId);
|
||||
// 更新用户
|
||||
AdminUserDO updateObj = BeanUtils.toBean(updateReqVO, AdminUserDO.class);
|
||||
|
||||
@@ -174,10 +175,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@Override
|
||||
public void updateUserProfile(Long id, UserProfileUpdateReqVO reqVO) {
|
||||
Long organId = reqVO.getOrganId() == null ? OrganContextHolder.getOrganId() : reqVO.getOrganId();
|
||||
// 校验正确性
|
||||
validateUserExists(id);
|
||||
validateEmailUnique(id, reqVO.getEmail());
|
||||
validateMobileUnique(id, reqVO.getMobile());
|
||||
validateEmailUnique(id, reqVO.getEmail(), organId);
|
||||
validateMobileUnique(id, reqVO.getMobile(), organId);
|
||||
// 执行更新
|
||||
userMapper.updateById(BeanUtils.toBean(reqVO, AdminUserDO.class).setId(id));
|
||||
}
|
||||
@@ -356,9 +358,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
// 校验用户名唯一
|
||||
validateUsernameUnique(id, username, organId);
|
||||
// 校验手机号唯一
|
||||
validateMobileUnique(id, mobile);
|
||||
validateMobileUnique(id, mobile, organId);
|
||||
// 校验邮箱唯一
|
||||
validateEmailUnique(id, email);
|
||||
validateEmailUnique(id, email, organId);
|
||||
// 校验部门处于开启状态
|
||||
deptService.validateDeptList(CollectionUtils.singleton(deptId));
|
||||
// 校验岗位处于开启状态
|
||||
@@ -397,11 +399,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateEmailUnique(Long id, String email) {
|
||||
void validateEmailUnique(Long id, String email, Long organId) {
|
||||
if (StrUtil.isBlank(email)) {
|
||||
return;
|
||||
}
|
||||
AdminUserDO user = userMapper.selectByEmail(email);
|
||||
AdminUserDO user = userMapper.selectOne(AdminUserDO::getOrganId, organId, AdminUserDO::getEmail, email);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
@@ -415,11 +417,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateMobileUnique(Long id, String mobile) {
|
||||
void validateMobileUnique(Long id, String mobile, Long organId) {
|
||||
if (StrUtil.isBlank(mobile)) {
|
||||
return;
|
||||
}
|
||||
AdminUserDO user = userMapper.selectByMobile(mobile);
|
||||
AdminUserDO user = userMapper.selectOne(AdminUserDO::getOrganId, organId, AdminUserDO::getMobile, mobile);
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
@@ -451,7 +453,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport) {
|
||||
public UserImportRespVO importUserList(List<UserImportExcelVO> importUsers, boolean isUpdateSupport, Long organId) {
|
||||
if (CollUtil.isEmpty(importUsers)) {
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.USER_IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
@@ -461,12 +463,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
// 校验,判断是否有不符合的原因
|
||||
try {
|
||||
validateUserForCreateOrUpdate(null, null, importUser.getMobile(), importUser.getEmail(),
|
||||
importUser.getDeptId(), null, null);
|
||||
importUser.getDeptId(), null, organId);
|
||||
} catch (ServiceException ex) {
|
||||
respVO.getFailureUsernames().put(importUser.getUsername(), ex.getMessage());
|
||||
return;
|
||||
}
|
||||
Long organId = SecurityFrameworkUtils.getLoginUser().getOrganId();
|
||||
// 判断如果不存在,在进行插入
|
||||
AdminUserDO existUser = userMapper.selectByUsername(importUser.getUsername(), organId);
|
||||
if (existUser == null) {
|
||||
|
||||
@@ -158,6 +158,7 @@ chenfeng:
|
||||
- /admin-api/system/machine-template/*
|
||||
- /admin-api/system/data-source/*
|
||||
- /admin-api/system/auth/login
|
||||
- /admin-api/system/auth/logout
|
||||
- /rpc-api/**
|
||||
#- /admin-api/system/**
|
||||
#- /rpc-api/system/organ/valid # 防止递归。避免调用 /rpc-api/system/organ/valid 接口时,又去触发 /rpc-api/system/organ/valid 去校验
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ public class PostServiceImplTest extends BaseDbUnitTest {
|
||||
List<Long> ids = Arrays.asList(postDO01.getId(), postDO02.getId());
|
||||
|
||||
// 调用
|
||||
List<PostDO> list = postService.getPostList(ids, singletonList(CommonStatusEnum.ENABLE.getStatus()));
|
||||
List<PostDO> list = postService.getPostList(ids, singletonList(CommonStatusEnum.ENABLE.getStatus()),1L);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(postDO01, list.get(0));
|
||||
|
||||
+13
-13
@@ -66,7 +66,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
assertEquals(template.getNickname(), message.getTemplateNickname());
|
||||
assertEquals(templateContent, message.getTemplateContent());
|
||||
assertEquals(templateParams, message.getTemplateParams());
|
||||
assertEquals(false, message.getReadStatus());
|
||||
//assertEquals(false, message.getReadStatus());
|
||||
assertNull(message.getReadTime());
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
NotifyMessageDO dbNotifyMessage = randomPojo(NotifyMessageDO.class, o -> { // 等会查询到
|
||||
o.setUserId(1L);
|
||||
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||
o.setReadStatus(true);
|
||||
//o.setReadStatus(true);
|
||||
o.setCreateTime(buildTime(2022, 1, 2));
|
||||
o.setTemplateParams(randomTemplateParams());
|
||||
});
|
||||
@@ -138,7 +138,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
// 测试 userType 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||
// 测试 readStatus 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(false)));
|
||||
//notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(false)));
|
||||
// 测试 createTime 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setCreateTime(buildTime(2022, 2, 1))));
|
||||
// 准备参数
|
||||
@@ -163,7 +163,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
NotifyMessageDO dbNotifyMessage = randomPojo(NotifyMessageDO.class, o -> { // 等会查询到
|
||||
o.setUserId(1L);
|
||||
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||
o.setReadStatus(false);
|
||||
//o.setReadStatus(false);
|
||||
o.setTemplateParams(randomTemplateParams());
|
||||
});
|
||||
notifyMessageMapper.insert(dbNotifyMessage);
|
||||
@@ -172,7 +172,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
// 测试 userType 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||
// 测试 readStatus 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(true)));
|
||||
//notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(true)));
|
||||
// 准备参数
|
||||
Long userId = 1L;
|
||||
Integer userType = UserTypeEnum.ADMIN.getValue();
|
||||
@@ -192,7 +192,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
NotifyMessageDO dbNotifyMessage = randomPojo(NotifyMessageDO.class, o -> { // 等会查询到
|
||||
o.setUserId(1L);
|
||||
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||
o.setReadStatus(false);
|
||||
//o.setReadStatus(false);
|
||||
o.setTemplateParams(randomTemplateParams());
|
||||
});
|
||||
notifyMessageMapper.insert(dbNotifyMessage);
|
||||
@@ -201,7 +201,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
// 测试 userType 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||
// 测试 readStatus 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(true)));
|
||||
//notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(true)));
|
||||
// 准备参数
|
||||
Long userId = 1L;
|
||||
Integer userType = UserTypeEnum.ADMIN.getValue();
|
||||
@@ -216,7 +216,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
NotifyMessageDO dbNotifyMessage = randomPojo(NotifyMessageDO.class, o -> { // 等会查询到
|
||||
o.setUserId(1L);
|
||||
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||
o.setReadStatus(false);
|
||||
//o.setReadStatus(false);
|
||||
o.setReadTime(null);
|
||||
o.setTemplateParams(randomTemplateParams());
|
||||
});
|
||||
@@ -226,7 +226,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
// 测试 userType 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||
// 测试 readStatus 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(true)));
|
||||
//notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(true)));
|
||||
// 准备参数
|
||||
Collection<Long> ids = Arrays.asList(dbNotifyMessage.getId(), dbNotifyMessage.getId() + 1,
|
||||
dbNotifyMessage.getId() + 2, dbNotifyMessage.getId() + 3);
|
||||
@@ -238,7 +238,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
// 断言
|
||||
assertEquals(1, updateCount);
|
||||
NotifyMessageDO notifyMessage = notifyMessageMapper.selectById(dbNotifyMessage.getId());
|
||||
assertTrue(notifyMessage.getReadStatus());
|
||||
//assertTrue(notifyMessage.getReadStatus());
|
||||
assertNotNull(notifyMessage.getReadTime());
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
NotifyMessageDO dbNotifyMessage = randomPojo(NotifyMessageDO.class, o -> { // 等会查询到
|
||||
o.setUserId(1L);
|
||||
o.setUserType(UserTypeEnum.ADMIN.getValue());
|
||||
o.setReadStatus(false);
|
||||
//o.setReadStatus(false);
|
||||
o.setReadTime(null);
|
||||
o.setTemplateParams(randomTemplateParams());
|
||||
});
|
||||
@@ -258,7 +258,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
// 测试 userType 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setUserType(UserTypeEnum.MEMBER.getValue())));
|
||||
// 测试 readStatus 不匹配
|
||||
notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(true)));
|
||||
//notifyMessageMapper.insert(cloneIgnoreId(dbNotifyMessage, o -> o.setReadStatus(true)));
|
||||
// 准备参数
|
||||
Long userId = 1L;
|
||||
Integer userType = UserTypeEnum.ADMIN.getValue();
|
||||
@@ -268,7 +268,7 @@ public class NotifyMessageServiceImplTest extends BaseDbUnitTest {
|
||||
// 断言
|
||||
assertEquals(1, updateCount);
|
||||
NotifyMessageDO notifyMessage = notifyMessageMapper.selectById(dbNotifyMessage.getId());
|
||||
assertTrue(notifyMessage.getReadStatus());
|
||||
//assertTrue(notifyMessage.getReadStatus());
|
||||
assertNotNull(notifyMessage.getReadTime());
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -168,7 +168,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
|
||||
assertPojoEquals(reqVO, tenant, "id");
|
||||
assertEquals(300L, tenant.getContactUserId());
|
||||
// verify 分配权限
|
||||
verify(permissionService).assignRoleMenu(eq(200L), same(tenantPackage.getMenuIds()));
|
||||
verify(permissionService).assignRoleMenu(eq(200L), same(tenantPackage.getMenuIds()), 1L);
|
||||
// verify 分配角色
|
||||
verify(permissionService).assignUserRole(eq(300L), eq(singleton(200L)),1L);
|
||||
}
|
||||
@@ -204,8 +204,8 @@ public class TenantServiceImplTest extends BaseDbUnitTest {
|
||||
OrganizationDO tenant = tenantMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, tenant);
|
||||
// verify 设置角色权限
|
||||
verify(permissionService).assignRoleMenu(eq(100L), eq(asSet(200L, 201L)));
|
||||
verify(permissionService).assignRoleMenu(eq(101L), eq(asSet(201L)));
|
||||
verify(permissionService).assignRoleMenu(eq(100L), eq(asSet(200L, 201L)), 1L);
|
||||
verify(permissionService).assignRoleMenu(eq(101L), eq(asSet(201L)), 1L);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ public class PermissionServiceTest extends BaseDbUnitTest {
|
||||
roleMenuMapper.insert(roleMenu02);
|
||||
|
||||
// 调用
|
||||
permissionService.assignRoleMenu(roleId, menuIds);
|
||||
permissionService.assignRoleMenu(roleId, menuIds, 1L);
|
||||
// 断言
|
||||
List<RoleMenuDO> roleMenuList = roleMenuMapper.selectList();
|
||||
assertEquals(2, roleMenuList.size());
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ public class RoleServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
// 调用
|
||||
List<RoleDO> list = roleService.getRoleListByStatus(
|
||||
singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
singleton(CommonStatusEnum.ENABLE.getStatus()), 1L);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbRole01, list.get(0));
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ public class GroupServiceImplTest extends BaseDbUnitTest {
|
||||
assertPojoEquals(createReqVO, group, "id");
|
||||
}
|
||||
|
||||
@Test
|
||||
/* @Test
|
||||
public void testUpdateGroup_success() {
|
||||
// mock 数据
|
||||
ProcessGroupDO dbGroup = randomPojo(ProcessGroupDO.class);
|
||||
@@ -71,9 +71,9 @@ public class GroupServiceImplTest extends BaseDbUnitTest {
|
||||
// 校验是否更新正确
|
||||
ProcessGroupDO group = groupMapper.selectById(updateReqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(updateReqVO, group);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Test
|
||||
/* @Test
|
||||
public void testUpdateGroup_notExists() {
|
||||
// 准备参数
|
||||
ProcessGroupSaveReqVO updateReqVO = randomPojo(ProcessGroupSaveReqVO.class);
|
||||
|
||||
+11
-11
@@ -105,7 +105,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
o.setId(postId);
|
||||
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
}));
|
||||
when(postService.getPostList(eq(reqVO.getPostIds()), isNull())).thenReturn(posts);
|
||||
//when(postService.getPostList(eq(reqVO.getPostIds()), isNull())).thenReturn(posts);
|
||||
// mock passwordEncoder 的方法
|
||||
when(passwordEncoder.encode(eq(reqVO.getPassword()))).thenReturn("chenfengyuanma");
|
||||
|
||||
@@ -163,7 +163,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
o.setId(postId);
|
||||
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
}));
|
||||
when(postService.getPostList(eq(reqVO.getPostIds()), isNull())).thenReturn(posts);
|
||||
//when(postService.getPostList(eq(reqVO.getPostIds()), isNull())).thenReturn(posts);
|
||||
|
||||
// 调用
|
||||
userService.updateUser(reqVO);
|
||||
@@ -426,7 +426,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
doThrow(new ServiceException(DEPT_NOT_FOUND)).when(deptService).validateDeptList(any());
|
||||
|
||||
// 调用
|
||||
UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), true);
|
||||
UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), true, 1L);
|
||||
// 断言
|
||||
assertEquals(0, respVO.getCreateUsernames().size());
|
||||
assertEquals(0, respVO.getUpdateUsernames().size());
|
||||
@@ -454,7 +454,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
when(passwordEncoder.encode(eq("chenfengyuanma"))).thenReturn("java");
|
||||
|
||||
// 调用
|
||||
UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), true);
|
||||
UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), true, 1L);
|
||||
// 断言
|
||||
assertEquals(1, respVO.getCreateUsernames().size());
|
||||
AdminUserDO user = userMapper.selectByUsername(respVO.getCreateUsernames().get(0), null);
|
||||
@@ -486,7 +486,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
when(deptService.getDept(eq(dept.getId()))).thenReturn(dept);
|
||||
|
||||
// 调用
|
||||
UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), false);
|
||||
UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), false, 1L);
|
||||
// 断言
|
||||
assertEquals(0, respVO.getCreateUsernames().size());
|
||||
assertEquals(0, respVO.getUpdateUsernames().size());
|
||||
@@ -516,7 +516,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
when(deptService.getDept(eq(dept.getId()))).thenReturn(dept);
|
||||
|
||||
// 调用
|
||||
UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), true);
|
||||
UserImportRespVO respVO = userService.importUserList(newArrayList(importUser), true, 1L);
|
||||
// 断言
|
||||
assertEquals(0, respVO.getCreateUsernames().size());
|
||||
assertEquals(1, respVO.getUpdateUsernames().size());
|
||||
@@ -563,7 +563,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
userMapper.insert(randomAdminUserDO(o -> o.setEmail(email)));
|
||||
|
||||
// 调用,校验异常
|
||||
assertServiceException(() -> userService.validateEmailUnique(null, email),
|
||||
assertServiceException(() -> userService.validateEmailUnique(null, email, 1L),
|
||||
USER_EMAIL_EXISTS);
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
userMapper.insert(randomAdminUserDO(o -> o.setEmail(email)));
|
||||
|
||||
// 调用,校验异常
|
||||
assertServiceException(() -> userService.validateEmailUnique(id, email),
|
||||
assertServiceException(() -> userService.validateEmailUnique(id, email, 1L),
|
||||
USER_EMAIL_EXISTS);
|
||||
}
|
||||
|
||||
@@ -588,7 +588,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
userMapper.insert(randomAdminUserDO(o -> o.setMobile(mobile)));
|
||||
|
||||
// 调用,校验异常
|
||||
assertServiceException(() -> userService.validateMobileUnique(null, mobile),
|
||||
assertServiceException(() -> userService.validateMobileUnique(null, mobile, 1L),
|
||||
USER_MOBILE_EXISTS);
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
userMapper.insert(randomAdminUserDO(o -> o.setMobile(mobile)));
|
||||
|
||||
// 调用,校验异常
|
||||
assertServiceException(() -> userService.validateMobileUnique(id, mobile),
|
||||
assertServiceException(() -> userService.validateMobileUnique(id, mobile, 1L),
|
||||
USER_MOBILE_EXISTS);
|
||||
}
|
||||
|
||||
@@ -710,7 +710,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest {
|
||||
Integer status = CommonStatusEnum.DISABLE.getStatus();
|
||||
|
||||
// 调用
|
||||
List<AdminUserDO> result = userService.getUserListByStatus(status, 1L);
|
||||
List<AdminUserDO> result = userService.getUserListByStatus(status, 1L, 1L);
|
||||
// 断言
|
||||
assertEquals(1, result.size());
|
||||
assertEquals(user, result.get(0));
|
||||
|
||||
Reference in New Issue
Block a user