From c342f88f2cd9aa312d085552c9ffc817fa8224a1 Mon Sep 17 00:00:00 2001 From: wxyclub Date: Fri, 27 Oct 2023 16:13:43 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E5=86=85=E5=A4=96=E9=83=A8=E4=BC=9A?= =?UTF-8?q?=E8=AE=AE=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/InsideOutsideMeeting.java | 18 ++- .../entity/InsideOutsideMeetingVO.java | 5 +- .../service/MeetingTopicService.java | 5 + .../impl/InsideOutsideMeetingServiceImpl.java | 111 +++++++++++++++++- .../service/impl/MeetingTopicServiceImpl.java | 63 ++++++++++ 5 files changed, 197 insertions(+), 5 deletions(-) diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/entity/InsideOutsideMeeting.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/entity/InsideOutsideMeeting.java index 8f783abc..8b7ab644 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/entity/InsideOutsideMeeting.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/entity/InsideOutsideMeeting.java @@ -1,5 +1,6 @@ package com.adc.da.slrs.InsideOntSideMeeting.entity; +import com.adc.da.att.entity.AttFileEO; import com.adc.da.base.entity.BaseEntity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; @@ -38,7 +39,10 @@ public class InsideOutsideMeeting extends BaseEntity { @TableField("MEETING_NAME") private String meetingName; - @ApiModelProperty(value = "课题名称,可通过调取功能从政策课题模块中获取") + /** + * 课题名称,可通过调取功能从政策课题模块中获取 + */ + @ApiModelProperty(value = "课题名称") @TableField("TOPIC_NAME") private String topicName; @@ -63,6 +67,10 @@ public class InsideOutsideMeeting extends BaseEntity { @TableField("MEETING_MINUTES") private String meetingMinutes; + @ApiModelProperty(value = "会议纪要文件列表") + @TableField(exist = false) + private List meetingMinutesList; + @ApiModelProperty(value = "会议主要内容") @TableField("MEETING_CONTENT") private String meetingContent; @@ -71,6 +79,9 @@ public class InsideOutsideMeeting extends BaseEntity { @TableField("FIRST_MEETING_TYPE") private String firstMeetingType; + @ApiModelProperty(value = "1级会议类别名称") + private String firstMeetingTypeName; + @ApiModelProperty(value = "2级会议类别") @TableField("SECOND_MEETING_TYPE") private String secondMeetingType; @@ -79,7 +90,10 @@ public class InsideOutsideMeeting extends BaseEntity { @TableField(exist = false) private List meetingTopicList; - @ApiModelProperty(value = "逻辑删除,0可用,1不可用") + /** + * 逻辑删除,0可用,1不可用 + */ + @ApiModelProperty(value = "逻辑删除") @TableField("VALID_FLAG") private Integer validFlag; diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/entity/InsideOutsideMeetingVO.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/entity/InsideOutsideMeetingVO.java index 5abc9a15..a596e3eb 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/entity/InsideOutsideMeetingVO.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/entity/InsideOutsideMeetingVO.java @@ -1,9 +1,8 @@ package com.adc.da.slrs.InsideOntSideMeeting.entity; +import com.adc.da.att.entity.AttFileEO; import com.adc.da.base.page.BasePage; -import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -39,6 +38,8 @@ public class InsideOutsideMeetingVO extends BasePage { private String meetingMinutes; + private List meetingMinutesList; + private String meetingContent; private String firstMeetingType; diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/MeetingTopicService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/MeetingTopicService.java index ef1b06a5..ea79e3f9 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/MeetingTopicService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/MeetingTopicService.java @@ -1,12 +1,17 @@ package com.adc.da.slrs.InsideOntSideMeeting.service; +import com.adc.da.slrs.InsideOntSideMeeting.entity.InsideOutsideMeeting; import com.adc.da.slrs.InsideOntSideMeeting.entity.MeetingTopic; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** * @author tjzdw * @description * @date 2023/10/13 */ public interface MeetingTopicService extends IService { + + public List compareMeetingTopic(InsideOutsideMeeting oldTopic, InsideOutsideMeeting newTopic); } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/impl/InsideOutsideMeetingServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/impl/InsideOutsideMeetingServiceImpl.java index 0dcee162..391aac06 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/impl/InsideOutsideMeetingServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/impl/InsideOutsideMeetingServiceImpl.java @@ -1,5 +1,7 @@ package com.adc.da.slrs.InsideOntSideMeeting.service.impl; +import com.adc.da.att.entity.AttFileEO; +import com.adc.da.att.service.IAttFileEOService; import com.adc.da.common.FileUnZip; import com.adc.da.http.ResponseMessage; import com.adc.da.http.Result; @@ -9,10 +11,13 @@ import com.adc.da.slrs.InsideOntSideMeeting.entity.InsideOutsideMeetingVO; import com.adc.da.slrs.InsideOntSideMeeting.entity.MeetingTopic; import com.adc.da.slrs.InsideOntSideMeeting.service.InsideOutsideMeetingService; import com.adc.da.slrs.InsideOntSideMeeting.service.MeetingTopicService; +import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation; +import com.adc.da.slrs.tsDictionaryType.service.ITsDicTypeService; import com.adc.da.utils.util.FieldConvertUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import io.swagger.annotations.ApiModelProperty; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFDateUtil; @@ -25,6 +30,9 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.File; import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -40,6 +48,12 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl meetingMinutesList = new ArrayList<>(); + for (String attId : insideOutSideMeeting.getMeetingMinutes().split(",")) { + AttFileEO fileInfo = attFileEOService.getFileInfo(attId); + meetingMinutesList.add(fileInfo); + } + insideOutSideMeeting.setMeetingMinutesList(meetingMinutesList); + } LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(MeetingTopic::getMeetingId, meetingId); List meetingTopicList = meetingTopicService.list(wrapper); @@ -98,7 +120,18 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl queryAllMeeting(InsideOutsideMeetingVO insideOutsideMeetingVO) { - return this.baseMapper.queryAllMeeting(insideOutsideMeetingVO); + List insideOutsideMeetingVOList = this.baseMapper.queryAllMeeting(insideOutsideMeetingVO); + for (InsideOutsideMeetingVO meetingVO : insideOutsideMeetingVOList) { + if (StringUtils.isNotBlank(meetingVO.getMeetingMinutes())) { + List meetingMinutesList = new ArrayList<>(); + for (String attId : meetingVO.getMeetingMinutes().split(",")) { + AttFileEO fileInfo = attFileEOService.getFileInfo(attId); + meetingMinutesList.add(fileInfo); + } + meetingVO.setMeetingMinutesList(meetingMinutesList); + } + } + return insideOutsideMeetingVOList; } @Override @@ -320,4 +353,80 @@ public class InsideOutsideMeetingServiceImpl extends ServiceImpl compareInsideOutsideMeeting(InsideOutsideMeeting oldMeeting, InsideOutsideMeeting newMeeting) { + List changes = new ArrayList<>(); + // 不需要比较的字段 + String[] ignoreFields = {"id","validFlag","createTime","modifyTime","meetingTopicList"}; + List ignoreFieldList = Arrays.asList(ignoreFields); + // 获取SarLawsInformation类的所有字段 + Field[] fields = SarLawsInformation.class.getDeclaredFields(); + for (Field field : fields) { + if (!ignoreFieldList.contains(field.getName())) { + try { + field.setAccessible(true); + String oldValue = String.valueOf(field.get(oldMeeting)); + String newValue = String.valueOf(field.get(newMeeting)); + if (!Objects.equals(oldValue, newValue)) { + if ("firstMeetingType".equals(field.getName()) || "secondMeetingType".equals(field.getName())) { + String typeName = ""; + if (StringUtils.isNotBlank(newValue)) { + typeName = dicTypeService.getDicTypeNameByDicCode(newValue); + } + // 获取资料类型名称 + String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1); + Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name"); + Object oldTypeName = method.invoke(oldMeeting); + ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; + changes.add(annotationsByType.value() + "由\"" + oldTypeName + "\"改为\"" + typeName + "\""); + } else if ("meetingMinutes".equals(field.getName())) { + List fileNameList = new ArrayList<>(); + if (StringUtils.isNotBlank(newValue)) { + String[] split = newValue.split(","); + for (String attId : split) { + AttFileEO fileInfo = attFileEOService.getFileInfo(attId); + fileNameList.add(fileInfo.getOldFileName()); + } + } + // 获取资料类型名称 + String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1); + Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name"); + Object oldTypeName = method.invoke(oldMeeting); + // 获取字段名称 + ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; + changes.add(annotationsByType.value() + "由\"" + oldTypeName + "\"改为\"" + String.join(",",fileNameList) + "\""); + } + else if ("meetingTopicList".equals(field.getName())) { +// // 获取会议列表内容 +// String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1); +// Method method = SarLawsInformation.class.getMethod("get" + fieldName); +// List oldMeetingTopicList = (List)method.invoke(oldMeeting); +// List newMeetingTopicList = (List)method.invoke(newMeeting); +// for (Object meetingTopic : oldMeetingTopicList) { +// meetingTopicService.compareMeetingTopic(meetingTopic, oldMeeting); +// } + + ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; + changes.add(annotationsByType.value() + "由\"" + oldValue + "\"改为\"" + newValue + "\""); + } + else { + ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; + changes.add(annotationsByType.value() + "由\"" + oldValue + "\"改为\"" + newValue + "\""); + } + } + } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { + // 处理异常 + e.printStackTrace(); + } + } + } + return changes; + } } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/impl/MeetingTopicServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/impl/MeetingTopicServiceImpl.java index f07636a7..3c0fbc76 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/impl/MeetingTopicServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/InsideOntSideMeeting/service/impl/MeetingTopicServiceImpl.java @@ -1,11 +1,26 @@ package com.adc.da.slrs.InsideOntSideMeeting.service.impl; +import com.adc.da.att.entity.AttFileEO; +import com.adc.da.att.service.IAttFileEOService; import com.adc.da.slrs.InsideOntSideMeeting.dao.MeetingTopicDao; +import com.adc.da.slrs.InsideOntSideMeeting.entity.InsideOutsideMeeting; import com.adc.da.slrs.InsideOntSideMeeting.entity.MeetingTopic; import com.adc.da.slrs.InsideOntSideMeeting.service.MeetingTopicService; +import com.adc.da.slrs.sarLawsInformation.entity.SarLawsInformation; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import io.swagger.annotations.ApiModelProperty; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; + /** * @author tjzdw * @description @@ -13,4 +28,52 @@ import org.springframework.stereotype.Service; */ @Service public class MeetingTopicServiceImpl extends ServiceImpl implements MeetingTopicService { + + @Resource + private IAttFileEOService attFileEOService; + + @Override + public List compareMeetingTopic(InsideOutsideMeeting oldTopic, InsideOutsideMeeting newTopic) { + List changes = new ArrayList<>(); + // 不需要比较的字段 + String[] ignoreFields = {"id","meetingId","validFlag","createTime","modifyTime"}; + List ignoreFieldList = Arrays.asList(ignoreFields); + // 获取SarLawsInformation类的所有字段 + Field[] fields = SarLawsInformation.class.getDeclaredFields(); + for (Field field : fields) { + if (!ignoreFieldList.contains(field.getName())) { + try { + field.setAccessible(true); + String oldValue = String.valueOf(field.get(oldTopic)); + String newValue = String.valueOf(field.get(newTopic)); + if (!Objects.equals(oldValue, newValue)) { + if ("agendaMaterials".equals(field.getName())) { + List fileNameList = new ArrayList<>(); + if (StringUtils.isNotBlank(newValue)) { + String[] split = newValue.split(","); + for (String attId : split) { + AttFileEO fileInfo = attFileEOService.getFileInfo(attId); + fileNameList.add(fileInfo.getOldFileName()); + } + } + // 获取文件名称 + String fieldName = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1); + Method method = SarLawsInformation.class.getMethod("get" + fieldName + "Name"); + Object oldTypeName = method.invoke(oldTopic); + // 获取字段名称 + ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; + changes.add(annotationsByType.value() + "由\"" + oldTypeName + "\"改为\"" + String.join(",",fileNameList) + "\""); + } else { + ApiModelProperty annotationsByType = field.getAnnotationsByType(ApiModelProperty.class)[0]; + changes.add(annotationsByType.value() + "由\"" + oldValue + "\"改为\"" + newValue + "\""); + } + } + } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { + // 处理异常 + e.printStackTrace(); + } + } + } + return changes; + } }