2. 第四流程添加一个接口征求意见、内容显示调查问卷(上传附件功能)、意见汇总(留言栏)

This commit is contained in:
lijiaqi 2022-10-08 11:49:53 +08:00
parent 365ebf2d1a
commit 7ba152031b
13 changed files with 305 additions and 16 deletions

View File

@ -13,12 +13,15 @@ import com.ydool.boot.common.result.Ret;
import com.ydool.boot.modules.rddb.entity.Const;
import com.ydool.boot.modules.rddb.entity.ReviewWork;
import com.ydool.boot.modules.rddb.entity.ReviewWorkComment;
import com.ydool.boot.modules.rddb.entity.ReviewWorkMessage;
import com.ydool.boot.modules.rddb.entity.dto.ReviewWorkDto;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkAuditRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkCheckRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkCommentRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkMessageRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.state.*;
import com.ydool.boot.modules.rddb.service.ReviewWorkCommentService;
import com.ydool.boot.modules.rddb.service.ReviewWorkMessageService;
import com.ydool.boot.modules.rddb.service.ReviewWorkService;
import com.ydool.boot.modules.rddb.wrapper.ReviewWorkWrapper;
import io.swagger.annotations.Api;
@ -45,6 +48,9 @@ public class ApiReviewWorkController extends ApiBaseController {
@Autowired
ReviewWorkCommentService reviewWorkCommentService;
@Autowired
ReviewWorkMessageService reviewWorkMessageService;
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ -62,9 +68,11 @@ public class ApiReviewWorkController extends ApiBaseController {
// .and(_qw -> _qw
// .eq("created_id", getApiUserId())
// .or()
// .inSql("id", "select review_id from t_review_work_user where user_id='" + getApiUserId() + "'")
// .inSql("id", "select review_id from t_review_work_user where user_id='" + getApiUserId() +
// "'")
// .or()
// .inSql("id", "select review_id from t_review_work_audit where user_id='" + getApiUserId() + "'"))
// .inSql("id", "select review_id from t_review_work_audit where user_id='" + getApiUserId() +
// "'"))
.orderByDesc("created_at");
if (Const.TYPE_RDDB.equals(platform)) {
qw.like("obj", platform);
@ -141,6 +149,33 @@ public class ApiReviewWorkController extends ApiBaseController {
render(Ret.ok().paged(paged));
}
@ApiOperation("意见")
@PostMapping("message")
@ResponseBody
public void message(@Validated ReviewWorkMessageRequest reviewWorkMessageRequest) {
Ret ret = reviewWorkService.message(reviewWorkMessageRequest, getApiUser());
render(ret);
}
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页"),
@ApiImplicitParam(name = "size", value = "显示条数"),
@ApiImplicitParam(name = "reviewId", value = "评议id"),
})
@DynamicResponseParameters(properties = {
@DynamicParameter(value = "评议意见", name = "data", dataTypeClass = ReviewWorkMessage.class)
})
@ApiOperation("意见列表")
@GetMapping("message")
public void messagePage(String reviewId) {
LambdaQueryWrapper<ReviewWorkMessage> qw = new LambdaQueryWrapper<ReviewWorkMessage>()
.eq(StrUtil.isNotBlank(reviewId), ReviewWorkMessage::getReviewId, reviewId)
.orderByDesc(ReviewWorkMessage::getCreatedAt);
IPage<ReviewWorkMessage> paged = reviewWorkMessageService.page(new Page<>(getPageNum(), getPageSize()), qw);
render(Ret.ok().paged(paged));
}
@ApiOperation("内部上报环节")
@PostMapping("state/in_report")
@ResponseBody
@ -171,27 +206,48 @@ public class ApiReviewWorkController extends ApiBaseController {
// render(Ret.ok().data(ReviewWorkWrapper.build().entityVO(review)));
// }
@ApiOperation("上传自查/调查报告环节")
@PostMapping("state/check")
@ResponseBody
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "评议", dataTypeClass = ReviewWorkDto.class)
})
public void stateCheckSave2(@RequestBody @Validated WorkCheckRequest workCheckRequest) {
ReviewWork review = reviewWorkService.stateCheckSave(workCheckRequest, getApiUser());
render(Ret.ok().data(ReviewWorkWrapper.build().entityVO(review)));
}
@ApiOperation("上报评议部门")
@PostMapping("state/report")
@ResponseBody
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "评议", dataTypeClass = ReviewWorkDto.class)
})
public void stateReport(@RequestBody ReviewWorkReportStateRequest reviewWorkReportStateRequest){
public void stateReport(@RequestBody ReviewWorkReportStateRequest reviewWorkReportStateRequest) {
ReviewWork review = reviewWorkService.stateReport(reviewWorkReportStateRequest, getApiUser());
render(Ret.ok().data(ReviewWorkWrapper.build().entityVO(review)));
}
@ApiOperation("上传自查/调查报告环节")
@PostMapping("state/check")
@ResponseBody
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "评议", dataTypeClass = ReviewWorkDto.class)
})
public void stateCheckSave(@RequestBody @Validated WorkCheckRequest workCheckRequest) {
ReviewWork review = reviewWorkService.stateCheckSave(workCheckRequest, getApiUser());
render(Ret.ok().data(ReviewWorkWrapper.build().entityVO(review)));
}
@ApiOperation("征求意见环节")
@PostMapping("state/ask")
@ResponseBody
@DynamicResponseParameters(properties = {
@DynamicParameter(name = "data", value = "评议", dataTypeClass = ReviewWorkDto.class)
})
public void stateAskSave(@RequestBody @Validated ReviewWorkAskStateRequest reviewWorkAskStateRequest) {
ReviewWork review = reviewWorkService.stateAskSave(reviewWorkAskStateRequest, getApiUser());
render(Ret.ok().data(ReviewWorkWrapper.build().entityVO(review)));
}
@ApiOperation("意见汇总结束")
@PostMapping("ask/end/{id}")
@ApiImplicitParam(name = "id", value = "评议id")
@ResponseBody
public void askEnd(@PathVariable String id) {
Ret ret = reviewWorkService.askEnd(id, getApiUser());
render(ret);
}
@ApiOperation("打分")

