【修改】试卷任务,【新增】试题交互,定时试题交互
This commit is contained in:
@@ -203,5 +203,15 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode XLSX_PARENT_IS_CHILD = new ErrorCode(1_002_032_007, "不能设置自己的子XLSX节点为父XLSX节点");
|
||||
|
||||
|
||||
// ========== 试题交互中间 ==========
|
||||
ErrorCode QUESTION_EXAMINE_NOT_EXISTS = new ErrorCode(1_004_004_010, "试题交互中间不存在");
|
||||
|
||||
// ========== 试题中间 ==========
|
||||
ErrorCode QESESTION_NOT_NULL = new ErrorCode(1_008_008_012, "审核试题不能为空");
|
||||
ErrorCode QESESTION_AUDIT_ERROR = new ErrorCode(1_008_008_022, "操作试题失败");
|
||||
// ========== rabbit ==========
|
||||
ErrorCode RABBITMQ_CONNECT_EXISTS = new ErrorCode(1_005_005_111, "连接失败");
|
||||
ErrorCode RABBITMQ_NOT_EXISTS = new ErrorCode(1_005_005_011, "接收试题出错");
|
||||
ErrorCode RABBITMQ_NAME_NOT_NULL = new ErrorCode(1_005_005_012, "队列名不能为空");
|
||||
ErrorCode MONITOR_NOT_EXISTS = new ErrorCode(1_003_301_001, "找不到值!");
|
||||
}
|
||||
|
@@ -70,4 +70,5 @@ public class TenantSaveReqVO {
|
||||
@Schema(description = "授权专业数量")
|
||||
private List<TenantSpecialtyPointsVO> tenantSpecialtyPointsVOList;
|
||||
|
||||
private String queueName;
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import pc.exam.pp.framework.common.pojo.PageParam;
|
||||
import pc.exam.pp.framework.common.pojo.PageResult;
|
||||
import pc.exam.pp.framework.common.util.object.BeanUtils;
|
||||
import pc.exam.pp.framework.excel.core.util.ExcelUtils;
|
||||
import pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtListByUserReqVo;
|
||||
import pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtyQueryVo;
|
||||
import pc.exam.pp.module.exam.dal.dataobject.classs.ClassDO;
|
||||
@@ -15,9 +16,11 @@ import pc.exam.pp.module.exam.service.classs.ClassService;
|
||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.*;
|
||||
import pc.exam.pp.module.system.convert.user.UserConvert;
|
||||
import pc.exam.pp.module.system.dal.dataobject.dept.DeptDO;
|
||||
import pc.exam.pp.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import pc.exam.pp.module.system.enums.common.SexEnum;
|
||||
import pc.exam.pp.module.system.service.dept.DeptService;
|
||||
import pc.exam.pp.module.system.service.tenant.TenantService;
|
||||
import pc.exam.pp.module.system.service.user.AdminUserService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -52,6 +55,8 @@ public class UserController {
|
||||
private ClassService classService;
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
@Resource
|
||||
private TenantService tenantService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "新增用户")
|
||||
|
@@ -92,4 +92,6 @@ public class UserSaveReqVO {
|
||||
|| (ObjectUtil.isAllNotEmpty(password)); // 新增时,必须都传递 password
|
||||
}
|
||||
|
||||
|
||||
private String queueName;
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ public interface TenantConvert {
|
||||
reqVO.setUsername(bean.getUsername());
|
||||
reqVO.setPassword(bean.getPassword());
|
||||
reqVO.setNickname(bean.getContactName()).setMobile(bean.getContactMobile());
|
||||
reqVO.setQueueName(bean.getQueueName());
|
||||
// 租户创建的用户,默认是管理员用户
|
||||
reqVO.setUserType("0");
|
||||
return reqVO;
|
||||
|
@@ -77,4 +77,7 @@ public class TenantDO extends BaseDO {
|
||||
*/
|
||||
private Integer accountCount;
|
||||
|
||||
|
||||
private String queueName;
|
||||
|
||||
}
|
||||
|
@@ -116,5 +116,6 @@ public class AdminUserDO extends TenantBaseDO {
|
||||
private LocalDateTime loginDate;
|
||||
|
||||
|
||||
private String queueName;
|
||||
|
||||
}
|
||||
|
@@ -200,7 +200,9 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
|
||||
if (userType.equals(UserTypeEnum.ADMIN.getValue())) {
|
||||
AdminUserDO user = adminUserService.getUser(userId);
|
||||
return MapUtil.builder(LoginUser.INFO_KEY_NICKNAME, user.getNickname())
|
||||
.put(LoginUser.INFO_KEY_DEPT_ID, StrUtil.toStringOrNull(user.getDeptId())).build();
|
||||
.put(LoginUser.INFO_KEY_DEPT_ID, StrUtil.toStringOrNull(user.getDeptId()))
|
||||
.put(LoginUser.INFO_KEY_QUEUE, StrUtil.toStringOrNull(user.getQueueName()))
|
||||
.build();
|
||||
} else if (userType.equals(UserTypeEnum.MEMBER.getValue())) {
|
||||
// 注意:目前 Member 暂时不读取,可以按需实现
|
||||
return Collections.emptyMap();
|
||||
|
@@ -12,6 +12,7 @@ import pc.exam.pp.framework.common.util.object.BeanUtils;
|
||||
import pc.exam.pp.framework.tenant.config.TenantProperties;
|
||||
import pc.exam.pp.framework.tenant.core.context.TenantContextHolder;
|
||||
import pc.exam.pp.framework.tenant.core.util.TenantUtils;
|
||||
import pc.exam.pp.module.exam.utils.rabbitmq.RabbitmqUtils;
|
||||
import pc.exam.pp.module.system.controller.admin.permission.vo.role.RoleSaveReqVO;
|
||||
import pc.exam.pp.module.system.controller.admin.tenant.vo.tenant.TenantPageReqVO;
|
||||
import pc.exam.pp.module.system.controller.admin.tenant.vo.tenant.TenantSaveReqVO;
|
||||
@@ -63,7 +64,8 @@ public class TenantServiceImpl implements TenantService {
|
||||
@SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection")
|
||||
@Autowired(required = false) // 由于 exam.tenant.enable 配置项,可以关闭多租户的功能,所以这里只能不强制注入
|
||||
private TenantProperties tenantProperties;
|
||||
|
||||
@Resource
|
||||
private RabbitmqUtils rabbitMqService;
|
||||
@Resource
|
||||
private TenantMapper tenantMapper;
|
||||
|
||||
@@ -117,6 +119,12 @@ public class TenantServiceImpl implements TenantService {
|
||||
tenantMapper.insert(tenant);
|
||||
// 创建租户对应的专业的授权点数
|
||||
Long tenantId = tenant.getId();
|
||||
|
||||
String queueName=tenantId.toString()+"_Queue";
|
||||
tenant.setQueueName(queueName);
|
||||
|
||||
tenantMapper.updateById(tenant);
|
||||
|
||||
for (TenantSpecialtyPointsVO specialtyPointsVO : createReqVO.getTenantSpecialtyPointsVOList()) {
|
||||
// 新增数据
|
||||
specialtyPointsVO.setTenantId(tenantId);
|
||||
@@ -124,6 +132,9 @@ public class TenantServiceImpl implements TenantService {
|
||||
BeanUtils.copyProperties(specialtyPointsVO, tenantSpcialtyDO);
|
||||
tenantSpecialtyMapper.insert(tenantSpcialtyDO);
|
||||
}
|
||||
createReqVO.setQueueName(queueName);
|
||||
//创建rabbitmq通道
|
||||
rabbitMqService.connect(queueName);
|
||||
// 创建租户的管理员
|
||||
TenantUtils.execute(tenant.getId(), () -> {
|
||||
// 创建角色
|
||||
|
@@ -11,6 +11,7 @@ import pc.exam.pp.framework.common.util.collection.CollectionUtils;
|
||||
import pc.exam.pp.framework.common.util.object.BeanUtils;
|
||||
import pc.exam.pp.framework.common.util.validation.ValidationUtils;
|
||||
import pc.exam.pp.framework.datapermission.core.util.DataPermissionUtils;
|
||||
import pc.exam.pp.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import pc.exam.pp.framework.web.core.util.WebFrameworkUtils;
|
||||
import pc.exam.pp.module.exam.controller.admin.classs.vo.ClassSaveReqVO;
|
||||
import pc.exam.pp.module.exam.controller.admin.specialty.vo.SpecialtListByUserReqVo;
|
||||
@@ -27,6 +28,7 @@ import pc.exam.pp.module.system.controller.admin.user.vo.profile.UserProfileUpda
|
||||
import pc.exam.pp.module.system.controller.admin.user.vo.user.*;
|
||||
import pc.exam.pp.module.system.dal.dataobject.dept.DeptDO;
|
||||
import pc.exam.pp.module.system.dal.dataobject.dept.UserPostDO;
|
||||
import pc.exam.pp.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import pc.exam.pp.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import pc.exam.pp.module.system.dal.dataobject.user.TeacherClassDO;
|
||||
import pc.exam.pp.module.system.dal.dataobject.user.TeacherSpecialtyDO;
|
||||
@@ -110,6 +112,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_CREATE_SUB_TYPE, bizNo = "{{#user.id}}",
|
||||
success = SYSTEM_USER_CREATE_SUCCESS)
|
||||
public Long createUser(UserSaveReqVO createReqVO) {
|
||||
|
||||
// 1.1 校验账户配合
|
||||
tenantService.handleTenantInfo(tenant -> {
|
||||
long count = userMapper.selectCount();
|
||||
@@ -123,7 +126,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
// 2.1 插入用户
|
||||
AdminUserDO user = BeanUtils.toBean(createReqVO, AdminUserDO.class);
|
||||
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||
user.setPassword(encodePassword(createReqVO.getPassword())); // 加密密码
|
||||
user.setPassword(encodePassword(createReqVO.getPassword())); //
|
||||
user.setQueueName(createReqVO.getQueueName());
|
||||
|
||||
userMapper.insert(user);
|
||||
// 2.2 插入关联岗位
|
||||
if (CollectionUtil.isNotEmpty(user.getPostIds())) {
|
||||
@@ -197,7 +202,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
AdminUserDO user = BeanUtils.toBean(createReqVO, AdminUserDO.class);
|
||||
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||
user.setPassword(encodePassword(createReqVO.getPassword())); // 加密密码s
|
||||
|
||||
user.setQueueName(SecurityFrameworkUtils.getLoginQueueName());
|
||||
userMapper.insert(user);
|
||||
|
||||
// 2.2 插入关联岗位
|
||||
if (CollectionUtil.isNotEmpty(user.getPostIds())) {
|
||||
userPostMapper.insertBatch(convertList(user.getPostIds(),
|
||||
@@ -218,6 +226,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
// 3. 记录操作日志上下文
|
||||
LogRecordContext.putVariable("user", user);
|
||||
|
||||
return user.getId();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user