diff --git a/src/main/java/com/ydool/boot/api/controller/ApiAppointController.java b/src/main/java/com/ydool/boot/api/controller/ApiAppointController.java index 96fe777..2fa7a7e 100644 --- a/src/main/java/com/ydool/boot/api/controller/ApiAppointController.java +++ b/src/main/java/com/ydool/boot/api/controller/ApiAppointController.java @@ -12,6 +12,7 @@ import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters; import com.ydool.boot.common.result.Ret; import com.ydool.boot.modules.rddb.entity.Appoint; import com.ydool.boot.modules.rddb.entity.AppointComment; +import com.ydool.boot.modules.rddb.entity.Const; import com.ydool.boot.modules.rddb.entity.dto.AppointDto; import com.ydool.boot.modules.rddb.entity.request.CommentRequest; import com.ydool.boot.modules.rddb.entity.request.ScoreRequest; @@ -47,13 +48,14 @@ public class ApiAppointController extends ApiBaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "page", value = "当前页"), @ApiImplicitParam(name = "size", value = "显示条数"), + @ApiImplicitParam(name = "platform", value = "当前登录的是哪个端 admin机关办公/ rddb代表/ voter选民 ", required = true) }) @DynamicResponseParameters(properties = { @DynamicParameter(value = "职务任免", name = "data", dataTypeClass = AppointDto.class) }) @ApiOperation("职务任免列表 (被指定的人与创建人可见)") @GetMapping - public void appointPage() { + public void appointPage(String platform) { QueryWrapper qw = new QueryWrapper() // .and(_qw -> _qw // .eq("created_id", getApiUserId()) @@ -61,6 +63,11 @@ public class ApiAppointController extends ApiBaseController { // .inSql("id", "select appoint_id from t_appoint_user where user_id='" + getApiUserId() + "'")) .lt("state", Appoint.STATE_END) .orderByDesc("created_at"); + if (Const.TYPE_RDDB.equals(platform)) { + qw.like("obj", platform); + } else if (Const.TYPE_VOTER.equals(platform)) { + qw.like("obj", platform); + } IPage paged = appointService.page(new Page<>(getPageNum(), getPageSize()), qw); render(Ret.ok().paged(AppointWrapper.build().pageVO(paged))); } @@ -68,16 +75,22 @@ public class ApiAppointController extends ApiBaseController { @ApiImplicitParams({ @ApiImplicitParam(name = "page", value = "当前页"), @ApiImplicitParam(name = "size", value = "显示条数"), + @ApiImplicitParam(name = "platform", value = "当前登录的是哪个端 admin机关办公/ rddb代表/ voter选民 ", required = true) }) @DynamicResponseParameters(properties = { @DynamicParameter(value = "职务任免", name = "data", dataTypeClass = AppointDto.class) }) @ApiOperation("公告栏 (所有人可见)") @GetMapping("public") - public void publicPage() { + public void publicPage(String platform) { QueryWrapper qw = new QueryWrapper() .eq("state", Appoint.STATE_END) .orderByDesc("created_at"); + if (Const.TYPE_RDDB.equals(platform)) { + qw.like("obj", platform); + } else if (Const.TYPE_VOTER.equals(platform)) { + qw.like("obj", platform); + } IPage paged = appointService.page(new Page<>(getPageNum(), getPageSize()), qw); render(Ret.ok().paged(AppointWrapper.build().pageVO(paged))); } @@ -156,6 +169,12 @@ public class ApiAppointController extends ApiBaseController { //公开环节自动跳过 + @ApiOperation("常委会公告") + @PostMapping("state/public") + @ResponseBody + public void statePublicSave(@Validated AppointPublicStateRequest appointPublicStateRequest) { + render(appointService.statePublicSave(appointPublicStateRequest, getApiUser())); + } @ApiOperation("履职环节") @PostMapping("state/perform") diff --git a/src/main/java/com/ydool/boot/modules/rddb/entity/Appoint.java b/src/main/java/com/ydool/boot/modules/rddb/entity/Appoint.java index 6be04e4..a37ba93 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/entity/Appoint.java +++ b/src/main/java/com/ydool/boot/modules/rddb/entity/Appoint.java @@ -36,6 +36,18 @@ public class Appoint extends BaseEntity { //结束标记 public static Integer STATE_END = 7; + @ApiModelProperty(value = "审议意见") + private String deliberations; + + @ApiModelProperty(value = "表决结果") + private String votingResult; + @ApiModelProperty(value = "测评结果") + String evaluationResults; + /** + * 测评对象 + */ + @ApiModelProperty(value = "admin机关办公/ rddb代表/ voter选民 多个用英文逗号间隔") + private String obj; /** * 创建者 */ diff --git a/src/main/java/com/ydool/boot/modules/rddb/entity/AppointAttachment.java b/src/main/java/com/ydool/boot/modules/rddb/entity/AppointAttachment.java index d5da88a..bedfc80 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/entity/AppointAttachment.java +++ b/src/main/java/com/ydool/boot/modules/rddb/entity/AppointAttachment.java @@ -73,5 +73,6 @@ public class AppointAttachment extends BaseEntity { @ApiModelProperty(value = "会议名称") private String conferenceName; - + @ApiModelProperty(value = "分类") + private String category; } diff --git a/src/main/java/com/ydool/boot/modules/rddb/entity/dto/AppointDto.java b/src/main/java/com/ydool/boot/modules/rddb/entity/dto/AppointDto.java index 2d0ee17..6185fa7 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/entity/dto/AppointDto.java +++ b/src/main/java/com/ydool/boot/modules/rddb/entity/dto/AppointDto.java @@ -15,16 +15,26 @@ public class AppointDto extends Appoint { @ApiModelProperty(value = "提名附件") List proposeAttachmentList; @ApiModelProperty(value = "会议附件") - List conferenceAttachmentList; + List conferenceAttachmentList; + @ApiModelProperty(value = "题库试卷") + List questionPapersAttachmentList; + @ApiModelProperty(value = "成绩汇总") + List resultsSummaryAttachmentList; + @ApiModelProperty(value = "公示文件") + List publicFileAttachmentList; + @ApiModelProperty(value = "提名文件") + List nominationPaperAttachmentList; + @ApiModelProperty(value = "公告文件") + List announcementFileAttachmentList; @ApiModelProperty(value = "履职附件") List performAttachmentList; @ApiModelProperty(value = "会议人员") - List conferenceUserList; + List conferenceUserList; @ApiModelProperty(value = "投票人员") - List voteUserList; + List voteUserList; @ApiModelProperty(value = "打分人员") - List performUserList; + List performUserList; @ApiModelProperty(value = "平均分") BigDecimal averageScore; diff --git a/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointPerformStateRequest.java b/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointPerformStateRequest.java index 4d44e60..5d18239 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointPerformStateRequest.java +++ b/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointPerformStateRequest.java @@ -39,4 +39,6 @@ public class AppointPerformStateRequest { String performAttachmentConferenceName; @ApiModelProperty(value = "打分分数") String score; + @ApiModelProperty(value = "测评结果") + String evaluationResults; } diff --git a/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointPublicStateRequest.java b/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointPublicStateRequest.java new file mode 100644 index 0000000..11ff157 --- /dev/null +++ b/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointPublicStateRequest.java @@ -0,0 +1,24 @@ +package com.ydool.boot.modules.rddb.entity.request.appoint.state; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class AppointPublicStateRequest { + @ApiModelProperty(value = "任免督职id", required = true) + private String id; + /** + * 测评对象 + */ + @ApiModelProperty(value = "admin机关办公/ rddb代表/ voter选民 多个用英文逗号间隔") + private String obj; + @ApiModelProperty(value = "附件名 英文逗号间隔") + String announcementFileAttachmentName; + @ApiModelProperty(value = "附件路径 英文逗号间隔") + String announcementFileAttachmentPath; + + @ApiModelProperty(value = "附件关联会议id 英文逗号间隔") + String announcementFileAttachmentConferenceId; + @ApiModelProperty(value = "附件关联会议名称 英文逗号间隔") + String announcementFileAttachmentConferenceName; +} diff --git a/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointScoreStateRequest.java b/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointScoreStateRequest.java index 71e36e4..e83f394 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointScoreStateRequest.java +++ b/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointScoreStateRequest.java @@ -11,7 +11,7 @@ import java.time.LocalDateTime; @Data public class AppointScoreStateRequest { - @ApiModelProperty(value = "任免督职id",required = true) + @ApiModelProperty(value = "任免督职id", required = true) private String id; /** @@ -45,4 +45,33 @@ public class AppointScoreStateRequest { private LocalDateTime examUploadAt; + @ApiModelProperty(value = "题库试卷附件名 英文逗号间隔") + String questionPapersAttachmentName; + @ApiModelProperty(value = "题库试卷附件路径 英文逗号间隔") + String questionPapersAttachmentPath; + @ApiModelProperty(value = "题库试卷附件关联会议id 英文逗号间隔") + String questionPapersAttachmentConferenceId; + @ApiModelProperty(value = "题库试卷附件关联会议名称 英文逗号间隔") + String questionPapersAttachmentConferenceName; + + @ApiModelProperty(value = "成绩汇总附件名 英文逗号间隔") + String resultsSummaryAttachmentName; + @ApiModelProperty(value = "成绩汇总附件路径 英文逗号间隔") + String resultsSummaryAttachmentPath; + @ApiModelProperty(value = "成绩汇总附件关联会议id 英文逗号间隔") + String resultsSummaryAttachmentConferenceId; + @ApiModelProperty(value = "成绩汇总附件关联会议名称 英文逗号间隔") + String resultsSummaryAttachmentConferenceName; + + + @ApiModelProperty(value = "公示文件附件名 英文逗号间隔") + String publicFileAttachmentName; + @ApiModelProperty(value = "公示文件附件路径 英文逗号间隔") + String publicFileAttachmentPath; + @ApiModelProperty(value = "公示文件附件关联会议id 英文逗号间隔") + String publicFileAttachmentConferenceId; + @ApiModelProperty(value = "公示文件附件关联会议名称 英文逗号间隔") + String publicFileAttachmentConferenceName; + + } diff --git a/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointVoteStateRequest.java b/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointVoteStateRequest.java index bafbe16..e5c6b37 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointVoteStateRequest.java +++ b/src/main/java/com/ydool/boot/modules/rddb/entity/request/appoint/state/AppointVoteStateRequest.java @@ -13,38 +13,53 @@ import java.time.LocalDateTime; @Data public class AppointVoteStateRequest { - @ApiModelProperty(value = "任免督职id",required = true) + @ApiModelProperty(value = "任免督职id", required = true) @NotBlank(message = "任免督职id不能为空") private String id; - /** - * 投票会议时间 - */ - @DateTimeFormat( - pattern = "yyyy-MM-dd HH:mm:ss" - ) - @JsonFormat( - pattern = "yyyy-MM-dd HH:mm:ss" - ) - @ApiModelProperty(value = "投票会议时间yyyy-MM-dd HH:mm:ss") - @NotNull(message = "投票会议时间不能为空") - private LocalDateTime voteAt; + @ApiModelProperty(value = "审议意见") + private String deliberations; - /** - * 投票会议地址 - */ - @ApiModelProperty(value = "投票会议地址") - @NotBlank(message = "投票会议地址不能为空") - private String voteAddress; + @ApiModelProperty(value = "表决结果") + private String votingResult; - - /** - * 是否通过 - */ - @ApiModelProperty(value = "是否通过",required = true) - @NotNull(message = "是否通过不能为空") - private Boolean status; +// /** +// * 投票会议时间 +// */ +// @DateTimeFormat( +// pattern = "yyyy-MM-dd HH:mm:ss" +// ) +// @JsonFormat( +// pattern = "yyyy-MM-dd HH:mm:ss" +// ) +// @ApiModelProperty(value = "投票会议时间yyyy-MM-dd HH:mm:ss") +// @NotNull(message = "投票会议时间不能为空") +// private LocalDateTime voteAt; +// +// /** +// * 投票会议地址 +// */ +// @ApiModelProperty(value = "投票会议地址") +// @NotBlank(message = "投票会议地址不能为空") +// private String voteAddress; +// +// +// /** +// * 是否通过 +// */ +// @ApiModelProperty(value = "是否通过",required = true) +// @NotNull(message = "是否通过不能为空") +// private Boolean status; // // @ApiModelProperty(value = "投票会议人员id,英文逗号间隔") // String voteUserIds; + + @ApiModelProperty(value = "提名文件附件名 英文逗号间隔") + String nominationPaperAttachmentName; + @ApiModelProperty(value = "提名文件附件路径 英文逗号间隔") + String nominationPaperAttachmentPath; + @ApiModelProperty(value = "提名文件附件关联会议id 英文逗号间隔") + String nominationPaperAttachmentConferenceId; + @ApiModelProperty(value = "提名文件附件关联会议名称 英文逗号间隔") + String nominationPaperAttachmentConferenceName; } diff --git a/src/main/java/com/ydool/boot/modules/rddb/service/AppointService.java b/src/main/java/com/ydool/boot/modules/rddb/service/AppointService.java index 8d19e56..b53d86d 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/service/AppointService.java +++ b/src/main/java/com/ydool/boot/modules/rddb/service/AppointService.java @@ -86,9 +86,12 @@ public class AppointService extends BaseService { saveAppointUser(appointBo.getId(), performUserIds, loginUser, Appoint.STATE_PERFORM); //保存附件 - saveAppointAttachment(appointBo.getId(), appointBo.getProposeAttachmentArrStr(), loginUser, Appoint.STATE_PROPOSE); - saveAppointAttachment(appointBo.getId(), appointBo.getConferenceAttachmentArrStr(), loginUser, Appoint.STATE_CONFERENCE); - saveAppointAttachment(appointBo.getId(), appointBo.getPerformAttachmentArrStr(), loginUser, Appoint.STATE_PERFORM); + saveAppointAttachment(appointBo.getId(), appointBo.getProposeAttachmentArrStr(), loginUser, + Appoint.STATE_PROPOSE); + saveAppointAttachment(appointBo.getId(), appointBo.getConferenceAttachmentArrStr(), loginUser, + Appoint.STATE_CONFERENCE); + saveAppointAttachment(appointBo.getId(), appointBo.getPerformAttachmentArrStr(), loginUser, + Appoint.STATE_PERFORM); return Ret.ok(); } @@ -103,7 +106,8 @@ public class AppointService extends BaseService { saveOrUpdate(appoint); saveAppointAttachment(appoint.getId(), appointProposeRequest.getProposeAttachmentName(), appointProposeRequest.getProposeAttachmentPath(), loginUser, Appoint.STATE_PROPOSE, - appointProposeRequest.getProposeAttachmentConferenceId(), appointProposeRequest.getProposeAttachmentConferenceName()); + appointProposeRequest.getProposeAttachmentConferenceId(), + appointProposeRequest.getProposeAttachmentConferenceName()); return appoint; } @@ -111,7 +115,8 @@ public class AppointService extends BaseService { public Appoint stateConferenceSave(AppointConferenceStateRequest appointConferenceRequest, User loginUser) { Appoint appoint = getById(appointConferenceRequest.getId()); Assert.notNull(appoint, "未找到该记录"); - if (Appoint.STATE_CONFERENCE != appoint.getState()) throw new ResultException(Ret.fail("当前环节不能提交该信息")); + if (Appoint.STATE_CONFERENCE != appoint.getState()) + throw new ResultException(Ret.fail("当前环节不能提交该信息")); BeanUtil.copyProperties(appointConferenceRequest, appoint); appoint.setState(Appoint.STATE_SCORE); appoint.setUpdatedId(loginUser.getId()); @@ -120,7 +125,8 @@ public class AppointService extends BaseService { appointConferenceRequest.getConferenceAttachmentPath(), loginUser, Appoint.STATE_CONFERENCE, appointConferenceRequest.getConferenceAttachmentConferenceId(), appointConferenceRequest.getConferenceAttachmentConferenceName()); - saveAppointUser(appoint.getId(), appointConferenceRequest.getConferenceUserIds(), loginUser, Appoint.STATE_CONFERENCE); + saveAppointUser(appoint.getId(), appointConferenceRequest.getConferenceUserIds(), loginUser, + Appoint.STATE_CONFERENCE); return appoint; } @@ -132,6 +138,18 @@ public class AppointService extends BaseService { appoint.setState(Appoint.STATE_VOTE); appoint.setUpdatedId(loginUser.getId()); saveOrUpdate(appoint); + saveAppointAttachment(appoint.getId(), appointScoreRequest.getQuestionPapersAttachmentName(), + appointScoreRequest.getQuestionPapersAttachmentPath(), loginUser, Appoint.STATE_SCORE, "1", + appointScoreRequest.getQuestionPapersAttachmentConferenceId(), + appointScoreRequest.getQuestionPapersAttachmentConferenceName()); + saveAppointAttachment(appoint.getId(), appointScoreRequest.getResultsSummaryAttachmentName(), + appointScoreRequest.getResultsSummaryAttachmentPath(), loginUser, Appoint.STATE_SCORE, "2", + appointScoreRequest.getResultsSummaryAttachmentConferenceId(), + appointScoreRequest.getResultsSummaryAttachmentConferenceName()); + saveAppointAttachment(appoint.getId(), appointScoreRequest.getPublicFileAttachmentName(), + appointScoreRequest.getPublicFileAttachmentPath(), loginUser, Appoint.STATE_SCORE, "3", + appointScoreRequest.getPublicFileAttachmentConferenceId(), + appointScoreRequest.getPublicFileAttachmentConferenceName()); return appoint; } @@ -198,6 +216,7 @@ public class AppointService extends BaseService { /** * 是否通过 + * * @param appointStatusRequest * @param loginUser * @return @@ -209,12 +228,34 @@ public class AppointService extends BaseService { if (Appoint.STATE_VOTE != appoint.getState()) throw new ResultException(Ret.fail("当前环节不能提交该信息")); // appoint.setState(Appoint.STATE_PUBLIC); 跳过公开环节 BeanUtil.copyProperties(appointVoteStateRequest, appoint); - if(appoint.getStatus()) { - appoint.setState(Appoint.STATE_PERFORM); - }else { - appoint.setState(Appoint.STATE_END); - } + + appoint.setState(Appoint.STATE_PUBLIC); + boolean flag = saveOrUpdate(appoint); + + saveAppointAttachment(appoint.getId(), appointVoteStateRequest.getNominationPaperAttachmentName(), + appointVoteStateRequest.getNominationPaperAttachmentPath(), loginUser, Appoint.STATE_PERFORM, + appointVoteStateRequest.getNominationPaperAttachmentConferenceId(), + appointVoteStateRequest.getNominationPaperAttachmentConferenceName()); + return !flag ? Ret.fail("操作失败") : Ret.ok().data(AppointWrapper.build().entityVO(appoint)); + } + + public Ret statePublicSave(AppointPublicStateRequest appointPublicStateRequest, User loginUser) { + Appoint appoint = getById(appointPublicStateRequest.getId()); + Assert.notNull(appoint, "未找到该记录"); + if (!loginUser.getId().equals(appoint.getCreatedId())) return Ret.fail("您不是创建人,不能操作"); + if (Appoint.STATE_PUBLIC != appoint.getState()) throw new ResultException(Ret.fail("当前环节不能提交该信息")); +// appoint.setState(Appoint.STATE_PUBLIC); 跳过公开环节 + BeanUtil.copyProperties(appointPublicStateRequest, appoint); + + appoint.setState(Appoint.STATE_PERFORM); + + boolean flag = saveOrUpdate(appoint); + + saveAppointAttachment(appoint.getId(), appointPublicStateRequest.getAnnouncementFileAttachmentName(), + appointPublicStateRequest.getAnnouncementFileAttachmentPath(), loginUser, Appoint.STATE_PUBLIC, + appointPublicStateRequest.getAnnouncementFileAttachmentConferenceId(), + appointPublicStateRequest.getAnnouncementFileAttachmentConferenceName()); return !flag ? Ret.fail("操作失败") : Ret.ok().data(AppointWrapper.build().entityVO(appoint)); } @@ -356,7 +397,8 @@ public class AppointService extends BaseService { * @param loginUser * @param state */ - private void saveAppointAttachment(String appointId, String appointAttachmentArrStr, User loginUser, Integer state) { + private void saveAppointAttachment(String appointId, String appointAttachmentArrStr, User loginUser, + Integer state) { appointAttachmentService.remove(new LambdaQueryWrapper() .eq(AppointAttachment::getAppointId, appointId) .eq(AppointAttachment::getType, state)); @@ -369,7 +411,8 @@ public class AppointService extends BaseService { item.setCreatedId(loginUser.getId()); item.setCreatedAt(LocalDateTime.now()); if (StrUtil.isNotBlank(item.getConferenceId())) { - conferenceAttachmentService.associationMeeting(item.getConferenceId(), item.getAttachment(), item.getTitle(), "任免督职附件", loginUser.getId()); + conferenceAttachmentService.associationMeeting(item.getConferenceId(), item.getAttachment(), + item.getTitle(), "任免督职附件", loginUser.getId()); } }); appointAttachmentService.saveBatch(appointAttachmentList); @@ -409,7 +452,8 @@ public class AppointService extends BaseService { .setCreatedId(loginUser.getId()) .setCreatedAt(LocalDateTime.now()); if (StrUtil.isNotBlank(conferenceIdArr[i])) { - conferenceAttachmentService.associationMeeting(conferenceIdArr[i], pathArr[i], nameArr[i], "任免督职附件", loginUser.getId()); + conferenceAttachmentService.associationMeeting(conferenceIdArr[i], pathArr[i], nameArr[i], + "任免督职附件", loginUser.getId()); } appointAttachmentService.save(appointAttachment); } @@ -428,4 +472,48 @@ public class AppointService extends BaseService { } } + private void saveAppointAttachment(String appointId, String attachmentName, String attachmentPath, User loginUser + , Integer state, String category, String conferenceId, String conferenceName) { + appointAttachmentService.remove(new LambdaQueryWrapper() + .eq(AppointAttachment::getAppointId, appointId) + .eq(AppointAttachment::getType, state)); + //todo zhouyuan + if (StrUtil.isNotBlank(attachmentName)) { + String[] nameArr = attachmentName.split(","); + String[] pathArr = attachmentPath.split(","); + + if (StrUtil.isNotBlank(conferenceId)) { + String[] conferenceIdArr = conferenceId.split(","); + String[] conferenceNameArr = conferenceName.split(","); + for (int i = 0; i < nameArr.length; i++) { + AppointAttachment appointAttachment = new AppointAttachment(); + appointAttachment.setType(state).setCategory(category) + .setAppointId(appointId) + .setConferenceId(conferenceIdArr[i]) + .setConferenceName(conferenceNameArr[i]) + .setTitle(nameArr[i]) + .setAttachment(pathArr[i]) + .setCreatedId(loginUser.getId()) + .setCreatedAt(LocalDateTime.now()); + if (StrUtil.isNotBlank(conferenceIdArr[i])) { + conferenceAttachmentService.associationMeeting(conferenceIdArr[i], pathArr[i], nameArr[i], + "任免督职附件", loginUser.getId()); + } + appointAttachmentService.save(appointAttachment); + } + } else { + for (int i = 0; i < nameArr.length; i++) { + AppointAttachment appointAttachment = new AppointAttachment(); + appointAttachment.setType(state).setCategory(category) + .setAppointId(appointId) + .setTitle(nameArr[i]) + .setAttachment(pathArr[i]) + .setCreatedId(loginUser.getId()) + .setCreatedAt(LocalDateTime.now()); + appointAttachmentService.save(appointAttachment); + } + } + } + } + } diff --git a/src/main/java/com/ydool/boot/modules/rddb/wrapper/AppointWrapper.java b/src/main/java/com/ydool/boot/modules/rddb/wrapper/AppointWrapper.java index 1057062..982f90f 100644 --- a/src/main/java/com/ydool/boot/modules/rddb/wrapper/AppointWrapper.java +++ b/src/main/java/com/ydool/boot/modules/rddb/wrapper/AppointWrapper.java @@ -41,7 +41,8 @@ public class AppointWrapper extends BaseWrapper { AppointAttachmentService appointAttachmentService = SpringUtils.getBean(AppointAttachmentService.class); AppointUserService appointUserService = SpringUtils.getBean(AppointUserService.class); - List proposeAttachmentList = appointAttachmentService.list(new LambdaQueryWrapper() + List proposeAttachmentList = + appointAttachmentService.list(new LambdaQueryWrapper() .eq(AppointAttachment::getAppointId, appoint.getId()) .eq(AppointAttachment::getType, Appoint.STATE_PROPOSE) .orderByDesc(AppointAttachment::getCreatedAt)); @@ -56,7 +57,8 @@ public class AppointWrapper extends BaseWrapper { i.setConferenceName(conferenceName); }); } - List conferenceAttachmentList = appointAttachmentService.list(new LambdaQueryWrapper() + List conferenceAttachmentList = + appointAttachmentService.list(new LambdaQueryWrapper() .eq(AppointAttachment::getAppointId, appoint.getId()) .eq(AppointAttachment::getType, Appoint.STATE_CONFERENCE) .orderByDesc(AppointAttachment::getCreatedAt)); @@ -71,7 +73,94 @@ public class AppointWrapper extends BaseWrapper { i.setConferenceName(conferenceName); }); } - List performAttachmentList = appointAttachmentService.list(new LambdaQueryWrapper() + List questionPapersAttachmentList = + appointAttachmentService.list(new LambdaQueryWrapper() + .eq(AppointAttachment::getAppointId, appoint.getId()) + .eq(AppointAttachment::getType, Appoint.STATE_SCORE) + .eq(AppointAttachment::getCategory, "1") + .orderByDesc(AppointAttachment::getCreatedAt)); + //获取关联会议名称 + if (CollectionUtil.isNotEmpty(questionPapersAttachmentList)) { + questionPapersAttachmentList.stream().forEach(i -> { + Conference conference = conferenceMapper.selectById(i.getConferenceId()); + String conferenceName = ""; + if (conference != null) { + conferenceName = conference.getTitle(); + } + i.setConferenceName(conferenceName); + }); + } + List resultsSummaryAttachmentList = + appointAttachmentService.list(new LambdaQueryWrapper() + .eq(AppointAttachment::getAppointId, appoint.getId()) + .eq(AppointAttachment::getType, Appoint.STATE_SCORE) + .eq(AppointAttachment::getCategory, "2") + .orderByDesc(AppointAttachment::getCreatedAt)); + //获取关联会议名称 + if (CollectionUtil.isNotEmpty(resultsSummaryAttachmentList)) { + resultsSummaryAttachmentList.stream().forEach(i -> { + Conference conference = conferenceMapper.selectById(i.getConferenceId()); + String conferenceName = ""; + if (conference != null) { + conferenceName = conference.getTitle(); + } + i.setConferenceName(conferenceName); + }); + } + List publicFileAttachmentList = + appointAttachmentService.list(new LambdaQueryWrapper() + .eq(AppointAttachment::getAppointId, appoint.getId()) + .eq(AppointAttachment::getType, Appoint.STATE_SCORE) + .eq(AppointAttachment::getCategory, "3") + .orderByDesc(AppointAttachment::getCreatedAt)); + //获取关联会议名称 + if (CollectionUtil.isNotEmpty(publicFileAttachmentList)) { + publicFileAttachmentList.stream().forEach(i -> { + Conference conference = conferenceMapper.selectById(i.getConferenceId()); + String conferenceName = ""; + if (conference != null) { + conferenceName = conference.getTitle(); + } + i.setConferenceName(conferenceName); + }); + } + List nominationPaperAttachmentList = + appointAttachmentService.list(new LambdaQueryWrapper() + .eq(AppointAttachment::getAppointId, appoint.getId()) + .eq(AppointAttachment::getType, Appoint.STATE_VOTE) + .orderByDesc(AppointAttachment::getCreatedAt)); + //获取关联会议名称 + if (CollectionUtil.isNotEmpty(nominationPaperAttachmentList)) { + nominationPaperAttachmentList.stream().forEach(i -> { + Conference conference = conferenceMapper.selectById(i.getConferenceId()); + String conferenceName = ""; + if (conference != null) { + conferenceName = conference.getTitle(); + } + i.setConferenceName(conferenceName); + }); + } + + List announcementFileAttachmentList = + appointAttachmentService.list(new LambdaQueryWrapper() + .eq(AppointAttachment::getAppointId, appoint.getId()) + .eq(AppointAttachment::getType, Appoint.STATE_PUBLIC) + .orderByDesc(AppointAttachment::getCreatedAt)); + //获取关联会议名称 + if (CollectionUtil.isNotEmpty(announcementFileAttachmentList)) { + announcementFileAttachmentList.stream().forEach(i -> { + Conference conference = conferenceMapper.selectById(i.getConferenceId()); + String conferenceName = ""; + if (conference != null) { + conferenceName = conference.getTitle(); + } + i.setConferenceName(conferenceName); + }); + } + + + List performAttachmentList = + appointAttachmentService.list(new LambdaQueryWrapper() .eq(AppointAttachment::getAppointId, appoint.getId()) .eq(AppointAttachment::getType, Appoint.STATE_PERFORM) .orderByDesc(AppointAttachment::getCreatedAt)); @@ -102,6 +191,11 @@ public class AppointWrapper extends BaseWrapper { appointDto.setProposeAttachmentList(proposeAttachmentList); appointDto.setConferenceAttachmentList(conferenceAttachmentList); + appointDto.setQuestionPapersAttachmentList(questionPapersAttachmentList); + appointDto.setResultsSummaryAttachmentList(resultsSummaryAttachmentList); + appointDto.setPublicFileAttachmentList(publicFileAttachmentList); + appointDto.setNominationPaperAttachmentList(nominationPaperAttachmentList); + appointDto.setAnnouncementFileAttachmentList(announcementFileAttachmentList); appointDto.setPerformAttachmentList(performAttachmentList); appointDto.setConferenceUserList(conferenceUserList); @@ -111,7 +205,8 @@ public class AppointWrapper extends BaseWrapper { //打分结束算平均分 if (Appoint.STATE_END == appoint.getState()) { //没打分的不算 - List scoredAppointUserList = performUserList.stream().filter(item -> item.getScore() != null).collect(Collectors.toList()); + List scoredAppointUserList = + performUserList.stream().filter(item -> item.getScore() != null).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(scoredAppointUserList)) { BigDecimal averageScore = scoredAppointUserList.stream().map(item -> item.getScore()) .reduce(BigDecimal.ZERO, BigDecimal::add) @@ -125,9 +220,12 @@ public class AppointWrapper extends BaseWrapper { //>=投票环节,算通过,拒绝,弃权的票数 if (Appoint.STATE_VOTE <= appoint.getState()) { //没投的不算 - List agreeAppointUserList = voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_AGREE).collect(Collectors.toList()); - List refuseAppointUserList = voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_REFUSE).collect(Collectors.toList()); - List abandonAppointUserList = voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_ABANDON).collect(Collectors.toList()); + List agreeAppointUserList = + voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_AGREE).collect(Collectors.toList()); + List refuseAppointUserList = + voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_REFUSE).collect(Collectors.toList()); + List abandonAppointUserList = + voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_ABANDON).collect(Collectors.toList()); appointDto.setAgreeVoteCount(agreeAppointUserList.size()); appointDto.setRefuseVoteCount(refuseAppointUserList.size()); appointDto.setAbandonVoteCount(abandonAppointUserList.size()); @@ -142,10 +240,12 @@ public class AppointWrapper extends BaseWrapper { appointDto.setIsCanPerform(false); if (userInfo != null) { if (userInfo.getId().equals(appoint.getCreatedId())) appointDto.setIsCreator(true); - List voteUserIdList = voteUserList.stream().map(AppointUser::getUserId).collect(Collectors.toList()); + List voteUserIdList = + voteUserList.stream().map(AppointUser::getUserId).collect(Collectors.toList()); if (voteUserIdList.contains(userInfo.getId())) appointDto.setIsCanVote(true); - List performUserIdList = performUserList.stream().map(AppointUser::getUserId).collect(Collectors.toList()); + List performUserIdList = + performUserList.stream().map(AppointUser::getUserId).collect(Collectors.toList()); if (performUserIdList.contains(userInfo.getId())) appointDto.setIsCanPerform(true); } return appointDto;