diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java index 76bd25e..aaae8c4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/leave/manage/LeaveManage.java @@ -215,6 +215,12 @@ public class LeaveManage { if (ExpertInviteTypeEnum.RANDOM.eq(meeting.getInviteType())) { inviteTask.notifyInviteTask(meeting.getId(), Boolean.FALSE); } + if (meeting.getConfirmedRoster()) { + LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) + .set(Meeting::getConfirmedRoster, Boolean.FALSE) + .eq(Meeting::getId, meeting.getId()); + meetingService.update(mUpdate); + } // 临时请假无需审核 leave.setAuditId(0L); leave.setStatus(LeaveStatusEnum.PASSED.getCode()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java index 428d29f..77ff065 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/controller/MeetingController.java @@ -174,11 +174,11 @@ public class MeetingController { meetingManage.setUpHeadman(req); } - @ApiOperation("重发短信") + @ApiOperation("重发短信 | 确认名单") @PostMapping("/confirmedRoster") @WebLog(value = "重发短信") - public void resendSms(@RequestBody MeetingCancelReq req) { - meetingManage.confirmedRoster(req.getMeetingId()); + public void resendSms(@RequestBody ConfirmedRosterReq req) { + meetingManage.confirmedRoster(req); } @GetMapping("/listReviewProject") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java index 73533f4..a19cd8d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/domain/MeetingExpert.java @@ -56,6 +56,9 @@ public class MeetingExpert implements Serializable { @ApiModelProperty("邀请类型") private Integer inviteType; + @ApiModelProperty("是否已确认名单") + private Boolean confirmedRoster; + private String submitKey; @TableField(fill = FieldFill.INSERT) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ConfirmedRosterReq.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ConfirmedRosterReq.java new file mode 100644 index 0000000..e16b55f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/req/ConfirmedRosterReq.java @@ -0,0 +1,28 @@ +package com.ningdatech.pmapi.meeting.entity.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + *

+ * 会议确认名单实体 + *

+ * + * @author WendyYang + * @since 10:43 2022/8/26 + */ +@Data +@ApiModel("会议确认名单实体") +public class ConfirmedRosterReq { + + @NotNull(message = "会议ID不能为空") + @ApiModelProperty("会议ID") + private Long meetingId; + + @ApiModelProperty + private Boolean reconfirmed; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java index 657e162..c179b4e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java @@ -716,6 +716,7 @@ public class MeetingManage { } } + @Transactional(rollbackFor = Exception.class) public void expertRemove(ExpertRemoveReq req) { String key = "EXPERT_REMOVE:" + req.getExpertMeetingId(); if (!distributedLock.lock(key, RETRY_TIMES)) { @@ -736,6 +737,10 @@ public class MeetingManage { if (!NOTICING.eq(expert.getStatus())) { throw BizException.wrap("已确认过的专家不允许移除!"); } + LambdaUpdateWrapper mUpdate = Wrappers.lambdaUpdate(Meeting.class) + .set(Meeting::getConfirmedRoster, false) + .eq(Meeting::getId, req.getMeetingId()); + meetingService.update(mUpdate); meetingExpertService.removeById(req.getExpertMeetingId()); } finally { distributedLock.releaseLock(key); @@ -791,7 +796,8 @@ public class MeetingManage { } } - public void confirmedRoster(Long meetingId) { + public void confirmedRoster(ConfirmedRosterReq req) { + Long meetingId = req.getMeetingId(); String key = "MEETING_RESEND_SMS:" + meetingId; if (!distributedLock.lock(key, RETRY_TIMES)) { throw BizException.wrap("请刷新后重试!"); @@ -809,6 +815,17 @@ public class MeetingManage { meetingService.update(update); } List experts = meetingExpertService.listAgreedExperts(meetingId); + List expertNoticing = experts.stream() + .filter(w -> meeting.getConfirmedRoster() || !w.getConfirmedRoster()) + .collect(Collectors.toList()); + if (expertNoticing.isEmpty()) { + return; + } + List currConfirmedMeIds = CollUtils.fieldList(expertNoticing, MeetingExpert::getId); + LambdaUpdateWrapper meUpdate = Wrappers.lambdaUpdate(MeetingExpert.class) + .in(MeetingExpert::getId, currConfirmedMeIds) + .set(MeetingExpert::getConfirmedRoster, Boolean.TRUE); + meetingExpertService.update(meUpdate); // TODO 发送会议通知 } finally { distributedLock.releaseLock(key); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 356ea3c..006964d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -1,5 +1,7 @@ package com.ningdatech.pmapi.projectlib.manage; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -260,13 +262,15 @@ public class ProjectLibManage { * 新增一个新的项目 新的版本号 */ public Project newProjectWithVersion(ProjectDTO projecDto){ - Project project = projectService.getById(projecDto.getId()); - - VUtils.isTrue(Objects.isNull(project)) + Project oldProject = projectService.getById(projecDto.getId()); + Project project = new Project(); + VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); - - project.setVersion(project.getVersion() + 1); - BeanUtils.copyProperties(projecDto,project); + BeanUtil.copyProperties(oldProject,project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + BeanUtil.copyProperties(projecDto,project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); project.setId(null); project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); @@ -282,13 +286,15 @@ public class ProjectLibManage { } public Project saveProjectWithVersionAndStatus(ProjectDTO projecDto,Integer stageCode,Integer statusCode){ - Project project = projectService.getById(projecDto.getId()); - - VUtils.isTrue(Objects.isNull(project)) + Project oldProject = projectService.getById(projecDto.getId()); + Project project = new Project(); + VUtils.isTrue(Objects.isNull(oldProject)) .throwMessage("项目不存在!"); - - project.setVersion(project.getVersion() + 1); - BeanUtils.copyProperties(projecDto,project); + BeanUtil.copyProperties(oldProject,project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + BeanUtil.copyProperties(projecDto,project, CopyOptions.create() + .setIgnoreError(Boolean.TRUE).setIgnoreNullValue(Boolean.TRUE)); + project.setVersion(oldProject.getVersion() + 1); project.setId(null); project.setCreateOn(LocalDateTime.now()); project.setUpdateOn(LocalDateTime.now()); @@ -448,4 +454,8 @@ public class ProjectLibManage { } return user; } + + private void copyProperties(ProjectDTO projecDto, Project project) { + + } } diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java index abecf42..8c374bd 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/statemachine/StateMachineTest.java @@ -1,9 +1,9 @@ package com.ningdatech.pmapi.statemachine; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; -import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.IProjectService; import org.junit.jupiter.api.Test; @@ -32,4 +32,14 @@ public class StateMachineTest extends AppTests { System.out.println(String.format("project:%s", JSON.toJSONString(project))); projectService.updateById(project); } + + @Test + public void yyyyyy(){ + Project project = projectService.getById(400); + projectService.update(Wrappers.lambdaUpdate(Project.class) + .set(Project::getNewest,Boolean.FALSE) + .ne(Project::getId,project.getId()) + .eq(Project::getProjectCode,project.getProjectCode())); + System.out.println(project); + } }