提交 945c276e 作者: 张开石

1、会议类型的新增、修改接口添加对会议类型的判断

2、会议模板的新增、更新接口添加请求参数的校验
父级 ed96c52d
...@@ -19,6 +19,11 @@ public class MeetingTypeConstant { ...@@ -19,6 +19,11 @@ public class MeetingTypeConstant {
public static final Integer AUTH_TYPE_ALL = 1; public static final Integer AUTH_TYPE_ALL = 1;
public static final Integer AUTH_TYPE_CUSTOM = 2; public static final Integer AUTH_TYPE_CUSTOM = 2;
/**
* 会议类型,system-系统通用,custom-自定义
*/
public static final String MEET_TYPE_SYSTEM = "system";
public static final String MEET_TYPE_CUSTOM = "custom";
} }
package com.cmeeting.controller; package com.cmeeting.controller;
import com.cmeeting.constant.MeetingTypeConstant; import com.cmeeting.constant.MeetingTypeConstant;
import com.cmeeting.dto.MeetTypeDto;
import com.cmeeting.service.MeetTypeService; import com.cmeeting.service.MeetTypeService;
import com.cmeeting.util.R; import com.cmeeting.util.R;
import com.cmeeting.vo.MeetingTypeVo; import com.cmeeting.vo.MeetingTypeVo;
import org.hibernate.validator.constraints.EAN;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* @Description * @Description
* @Author zhang kaishi * @Author zhang kaishi
...@@ -32,6 +36,10 @@ public class MeetingTypeController { ...@@ -32,6 +36,10 @@ public class MeetingTypeController {
if (MeetingTypeConstant.AUTH_TYPE_CUSTOM.equals(authType) && ObjectUtils.isEmpty(meetingTypeVo.getUserIds())) { if (MeetingTypeConstant.AUTH_TYPE_CUSTOM.equals(authType) && ObjectUtils.isEmpty(meetingTypeVo.getUserIds())) {
return R.error("userIds不能为空"); return R.error("userIds不能为空");
} }
String type = meetingTypeVo.getType();
if (!MeetingTypeConstant.MEET_TYPE_SYSTEM.equals(type) && !MeetingTypeConstant.MEET_TYPE_CUSTOM.equals(type) ) {
return R.error("type参数错误");
}
meetTypeService.add(meetingTypeVo); meetTypeService.add(meetingTypeVo);
return R.ok(); return R.ok();
...@@ -48,6 +56,10 @@ public class MeetingTypeController { ...@@ -48,6 +56,10 @@ public class MeetingTypeController {
if (MeetingTypeConstant.AUTH_TYPE_CUSTOM.equals(authType) && ObjectUtils.isEmpty(meetingTypeVo.getUserIds())) { if (MeetingTypeConstant.AUTH_TYPE_CUSTOM.equals(authType) && ObjectUtils.isEmpty(meetingTypeVo.getUserIds())) {
return R.error("userIds不能为空"); return R.error("userIds不能为空");
} }
String type = meetingTypeVo.getType();
if (!MeetingTypeConstant.MEET_TYPE_SYSTEM.equals(type) && !MeetingTypeConstant.MEET_TYPE_CUSTOM.equals(type) ) {
return R.error("type参数错误");
}
meetTypeService.update(meetingTypeVo); meetTypeService.update(meetingTypeVo);
return R.ok(); return R.ok();
......
...@@ -24,6 +24,11 @@ public class MeetType { ...@@ -24,6 +24,11 @@ public class MeetType {
private String name; private String name;
/** /**
* 会议类型,system-系统通用,custom-自定义
*/
private String type;
/**
* 逻辑删除,0-否(默认),1-是 * 逻辑删除,0-否(默认),1-是
*/ */
@TableLogic(delval = "1", value = "0") @TableLogic(delval = "1", value = "0")
......
...@@ -6,6 +6,7 @@ import com.cmeeting.ad.entity.RobotSecurityUser; ...@@ -6,6 +6,7 @@ import com.cmeeting.ad.entity.RobotSecurityUser;
import com.cmeeting.ad.util.SecurityUtil; import com.cmeeting.ad.util.SecurityUtil;
import com.cmeeting.constant.MeetingTypeConstant; import com.cmeeting.constant.MeetingTypeConstant;
import com.cmeeting.constant.ModulePermissionConstant; import com.cmeeting.constant.ModulePermissionConstant;
import com.cmeeting.dto.MeetTypeDto;
import com.cmeeting.mapper.primary.MeetTemplateEnableMapper; import com.cmeeting.mapper.primary.MeetTemplateEnableMapper;
import com.cmeeting.mapper.primary.MeetingRecordTemplateMapper; import com.cmeeting.mapper.primary.MeetingRecordTemplateMapper;
import com.cmeeting.mapper.primary.ModulePermissionMapper; import com.cmeeting.mapper.primary.ModulePermissionMapper;
...@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service; ...@@ -25,6 +26,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -54,6 +56,13 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType> ...@@ -54,6 +56,13 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType>
@Override @Override
public void add(MeetingTypeVo meetingTypeVo) { public void add(MeetingTypeVo meetingTypeVo) {
if (MeetingTypeConstant.MEET_TYPE_SYSTEM.equals(meetingTypeVo.getType())) {
Integer count = meetTypeMapper.selectCount(new QueryWrapper<MeetType>().eq("type", MeetingTypeConstant.MEET_TYPE_SYSTEM));
if (count > 0) {
throw new RuntimeException("系统通用会议类型已存在");
}
}
Date now = new Date(); Date now = new Date();
RobotSecurityUser loginUser = SecurityUtil.getUser(); RobotSecurityUser loginUser = SecurityUtil.getUser();
...@@ -61,6 +70,7 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType> ...@@ -61,6 +70,7 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType>
MeetType meetType = new MeetType(); MeetType meetType = new MeetType();
meetType.setName(meetingTypeVo.getName()); meetType.setName(meetingTypeVo.getName());
meetType.setType(meetingTypeVo.getType());
meetType.setPersonalPermission(meetingTypeVo.getPersonalPermission()); meetType.setPersonalPermission(meetingTypeVo.getPersonalPermission());
meetType.setAuthType(meetingTypeVo.getAuthType()); meetType.setAuthType(meetingTypeVo.getAuthType());
meetType.setRelId(meetingTypeVo.getRelId()); meetType.setRelId(meetingTypeVo.getRelId());
...@@ -81,13 +91,20 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType> ...@@ -81,13 +91,20 @@ public class MeetTypeServiceImpl extends ServiceImpl<MeetTypeMapper, MeetType>
*/ */
@Override @Override
public void update(MeetingTypeVo meetingTypeVo) { public void update(MeetingTypeVo meetingTypeVo) {
Date now = new Date(); if (MeetingTypeConstant.MEET_TYPE_SYSTEM.equals(meetingTypeVo.getType())) {
Integer count = meetTypeMapper.selectCount(new QueryWrapper<MeetType>().eq("type", MeetingTypeConstant.MEET_TYPE_SYSTEM));
if (count > 0) {
throw new RuntimeException("系统通用会议类型已存在");
}
}
Date now = new Date();
RobotSecurityUser loginUser = SecurityUtil.getUser(); RobotSecurityUser loginUser = SecurityUtil.getUser();
MeetType meetType = new MeetType(); MeetType meetType = new MeetType();
meetType.setId(meetingTypeVo.getId()); meetType.setId(meetingTypeVo.getId());
meetType.setName(meetingTypeVo.getName()); meetType.setName(meetingTypeVo.getName());
meetType.setType(meetingTypeVo.getType());
meetType.setPersonalPermission(meetingTypeVo.getPersonalPermission()); meetType.setPersonalPermission(meetingTypeVo.getPersonalPermission());
meetType.setAuthType(meetingTypeVo.getAuthType()); meetType.setAuthType(meetingTypeVo.getAuthType());
meetType.setRelId(meetingTypeVo.getRelId()); meetType.setRelId(meetingTypeVo.getRelId());
......
...@@ -29,6 +29,7 @@ public class EditRecordTemplateVo { ...@@ -29,6 +29,7 @@ public class EditRecordTemplateVo {
private Long referTemplateId; private Long referTemplateId;
// 模板描述 // 模板描述
@NotEmpty(message = "typeDetail不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String typeDetail; private String typeDetail;
// 提示词 // 提示词
......
...@@ -23,6 +23,10 @@ public class MeetingTypeVo { ...@@ -23,6 +23,10 @@ public class MeetingTypeVo {
@NotEmpty(message = "name不能为空", groups = {AddGroup.class, UpdateGroup.class}) @NotEmpty(message = "name不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String name; private String name;
// 会议类型,system-系统通用,custom-自定义
@NotEmpty(message = "type不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String type;
// 允许用户在此类型下自定义创建模板,0-不允许,1-允许(默认) // 允许用户在此类型下自定义创建模板,0-不允许,1-允许(默认)
@Range(min = 0, max = 1, message = "personalPermission只能为0或1", groups = {AddGroup.class, UpdateGroup.class}) @Range(min = 0, max = 1, message = "personalPermission只能为0或1", groups = {AddGroup.class, UpdateGroup.class})
private Integer personalPermission; private Integer personalPermission;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<resultMap id="BaseResultMap" type="com.cmeeting.pojo.MeetType"> <resultMap id="BaseResultMap" type="com.cmeeting.pojo.MeetType">
<id property="id" column="id" /> <id property="id" column="id" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="type" column="type" />
<result property="isDel" column="is_del" /> <result property="isDel" column="is_del" />
<result property="personalPermission" column="personal_permission" /> <result property="personalPermission" column="personal_permission" />
<result property="authType" column="auth_type" /> <result property="authType" column="auth_type" />
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, `name`, is_del, personal_permission, auth_type, rel_id, id, `name`, `type`, is_del, personal_permission, auth_type, rel_id,
content, create_time, update_time, create_user, update_user, create_user_name, update_user_name content, create_time, update_time, create_user, update_user, create_user_name, update_user_name
</sql> </sql>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论