From 047a667866119e8a182e678bd517510bff358e93 Mon Sep 17 00:00:00 2001
From: zqy <2522236926@qq.com>
Date: 星期五, 19 四月 2024 17:33:59 +0800
Subject: [PATCH] Meeting接口
---
zhang-content/src/main/java/com/ruoyi/domain/Meeting.java | 100 +++++++++
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MeetingController.java | 130 +++++++++++
zhang-content/src/main/java/com/ruoyi/service/MeetingService.java | 31 ++
zhang-content/src/main/java/com/ruoyi/mapper/MeetingMapper.java | 18 +
zhang-content/src/main/java/com/ruoyi/service/impl/MeetingServiceImpl.java | 368 +++++++++++++++++++++++++++++++++
5 files changed, 647 insertions(+), 0 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MeetingController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MeetingController.java
new file mode 100644
index 0000000..d29677a
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/MeetingController.java
@@ -0,0 +1,130 @@
+package com.ruoyi.web.controller.zhang;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.domain.Meeting;
+import com.ruoyi.domain.ZfEvent;
+import com.ruoyi.domain.excel.ZfEventExcelBean;
+import com.ruoyi.service.MeetingService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
+import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
+
+/**
+ * <p>
+ * 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author ojq
+ * @since 2023-03-12
+ */
+@Slf4j
+@RestController
+@RequestMapping("/zMeeting")
+public class MeetingController extends BaseController {
+ @Autowired
+ private MeetingService meetingService;
+
+ @GetMapping("/all")
+ public AjaxResult listAll(Meeting meeting){
+ Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
+ Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
+ return meetingService.selectDataList(meeting, pageNum, pageSize);
+ }
+
+ /**
+ * 鑾峰彇浼氳璁板綍璇︾粏淇℃伅
+ */
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
+ return success(meetingService.getById(id));
+ }
+
+ /**
+ * 鏂板浼氳璁板綍
+ */
+ @Log(title = "浼氳璁板綍", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody Meeting meeting)
+ {
+ return meetingService.addData(meeting);
+ }
+
+ /**
+ * 鑾峰彇瀵煎叆妯℃澘
+ */
+ @PostMapping("/model")
+ public void getExportModel(HttpServletResponse response){
+ List<Meeting> list = Collections.singletonList(new Meeting());
+ ExcelUtil<Meeting> util = new ExcelUtil<>(Meeting.class);
+ util.exportExcel(response,list,"浼氳瀵煎叆妯℃澘");
+ }
+
+ /**
+ * 瀵煎嚭浼氳璁板綍鍒楄〃
+ */
+ @Log(title = "浼氳璁板綍", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, Meeting meeting) {
+ List<Meeting> list = new ArrayList<>();
+
+ list = meetingService.selectByCondition(meeting);
+ log.info("瀵煎嚭璁板綍涓�:{}", list);
+ ExcelUtil<Meeting> util = new ExcelUtil<>(Meeting.class);
+ util.exportExcel(response, list, "浼氳璁板綍鏁版嵁");
+
+ }
+ /**
+ * 瀵煎嚭浼氳璁板綍鍒楄〃
+ */
+// @PreAuthorize("@ss.hasPermi('system:property:export')")
+ @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.EXPORT)
+ @PostMapping("/export1/{ids}")
+ public void export(HttpServletResponse response, @PathVariable Long[] ids) {
+ List<Meeting> list = meetingService.selectByIds(ids);
+ log.info("瀵煎嚭璁板綍涓�:{}", list);
+ ExcelUtil<Meeting> util = new ExcelUtil<>(Meeting.class);
+ util.exportExcel(response, list, "浼氳璁板綍鏁版嵁");
+
+ }
+ /**
+ * 淇敼浼氳璁板綍
+ */
+ @Log(title = "浼氳璁板綍", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody Meeting meeting) {
+ return meetingService.updateData(meeting);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎浼氳璁板綍
+ */
+ @Log(title = "浼氳璁板綍", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids) {
+ return meetingService.deleteData(ids);
+ }
+
+ /**
+ * 瀵煎叆浼氳璁板綍鍒楄〃
+ */
+ @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.IMPORT)
+ @PostMapping("/importData")
+ public AjaxResult importData(@RequestParam("excelImport") MultipartFile file) throws Exception {
+ return meetingService.importExcel(file);
+ }
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/domain/Meeting.java b/zhang-content/src/main/java/com/ruoyi/domain/Meeting.java
new file mode 100644
index 0000000..aa37835
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/domain/Meeting.java
@@ -0,0 +1,100 @@
+package com.ruoyi.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("meeting")
+public class Meeting {
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+ /**
+ * 鏍囬
+ */
+ @Excel(name = "鏍囬")
+ private String title;
+ /**
+ * 鍦扮偣
+ */
+ @Excel(name = "鍦扮偣")
+ private String place;
+ /**
+ * 鍙绾充汉鏁�
+ */
+ @Excel(name = "鍙绾充汉鏁�")
+ private int conPeople;
+ /**
+ * 鍙備笌浜烘暟
+ */
+ @Excel(name = "鍙備笌浜烘暟")
+ private int partPeople;
+ /**
+ * 鐢宠浜�
+ */
+ @Excel(name = "鐢宠浜�")
+ private int applyPerson;
+ /**
+ * 鐢宠閮ㄩ棬鎴栧搴�
+ */
+ @Excel(name = "鐢宠閮ㄩ棬鎴栧搴�")
+ private String applyApart;
+ /**
+ * 寮�濮嬫椂闂�
+ */
+ @Excel(name = "寮�濮嬫椂闂�")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date startTime;
+ /**
+ * 缁撴潫鏃堕棿
+ */
+ @Excel(name = "缁撴潫鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date endTime;
+
+
+ /**
+ * 寮�濮嬪紑浼氭椂闂�
+ */
+ @TableField(exist = false)
+ private Date happenStartTime;
+
+ /**
+ * 缁撴潫鏃堕棿
+ */
+ @TableField(exist = false)
+ private Date happenEndTime;
+ /**
+ * 鏄惁鎽嗘斁姘寸墝
+ */
+ @Excel(name = "鏄惁鎽嗘斁姘寸墝")
+ private int isPlacebrand;
+ /**
+ * 鑱旂郴浜�
+ */
+ @Excel(name = "鑱旂郴浜�")
+ private int connPerson;
+ /**
+ * 鑱旂郴鐢佃瘽
+ */
+ @Excel(name = "鑱旂郴鐢佃瘽")
+ private String connPhone;
+ /**
+ * 鐘舵��
+ */
+ @Excel(name = "鐘舵��")
+ private int statu;
+ /**
+ * 鐢熸垚鏃堕棿
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date createTime;
+
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/MeetingMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/MeetingMapper.java
new file mode 100644
index 0000000..cddde69
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/mapper/MeetingMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ruoyi.domain.Meeting;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface MeetingMapper extends BaseMapper<Meeting> {
+
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/MeetingService.java b/zhang-content/src/main/java/com/ruoyi/service/MeetingService.java
new file mode 100644
index 0000000..8e96d13
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/MeetingService.java
@@ -0,0 +1,31 @@
+package com.ruoyi.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.domain.Meeting;
+import com.ruoyi.domain.ZfClean;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+
+public interface MeetingService extends IService<Meeting> {
+
+ AjaxResult selectDataList(Meeting meeting, Integer pageNum, Integer pageSize);
+
+ List<Meeting> selectByCondition(Meeting meeting);
+
+ List<Meeting> selectByIds(Long[] ids);
+// AjaxResult addData(ZfClean zfClean);
+
+// AjaxResult addData2(ZfClean zfClean);
+
+ AjaxResult importExcel(MultipartFile file);
+
+ AjaxResult updateData(Meeting meeting);
+
+ AjaxResult deleteData(Long[] ids);
+
+ AjaxResult addData(Meeting meeting);
+
+}
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/MeetingServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/MeetingServiceImpl.java
new file mode 100644
index 0000000..5eec8e2
--- /dev/null
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/MeetingServiceImpl.java
@@ -0,0 +1,368 @@
+package com.ruoyi.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.EsModel;
+import com.ruoyi.common.utils.MapUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.domain.*;
+import com.ruoyi.mapper.MeetingMapper;
+import com.ruoyi.service.*;
+import lombok.extern.slf4j.Slf4j;
+import org.elasticsearch.action.delete.DeleteRequest;
+import org.elasticsearch.action.update.UpdateRequest;
+import org.elasticsearch.client.RequestOptions;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.ruoyi.constant.MenuAuthority.*;
+
+@Slf4j
+@Service
+public class MeetingServiceImpl extends ServiceImpl<MeetingMapper, Meeting> implements MeetingService {
+
+ @Resource
+ ZInfoUserService zInfoUserService;
+
+ @Resource
+ ZAuthorityService zAuthorityService;
+
+ @Resource
+ private EsService esSer;
+
+ @Resource
+ ZfLogService zfLogService;
+
+ @Resource
+ private RestHighLevelClient restHighLevelClient;
+
+ @Resource
+ private MeetingService meetingService;
+
+ private LambdaQueryWrapper<Meeting> buildCondition(Meeting meeting) {
+ LambdaQueryWrapper<Meeting> lqw = new LambdaQueryWrapper<>();
+ // lqw.in(ZfDoctor::getFamilyId,familyIdList);
+ lqw.orderByDesc(Meeting::getCreateTime);
+ lqw.like(StringUtils.isNotEmpty(meeting.getPlace()), Meeting::getPlace, meeting.getPlace())
+ .like(StringUtils.isNotEmpty(meeting.getApplyApart()), Meeting::getApplyApart, meeting.getApplyApart());
+// .like(Integer.valueOf(meeting.getApplyPerson())!=null, Meeting::getApplyPerson, meeting.getApplyPerson());
+
+
+
+ lqw.between(meeting.getHappenStartTime() != null && meeting.getHappenEndTime() != null, Meeting::getStartTime, meeting.getHappenStartTime(), meeting.getHappenEndTime());
+
+ return lqw;
+ }
+ private LambdaQueryWrapper<Meeting> uniqueCondition(Meeting meeting){
+ LambdaQueryWrapper<Meeting> lqw = new LambdaQueryWrapper<>();
+ lqw.eq(!StringUtils.isEmpty(meeting.getPlace()), Meeting::getPlace, meeting.getPlace());
+ lqw.eq(!StringUtils.isEmpty(meeting.getApplyApart()), Meeting::getApplyApart, meeting.getApplyApart());
+ lqw.eq(!StringUtils.isEmpty(meeting.getTitle()), Meeting::getTitle, meeting.getTitle());
+ lqw.eq(!StringUtils.isEmpty(meeting.getConnPhone()), Meeting::getConnPhone, meeting.getConnPhone());
+// lqw.eq(meeting.getFamilyId()!=null,Meeting::getFamilyId,meeting.getFamilyId());
+ lqw.eq(!StringUtils.isEmpty(String.valueOf(meeting.getApplyPerson())), Meeting::getApplyPerson, meeting.getApplyPerson());
+ lqw.eq(!StringUtils.isEmpty(String.valueOf(meeting.getPartPeople())), Meeting::getPartPeople, meeting.getPartPeople());
+ lqw.eq(!StringUtils.isEmpty(String.valueOf(meeting.getConnPerson())), Meeting::getConnPerson, meeting.getConnPerson());
+ return lqw;
+ }
+
+
+
+ @Override
+ public AjaxResult selectDataList(Meeting meeting, Integer pageNum, Integer pageSize) {
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ if(myself==null)
+ {
+ // System.out.println("ssssss");
+ return AjaxResult.success("鎮ㄦ病鍔犲叆鍒板搴旂殑瀹跺涵锛岃鑱旂郴绠$悊鍛�");
+ }
+ Long familyId = myself.getFamilyId();
+// //涔熻鏌ュ埆浜烘巿鏉冪殑
+// List<ZAuthority> authority = zAuthorityService.getAuthority();
+// List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(DOCTOR_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+// //鍔犱笂鑷繁瀹跺涵鐨刬d
+// idList.add(familyId);
+// String familyIds = listFamilyIds();
+// String secondFamilyAuthority = listSecondFamilyIds();
+ LambdaQueryWrapper<Meeting> lqw = buildCondition(meeting);
+
+
+ Page<Meeting> meetingPage = new Page<>(pageNum, pageSize);
+ Page<Meeting> pageResult = page(meetingPage, lqw);
+
+ List<Meeting> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹�
+// System.out.println(beanRecords);
+
+
+
+ HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
+ return AjaxResult.success(data); }
+
+
+
+ @Override
+ public List<Meeting> selectByCondition(Meeting meeting) {
+ //瑕佹煡鑷繁瀹跺涵鐨�
+ ZInfoUser myself = zInfoUserService.getMyself();
+ System.out.println("================");
+
+// Long familyId = myself.getFamilyId();
+//
+// //涔熻鏌ュ埆浜烘巿鏉冪殑
+// List<ZAuthority> authority = zAuthorityService.getAuthority();
+// List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
+// //鍔犱笂鑷繁瀹跺涵鐨刬d
+// idList.add(familyId);
+
+ LambdaQueryWrapper<Meeting> lambdaQueryWrapper = buildCondition(meeting);
+ List<Meeting> beanRecords = list(lambdaQueryWrapper);
+ log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords);
+ return beanRecords;
+ }
+
+ @Override
+ public List<Meeting> selectByIds(Long[] ids) {
+ List<Meeting> list = new ArrayList<>();
+ if (ids.length != 0)
+ list = listByIds(Arrays.asList(ids));
+ else
+ list = list();
+ return list;
+
+ }
+
+ @Override
+ @Transactional
+ public AjaxResult importExcel(MultipartFile file) {
+ ExcelUtil<Meeting> util = new ExcelUtil<>(Meeting.class);
+ List<Meeting> dataList = null;
+ try {
+ dataList = util.importExcel(file.getInputStream());
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ log.info("鏁版嵁鍒楄〃涓猴細{}", dataList);
+
+
+ for (Meeting meeting : dataList) {
+ meetingService.addData(meeting);
+ }
+
+ return AjaxResult.success("瀵煎叆鏁版嵁鎴愬姛");
+
+ }
+
+ @Override
+ public AjaxResult updateData(Meeting meeting) {
+// ZInfoUser myself = zInfoUserService.getMyself();
+// Long familyId = myself.getFamilyId();
+//
+// //鍏堟牴鎹甶d鏌ヨ鍑烘暟鎹殑familyId锛岀湅鐪嬫湁娌℃湁鏉冮檺鎿嶄綔
+// Long dataFamilyId = getById(zfDoctor.getId()).getFamilyId();
+//
+// List<ZAuthority> authority = zAuthorityService.getAuthority();
+// List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(DOCTOR_LIST_UPDATE)).map(ZAuthority::getFid).collect(Collectors.toList());
+// familyIdList.add(familyId);
+
+// if (dataFamilyId!=null && !familyIdList.contains(dataFamilyId)) {
+// throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+// }
+
+ //鎿嶄綔鍚庡姞鍏ユ棩蹇�
+ ZfLog zfLog = new ZfLog();
+ zfLog.setUpdateTime(LocalDateTime.now());
+ zfLog.setModule("浼氳");
+ zfLog.setUpdater(zInfoUserService.getMyself().getNickName());
+ zfLogService.save(zfLog);
+
+ if(updateById(meeting)){
+ //鍒版暟鎹簱涓煡璇㈠搴旂殑鏁版嵁
+ Meeting dataById = getById(meeting.getId());
+
+ //鍏堝埌es涓煡璇㈠埌瀵瑰簲閭f潯鏁版嵁鍦╡s鐨刬d
+ EsModel esResult = esSer.findByCtId(dataById.getId().intValue(), "浼氳");
+
+ if (esResult == null){
+ return AjaxResult.success();
+ }
+
+ //鎿嶄綔es淇敼鏁版嵁
+ EsModel newModel = new EsModel();
+ if(meeting.getPlace()!=null){
+ newModel.setBy1(meeting.getPlace());
+ }else {
+ newModel.setBy1(dataById.getPlace());
+ }
+
+ if(meeting.getApplyApart()!=null){
+ newModel.setBy2(meeting.getApplyApart());
+ }else {
+ newModel.setBy2(dataById.getApplyApart());
+ }
+
+ if(meeting.getTitle()!=null){
+ newModel.setBy3(meeting.getTitle());
+ }else {
+ newModel.setBy3(dataById.getTitle());
+ }
+ if(meeting.getConnPhone()!=null){
+ newModel.setBy4(meeting.getConnPhone());
+ }else {
+ newModel.setBy4(dataById.getConnPhone());
+ }
+
+ if(StringUtils.isEmpty(String.valueOf(meeting.getApplyPerson()))){
+ newModel.setBy5(String.valueOf(meeting.getApplyPerson()));
+ }else {
+ newModel.setBy5(String.valueOf(dataById.getApplyPerson()));
+ }
+
+ if(StringUtils.isEmpty(String.valueOf(meeting.getPartPeople()))){
+ newModel.setBy6(String.valueOf(meeting.getPartPeople()));
+ }else {
+ newModel.setBy6(String.valueOf(dataById.getPartPeople()));
+ }
+
+ if(StringUtils.isEmpty(String.valueOf(meeting.getConnPerson()))){
+ newModel.setBy7(String.valueOf(meeting.getConnPerson()));
+ }else {
+ newModel.setBy7(String.valueOf(dataById.getConnPerson()));
+ }
+
+
+ UpdateRequest updateRequest = new UpdateRequest("allsearchdata", esResult.getId());
+ updateRequest.doc(
+ "by1",newModel.getBy1(),
+ "by2",newModel.getBy2(),
+ "by3",newModel.getBy3(),
+ "by4",newModel.getBy4(),
+ "by6",newModel.getBy6(),
+ "by7",newModel.getBy7()
+ );
+
+ try {
+ restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+ }
+
+ @Override
+ public AjaxResult deleteData(Long[] ids) {
+
+// List<Meeting> dataList = meetingService.listByIds(Arrays.asList(ids));
+//
+// ZInfoUser myself = zInfoUserService.getMyself();
+// Long familyId = myself.getFamilyId();
+//
+// List<ZAuthority> authority = zAuthorityService.getAuthority();
+// List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList());
+// familyIdList.add(familyId);
+//
+// for (Meeting data : dataList) {
+// if (!familyIdList.contains(data.getFamilyId())){
+// throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+// }
+// }
+
+ List<Meeting> meetings = listByIds(Arrays.asList(ids));
+
+ if (meetingService.removeByIds(Arrays.asList(ids))) {
+
+ //鍒犻櫎es涓殑鏁版嵁
+ meetings.stream().forEach(meeting -> {
+ EsModel esModel = esSer.findByCtId((meeting.getId().intValue()), "浼氳");
+ if (esModel != null){
+ DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId());
+ try {
+ restHighLevelClient.delete(deleteRequest,RequestOptions.DEFAULT);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+
+ return AjaxResult.success();
+ }else {
+ return AjaxResult.error();
+ }
+
+ }
+
+
+
+ @Override
+ public AjaxResult addData(Meeting meeting) {
+
+ ZInfoUser myself = zInfoUserService.getMyself();
+ Long familyId = myself.getFamilyId();
+
+ if(familyId == null){
+ throw new RuntimeException("鎮ㄨ繕鏈姞鍏ヤ换浣曞搴�");
+ }
+
+ List<ZAuthority> authority = zAuthorityService.getAuthority();
+ List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_ADD)).map(ZAuthority::getFid).collect(Collectors.toList());
+ familyIdList.add(familyId);
+
+// if (meeting.getFamilyId()!=null && !familyIdList.contains(zfEvent.getFamilyId())) {
+// throw new RuntimeException("浣犳病鏈夋潈闄愭搷浣滄瀹跺涵鐨勬暟鎹�");
+// }
+//
+////
+// if(meeting.getFamilyId() == null){
+// //榛樿娣诲姞鑷繁瀹跺涵鐨勬暟鎹�
+// zfEvent.setFamilyId(familyId);
+// }
+//
+// 鍒ゆ柇鏄惁鏈夐噸澶嶆暟鎹�
+ LambdaQueryWrapper<Meeting> lqw = uniqueCondition(meeting);
+ List<Meeting> list = list(lqw);
+
+ if(list.size()>0){
+ throw new RuntimeException("璇峰嬁鏂板閲嶅鏁版嵁");
+ }
+
+ if (save(meeting)) {
+ EsModel esModel = new EsModel();
+ Long inte =meeting.getId();
+ String uuid = UUID.randomUUID().toString().replace("-","");
+ esModel.setId(uuid);
+ esModel.setCtId(Long.valueOf(inte));
+ esModel.setCtTableName("浼氳璁板綍");
+ esModel.setBy1(meeting.getPlace());
+ esModel.setBy2(meeting.getApplyApart());
+ esModel.setBy3(meeting.getTitle());
+ esModel.setBy4(meeting.getConnPhone());
+ esModel.setBy5(String.valueOf(meeting.getApplyPerson()));
+ esModel.setBy6(String.valueOf(meeting.getPartPeople()));
+ esModel.setBy7(String.valueOf(meeting.getConnPerson()));
+ //杩欓噷瀛樺偍鏌ヨ璇︽儏鐨勮矾寰�
+ esModel.setBy5("/zMeeting");
+// esModel.setFid(familyId);
+ esSer.insertTable(esModel);
+
+ return AjaxResult.success();
+ } else {
+ return AjaxResult.error();
+
+ }
+ }
+}
--
Gitblit v1.9.1