View File

@ -0,0 +1,48 @@
package com.ydool.boot.modules.rddb.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.boot.core.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 评议意见汇总
* </p>
*
* @author zhouyuan
* @since 2022-10-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("t_review_work_message")
public class ReviewWorkMessage extends BaseEntity{
private static final long serialVersionUID = 1L;
/**
* 创建者
*/
private String createdId;
/**
* 更新者
*/
private String updatedId;
/**
* 评议id
*/
private String reviewId;
/**
* 人员id
*/
private String userId;
/**
* 内容
*/
private String content;
private String userName;
}

View File

@ -18,6 +18,8 @@ public class ReviewWorkDto extends ReviewWork {
List<ReviewWorkAttachment> checkAttachment1List;
@ApiModelProperty(value = "会议方案")
List<ReviewWorkAttachment> checkAttachment2List;
@ApiModelProperty(value = "调查问卷")
List<ReviewWorkAttachment> askAttachmentList;
@ApiModelProperty(value = "评议意见附件")
List<ReviewWorkAttachment> opinionAttachmentList;
@ApiModelProperty(value = "整改结果附件")

View File

@ -0,0 +1,13 @@
package com.ydool.boot.modules.rddb.entity.request.review_work;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ReviewWorkMessageRequest {
@ApiModelProperty(value = "评议id", required = true)
private String reviewId;
@ApiModelProperty(value = "内容", required = true)
private String content;
}

View File

@ -0,0 +1,16 @@
package com.ydool.boot.modules.rddb.entity.request.review_work.state;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class ReviewWorkAskStateRequest {
@ApiModelProperty(value = "评议id", required = true)
private String id;
@ApiModelProperty(value = "调查问卷")
private List<CheckAttachment> attachment;
}

View File

@ -20,7 +20,7 @@ public class MyGenerator {
public static void main(String[] args) {
//表名
String tableName = "t_conference_attachment_vote";
String tableName = "t_review_work_message";
//表前缀
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("123456");
dsc.setPassword("Wang09211108");
dsc.setDbType(DbType.MYSQL);
mpg.setDataSource(dsc);

View File

@ -0,0 +1,16 @@
package com.ydool.boot.modules.rddb.mapper;
import com.ydool.boot.modules.rddb.entity.ReviewWorkMessage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 评议意见汇总 Mapper 接口
* </p>
*
* @author zhouyuan
* @since 2022-10-08
*/
public interface ReviewWorkMessageMapper extends BaseMapper<ReviewWorkMessage> {
}

View File

@ -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.ReviewWorkMessageMapper">
</mapper>

View File

@ -0,0 +1,20 @@
package com.ydool.boot.modules.rddb.service;
import com.ydool.boot.modules.rddb.entity.ReviewWorkMessage;
import com.ydool.boot.modules.rddb.mapper.ReviewWorkMessageMapper;
import com.ydool.boot.modules.rddb.service.inter.IReviewWorkMessageService;
import com.ydool.boot.core.service.BaseService;
import org.springframework.stereotype.Service;
/**
* <p>
* 评议意见汇总 服务实现类
* </p>
*
* @author zhouyuan
* @since 2022-10-08
*/
@Service
public class ReviewWorkMessageService extends BaseService<ReviewWorkMessageMapper, ReviewWorkMessage> implements IReviewWorkMessageService {
}

View File

@ -18,6 +18,7 @@ import com.ydool.boot.modules.rddb.entity.bo.ReviewWorkBo;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkAuditRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkCheckRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkCommentRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.ReviewWorkMessageRequest;
import com.ydool.boot.modules.rddb.entity.request.review_work.state.*;
import com.ydool.boot.modules.rddb.mapper.ReviewWorkMapper;
import com.ydool.boot.modules.rddb.wrapper.ReviewWorkWrapper;
@ -50,6 +51,8 @@ public class ReviewWorkService extends BaseService<ReviewWorkMapper, ReviewWork>
ReviewWorkAuditService reviewWorkAuditService;
@Autowired
ReviewWorkUserService reviewWorkUserService;
@Autowired
ReviewWorkMessageService reviewWorkMessageService;
@Autowired
ConferenceAttachmentService conferenceAttachmentService;
@ -145,6 +148,22 @@ public class ReviewWorkService extends BaseService<ReviewWorkMapper, ReviewWork>
return !flag ? Ret.fail("操作失败") : Ret.ok().data(ReviewWorkWrapper.build().entityVO(reviewWork));
}
public Ret message(ReviewWorkMessageRequest reviewWorkMessageRequest, User loginUser) {
ReviewWork reviewWork = getById(reviewWorkMessageRequest.getReviewId());
Assert.notNull(reviewWork, "未找到该记录");
if (ReviewWork.STATE_ASK != reviewWork.getState())
throw new ResultException(Ret.fail("当前环节不能提意见"));
ReviewWorkMessage reviewWorkMessage = BeanUtil.copyProperties(reviewWorkMessageRequest,
ReviewWorkMessage.class);
reviewWorkMessage.setCreatedId(loginUser.getId());
reviewWorkMessage.setUserId(loginUser.getId());
reviewWorkMessage.setUserName(loginUser.getUserName());
boolean flag = reviewWorkMessageService.saveOrUpdate(reviewWorkMessage);
return !flag ? Ret.fail("操作失败") : Ret.ok().data(ReviewWorkWrapper.build().entityVO(reviewWork));
}
@Transactional
public ReviewWork stateInReportSave(ReviewWorkInReportStateRequest reviewWorkInReportStateRequest, User loginUser) {
ReviewWork reviewWork = BeanUtil.copyProperties(reviewWorkInReportStateRequest, ReviewWork.class);
@ -238,6 +257,29 @@ public class ReviewWorkService extends BaseService<ReviewWorkMapper, ReviewWork>
return reviewWork;
}
@Transactional
public ReviewWork stateAskSave(ReviewWorkAskStateRequest reviewWorkAskStateRequest, User loginUser) {
ReviewWork reviewWork = getById(reviewWorkAskStateRequest.getId());
Assert.notNull(reviewWork, "未找到该记录");
if (ReviewWork.STATE_ASK != reviewWork.getState())
throw new ResultException(Ret.fail("当前环节不能提交该信息"));
BeanUtil.copyProperties(reviewWorkAskStateRequest, reviewWork);
saveOrUpdate(reviewWork);
// saveReviewWorkCheck(reviewWork, workCheckRequest, loginUser);
List<CheckAttachment> attachment = reviewWorkAskStateRequest.getAttachment();
if (CollectionUtil.isNotEmpty(attachment)){
saveReviewWorkAttachment(reviewWork.getId(),
attachment.stream().map(CheckAttachment::getCheckAttachmentName).collect(Collectors.toList()).toString(),
attachment.stream().map(CheckAttachment::getCheckAttachmentPath).collect(Collectors.toList()).toString(), loginUser, ReviewWork.STATE_ASK,
attachment.stream().map(CheckAttachment::getCheckAttachmentConferenceId).collect(Collectors.toList()).toString(),
attachment.stream().map(CheckAttachment::getCheckAttachmentConferenceName).collect(Collectors.toList()).toString());
}
return reviewWork;
}
@Transactional
public ReviewWork stateReport(ReviewWorkReportStateRequest reviewWorkReportStateRequest, User loginUser) {
ReviewWork reviewWork = getById(reviewWorkReportStateRequest.getId());
@ -348,6 +390,7 @@ public class ReviewWorkService extends BaseService<ReviewWorkMapper, ReviewWork>
}
public Ret check(ReviewWorkCheckRequest reviewWorkCheckRequest, User loginUser) {
ReviewWork reviewWork = getById(reviewWorkCheckRequest.getReviewId());
Assert.notNull(reviewWork, "未找到该记录");
@ -383,6 +426,17 @@ public class ReviewWorkService extends BaseService<ReviewWorkMapper, ReviewWork>
return !flag ? Ret.fail("操作失败") : Ret.ok().data(ReviewWorkWrapper.build().entityVO(reviewWork));
}
public Ret askEnd(String id, User loginUser) {
ReviewWork reviewWork = getById(id);
Assert.notNull(reviewWork, "未找到该记录");
if (ReviewWork.STATE_ASK != reviewWork.getState())
throw new ResultException(Ret.fail("当前环节不能提交该信息"));
if (!loginUser.getId().equals(reviewWork.getCreatedId())) return Ret.fail("您不是创建人,不能操作");
reviewWork.setState(ReviewWork.STATE_OPINION);
boolean flag = saveOrUpdate(reviewWork);
return !flag ? Ret.fail("操作失败") : Ret.ok().data(ReviewWorkWrapper.build().entityVO(reviewWork));
}
public ReviewWork stateOpinionSave(ReviewWorkOpinionStateRequest reviewWorkOpinionStateRequest, User loginUser) {
ReviewWork reviewWork = getById(reviewWorkOpinionStateRequest.getReviewId());
Assert.notNull(reviewWork, "未找到该记录");
@ -617,7 +671,8 @@ public class ReviewWorkService extends BaseService<ReviewWorkMapper, ReviewWork>
, String conferenceName,String classify) {
reviewWorkAttachmentService.remove(new LambdaQueryWrapper<ReviewWorkAttachment>()
.eq(ReviewWorkAttachment::getReviewId, reviewId)
.eq(ReviewWorkAttachment::getType, state));
.eq(ReviewWorkAttachment::getType, state)
.eq(ReviewWorkAttachment::getClassify,classify));
if (StrUtil.isNotBlank(attachmentName)) {
String[] nameArr = attachmentName.split(",");
String[] pathArr = attachmentPath.split(",");

View File

@ -0,0 +1,16 @@
package com.ydool.boot.modules.rddb.service.inter;
import com.ydool.boot.modules.rddb.entity.ReviewWorkMessage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 评议意见汇总 服务类
* </p>
*
* @author zhouyuan
* @since 2022-10-08
*/
public interface IReviewWorkMessageService extends IService<ReviewWorkMessage> {
}

View File

@ -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-10-08
*/
@Controller
@RequestMapping("/rddb/reviewWorkMessage")
public class ReviewWorkMessageController extends BaseController {
}

View File

@ -152,6 +152,26 @@ public class ReviewWorkWrapper extends BaseWrapper<ReviewWork, ReviewWorkDto> {
}
List<ReviewWorkAttachment> askAttachmentList = reviewWorkAttachmentService.list(new
LambdaQueryWrapper<ReviewWorkAttachment>()
.eq(ReviewWorkAttachment::getReviewId, reviewWork.getId())
.eq(ReviewWorkAttachment::getType, ReviewWork.STATE_ASK)
.orderByDesc(ReviewWorkAttachment::getCreatedAt));
//获取关联会议名称
if (CollectionUtil.isNotEmpty(askAttachmentList)) {
askAttachmentList.stream().forEach(i -> {
if (StrUtil.isNotBlank(i.getConferenceId())) {
Conference conference = conferenceMapper.selectById(i.getConferenceId());
String conferenceName = "";
if (conference != null) {
conferenceName = conference.getTitle();
}
i.setConferenceName(conferenceName);
}
});
}
List<ReviewWorkAttachment> reportAttachmentList =
reviewWorkAttachmentService.list(new LambdaQueryWrapper<ReviewWorkAttachment>()
.eq(ReviewWorkAttachment::getReviewId, reviewWork.getId())
@ -223,6 +243,7 @@ public class ReviewWorkWrapper extends BaseWrapper<ReviewWork, ReviewWorkDto> {
ReviewWorkDto.setInReportAttachmentList(inReportAttachmentList);
ReviewWorkDto.setCheckAttachment1List(checkAttachment1List);
ReviewWorkDto.setCheckAttachment2List(checkAttachment2List);
ReviewWorkDto.setAskAttachmentList(askAttachmentList);
// ReviewWorkDto.setCheckAttachmentList(reviewWorkCheckDtos);
ReviewWorkDto.setOpinionAttachmentList(opinionAttachmentList);
ReviewWorkDto.setResultAttachmentList(resultAttachmentList);