add 标协会议校验酒店联系人
This commit is contained in:
-1
@@ -20,7 +20,6 @@ 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;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
-6
@@ -1,24 +1,18 @@
|
||||
package com.jero.meeting.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.jero.meeting.valid.group.StandardMeeting;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
|
||||
+35
-3
@@ -8,12 +8,15 @@ import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.ValidUtil;
|
||||
import com.jero.meeting.common.MeetingCommon;
|
||||
import com.jero.meeting.entity.PayMeeting;
|
||||
import com.jero.meeting.entity.PayMeetingHotelContacts;
|
||||
import com.jero.meeting.mapper.PayMeetingMapper;
|
||||
import com.jero.meeting.service.IPayMeetingHotelContactsService;
|
||||
import com.jero.meeting.service.IPayMeetingService;
|
||||
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.shiro.util.CollectionUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -35,14 +38,26 @@ import javax.annotation.Resource;
|
||||
public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeeting> implements IPayMeetingService {
|
||||
@Resource
|
||||
private ISysBaseAPI sysBaseApi;
|
||||
@Resource
|
||||
private IPayMeetingHotelContactsService meetingHotelContactsService;
|
||||
|
||||
/**
|
||||
* 新增会议
|
||||
*/
|
||||
@Override
|
||||
public void add(PayMeetingVO payMeetingVO) {
|
||||
PayMeeting payMeeting = getPayMeeting(payMeetingVO);
|
||||
//酒店联系人列表
|
||||
List<PayMeetingHotelContacts> hotelContactsList = new ArrayList<>();
|
||||
PayMeeting payMeeting = getPayMeeting(payMeetingVO,hotelContactsList);
|
||||
save(payMeeting);
|
||||
//如果酒店联系人列表不为空,就新增
|
||||
if (!CollectionUtils.isEmpty(hotelContactsList)){
|
||||
String meetingId = payMeeting.getId();
|
||||
hotelContactsList.forEach(hotelContacts ->
|
||||
hotelContacts.setMeetingId(meetingId)
|
||||
);
|
||||
meetingHotelContactsService.saveBatch(hotelContactsList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,12 +65,25 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
|
||||
*/
|
||||
@Override
|
||||
public void editById(PayMeetingVO payMeetingVO) {
|
||||
PayMeeting payMeeting = getPayMeeting(payMeetingVO);
|
||||
List<PayMeetingHotelContacts> hotelContactsList = new ArrayList<>();
|
||||
PayMeeting payMeeting = getPayMeeting(payMeetingVO, hotelContactsList);
|
||||
saveOrUpdate(payMeeting);
|
||||
//如果酒店联系人列表不为空,就更新
|
||||
if (!CollectionUtils.isEmpty(hotelContactsList)){
|
||||
String meetingId = payMeeting.getId();
|
||||
//先删除原先的酒店联系人,在添加新的
|
||||
LambdaQueryWrapper<PayMeetingHotelContacts> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PayMeetingHotelContacts::getMeetingId,meetingId);
|
||||
meetingHotelContactsService.remove(queryWrapper);
|
||||
hotelContactsList.forEach(hotelContacts ->
|
||||
hotelContacts.setMeetingId(meetingId)
|
||||
);
|
||||
meetingHotelContactsService.saveBatch(hotelContactsList);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PayMeeting getPayMeeting(PayMeetingVO payMeetingVO) {
|
||||
private PayMeeting getPayMeeting(PayMeetingVO payMeetingVO, List<PayMeetingHotelContacts> hotelContactsList) {
|
||||
List<String> errorMsgList = new ArrayList<>();
|
||||
PayMeeting payMeeting = new PayMeeting();
|
||||
//判断会议名称
|
||||
@@ -92,6 +120,10 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
|
||||
ValidUtil.validate(payMeetingVO, WorkingGroupMeeting.class);
|
||||
}else if (meetingType.equals(MeetingCommon.STANDARD_MEETING)){
|
||||
ValidUtil.validate(payMeetingVO, StandardMeeting.class);
|
||||
hotelContactsList = payMeetingVO.getHotelContactsList();
|
||||
for (PayMeetingHotelContacts hotelContacts : hotelContactsList) {
|
||||
ValidUtil.validate(hotelContacts, StandardMeeting.class);
|
||||
}
|
||||
}else if (meetingType.equals(MeetingCommon.INTERNATIONAL_MEETING)){
|
||||
ValidUtil.validate(payMeetingVO, InternationalMeeting.class);
|
||||
//邀请码不能有重复的
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
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;
|
||||
import lombok.Data;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 会议管理VO
|
||||
@@ -219,9 +216,9 @@ public class PayMeetingVO implements Serializable {
|
||||
/**
|
||||
* 会议关联酒店联系人列表
|
||||
*/
|
||||
@Valid
|
||||
@NotNull(message = "酒店联系人不能为空",groups = StandardMeeting.class)
|
||||
@Size(max = 5, message = "酒店联系人最多为5个",groups = StandardMeeting.class)
|
||||
private ValidList<PayMeetingHotelContacts> payMeetingHotelContactsList;
|
||||
private List<PayMeetingHotelContacts> hotelContactsList;
|
||||
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
package com.jero.valid;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
* @date 2021-09-02 17:36
|
||||
*/
|
||||
public class ValidList<E> implements List<E> {
|
||||
@Valid
|
||||
private List<E> list;
|
||||
|
||||
public ValidList() {
|
||||
this.list = new ArrayList<>();
|
||||
}
|
||||
|
||||
public ValidList(List<E> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public List<E> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<E> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
//重写List方法,可省略
|
||||
@Override
|
||||
public int size() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return list.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return list.contains(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<E> iterator() {
|
||||
return list.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return list.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T[] toArray(@NotNull T[] a) {
|
||||
return list.toArray(a);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(E e) {
|
||||
return list.add(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return list.remove(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsAll(@NotNull Collection<?> c) {
|
||||
return list.contains(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(@NotNull Collection<? extends E> c) {
|
||||
return list.addAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(int index, @NotNull Collection<? extends E> c) {
|
||||
return list.addAll(index, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeAll(@NotNull Collection<?> c) {
|
||||
return list.removeAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean retainAll(@NotNull Collection<?> c) {
|
||||
return list.retainAll(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E get(int index) {
|
||||
return list.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E set(int index, E element) {
|
||||
return list.set(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, E element) {
|
||||
list.add(index, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public E remove(int index) {
|
||||
return list.remove(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(Object o) {
|
||||
return list.indexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return list.lastIndexOf(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<E> listIterator() {
|
||||
return list.listIterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListIterator<E> listIterator(int index) {
|
||||
return list.listIterator(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<E> subList(int fromIndex, int toIndex) {
|
||||
return list.subList(fromIndex, toIndex);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user