update
This commit is contained in:
parent
dd5ed1e161
commit
5ffa4d7bf3
|
@ -0,0 +1,132 @@
|
|||
package com.ydool.boot.api.controller;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
|
||||
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
|
||||
import com.ydool.boot.common.result.Ret;
|
||||
import com.ydool.boot.modules.rddb.entity.Conference;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachment;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceUser;
|
||||
import com.ydool.boot.modules.rddb.entity.dto.ConferenceAttachmentDto;
|
||||
import com.ydool.boot.modules.rddb.entity.request.ScoreRequest;
|
||||
import com.ydool.boot.modules.rddb.entity.request.VoteRequest;
|
||||
import com.ydool.boot.modules.rddb.entity.request.conference_attachment.ConferenceAttachmentBeginRequest;
|
||||
import com.ydool.boot.modules.rddb.service.*;
|
||||
import com.ydool.boot.modules.rddb.wrapper.ConferenceAttachmentWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: zhouyuan
|
||||
* @date: 2022/09/23
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/api/conference_attachment")
|
||||
@Api(value = "会议附件", tags = "会议附件")
|
||||
public class ApiConferenceAttachmentController extends ApiBaseController {
|
||||
|
||||
@Autowired
|
||||
private ConferenceService conferenceService;
|
||||
@Autowired
|
||||
private ConferenceAttachmentService conferenceAttachmentService;
|
||||
@Autowired
|
||||
private ConferenceAttachmentVoteService voteService;
|
||||
@Autowired
|
||||
private ConferenceAttachmentScoreService scoreService;
|
||||
@Autowired
|
||||
ConferenceUserService conferenceUserService;
|
||||
|
||||
@ApiOperation("开启打分")
|
||||
@PostMapping("score/begin")
|
||||
@ResponseBody
|
||||
public void beginScore(@RequestBody ConferenceAttachmentBeginRequest request) {
|
||||
Ret ret = conferenceAttachmentService.beginScore(request, getApiUser());
|
||||
render(ret);
|
||||
}
|
||||
|
||||
@ApiOperation("开启投票")
|
||||
@PostMapping("vote/begin")
|
||||
@ResponseBody
|
||||
public void beginVote(@RequestBody ConferenceAttachmentBeginRequest request) {
|
||||
Ret ret = conferenceAttachmentService.beginVote(request, getApiUser());
|
||||
render(ret);
|
||||
}
|
||||
|
||||
@ApiOperation("关闭打分")
|
||||
@PostMapping("score/end/{id}")
|
||||
@ResponseBody
|
||||
public void endScore(@PathVariable String id) {
|
||||
ConferenceAttachment conferenceAttachment = conferenceAttachmentService.getById(id);
|
||||
Assert.notNull(conferenceAttachment);
|
||||
Conference conference = conferenceService.getById(conferenceAttachment.getConferenceId());
|
||||
Assert.notNull(conference);
|
||||
if (!conference.getCreatedId().equals(getApiUserId())) render(Ret.fail("您非创建人,不能关闭打分"));
|
||||
|
||||
conferenceAttachment.setScoreState(2);
|
||||
conferenceAttachmentService.updateById(conferenceAttachment);
|
||||
render(Ret.ok());
|
||||
}
|
||||
|
||||
@ApiOperation("关闭投票")
|
||||
@PostMapping("vote/end/{id}")
|
||||
@ResponseBody
|
||||
public void endVote(@PathVariable String id) {
|
||||
ConferenceAttachment conferenceAttachment = conferenceAttachmentService.getById(id);
|
||||
Assert.notNull(conferenceAttachment);
|
||||
Conference conference = conferenceService.getById(conferenceAttachment.getConferenceId());
|
||||
Assert.notNull(conference);
|
||||
if (!conference.getCreatedId().equals(getApiUserId())) render(Ret.fail("您非创建人,不能关闭投票"));
|
||||
|
||||
conferenceAttachment.setVoteState(2);
|
||||
conferenceAttachmentService.updateById(conferenceAttachment);
|
||||
render(Ret.ok());
|
||||
}
|
||||
|
||||
@ApiOperation("打分")
|
||||
@PostMapping("score")
|
||||
@ResponseBody
|
||||
public void score(@RequestBody ScoreRequest request) {
|
||||
Ret ret = conferenceAttachmentService.score(request, getApiUser());
|
||||
render(ret);
|
||||
}
|
||||
|
||||
@ApiOperation("投票")
|
||||
@PostMapping("vote")
|
||||
@ResponseBody
|
||||
public void vote(@RequestBody VoteRequest request) {
|
||||
Ret ret = conferenceAttachmentService.vote(request, getApiUser());
|
||||
render(ret);
|
||||
}
|
||||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("detail/{id}")
|
||||
@ResponseBody
|
||||
@DynamicResponseParameters(properties = {@DynamicParameter(name = "data", dataTypeClass =
|
||||
ConferenceAttachmentDto.class)})
|
||||
public void detail(@PathVariable String id) {
|
||||
ConferenceAttachment conferenceAttachment = conferenceAttachmentService.getById(id);
|
||||
if (conferenceAttachment == null) render(Ret.fail("未找到该记录"));
|
||||
render(Ret.ok().data(ConferenceAttachmentWrapper.build().entityVO(conferenceAttachment)));
|
||||
}
|
||||
|
||||
@ApiOperation("根据附件id查询所属会议的已签到人员")
|
||||
@GetMapping("signed_user/{id}")
|
||||
@ResponseBody
|
||||
public void signedUser(@PathVariable String id) {
|
||||
ConferenceAttachment conferenceAttachment = conferenceAttachmentService.getById(id);
|
||||
Assert.notNull(conferenceAttachment);
|
||||
Conference conference = conferenceService.getById(conferenceAttachment.getConferenceId());
|
||||
Assert.notNull(conference);
|
||||
//签到人员列表
|
||||
List<ConferenceUser> conferenceUserList = conferenceUserService.list(new QueryWrapper<ConferenceUser>()
|
||||
.eq("conference_id", conference.getId())
|
||||
.eq("status", 1));
|
||||
render(Ret.ok().data(conferenceUserList));
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import com.ydool.boot.modules.rddb.entity.ConferenceUser;
|
|||
import com.ydool.boot.modules.rddb.service.ConferenceAttachmentService;
|
||||
import com.ydool.boot.modules.rddb.service.ConferenceService;
|
||||
import com.ydool.boot.modules.rddb.service.ConferenceUserService;
|
||||
import com.ydool.boot.modules.rddb.wrapper.ConferenceWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
@ -23,7 +24,6 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: zhouyuan
|
||||
|
@ -70,20 +70,7 @@ public class ApiConferenceController extends ApiBaseController {
|
|||
Page page = conferenceService.page(new Page(getPageNum(), getPageSize()), wrapper);
|
||||
page.getRecords().forEach(item -> {
|
||||
Conference conference = (Conference) item;
|
||||
//会议议题列表
|
||||
List<ConferenceAttachment> conferenceIssueList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().eq("pid", "").eq("conference_id", (conference.getId())));
|
||||
//议题列表里装会议附件列表
|
||||
conferenceIssueList.forEach(conferenceIssue -> {
|
||||
List<ConferenceAttachment> conferenceAttachmentList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().eq("pid", conferenceIssue.getId()).eq("conference_id", (conference.getId())));
|
||||
//处理文件前缀
|
||||
conferenceAttachmentList.forEach(ConferenceAttachment::full);
|
||||
conferenceIssue.setConferenceAttachmentList(conferenceAttachmentList);
|
||||
});
|
||||
conference.setConferenceIssueList(conferenceIssueList);
|
||||
//当前登录用户是否已签到
|
||||
ConferenceUser conferenceUser = conferenceUserService.getOne(new QueryWrapper<ConferenceUser>().eq("conference_id", conference.getId()).eq("user_id", getApiUserId()));
|
||||
conference.setSign(conferenceUser != null ? conferenceUser.getStatus() : null);
|
||||
conference.setSignTime(conferenceUser != null ? conferenceUser.getUpdatedAt() : null);
|
||||
|
||||
});
|
||||
render(Ret.ok().paged(page));
|
||||
}
|
||||
|
@ -149,24 +136,7 @@ public class ApiConferenceController extends ApiBaseController {
|
|||
}
|
||||
|
||||
Page page = conferenceService.page(new Page(getPageNum(), getPageSize()), wrapper);
|
||||
page.getRecords().forEach(item -> {
|
||||
Conference conference = (Conference) item;
|
||||
//会议议题列表
|
||||
List<ConferenceAttachment> conferenceIssueList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().orderByAsc("sort_no").eq("pid", "").eq("conference_id", (conference.getId())));
|
||||
//议题列表里装会议附件列表
|
||||
conferenceIssueList.forEach(conferenceIssue -> {
|
||||
List<ConferenceAttachment> conferenceAttachmentList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().orderByAsc("sort_no").eq("pid", conferenceIssue.getId()).eq("conference_id", (conference.getId())));
|
||||
//处理文件前缀
|
||||
conferenceAttachmentList.forEach(ConferenceAttachment::full);
|
||||
conferenceIssue.setConferenceAttachmentList(conferenceAttachmentList);
|
||||
});
|
||||
conference.setConferenceIssueList(conferenceIssueList);
|
||||
//当前登录用户是否已签到
|
||||
ConferenceUser conferenceUser = conferenceUserService.getOne(new QueryWrapper<ConferenceUser>().eq("conference_id", conference.getId()).eq("user_id", getApiUserId()));
|
||||
conference.setSign(conferenceUser != null ? conferenceUser.getStatus() : null);
|
||||
conference.setSignTime(conferenceUser != null ? conferenceUser.getUpdatedAt() : null);
|
||||
});
|
||||
render(Ret.ok().paged(page));
|
||||
render(Ret.ok().paged(ConferenceWrapper.build().pageVO(page)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -180,27 +150,7 @@ public class ApiConferenceController extends ApiBaseController {
|
|||
public void conferenceDetail(String id) {
|
||||
Conference conference = conferenceService.getById(id);
|
||||
if (conference != null) {
|
||||
//会议议题列表
|
||||
List<ConferenceAttachment> conferenceIssueList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().orderByAsc("sort_no").eq("pid", "").eq("conference_id", (conference.getId())));
|
||||
//议题列表里装会议附件列表
|
||||
conferenceIssueList.forEach(conferenceIssue -> {
|
||||
List<ConferenceAttachment> conferenceAttachmentList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>().orderByAsc("sort_no").eq("pid", conferenceIssue.getId()).eq("conference_id", (conference.getId())));
|
||||
//处理文件前缀
|
||||
conferenceAttachmentList.forEach(ConferenceAttachment::full);
|
||||
conferenceIssue.setConferenceAttachmentList(conferenceAttachmentList);
|
||||
});
|
||||
conference.setConferenceIssueList(conferenceIssueList);
|
||||
//当前登录用户是否已签到
|
||||
ConferenceUser conferenceUser = conferenceUserService.getOne(new QueryWrapper<ConferenceUser>().eq("conference_id", conference.getId()).eq("user_id", getApiUserId()));
|
||||
conference.setSign(conferenceUser != null ? conferenceUser.getStatus() : null);
|
||||
conference.setSignTime(conferenceUser != null ? conferenceUser.getUpdatedAt() : null);
|
||||
|
||||
//该会议应签到人数和现签到人数
|
||||
int allSignCount = conferenceUserService.count(new QueryWrapper<ConferenceUser>().eq("conference_Id", conference.getId()));
|
||||
int unSignCount = conferenceUserService.count(new QueryWrapper<ConferenceUser>().eq("conference_Id", conference.getId()).eq("status", ConferenceUser.STATUS_UN_SIGN));
|
||||
conference.setAllSignCount(allSignCount);
|
||||
conference.setSignedCount(allSignCount - unSignCount);
|
||||
render(Ret.ok().data(conference));
|
||||
render(Ret.ok().data(ConferenceWrapper.build().entityVO(conference)));
|
||||
}
|
||||
render(Ret.fail("未找到该会议"));
|
||||
}
|
||||
|
|
|
@ -55,9 +55,15 @@ public class ApiDbController extends ApiBaseController {
|
|||
dbVO.getPrecinctAddress(), dbVO.getDbIdentity(), dbVO.getOfficeId());
|
||||
if (StrUtil.isNotBlank(pageNo) || StrUtil.isNotBlank(pageSize)) {
|
||||
IPage<Db> paged = dbService.page(new Page<>(Convert.toInt(pageNo), Convert.toInt(pageSize)), qw);
|
||||
paged.getRecords().forEach(item->{
|
||||
item.setPhone("");
|
||||
});
|
||||
render(Ret.ok().paged(DbWrapper.build().pageVO(paged)));
|
||||
} else {
|
||||
List<Db> list = dbService.list(qw);
|
||||
list.forEach(item->{
|
||||
item.setPhone("");
|
||||
});
|
||||
render(Ret.ok().data(DbWrapper.build().listVO(list)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ydool.boot.modules.rddb.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ydool.boot.core.entity.BaseEntity;
|
||||
|
@ -12,7 +11,6 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -101,35 +99,4 @@ public class Conference extends BaseEntity {
|
|||
@ApiModelProperty(value = "会议文件类型")
|
||||
private String category;
|
||||
|
||||
//非实体字段
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("非实体字段,返回会议议题的集合")
|
||||
private List conferenceIssueList;
|
||||
|
||||
//非实体字段
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("非实体字段,当前登录用户该会议是否已签到 0未 1已")
|
||||
private Integer sign;
|
||||
|
||||
//非实体字段
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("非实体字段,当前登录用户签到时间")
|
||||
@DateTimeFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime signTime;
|
||||
|
||||
//非实体字段
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("非实体字段,关联的会议 应签到多少人")
|
||||
private Integer allSignCount;
|
||||
|
||||
//非实体字段
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("非实体字段,关联的会议 已签到多少人")
|
||||
private Integer signedCount;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +2,10 @@ package com.ydool.boot.modules.rddb.entity;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ydool.boot.core.entity.BaseEntity;
|
||||
import com.ydool.boot.core.entity.TreeEntity;
|
||||
import com.ydool.boot.modules.rddb.entity.dto.ConferenceAttachmentDto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -72,6 +71,12 @@ public class ConferenceAttachment extends TreeEntity {
|
|||
@TableField(exist = false)
|
||||
private String sort;
|
||||
|
||||
@ApiModelProperty(value = "投票状态 1开启 2结束")
|
||||
private Integer voteState;
|
||||
|
||||
@ApiModelProperty(value = "打分状态 1开启 2结束")
|
||||
private Integer scoreState;
|
||||
|
||||
//非实体字段
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("非实体字段,返回所属会议的信息")
|
||||
|
@ -80,7 +85,7 @@ public class ConferenceAttachment extends TreeEntity {
|
|||
//非实体字段
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("非实体字段,返回议题的会议附件集合")
|
||||
private List conferenceAttachmentList;
|
||||
private List<ConferenceAttachmentDto> conferenceAttachmentList;
|
||||
|
||||
public void full() {
|
||||
if (StringUtils.isNotBlank(getAttachment())) {
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package com.ydool.boot.modules.rddb.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ydool.boot.core.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件打分人员
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_conference_attachment_score")
|
||||
public class ConferenceAttachmentScore extends BaseEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createdId;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updatedId;
|
||||
|
||||
/**
|
||||
* 会议附件id
|
||||
*/
|
||||
private String resourceId;
|
||||
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 分数 1-100
|
||||
*/
|
||||
private BigDecimal score;
|
||||
|
||||
@DateTimeFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime scoreAt;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortNo;
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.ydool.boot.modules.rddb.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ydool.boot.core.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件投票人员
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_conference_attachment_vote")
|
||||
public class ConferenceAttachmentVote extends BaseEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createdId;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updatedId;
|
||||
|
||||
/**
|
||||
* 会议附件id
|
||||
*/
|
||||
private String resourceId;
|
||||
|
||||
/**
|
||||
* 人员id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 投票情况01
|
||||
*/
|
||||
private Integer vote;
|
||||
|
||||
@DateTimeFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime voteAt;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortNo;
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.ydool.boot.modules.rddb.entity.dto;
|
||||
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachment;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentScore;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentVote;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ConferenceAttachmentDto extends ConferenceAttachment {
|
||||
|
||||
@ApiModelProperty(value = "打分人员")
|
||||
List<ConferenceAttachmentScore> scoreList;
|
||||
|
||||
@ApiModelProperty(value = "投票人员")
|
||||
List<ConferenceAttachmentVote> voteList;
|
||||
|
||||
@ApiModelProperty(value = "是否是投票人员")
|
||||
Boolean isVoteUser;
|
||||
|
||||
@ApiModelProperty(value = "是否是打分人员")
|
||||
Boolean isScoreUser;
|
||||
|
||||
@ApiModelProperty(value = "是否已投票")
|
||||
Boolean isVoted;
|
||||
|
||||
@ApiModelProperty(value = "是否已打分")
|
||||
Boolean isScored;
|
||||
|
||||
@ApiModelProperty(value = "平均分")
|
||||
BigDecimal averageScore;
|
||||
|
||||
@ApiModelProperty(value = "同意票数")
|
||||
Integer agreeVoteCount;
|
||||
|
||||
@ApiModelProperty(value = "拒绝票数")
|
||||
Integer refuseVoteCount;
|
||||
|
||||
@ApiModelProperty(value = "弃权票数")
|
||||
Integer abandonVoteCount;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.ydool.boot.modules.rddb.entity.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ydool.boot.modules.rddb.entity.Conference;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceUser;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ConferenceDto extends Conference {
|
||||
|
||||
@ApiModelProperty("议题集合")
|
||||
private List conferenceIssueList;
|
||||
|
||||
@ApiModelProperty("是否已签到 0未签到 1已签到")
|
||||
private Integer sign;
|
||||
|
||||
@ApiModelProperty("当前登录用户签到时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime signTime;
|
||||
|
||||
@ApiModelProperty("关联的会议 应签到多少人")
|
||||
private Integer allSignCount;
|
||||
|
||||
@ApiModelProperty("关联的会议 已签到多少人")
|
||||
private Integer signedCount;
|
||||
|
||||
//新加字段
|
||||
@ApiModelProperty("是否是签到人员")
|
||||
private Boolean isSignUser;
|
||||
|
||||
@ApiModelProperty("是否是创建人员")
|
||||
private Boolean isCreatedUser;
|
||||
|
||||
@ApiModelProperty(value = "签到人员")
|
||||
List<ConferenceUser> conferenceUserList;
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.ydool.boot.modules.rddb.entity.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class VoteRequest {
|
||||
|
||||
@ApiModelProperty(value = "id", required = true)
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "投票 (0待投票 1赞成 2反对 3弃权)", required = true)
|
||||
private Integer vote;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.ydool.boot.modules.rddb.entity.request.conference_attachment;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
|
||||
@Data
|
||||
public class ConferenceAttachmentBeginRequest {
|
||||
|
||||
@ApiModelProperty(value = "附件id", required = true)
|
||||
@NotBlank
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "人员ids,英文逗号间隔", required = true)
|
||||
@NotBlank
|
||||
private String ids;
|
||||
}
|
|
@ -20,7 +20,7 @@ public class MyGenerator {
|
|||
public static void main(String[] args) {
|
||||
|
||||
//表名
|
||||
String tableName = "t_review_work_check_user";
|
||||
String tableName = "t_conference_attachment_vote";
|
||||
//表前缀
|
||||
String tablePrefix = "t_";
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class MyGenerator {
|
|||
dsc.setUrl("jdbc:mysql://127.0.0.1:3306/ydool_rd?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8");
|
||||
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
|
||||
dsc.setUsername("root");
|
||||
dsc.setPassword("Wang09211108");
|
||||
dsc.setPassword("123456");
|
||||
dsc.setDbType(DbType.MYSQL);
|
||||
mpg.setDataSource(dsc);
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.ydool.boot.modules.rddb.mapper;
|
||||
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentScore;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件打分人员 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
public interface ConferenceAttachmentScoreMapper extends BaseMapper<ConferenceAttachmentScore> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.ydool.boot.modules.rddb.mapper;
|
||||
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentVote;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件投票人员 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
public interface ConferenceAttachmentVoteMapper extends BaseMapper<ConferenceAttachmentVote> {
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ydool.boot.modules.rddb.mapper.ConferenceAttachmentScoreMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ydool.boot.modules.rddb.mapper.ConferenceAttachmentVoteMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,20 @@
|
|||
package com.ydool.boot.modules.rddb.service;
|
||||
|
||||
import com.ydool.boot.core.service.BaseService;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentScore;
|
||||
import com.ydool.boot.modules.rddb.mapper.ConferenceAttachmentScoreMapper;
|
||||
import com.ydool.boot.modules.rddb.service.inter.IConferenceAttachmentScoreService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件打分人员 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
@Service
|
||||
public class ConferenceAttachmentScoreService extends BaseService<ConferenceAttachmentScoreMapper, ConferenceAttachmentScore> implements IConferenceAttachmentScoreService {
|
||||
|
||||
}
|
|
@ -1,16 +1,27 @@
|
|||
package com.ydool.boot.modules.rddb.service;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ydool.boot.core.service.BaseService;
|
||||
import com.ydool.boot.common.result.Ret;
|
||||
import com.ydool.boot.core.service.BaseTreeService;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachment;
|
||||
import com.ydool.boot.modules.rddb.entity.*;
|
||||
import com.ydool.boot.modules.rddb.entity.request.ScoreRequest;
|
||||
import com.ydool.boot.modules.rddb.entity.request.VoteRequest;
|
||||
import com.ydool.boot.modules.rddb.entity.request.conference_attachment.ConferenceAttachmentBeginRequest;
|
||||
import com.ydool.boot.modules.rddb.mapper.ConferenceAttachmentMapper;
|
||||
import com.ydool.boot.modules.sys.entity.User;
|
||||
import com.ydool.boot.modules.sys.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -24,19 +35,26 @@ import java.time.LocalDateTime;
|
|||
public class ConferenceAttachmentService extends BaseTreeService<ConferenceAttachmentMapper, ConferenceAttachment> {
|
||||
|
||||
@Autowired
|
||||
private ConferenceAttachmentMapper conferenceAttachmentMapper;
|
||||
ConferenceAttachmentMapper conferenceAttachmentMapper;
|
||||
@Autowired
|
||||
ConferenceService conferenceService;
|
||||
@Autowired
|
||||
UserService userService;
|
||||
@Autowired
|
||||
ConferenceAttachmentScoreService scoreService;
|
||||
@Autowired
|
||||
ConferenceAttachmentVoteService voteService;
|
||||
|
||||
public Page page(Page page, String conferenceTitle, String attachmentTitle) {
|
||||
return conferenceAttachmentMapper.page(page, conferenceTitle, attachmentTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param conferenceId 所属会议id
|
||||
* @param attachment 附件路径
|
||||
* @param title 附件名
|
||||
* @param headline 议题名
|
||||
* @param userId 用户ID
|
||||
* @param attachment 附件路径
|
||||
* @param title 附件名
|
||||
* @param headline 议题名
|
||||
* @param userId 用户ID
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
|
@ -62,7 +80,7 @@ public class ConferenceAttachmentService extends BaseTreeService<ConferenceAttac
|
|||
//不存在
|
||||
else {
|
||||
//创建议题
|
||||
ConferenceAttachment conferenceAttachment2 = new ConferenceAttachment()
|
||||
ConferenceAttachment conferenceAttachment2 = new ConferenceAttachment()
|
||||
.builder()
|
||||
.title(headline)
|
||||
.conferenceId(conferenceId)
|
||||
|
@ -93,4 +111,127 @@ public class ConferenceAttachmentService extends BaseTreeService<ConferenceAttac
|
|||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
public Ret beginScore(ConferenceAttachmentBeginRequest request, User loginUser) {
|
||||
String id = request.getId();
|
||||
String ids = request.getIds();
|
||||
ConferenceAttachment conferenceAttachment = getById(id);
|
||||
Assert.notNull(conferenceAttachment);
|
||||
Conference conference = conferenceService.getById(conferenceAttachment.getConferenceId());
|
||||
Assert.notNull(conference);
|
||||
if (!conference.getCreatedId().equals(loginUser.getId())) return Ret.fail("您非创建人,不能开启打分");
|
||||
conferenceAttachment.setScoreState(1);
|
||||
updateById(conferenceAttachment);
|
||||
|
||||
scoreService.remove(new LambdaQueryWrapper<ConferenceAttachmentScore>()
|
||||
.eq(ConferenceAttachmentScore::getResourceId,id));
|
||||
|
||||
String[] userIdArr = ids.split(",");
|
||||
List<ConferenceAttachmentScore> dataList = new ArrayList<>();
|
||||
for (int i = 0; i < userIdArr.length; i++) {
|
||||
String userId = userIdArr[i];
|
||||
User user = userService.getById(userId);
|
||||
if (user != null) {
|
||||
ConferenceAttachmentScore ca = new ConferenceAttachmentScore();
|
||||
ca.setResourceId(id);
|
||||
ca.setUserId(user.getId());
|
||||
ca.setUserName(user.getUserName());
|
||||
ca.setSortNo(i);
|
||||
dataList.add(ca);
|
||||
}
|
||||
}
|
||||
scoreService.saveBatch(dataList);
|
||||
return Ret.ok();
|
||||
}
|
||||
|
||||
public Ret beginVote(ConferenceAttachmentBeginRequest request, User loginUser) {
|
||||
String id = request.getId();
|
||||
String ids = request.getIds();
|
||||
ConferenceAttachment conferenceAttachment = getById(id);
|
||||
Assert.notNull(conferenceAttachment);
|
||||
Conference conference = conferenceService.getById(conferenceAttachment.getConferenceId());
|
||||
Assert.notNull(conference);
|
||||
if (!conference.getCreatedId().equals(loginUser.getId())) return Ret.fail("您非创建人,不能开启投票");
|
||||
conferenceAttachment.setVoteState(1);
|
||||
updateById(conferenceAttachment);
|
||||
|
||||
voteService.remove(new LambdaQueryWrapper<ConferenceAttachmentVote>()
|
||||
.eq(ConferenceAttachmentVote::getResourceId,id));
|
||||
|
||||
String[] userIdArr = ids.split(",");
|
||||
List<ConferenceAttachmentVote> dataList = new ArrayList<>();
|
||||
for (int i = 0; i < userIdArr.length; i++) {
|
||||
String userId = userIdArr[i];
|
||||
User user = userService.getById(userId);
|
||||
if (user != null) {
|
||||
ConferenceAttachmentVote ca = new ConferenceAttachmentVote();
|
||||
ca.setResourceId(id);
|
||||
ca.setUserId(user.getId());
|
||||
ca.setUserName(user.getUserName());
|
||||
ca.setSortNo(i);
|
||||
ca.setVote(0);
|
||||
dataList.add(ca);
|
||||
}
|
||||
}
|
||||
voteService.saveBatch(dataList);
|
||||
return Ret.ok();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Ret score(ScoreRequest request, User loginUser) {
|
||||
String id = request.getId();
|
||||
BigDecimal score = request.getScore();
|
||||
|
||||
ConferenceAttachment conferenceAttachment = getById(id);
|
||||
Assert.notNull(conferenceAttachment, "未找到该记录");
|
||||
ConferenceAttachmentScore conferenceAttachmentScore = scoreService.getOne(new LambdaQueryWrapper<ConferenceAttachmentScore>()
|
||||
.eq(ConferenceAttachmentScore::getResourceId, id)
|
||||
.eq(ConferenceAttachmentScore::getUserId, loginUser.getId()));
|
||||
if (conferenceAttachmentScore == null) return Ret.fail("您没有打分的权限");
|
||||
if (conferenceAttachmentScore.getScore() != null) return Ret.fail("您已打过分");
|
||||
if (1 != conferenceAttachment.getScoreState()) return Ret.fail("非可打分状态,不能操作");
|
||||
conferenceAttachmentScore.setScore(score);
|
||||
conferenceAttachmentScore.setScoreAt(LocalDateTime.now());
|
||||
boolean flag = scoreService.updateById(conferenceAttachmentScore);
|
||||
|
||||
//全部打分完
|
||||
int nullCount = scoreService.count(Wrappers.lambdaQuery(ConferenceAttachmentScore.class)
|
||||
.eq(ConferenceAttachmentScore::getResourceId, id)
|
||||
.isNull(ConferenceAttachmentScore::getScore));
|
||||
if (nullCount == 0) {
|
||||
conferenceAttachment.setScoreState(2);
|
||||
saveOrUpdate(conferenceAttachment);
|
||||
}
|
||||
return !flag ? Ret.fail("操作失败") : Ret.ok();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public Ret vote(VoteRequest request, User loginUser) {
|
||||
String id = request.getId();
|
||||
Integer vote = request.getVote();
|
||||
|
||||
ConferenceAttachment conferenceAttachment = getById(id);
|
||||
Assert.notNull(conferenceAttachment, "未找到该记录");
|
||||
ConferenceAttachmentVote conferenceAttachmentVote = voteService.getOne(new LambdaQueryWrapper<ConferenceAttachmentVote>()
|
||||
.eq(ConferenceAttachmentVote::getResourceId, id)
|
||||
.eq(ConferenceAttachmentVote::getUserId, loginUser.getId()));
|
||||
if (conferenceAttachmentVote == null) return Ret.fail("您没有投票的权限");
|
||||
if (conferenceAttachmentVote.getVote() != 0) return Ret.fail("您已投过票");
|
||||
if (1 != conferenceAttachment.getVoteState()) return Ret.fail("非可投票状态,不能操作");
|
||||
conferenceAttachmentVote.setVote(vote);
|
||||
conferenceAttachmentVote.setVoteAt(LocalDateTime.now());
|
||||
boolean flag = voteService.updateById(conferenceAttachmentVote);
|
||||
|
||||
//全部投票完
|
||||
int nullCount = voteService.count(Wrappers.lambdaQuery(ConferenceAttachmentVote.class)
|
||||
.eq(ConferenceAttachmentVote::getResourceId, id)
|
||||
.eq(ConferenceAttachmentVote::getVote, 0));
|
||||
if (nullCount == 0) {
|
||||
conferenceAttachment.setVoteState(2);
|
||||
saveOrUpdate(conferenceAttachment);
|
||||
}
|
||||
return !flag ? Ret.fail("操作失败") : Ret.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.ydool.boot.modules.rddb.service;
|
||||
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentVote;
|
||||
import com.ydool.boot.modules.rddb.mapper.ConferenceAttachmentVoteMapper;
|
||||
import com.ydool.boot.modules.rddb.service.inter.IConferenceAttachmentVoteService;
|
||||
import com.ydool.boot.core.service.BaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件投票人员 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
@Service
|
||||
public class ConferenceAttachmentVoteService extends BaseService<ConferenceAttachmentVoteMapper, ConferenceAttachmentVote> implements IConferenceAttachmentVoteService {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.ydool.boot.modules.rddb.service.inter;
|
||||
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentScore;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件打分人员 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
public interface IConferenceAttachmentScoreService extends IService<ConferenceAttachmentScore> {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.ydool.boot.modules.rddb.service.inter;
|
||||
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentVote;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件投票人员 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
public interface IConferenceAttachmentVoteService extends IService<ConferenceAttachmentVote> {
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.ydool.boot.modules.rddb.web;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.ydool.boot.core.web.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件打分人员 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/rddb/conferenceAttachmentScore")
|
||||
public class ConferenceAttachmentScoreController extends BaseController {
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.ydool.boot.modules.rddb.web;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import com.ydool.boot.core.web.BaseController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 会议附件投票人员 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author zhouyuan
|
||||
* @since 2022-09-23
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/rddb/conferenceAttachmentVote")
|
||||
public class ConferenceAttachmentVoteController extends BaseController {
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.ydool.boot.modules.rddb.wrapper;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ydool.boot.api.util.TokenUtil;
|
||||
import com.ydool.boot.api.util.UserInfo;
|
||||
import com.ydool.boot.common.utils.SpringUtils;
|
||||
import com.ydool.boot.core.wrapper.BaseWrapper;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachment;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentScore;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachmentVote;
|
||||
import com.ydool.boot.modules.rddb.entity.dto.ConferenceAttachmentDto;
|
||||
import com.ydool.boot.modules.rddb.service.ConferenceAttachmentScoreService;
|
||||
import com.ydool.boot.modules.rddb.service.ConferenceAttachmentVoteService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhouyuan
|
||||
* @date 2022/09/23
|
||||
*/
|
||||
public class ConferenceAttachmentWrapper extends BaseWrapper<ConferenceAttachment, ConferenceAttachmentDto> {
|
||||
|
||||
public static ConferenceAttachmentWrapper build() {
|
||||
return new ConferenceAttachmentWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConferenceAttachmentDto entityVO(ConferenceAttachment obj) {
|
||||
ConferenceAttachmentDto dto = BeanUtil.copyProperties(obj, ConferenceAttachmentDto.class);
|
||||
|
||||
ConferenceAttachmentScoreService scoreService = SpringUtils.getBean(ConferenceAttachmentScoreService.class);
|
||||
ConferenceAttachmentVoteService voteService = SpringUtils.getBean(ConferenceAttachmentVoteService.class);
|
||||
|
||||
List<ConferenceAttachmentScore> scoreList = scoreService.list(new LambdaQueryWrapper<ConferenceAttachmentScore>()
|
||||
.eq(ConferenceAttachmentScore::getResourceId, obj.getId()));
|
||||
List<ConferenceAttachmentVote> voteList = voteService.list(new LambdaQueryWrapper<ConferenceAttachmentVote>()
|
||||
.eq(ConferenceAttachmentVote::getResourceId, obj.getId()));
|
||||
dto.setScoreList(scoreList);
|
||||
dto.setVoteList(voteList);
|
||||
|
||||
//打分结束算平均分
|
||||
if (null != dto.getScoreState() && 2 == dto.getScoreState()) {
|
||||
//没打分的不算
|
||||
List<ConferenceAttachmentScore> scoredList = scoreList.stream().filter(item -> item.getScore() != null).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(scoredList)) {
|
||||
BigDecimal averageScore = scoredList.stream().map(item -> item.getScore())
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
||||
.divide(new BigDecimal(scoredList.size()), BigDecimal.ROUND_HALF_UP);
|
||||
dto.setAverageScore(averageScore);
|
||||
} else {
|
||||
dto.setAverageScore(new BigDecimal("0"));
|
||||
}
|
||||
}
|
||||
|
||||
if (null != dto.getVoteState() && 2 == dto.getVoteState()) {
|
||||
//没投的不算
|
||||
List<ConferenceAttachmentVote> agreeList = voteList.stream().filter(item -> item.getVote() == 1).collect(Collectors.toList());
|
||||
List<ConferenceAttachmentVote> refuseList = voteList.stream().filter(item -> item.getVote() == 2).collect(Collectors.toList());
|
||||
List<ConferenceAttachmentVote> abandonList = voteList.stream().filter(item -> item.getVote() == 3).collect(Collectors.toList());
|
||||
dto.setAgreeVoteCount(agreeList.size());
|
||||
dto.setRefuseVoteCount(refuseList.size());
|
||||
dto.setAbandonVoteCount(abandonList.size());
|
||||
}
|
||||
|
||||
dto.setIsVoteUser(false);
|
||||
dto.setIsVoted(false);
|
||||
dto.setIsScoreUser(false);
|
||||
dto.setIsScored(false);
|
||||
|
||||
UserInfo loginUser = TokenUtil.getUserInfo();
|
||||
//是否是投票人
|
||||
List<String> voteUserIdList = voteList.stream().map(ConferenceAttachmentVote::getUserId).collect(Collectors.toList());
|
||||
dto.setIsVoteUser(voteUserIdList.contains(loginUser.getId()));
|
||||
//是否是打分人
|
||||
List<String> scoreUserIdList = scoreList.stream().map(ConferenceAttachmentScore::getUserId).collect(Collectors.toList());
|
||||
dto.setIsScoreUser(scoreUserIdList.contains(loginUser.getId()));
|
||||
//是否已投票
|
||||
ConferenceAttachmentVote conferenceAttachmentVote = voteService.getOne(new LambdaQueryWrapper<ConferenceAttachmentVote>()
|
||||
.eq(ConferenceAttachmentVote::getResourceId, obj.getId())
|
||||
.eq(ConferenceAttachmentVote::getUserId, loginUser.getId()));
|
||||
dto.setIsVoted(conferenceAttachmentVote != null && conferenceAttachmentVote.getVote() != 0);
|
||||
//是否已打分
|
||||
ConferenceAttachmentScore conferenceAttachmentScore = scoreService.getOne(new LambdaQueryWrapper<ConferenceAttachmentScore>()
|
||||
.eq(ConferenceAttachmentScore::getResourceId, obj.getId())
|
||||
.eq(ConferenceAttachmentScore::getUserId, loginUser.getId()));
|
||||
dto.setIsScored(conferenceAttachmentScore != null && conferenceAttachmentScore.getScore() != null);
|
||||
return dto;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package com.ydool.boot.modules.rddb.wrapper;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ydool.boot.api.util.TokenUtil;
|
||||
import com.ydool.boot.api.util.UserInfo;
|
||||
import com.ydool.boot.common.utils.SpringUtils;
|
||||
import com.ydool.boot.core.wrapper.BaseWrapper;
|
||||
import com.ydool.boot.modules.rddb.entity.Conference;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceAttachment;
|
||||
import com.ydool.boot.modules.rddb.entity.ConferenceUser;
|
||||
import com.ydool.boot.modules.rddb.entity.dto.ConferenceDto;
|
||||
import com.ydool.boot.modules.rddb.service.ConferenceAttachmentService;
|
||||
import com.ydool.boot.modules.rddb.service.ConferenceUserService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhouyuan
|
||||
* @date 2022/09/23
|
||||
*/
|
||||
public class ConferenceWrapper extends BaseWrapper<Conference, ConferenceDto> {
|
||||
|
||||
public static ConferenceWrapper build() {
|
||||
return new ConferenceWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConferenceDto entityVO(Conference conference) {
|
||||
ConferenceAttachmentService conferenceAttachmentService = SpringUtils.getBean(ConferenceAttachmentService.class);
|
||||
ConferenceUserService conferenceUserService = SpringUtils.getBean(ConferenceUserService.class);
|
||||
ConferenceDto dto = BeanUtil.copyProperties(conference, ConferenceDto.class);
|
||||
|
||||
//会议议题列表
|
||||
List<ConferenceAttachment> conferenceIssueList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>()
|
||||
.eq("pid", "")
|
||||
.eq("conference_id", (conference.getId())));
|
||||
//议题列表里装会议附件列表
|
||||
conferenceIssueList.forEach(conferenceIssue -> {
|
||||
List<ConferenceAttachment> conferenceAttachmentList = conferenceAttachmentService.list(new QueryWrapper<ConferenceAttachment>()
|
||||
.eq("pid", conferenceIssue.getId())
|
||||
.eq("conference_id", (conference.getId())));
|
||||
conferenceAttachmentList.forEach(ConferenceAttachment::full);
|
||||
conferenceIssue.setConferenceAttachmentList(ConferenceAttachmentWrapper.build().listVO(conferenceAttachmentList));
|
||||
});
|
||||
dto.setConferenceIssueList(conferenceIssueList);
|
||||
|
||||
UserInfo loginUserInfo = TokenUtil.getUserInfo();
|
||||
//当前登录用户是否已签到
|
||||
ConferenceUser conferenceUser = conferenceUserService.getOne(new QueryWrapper<ConferenceUser>()
|
||||
.eq("conference_id", conference.getId())
|
||||
.eq("user_id", loginUserInfo.getId()));
|
||||
dto.setSign(conferenceUser != null ? conferenceUser.getStatus() : null);
|
||||
dto.setSignTime(dto.getSign()!=null&&dto.getSign()==1 ? conferenceUser.getUpdatedAt() : null);
|
||||
|
||||
//该会议应签到人数和现签到人数
|
||||
int allSignCount = conferenceUserService.count(new QueryWrapper<ConferenceUser>().eq("conference_Id", conference.getId()));
|
||||
int unSignCount = conferenceUserService.count(new QueryWrapper<ConferenceUser>().eq("conference_Id", conference.getId()).eq("status", ConferenceUser.STATUS_UN_SIGN));
|
||||
dto.setAllSignCount(allSignCount);
|
||||
dto.setSignedCount(allSignCount - unSignCount);
|
||||
|
||||
//签到人员列表
|
||||
List<ConferenceUser> conferenceUserList = conferenceUserService.list(new QueryWrapper<ConferenceUser>()
|
||||
.eq("conference_Id", conference.getId()));
|
||||
dto.setConferenceUserList(conferenceUserList);
|
||||
List<String> signUserIdList = conferenceUserList.stream().map(ConferenceUser::getUserId).collect(Collectors.toList());
|
||||
|
||||
//当前登录用户是否是签到人员
|
||||
dto.setIsSignUser(signUserIdList.contains(loginUserInfo.getId()));
|
||||
//当前用户是否是创建人员
|
||||
dto.setIsCreatedUser(loginUserInfo.getId().equals(conference.getCreatedId()));
|
||||
return dto;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue