From e4f90124d0f16d3e77a2fd3d852873f818733343 Mon Sep 17 00:00:00 2001 From: lijiaqi Date: Wed, 17 Aug 2022 11:11:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0-=E7=9D=A3?= =?UTF-8?q?=E8=AF=84=E8=81=94=E4=B8=89=E4=B8=AA=E7=B3=BB=E5=88=97=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=B4=BB=E5=8A=A8=E7=9A=84=E9=99=84=E4=BB=B6=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=90=8E=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AA=E9=80=89?= =?UTF-8?q?=E9=A1=B9=EF=BC=88=E5=85=B3=E8=81=94=E8=BF=91=E6=9C=9F=E4=BC=9A?= =?UTF-8?q?=E8=AE=AE=E3=80=81=E4=B8=8D=E5=85=B3=E8=81=94=EF=BC=89=EF=BC=8C?= =?UTF-8?q?=E6=89=93=E9=80=9A=E4=BC=9A=E8=AE=AE=E6=96=87=E4=BB=B6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=A8=A1=E5=9D=97=EF=BC=8C=E9=80=89=E6=8B=A9=E5=85=B3?= =?UTF-8?q?=E8=81=94=E7=9A=84=E4=BC=9A=E8=AE=AE=E5=90=8E=E6=AD=A4=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E8=87=AA=E5=8A=A8=E4=B8=8A=E4=BC=A0=E5=88=B0=E6=89=80?= =?UTF-8?q?=E9=80=89=E7=9A=84=E4=BC=9A=E8=AE=AE=E6=96=87=E4=BB=B6=E5=86=85?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E5=9C=A8=E4=BC=9A=E8=AE=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E7=9B=B4=E6=8E=A5=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/ApiBaseDataController.java | 17 ++++++ .../rddb/entity/ConferenceAttachment.java | 7 ++- .../service/ConferenceAttachmentService.java | 58 +++++++++++++++++++ 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/ydool/boot/api/controller/ApiBaseDataController.java b/src/main/java/com/ydool/boot/api/controller/ApiBaseDataController.java index 5c2845d..82f1ad5 100644 --- a/src/main/java/com/ydool/boot/api/controller/ApiBaseDataController.java +++ b/src/main/java/com/ydool/boot/api/controller/ApiBaseDataController.java @@ -16,7 +16,9 @@ import com.ydool.boot.modules.sys.entity.Street; import com.ydool.boot.modules.sys.service.StreetService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -57,6 +59,7 @@ public class ApiBaseDataController extends ApiBaseController { @Autowired private OfficeService officeService; + @GetMapping("street") @ResponseBody @ApiOperation(value = "获取街道列表") @@ -141,4 +144,18 @@ public class ApiBaseDataController extends ApiBaseController { render(Ret.ok().data(ConfigUtils.getStr(code))); } + @GetMapping("associationMeeting") + @ResponseBody + @ApiOperation(value = "附件关联会议") + @ApiImplicitParams({ + @ApiImplicitParam(name = "conferenceId", value = "关联会议id", required = true), + @ApiImplicitParam(name = "attachment", value = "关联附件路径", required = true), + @ApiImplicitParam(name = "title", value = "附件名", required = true), + @ApiImplicitParam(name = "headline", value = "会议议题(附件所属的主题名)", required = true) + }) + public void associationMeeting(String conferenceId, String attachment, String title, String headline) { + boolean flag = conferenceAttachmentService.associationMeeting(conferenceId, attachment, title, headline, getApiUserId()); + renderJson(!flag ? Ret.fail("操作失败") : Ret.ok()); + } + } diff --git a/src/main/java/com/ydool/boot/modules/rddb/entity/ConferenceAttachment.java b/src/main/java/com/ydool/boot/modules/rddb/entity/ConferenceAttachment.java index bd4ca91..fc5a4de 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/entity/ConferenceAttachment.java +++ b/src/main/java/com/ydool/boot/modules/rddb/entity/ConferenceAttachment.java @@ -5,8 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.ydool.boot.core.entity.BaseEntity; import com.ydool.boot.core.entity.TreeEntity; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; +import lombok.*; +import lombok.experimental.Accessors; import org.apache.commons.lang3.StringUtils; import java.util.List; @@ -20,6 +20,9 @@ import java.util.List; * @since 2020-10-15 */ @Data +@Builder +@NoArgsConstructor +@AllArgsConstructor @EqualsAndHashCode(callSuper = true) @TableName("t_conference_attachment") public class ConferenceAttachment extends TreeEntity { diff --git a/src/main/java/com/ydool/boot/modules/rddb/service/ConferenceAttachmentService.java b/src/main/java/com/ydool/boot/modules/rddb/service/ConferenceAttachmentService.java index 32eaca0..332715f 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/service/ConferenceAttachmentService.java +++ b/src/main/java/com/ydool/boot/modules/rddb/service/ConferenceAttachmentService.java @@ -1,5 +1,6 @@ package com.ydool.boot.modules.rddb.service; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ydool.boot.core.service.BaseService; import com.ydool.boot.core.service.BaseTreeService; @@ -7,6 +8,9 @@ import com.ydool.boot.modules.rddb.entity.ConferenceAttachment; import com.ydool.boot.modules.rddb.mapper.ConferenceAttachmentMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; /** *

@@ -25,4 +29,58 @@ public class ConferenceAttachmentService extends BaseTreeService().eq("conference_id", conferenceId).eq("title", headline)); + //已存在 + if (conferenceAttachment != null) { + ConferenceAttachment conferenceAttachment1 = new ConferenceAttachment() + .builder() + .title(title) + .conferenceId(conferenceId) + .attachment(attachment) + .pid(conferenceAttachment.getId()) + .createdId(userId) + .updatedId(userId) + .build(); + conferenceAttachment1.setCreatedAt(LocalDateTime.now()); + conferenceAttachment1.setUpdatedAt(LocalDateTime.now()); + flag = saveOrUpdate(conferenceAttachment1); + } + //不存在 + else { + //创建议题 + ConferenceAttachment conferenceAttachment2 = new ConferenceAttachment() + .builder() + .title(headline) + .conferenceId(conferenceId) + .attachment(attachment) + .createdId(userId) + .updatedId(userId) + .pid("") + .build(); + conferenceAttachment2.setCreatedAt(LocalDateTime.now()); + conferenceAttachment2.setUpdatedAt(LocalDateTime.now()); + flag = saveOrUpdate(conferenceAttachment2); + + System.out.println(conferenceAttachment2); + //创建附件 + ConferenceAttachment conferenceAttachment1 = new ConferenceAttachment() + .builder() + .title(title) + .conferenceId(conferenceId) + .attachment(attachment) + .pid(conferenceAttachment2.getId()) + .createdId(userId) + .updatedId(userId) + .build(); + conferenceAttachment1.setCreatedAt(LocalDateTime.now()); + conferenceAttachment1.setUpdatedAt(LocalDateTime.now()); + flag = saveOrUpdate(conferenceAttachment1); + } + return flag; + } }