Commit c8d51489 authored by mengmeng's avatar mengmeng

meeting updateApi modify

parent 3085dabe
...@@ -14,4 +14,8 @@ public interface MeetingService extends CrudService<MeetingEntity, MeetingDTO> { ...@@ -14,4 +14,8 @@ public interface MeetingService extends CrudService<MeetingEntity, MeetingDTO> {
@Override @Override
void save(MeetingDTO dto); void save(MeetingDTO dto);
@Override
void update(MeetingDTO dto);
} }
...@@ -5,6 +5,7 @@ import io.hmit.common.service.impl.CrudServiceImpl; ...@@ -5,6 +5,7 @@ import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils; import io.hmit.common.utils.ConvertUtils;
import io.hmit.modules.meeting.dao.MeetingDao; import io.hmit.modules.meeting.dao.MeetingDao;
import io.hmit.modules.meeting.dto.MeetingDTO; import io.hmit.modules.meeting.dto.MeetingDTO;
import io.hmit.modules.meeting.dto.WlMeetingStaffDTO;
import io.hmit.modules.meeting.entity.MeetingEntity; import io.hmit.modules.meeting.entity.MeetingEntity;
import io.hmit.modules.meeting.entity.WlMeetingStaffEntity; import io.hmit.modules.meeting.entity.WlMeetingStaffEntity;
import io.hmit.modules.meeting.service.MeetingService; import io.hmit.modules.meeting.service.MeetingService;
...@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service; ...@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -54,6 +56,43 @@ public class MeetingServiceImpl extends CrudServiceImpl<MeetingDao, MeetingEntit ...@@ -54,6 +56,43 @@ public class MeetingServiceImpl extends CrudServiceImpl<MeetingDao, MeetingEntit
BeanUtils.copyProperties(entity, dto); BeanUtils.copyProperties(entity, dto);
//会议人员对应关系保存 //会议人员对应关系保存
Map<String, Object> params = new HashMap<>();
params.put("meetingId",dto.getId());
List<WlMeetingStaffDTO> wl= wlMeetingStaffService.list(params);
if(wl.size()>0){
wl.forEach(wlMeetingStaffDTO -> {
wlMeetingStaffService.deleteById(wlMeetingStaffDTO.getId());
});
}
List<WlMeetingStaffEntity> wlMeetingStaffList = new ArrayList<>();
dto.getInvitedUserIDs().stream().forEach(userId->{
WlMeetingStaffEntity meetingStaff = new WlMeetingStaffEntity();
meetingStaff = meetingStaff.assembleWlMeetingStaff(dto.getId(),userId,null);
wlMeetingStaffList.add(meetingStaff);
});
wlMeetingStaffService.insertBatch(wlMeetingStaffList);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(MeetingDTO dto) {
MeetingEntity entity = ConvertUtils.sourceToTarget(dto, currentModelClass());
updateById(entity);
//copy主键值到dto
// BeanUtils.copyProperties(entity, dto);
//会议人员对应关系查询是否存在,有先删除再保存
Map<String, Object> params = new HashMap<>();
params.put("meetingId",dto.getId());
List<WlMeetingStaffDTO> wl= wlMeetingStaffService.list(params);
if(wl.size()>0){
wl.forEach(wlMeetingStaffDTO -> {
wlMeetingStaffService.deleteById(wlMeetingStaffDTO.getId());
});
}
List<WlMeetingStaffEntity> wlMeetingStaffList = new ArrayList<>(); List<WlMeetingStaffEntity> wlMeetingStaffList = new ArrayList<>();
dto.getInvitedUserIDs().stream().forEach(userId->{ dto.getInvitedUserIDs().stream().forEach(userId->{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment