This commit is contained in:
lijiaqi 2022-09-07 16:36:20 +08:00
parent a2ca779289
commit 86e11e1f65
3 changed files with 22 additions and 9 deletions

View File

@ -125,8 +125,8 @@ public class ApiAppointController extends ApiBaseController {
@PostMapping("state/vote") @PostMapping("state/vote")
@ResponseBody @ResponseBody
public void stateVoteSave(@Validated AppointVoteStateRequest appointVoteRequest) { public void stateVoteSave(@Validated AppointVoteStateRequest appointVoteRequest) {
Appoint appoint = appointService.stateVoteSave(appointVoteRequest, getApiUser()); Ret ret = appointService.statusSave(appointStatusRequest, getApiUser());
render(Ret.ok().data(AppointWrapper.build().entityVO(appoint))); render(ret);
} }
@ApiOperation("投票") @ApiOperation("投票")

View File

@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -12,6 +14,7 @@ import java.time.LocalDateTime;
public class AppointVoteStateRequest { public class AppointVoteStateRequest {
@ApiModelProperty(value = "任免督职id",required = true) @ApiModelProperty(value = "任免督职id",required = true)
@NotBlank(message = "任免督职id不能为空")
private String id; private String id;
/** /**
@ -24,14 +27,24 @@ public class AppointVoteStateRequest {
pattern = "yyyy-MM-dd HH:mm:ss" pattern = "yyyy-MM-dd HH:mm:ss"
) )
@ApiModelProperty(value = "投票会议时间yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "投票会议时间yyyy-MM-dd HH:mm:ss")
@NotBlank(message = "投票会议时间不能为空")
private LocalDateTime voteAt; private LocalDateTime voteAt;
/** /**
* 投票会议地址 * 投票会议地址
*/ */
@ApiModelProperty(value = "投票会议地址") @ApiModelProperty(value = "投票会议地址")
@NotBlank(message = "投票会议地址不能为空")
private String voteAddress; private String voteAddress;
@ApiModelProperty(value = "投票会议人员id,英文逗号间隔")
String voteUserIds; /**
* 是否通过
*/
@ApiModelProperty(value = "是否通过",required = true)
@NotNull(message = "是否通过不能为空")
private Boolean status;
//
// @ApiModelProperty(value = "投票会议人员id,英文逗号间隔")
// String voteUserIds;
} }

View File

@ -141,7 +141,7 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
BeanUtil.copyProperties(appointVoteRequest, appoint); BeanUtil.copyProperties(appointVoteRequest, appoint);
appoint.setUpdatedId(loginUser.getId()); appoint.setUpdatedId(loginUser.getId());
saveOrUpdate(appoint); saveOrUpdate(appoint);
saveAppointUser(appoint.getId(), appointVoteRequest.getVoteUserIds(), loginUser, Appoint.STATE_VOTE); // saveAppointUser(appoint.getId(), appointVoteRequest.getVoteUserIds(), loginUser, Appoint.STATE_VOTE);
return appoint; return appoint;
} }
@ -202,14 +202,14 @@ public class AppointService extends BaseService<AppointMapper, Appoint> {
* @param loginUser * @param loginUser
* @return * @return
*/ */
public Ret statusSave(AppointStatusRequest appointStatusRequest, User loginUser) { public Ret statusSave(AppointVoteStateRequest appointVoteStateRequest, User loginUser) {
Appoint appoint = getById(appointStatusRequest.getId()); Appoint appoint = getById(appointVoteStateRequest.getId());
Assert.notNull(appoint, "未找到该记录"); Assert.notNull(appoint, "未找到该记录");
if (!loginUser.getId().equals(appoint.getCreatedId())) return Ret.fail("您不是创建人,不能操作"); if (!loginUser.getId().equals(appoint.getCreatedId())) return Ret.fail("您不是创建人,不能操作");
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); 跳过公开环节
appoint.setStatus(appointStatusRequest.getStatus()); BeanUtil.copyProperties(appointVoteStateRequest, appoint);
if(appointStatusRequest.getStatus()) { if(appoint.getStatus()) {
appoint.setState(Appoint.STATE_PERFORM); appoint.setState(Appoint.STATE_PERFORM);
}else { }else {
appoint.setState(Appoint.STATE_END); appoint.setState(Appoint.STATE_END);