add 国际研讨会会议校验邀请码不能重复
This commit is contained in:
+4
-2
@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.meeting.vo.PayMeetingVO;
|
||||
import com.jero.modules.system.volid.group.UpdateGroup;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -93,8 +94,9 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
|
||||
@AutoLog(value = "会议管理-编辑")
|
||||
@ApiOperation(value="会议管理-编辑", notes="会议管理-编辑")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody PayMeeting payMeeting) {
|
||||
payMeetingService.editById(payMeeting);
|
||||
public Result<?> edit(@RequestBody PayMeetingVO payMeetingVO) {
|
||||
ValidUtil.validate(payMeetingVO, UpdateGroup.class);
|
||||
payMeetingService.editById(payMeetingVO);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
|
||||
+3
-9
@@ -14,21 +14,15 @@ import java.util.List;
|
||||
*/
|
||||
public interface IPayMeetingService extends IService<PayMeeting> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
void add(PayMeeting payMeeting);
|
||||
|
||||
/**
|
||||
* 新增会议
|
||||
* @param payMeetingVO
|
||||
*/
|
||||
void add(PayMeetingVO payMeetingVO);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
void editById(PayMeeting payMeeting);
|
||||
* 新增会议
|
||||
*/
|
||||
void editById(PayMeetingVO payMeeting);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
|
||||
+44
-19
@@ -14,14 +14,12 @@ import com.jero.meeting.valid.group.InternationalMeeting;
|
||||
import com.jero.meeting.valid.group.StandardMeeting;
|
||||
import com.jero.meeting.valid.group.WorkingGroupMeeting;
|
||||
import com.jero.meeting.vo.PayMeetingVO;
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
@@ -37,23 +35,37 @@ import javax.annotation.Resource;
|
||||
public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeeting> implements IPayMeetingService {
|
||||
@Resource
|
||||
private ISysBaseAPI sysBaseApi;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* 新增会议
|
||||
*/
|
||||
@Override
|
||||
public void add(PayMeeting payMeeting) {
|
||||
public void add(PayMeetingVO payMeetingVO) {
|
||||
PayMeeting payMeeting = getPayMeeting(payMeetingVO);
|
||||
save(payMeeting);
|
||||
}
|
||||
|
||||
save(payMeeting);
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Override
|
||||
public void editById(PayMeetingVO payMeetingVO) {
|
||||
PayMeeting payMeeting = getPayMeeting(payMeetingVO);
|
||||
saveOrUpdate(payMeeting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(PayMeetingVO payMeetingVO) {
|
||||
@NotNull
|
||||
private PayMeeting getPayMeeting(PayMeetingVO payMeetingVO) {
|
||||
List<String> errorMsgList = new ArrayList<>();
|
||||
PayMeeting payMeeting = new PayMeeting();
|
||||
//判断会议名称
|
||||
String meetingName = payMeetingVO.getMeetingName();
|
||||
LambdaQueryWrapper<PayMeeting> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PayMeeting::getMeetingName,meetingName);
|
||||
String id = payMeetingVO.getId();
|
||||
if (id !=null){
|
||||
wrapper.ne(PayMeeting::getId,id);
|
||||
}
|
||||
if (count(wrapper)>0){
|
||||
throw new JeroBootException("会议名称不能重复");
|
||||
}
|
||||
@@ -82,8 +94,29 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
|
||||
ValidUtil.validate(payMeetingVO, StandardMeeting.class);
|
||||
}else if (meetingType.equals(MeetingCommon.INTERNATIONAL_MEETING)){
|
||||
ValidUtil.validate(payMeetingVO, InternationalMeeting.class);
|
||||
}else {
|
||||
|
||||
//邀请码不能有重复的
|
||||
List<String> codeList = new ArrayList<>();
|
||||
//VIP邀请码
|
||||
String vipInvitationCode = payMeetingVO.getVipInvitationCode();
|
||||
codeList.add(vipInvitationCode);
|
||||
//演讲嘉宾邀请码
|
||||
String speakerInvitationCode = payMeetingVO.getSpeakerInvitationCode();
|
||||
if (codeList.contains(speakerInvitationCode)) {
|
||||
throw new JeroBootException("邀请码不能重复");
|
||||
}
|
||||
codeList.add(speakerInvitationCode);
|
||||
//特邀嘉宾邀请码
|
||||
String guestInvitationCode = payMeetingVO.getGuestInvitationCode();
|
||||
if (codeList.contains(guestInvitationCode)) {
|
||||
throw new JeroBootException("邀请码不能重复");
|
||||
}
|
||||
codeList.add(guestInvitationCode);
|
||||
//合作伙伴邀请码
|
||||
String cooperativeInvitationCode = payMeetingVO.getCooperativeInvitationCode();
|
||||
if (codeList.contains(cooperativeInvitationCode)) {
|
||||
throw new JeroBootException("邀请码不能重复");
|
||||
}
|
||||
codeList.add(cooperativeInvitationCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,17 +124,9 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
|
||||
throw new JeroBootException(errorMsgList.toString());
|
||||
}
|
||||
BeanUtils.copyProperties(payMeetingVO,payMeeting);
|
||||
save(payMeeting);
|
||||
return payMeeting;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Override
|
||||
public void editById(PayMeeting payMeeting) {
|
||||
saveOrUpdate(payMeeting);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.jero.meeting.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.meeting.entity.PayMeetingHotelContacts;
|
||||
import com.jero.meeting.valid.group.InternationalMeeting;
|
||||
import com.jero.meeting.valid.group.StandardMeeting;
|
||||
import com.jero.meeting.valid.group.WorkingGroupMeeting;
|
||||
import com.jero.modules.system.volid.group.UpdateGroup;
|
||||
import com.jero.valid.ValidList;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -30,6 +33,11 @@ import java.io.Serializable;
|
||||
public class PayMeetingVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@NotBlank(message = "会议id不能为空",groups = UpdateGroup.class)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
/**会议名称*/
|
||||
@Excel(name = "会议名称", width = 15)
|
||||
@ApiModelProperty(value = "会议名称")
|
||||
|
||||
Reference in New Issue
Block a user