This commit is contained in:
lijiaqi 2022-11-08 09:30:23 +08:00
parent f8a801c5e7
commit 965fee9252
10 changed files with 357 additions and 57 deletions

View File

@ -12,6 +12,7 @@ import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.ydool.boot.common.result.Ret; import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.Appoint; import com.ydool.boot.modules.rddb.entity.Appoint;
import com.ydool.boot.modules.rddb.entity.AppointComment; 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.dto.AppointDto;
import com.ydool.boot.modules.rddb.entity.request.CommentRequest; import com.ydool.boot.modules.rddb.entity.request.CommentRequest;
import com.ydool.boot.modules.rddb.entity.request.ScoreRequest; import com.ydool.boot.modules.rddb.entity.request.ScoreRequest;
@ -47,13 +48,14 @@ public class ApiAppointController extends ApiBaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"), @ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"), @ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "platform", value = "当前登录的是哪个端 admin机关办公/ rddb代表/ voter选民 ", required = true)
}) })
@DynamicResponseParameters(properties = { @DynamicResponseParameters(properties = {
@DynamicParameter(value = "职务任免", name = "data", dataTypeClass = AppointDto.class) @DynamicParameter(value = "职务任免", name = "data", dataTypeClass = AppointDto.class)
}) })
@ApiOperation("职务任免列表 (被指定的人与创建人可见)") @ApiOperation("职务任免列表 (被指定的人与创建人可见)")
@GetMapping @GetMapping
public void appointPage() { public void appointPage(String platform) {
QueryWrapper<Appoint> qw = new QueryWrapper<Appoint>() QueryWrapper<Appoint> qw = new QueryWrapper<Appoint>()
// .and(_qw -> _qw // .and(_qw -> _qw
// .eq("created_id", getApiUserId()) // .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() + "'")) // .inSql("id", "select appoint_id from t_appoint_user where user_id='" + getApiUserId() + "'"))
.lt("state", Appoint.STATE_END) .lt("state", Appoint.STATE_END)
.orderByDesc("created_at"); .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<Appoint> paged = appointService.page(new Page<>(getPageNum(), getPageSize()), qw); IPage<Appoint> paged = appointService.page(new Page<>(getPageNum(), getPageSize()), qw);
render(Ret.ok().paged(AppointWrapper.build().pageVO(paged))); render(Ret.ok().paged(AppointWrapper.build().pageVO(paged)));
} }
@ -68,16 +75,22 @@ public class ApiAppointController extends ApiBaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"), @ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"), @ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "platform", value = "当前登录的是哪个端 admin机关办公/ rddb代表/ voter选民 ", required = true)
}) })
@DynamicResponseParameters(properties = { @DynamicResponseParameters(properties = {
@DynamicParameter(value = "职务任免", name = "data", dataTypeClass = AppointDto.class) @DynamicParameter(value = "职务任免", name = "data", dataTypeClass = AppointDto.class)
}) })
@ApiOperation("公告栏 (所有人可见)") @ApiOperation("公告栏 (所有人可见)")
@GetMapping("public") @GetMapping("public")
public void publicPage() { public void publicPage(String platform) {
QueryWrapper<Appoint> qw = new QueryWrapper<Appoint>() QueryWrapper<Appoint> qw = new QueryWrapper<Appoint>()
.eq("state", Appoint.STATE_END) .eq("state", Appoint.STATE_END)
.orderByDesc("created_at"); .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<Appoint> paged = appointService.page(new Page<>(getPageNum(), getPageSize()), qw); IPage<Appoint> paged = appointService.page(new Page<>(getPageNum(), getPageSize()), qw);
render(Ret.ok().paged(AppointWrapper.build().pageVO(paged))); 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("履职环节") @ApiOperation("履职环节")
@PostMapping("state/perform") @PostMapping("state/perform")

View File

@ -36,6 +36,18 @@ public class Appoint extends BaseEntity {
//结束标记 //结束标记
public static Integer STATE_END = 7; 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;
/** /**
* 创建者 * 创建者
*/ */

View File

@ -73,5 +73,6 @@ public class AppointAttachment extends BaseEntity {
@ApiModelProperty(value = "会议名称") @ApiModelProperty(value = "会议名称")
private String conferenceName; private String conferenceName;
@ApiModelProperty(value = "分类")
private String category;
} }

View File

@ -15,16 +15,26 @@ public class AppointDto extends Appoint {
@ApiModelProperty(value = "提名附件") @ApiModelProperty(value = "提名附件")
List<AppointAttachment> proposeAttachmentList; List<AppointAttachment> proposeAttachmentList;
@ApiModelProperty(value = "会议附件") @ApiModelProperty(value = "会议附件")
List <AppointAttachment>conferenceAttachmentList; List<AppointAttachment> conferenceAttachmentList;
@ApiModelProperty(value = "题库试卷")
List<AppointAttachment> questionPapersAttachmentList;
@ApiModelProperty(value = "成绩汇总")
List<AppointAttachment> resultsSummaryAttachmentList;
@ApiModelProperty(value = "公示文件")
List<AppointAttachment> publicFileAttachmentList;
@ApiModelProperty(value = "提名文件")
List<AppointAttachment> nominationPaperAttachmentList;
@ApiModelProperty(value = "公告文件")
List<AppointAttachment> announcementFileAttachmentList;
@ApiModelProperty(value = "履职附件") @ApiModelProperty(value = "履职附件")
List<AppointAttachment> performAttachmentList; List<AppointAttachment> performAttachmentList;
@ApiModelProperty(value = "会议人员") @ApiModelProperty(value = "会议人员")
List <AppointUser>conferenceUserList; List<AppointUser> conferenceUserList;
@ApiModelProperty(value = "投票人员") @ApiModelProperty(value = "投票人员")
List <AppointUser>voteUserList; List<AppointUser> voteUserList;
@ApiModelProperty(value = "打分人员") @ApiModelProperty(value = "打分人员")
List <AppointUser>performUserList; List<AppointUser> performUserList;
@ApiModelProperty(value = "平均分") @ApiModelProperty(value = "平均分")
BigDecimal averageScore; BigDecimal averageScore;

View File

@ -39,4 +39,6 @@ public class AppointPerformStateRequest {
String performAttachmentConferenceName; String performAttachmentConferenceName;
@ApiModelProperty(value = "打分分数") @ApiModelProperty(value = "打分分数")
String score; String score;
@ApiModelProperty(value = "测评结果")
String evaluationResults;
} }

View File

@ -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;
}

View File

@ -11,7 +11,7 @@ import java.time.LocalDateTime;
@Data @Data
public class AppointScoreStateRequest { public class AppointScoreStateRequest {
@ApiModelProperty(value = "任免督职id",required = true) @ApiModelProperty(value = "任免督职id", required = true)
private String id; private String id;
/** /**
@ -45,4 +45,33 @@ public class AppointScoreStateRequest {
private LocalDateTime examUploadAt; 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;
} }

View File

@ -13,38 +13,53 @@ import java.time.LocalDateTime;
@Data @Data
public class AppointVoteStateRequest { public class AppointVoteStateRequest {
@ApiModelProperty(value = "任免督职id",required = true) @ApiModelProperty(value = "任免督职id", required = true)
@NotBlank(message = "任免督职id不能为空") @NotBlank(message = "任免督职id不能为空")
private String id; private String id;
/** @ApiModelProperty(value = "审议意见")
* 投票会议时间 private String deliberations;
*/
@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 votingResult;
*/
@ApiModelProperty(value = "投票会议地址")
@NotBlank(message = "投票会议地址不能为空")
private String voteAddress;
// /**
/** // * 投票会议时间
* 是否通过 // */
*/ // @DateTimeFormat(
@ApiModelProperty(value = "是否通过",required = true) // pattern = "yyyy-MM-dd HH:mm:ss"
@NotNull(message = "是否通过不能为空") // )
private Boolean status; // @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,英文逗号间隔") // @ApiModelProperty(value = "投票会议人员id,英文逗号间隔")
// String voteUserIds; // String voteUserIds;
@ApiModelProperty(value = "提名文件附件名 英文逗号间隔")
String nominationPaperAttachmentName;
@ApiModelProperty(value = "提名文件附件路径 英文逗号间隔")
String nominationPaperAttachmentPath;
@ApiModelProperty(value = "提名文件附件关联会议id 英文逗号间隔")
String nominationPaperAttachmentConferenceId;
@ApiModelProperty(value = "提名文件附件关联会议名称 英文逗号间隔")
String nominationPaperAttachmentConferenceName;
} }

View File

@ -86,9 +86,12 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
saveAppointUser(appointBo.getId(), performUserIds, loginUser, Appoint.STATE_PERFORM); saveAppointUser(appointBo.getId(), performUserIds, loginUser, Appoint.STATE_PERFORM);
//保存附件 //保存附件
saveAppointAttachment(appointBo.getId(), appointBo.getProposeAttachmentArrStr(), loginUser, Appoint.STATE_PROPOSE); saveAppointAttachment(appointBo.getId(), appointBo.getProposeAttachmentArrStr(), loginUser,
saveAppointAttachment(appointBo.getId(), appointBo.getConferenceAttachmentArrStr(), loginUser, Appoint.STATE_CONFERENCE); Appoint.STATE_PROPOSE);
saveAppointAttachment(appointBo.getId(), appointBo.getPerformAttachmentArrStr(), loginUser, Appoint.STATE_PERFORM); saveAppointAttachment(appointBo.getId(), appointBo.getConferenceAttachmentArrStr(), loginUser,
Appoint.STATE_CONFERENCE);
saveAppointAttachment(appointBo.getId(), appointBo.getPerformAttachmentArrStr(), loginUser,
Appoint.STATE_PERFORM);
return Ret.ok(); return Ret.ok();
} }
@ -103,7 +106,8 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
saveOrUpdate(appoint); saveOrUpdate(appoint);
saveAppointAttachment(appoint.getId(), appointProposeRequest.getProposeAttachmentName(), saveAppointAttachment(appoint.getId(), appointProposeRequest.getProposeAttachmentName(),
appointProposeRequest.getProposeAttachmentPath(), loginUser, Appoint.STATE_PROPOSE, appointProposeRequest.getProposeAttachmentPath(), loginUser, Appoint.STATE_PROPOSE,
appointProposeRequest.getProposeAttachmentConferenceId(), appointProposeRequest.getProposeAttachmentConferenceName()); appointProposeRequest.getProposeAttachmentConferenceId(),
appointProposeRequest.getProposeAttachmentConferenceName());
return appoint; return appoint;
} }
@ -111,7 +115,8 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
public Appoint stateConferenceSave(AppointConferenceStateRequest appointConferenceRequest, User loginUser) { public Appoint stateConferenceSave(AppointConferenceStateRequest appointConferenceRequest, User loginUser) {
Appoint appoint = getById(appointConferenceRequest.getId()); Appoint appoint = getById(appointConferenceRequest.getId());
Assert.notNull(appoint, "未找到该记录"); 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); BeanUtil.copyProperties(appointConferenceRequest, appoint);
appoint.setState(Appoint.STATE_SCORE); appoint.setState(Appoint.STATE_SCORE);
appoint.setUpdatedId(loginUser.getId()); appoint.setUpdatedId(loginUser.getId());
@ -120,7 +125,8 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
appointConferenceRequest.getConferenceAttachmentPath(), loginUser, Appoint.STATE_CONFERENCE, appointConferenceRequest.getConferenceAttachmentPath(), loginUser, Appoint.STATE_CONFERENCE,
appointConferenceRequest.getConferenceAttachmentConferenceId(), appointConferenceRequest.getConferenceAttachmentConferenceId(),
appointConferenceRequest.getConferenceAttachmentConferenceName()); appointConferenceRequest.getConferenceAttachmentConferenceName());
saveAppointUser(appoint.getId(), appointConferenceRequest.getConferenceUserIds(), loginUser, Appoint.STATE_CONFERENCE); saveAppointUser(appoint.getId(), appointConferenceRequest.getConferenceUserIds(), loginUser,
Appoint.STATE_CONFERENCE);
return appoint; return appoint;
} }
@ -132,6 +138,18 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
appoint.setState(Appoint.STATE_VOTE); appoint.setState(Appoint.STATE_VOTE);
appoint.setUpdatedId(loginUser.getId()); appoint.setUpdatedId(loginUser.getId());
saveOrUpdate(appoint); 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; return appoint;
} }
@ -198,6 +216,7 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
/** /**
* 是否通过 * 是否通过
*
* @param appointStatusRequest * @param appointStatusRequest
* @param loginUser * @param loginUser
* @return * @return
@ -209,12 +228,34 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
if (Appoint.STATE_VOTE != appoint.getState()) throw new ResultException(Ret.fail("当前环节不能提交该信息")); if (Appoint.STATE_VOTE != appoint.getState()) throw new ResultException(Ret.fail("当前环节不能提交该信息"));
// appoint.setState(Appoint.STATE_PUBLIC); 跳过公开环节 // appoint.setState(Appoint.STATE_PUBLIC); 跳过公开环节
BeanUtil.copyProperties(appointVoteStateRequest, appoint); BeanUtil.copyProperties(appointVoteStateRequest, appoint);
if(appoint.getStatus()) {
appoint.setState(Appoint.STATE_PERFORM); appoint.setState(Appoint.STATE_PUBLIC);
}else {
appoint.setState(Appoint.STATE_END);
}
boolean flag = saveOrUpdate(appoint); 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)); return !flag ? Ret.fail("操作失败") : Ret.ok().data(AppointWrapper.build().entityVO(appoint));
} }
@ -356,7 +397,8 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
* @param loginUser * @param loginUser
* @param state * @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<AppointAttachment>() appointAttachmentService.remove(new LambdaQueryWrapper<AppointAttachment>()
.eq(AppointAttachment::getAppointId, appointId) .eq(AppointAttachment::getAppointId, appointId)
.eq(AppointAttachment::getType, state)); .eq(AppointAttachment::getType, state));
@ -369,7 +411,8 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
item.setCreatedId(loginUser.getId()); item.setCreatedId(loginUser.getId());
item.setCreatedAt(LocalDateTime.now()); item.setCreatedAt(LocalDateTime.now());
if (StrUtil.isNotBlank(item.getConferenceId())) { 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); appointAttachmentService.saveBatch(appointAttachmentList);
@ -409,7 +452,8 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
.setCreatedId(loginUser.getId()) .setCreatedId(loginUser.getId())
.setCreatedAt(LocalDateTime.now()); .setCreatedAt(LocalDateTime.now());
if (StrUtil.isNotBlank(conferenceIdArr[i])) { 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); appointAttachmentService.save(appointAttachment);
} }
@ -428,4 +472,48 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
} }
} }
private void saveAppointAttachment(String appointId, String attachmentName, String attachmentPath, User loginUser
, Integer state, String category, String conferenceId, String conferenceName) {
appointAttachmentService.remove(new LambdaQueryWrapper<AppointAttachment>()
.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);
}
}
}
}
} }

View File

@ -41,7 +41,8 @@ public class AppointWrapper extends BaseWrapper<Appoint, AppointDto> {
AppointAttachmentService appointAttachmentService = SpringUtils.getBean(AppointAttachmentService.class); AppointAttachmentService appointAttachmentService = SpringUtils.getBean(AppointAttachmentService.class);
AppointUserService appointUserService = SpringUtils.getBean(AppointUserService.class); AppointUserService appointUserService = SpringUtils.getBean(AppointUserService.class);
List<AppointAttachment> proposeAttachmentList = appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>() List<AppointAttachment> proposeAttachmentList =
appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>()
.eq(AppointAttachment::getAppointId, appoint.getId()) .eq(AppointAttachment::getAppointId, appoint.getId())
.eq(AppointAttachment::getType, Appoint.STATE_PROPOSE) .eq(AppointAttachment::getType, Appoint.STATE_PROPOSE)
.orderByDesc(AppointAttachment::getCreatedAt)); .orderByDesc(AppointAttachment::getCreatedAt));
@ -56,7 +57,8 @@ public class AppointWrapper extends BaseWrapper<Appoint, AppointDto> {
i.setConferenceName(conferenceName); i.setConferenceName(conferenceName);
}); });
} }
List<AppointAttachment> conferenceAttachmentList = appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>() List<AppointAttachment> conferenceAttachmentList =
appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>()
.eq(AppointAttachment::getAppointId, appoint.getId()) .eq(AppointAttachment::getAppointId, appoint.getId())
.eq(AppointAttachment::getType, Appoint.STATE_CONFERENCE) .eq(AppointAttachment::getType, Appoint.STATE_CONFERENCE)
.orderByDesc(AppointAttachment::getCreatedAt)); .orderByDesc(AppointAttachment::getCreatedAt));
@ -71,7 +73,94 @@ public class AppointWrapper extends BaseWrapper<Appoint, AppointDto> {
i.setConferenceName(conferenceName); i.setConferenceName(conferenceName);
}); });
} }
List<AppointAttachment> performAttachmentList = appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>() List<AppointAttachment> questionPapersAttachmentList =
appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>()
.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<AppointAttachment> resultsSummaryAttachmentList =
appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>()
.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<AppointAttachment> publicFileAttachmentList =
appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>()
.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<AppointAttachment> nominationPaperAttachmentList =
appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>()
.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<AppointAttachment> announcementFileAttachmentList =
appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>()
.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<AppointAttachment> performAttachmentList =
appointAttachmentService.list(new LambdaQueryWrapper<AppointAttachment>()
.eq(AppointAttachment::getAppointId, appoint.getId()) .eq(AppointAttachment::getAppointId, appoint.getId())
.eq(AppointAttachment::getType, Appoint.STATE_PERFORM) .eq(AppointAttachment::getType, Appoint.STATE_PERFORM)
.orderByDesc(AppointAttachment::getCreatedAt)); .orderByDesc(AppointAttachment::getCreatedAt));
@ -102,6 +191,11 @@ public class AppointWrapper extends BaseWrapper<Appoint, AppointDto> {
appointDto.setProposeAttachmentList(proposeAttachmentList); appointDto.setProposeAttachmentList(proposeAttachmentList);
appointDto.setConferenceAttachmentList(conferenceAttachmentList); appointDto.setConferenceAttachmentList(conferenceAttachmentList);
appointDto.setQuestionPapersAttachmentList(questionPapersAttachmentList);
appointDto.setResultsSummaryAttachmentList(resultsSummaryAttachmentList);
appointDto.setPublicFileAttachmentList(publicFileAttachmentList);
appointDto.setNominationPaperAttachmentList(nominationPaperAttachmentList);
appointDto.setAnnouncementFileAttachmentList(announcementFileAttachmentList);
appointDto.setPerformAttachmentList(performAttachmentList); appointDto.setPerformAttachmentList(performAttachmentList);
appointDto.setConferenceUserList(conferenceUserList); appointDto.setConferenceUserList(conferenceUserList);
@ -111,7 +205,8 @@ public class AppointWrapper extends BaseWrapper<Appoint, AppointDto> {
//打分结束算平均分 //打分结束算平均分
if (Appoint.STATE_END == appoint.getState()) { if (Appoint.STATE_END == appoint.getState()) {
//没打分的不算 //没打分的不算
List<AppointUser> scoredAppointUserList = performUserList.stream().filter(item -> item.getScore() != null).collect(Collectors.toList()); List<AppointUser> scoredAppointUserList =
performUserList.stream().filter(item -> item.getScore() != null).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(scoredAppointUserList)) { if (CollectionUtil.isNotEmpty(scoredAppointUserList)) {
BigDecimal averageScore = scoredAppointUserList.stream().map(item -> item.getScore()) BigDecimal averageScore = scoredAppointUserList.stream().map(item -> item.getScore())
.reduce(BigDecimal.ZERO, BigDecimal::add) .reduce(BigDecimal.ZERO, BigDecimal::add)
@ -125,9 +220,12 @@ public class AppointWrapper extends BaseWrapper<Appoint, AppointDto> {
//>=投票环节,算通过,拒绝,弃权的票数 //>=投票环节,算通过,拒绝,弃权的票数
if (Appoint.STATE_VOTE <= appoint.getState()) { if (Appoint.STATE_VOTE <= appoint.getState()) {
//没投的不算 //没投的不算
List<AppointUser> agreeAppointUserList = voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_AGREE).collect(Collectors.toList()); List<AppointUser> agreeAppointUserList =
List<AppointUser> refuseAppointUserList = voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_REFUSE).collect(Collectors.toList()); voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_AGREE).collect(Collectors.toList());
List<AppointUser> abandonAppointUserList = voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_ABANDON).collect(Collectors.toList()); List<AppointUser> refuseAppointUserList =
voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_REFUSE).collect(Collectors.toList());
List<AppointUser> abandonAppointUserList =
voteUserList.stream().filter(item -> item.getVote() == AppointUser.VOTE_ABANDON).collect(Collectors.toList());
appointDto.setAgreeVoteCount(agreeAppointUserList.size()); appointDto.setAgreeVoteCount(agreeAppointUserList.size());
appointDto.setRefuseVoteCount(refuseAppointUserList.size()); appointDto.setRefuseVoteCount(refuseAppointUserList.size());
appointDto.setAbandonVoteCount(abandonAppointUserList.size()); appointDto.setAbandonVoteCount(abandonAppointUserList.size());
@ -142,10 +240,12 @@ public class AppointWrapper extends BaseWrapper<Appoint, AppointDto> {
appointDto.setIsCanPerform(false); appointDto.setIsCanPerform(false);
if (userInfo != null) { if (userInfo != null) {
if (userInfo.getId().equals(appoint.getCreatedId())) appointDto.setIsCreator(true); if (userInfo.getId().equals(appoint.getCreatedId())) appointDto.setIsCreator(true);
List<String> voteUserIdList = voteUserList.stream().map(AppointUser::getUserId).collect(Collectors.toList()); List<String> voteUserIdList =
voteUserList.stream().map(AppointUser::getUserId).collect(Collectors.toList());
if (voteUserIdList.contains(userInfo.getId())) appointDto.setIsCanVote(true); if (voteUserIdList.contains(userInfo.getId())) appointDto.setIsCanVote(true);
List<String> performUserIdList = performUserList.stream().map(AppointUser::getUserId).collect(Collectors.toList()); List<String> performUserIdList =
performUserList.stream().map(AppointUser::getUserId).collect(Collectors.toList());
if (performUserIdList.contains(userInfo.getId())) appointDto.setIsCanPerform(true); if (performUserIdList.contains(userInfo.getId())) appointDto.setIsCanPerform(true);
} }
return appointDto; return appointDto;