Commit 74356169 authored by wdy's avatar wdy

填写问卷

parent 5fbc5eb3
......@@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveFileVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -85,11 +87,14 @@ public class ReviewDetailsResult implements Serializable {
@JsonFormat(shape = JsonFormat.Shape.STRING)
@ApiModelProperty("关联到车企留档文件")
private Long reviewEnterpriseArchiveId;
private String reviewEnterpriseArchiveId;
@TableField(exist = false)
@ApiModelProperty("文件名称")
private String fileName;
@TableField(exist = false)
@ApiModelProperty("文件列表")
List<ReviewEnterpriseArchiveFileVO> fileList;
}
package com.ruoyi.domain.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@ApiModel(value = "ReviewEnterpriseArchiveFileVO", description = "细则关联车企文件列表")
@Accessors(chain = true)
@Data
public class ReviewEnterpriseArchiveFileVO {
@ApiModelProperty("文件id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
@ApiModelProperty("文件名称")
private String fileName;
@ApiModelProperty("文件目录")
private String catalogue;
}
......@@ -3,7 +3,9 @@ package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.ReviewDetailsResult;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveFileVO;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.web.request.ReviewDetailsResultSaveRequest;
......@@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -48,8 +51,25 @@ public class ReviewDetailsResultServiceImpl extends ServiceImpl<ReviewDetailsRes
result.setUserId(loginUser.getUserId());
result.setUserName(loginUser.getNickName());
result.setLastModifyTime(new Date());
result.setCatalogue(request.getCatalogue());
result.setReviewEnterpriseArchiveId(request.getReviewEnterpriseArchiveId());
// 获取文件列表
List<ReviewEnterpriseArchiveFileVO> fileList = request.getFileList();
List<Long> idList = new ArrayList<>();
List<String> fileNameList = new ArrayList<>();
List<String> catalogueList = new ArrayList<>();
// 遍历fileList
for (ReviewEnterpriseArchiveFileVO fileVO : fileList) {
// 将字段逗号分隔后存入对应的集合中
idList.add(fileVO.getId());
fileNameList.add(fileVO.getFileName());
catalogueList.add(fileVO.getCatalogue());
}
result.setReviewEnterpriseArchiveId(StringUtils.join(idList, ","));
result.setFileName(StringUtils.join(fileNameList, ","));
result.setCatalogue(StringUtils.join(catalogueList, ","));
this.baseMapper.updateById(result);
} else {
......@@ -57,13 +77,30 @@ public class ReviewDetailsResultServiceImpl extends ServiceImpl<ReviewDetailsRes
ReviewDetailsResult reviewDetailsResult = new ReviewDetailsResult();
reviewDetailsResult.setTaskId(request.getTaskId());
reviewDetailsResult.setReviewDetailsId(request.getReviewDetailsId());
reviewDetailsResult.setReviewEnterpriseArchiveId(request.getReviewEnterpriseArchiveId());
reviewDetailsResult.setCatalogue(request.getCatalogue());
reviewDetailsResult.setPassed(request.getPassed());
reviewDetailsResult.setUserId(loginUser.getUserId());
reviewDetailsResult.setUserName(loginUser.getNickName());
reviewDetailsResult.setLastModifyTime(new Date());
// 获取文件列表
List<ReviewEnterpriseArchiveFileVO> fileList = request.getFileList();
List<Long> idList = new ArrayList<>();
List<String> fileNameList = new ArrayList<>();
List<String> catalogueList = new ArrayList<>();
// 遍历fileList
for (ReviewEnterpriseArchiveFileVO fileVO : fileList) {
// 将字段逗号分隔后存入对应的集合中
idList.add(fileVO.getId());
fileNameList.add(fileVO.getFileName());
catalogueList.add(fileVO.getCatalogue());
}
reviewDetailsResult.setReviewEnterpriseArchiveId(StringUtils.join(idList, ","));
reviewDetailsResult.setFileName(StringUtils.join(fileNameList, ","));
reviewDetailsResult.setCatalogue(StringUtils.join(catalogueList, ","));
this.baseMapper.insert(reviewDetailsResult);
}
}
......
......@@ -4,6 +4,7 @@ import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.domain.*;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveFileVO;
import com.ruoyi.mapper.*;
import com.ruoyi.service.*;
import com.ruoyi.web.response.CarReviewTaskViewResponse;
......@@ -181,8 +182,8 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
standard.setPassed(null);
}
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
reviewDetailsResult.setFileName(reviewEnterpriseArchive.getFileName());
reviewDetailsResult.setFileList(setFileList(reviewDetailsResult));
}
details.setResult(reviewDetailsResult);
}
......@@ -204,6 +205,36 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
}
// 设置文件列表
private List<ReviewEnterpriseArchiveFileVO> setFileList(ReviewDetailsResult reviewDetailsResult) {
// 拆分字段值,得到对应的数组
String[] idArray = reviewDetailsResult.getReviewEnterpriseArchiveId().split(",");
String[] catalogueArray = reviewDetailsResult.getCatalogue().split(",");
String[] fileNameArray = reviewDetailsResult.getFileName().split(",");
// 获取数组的最大长度
int maxLength = Math.max(Math.max(idArray.length, catalogueArray.length), fileNameArray.length);
// 创建列表,用于存储合成对象
List<ReviewEnterpriseArchiveFileVO> fileList = new ArrayList<>();
// 合成对象
for (int i = 0; i < maxLength; i++) {
Long id = (i < idArray.length && !idArray[i].isEmpty()) ? Long.parseLong(idArray[i]) : null;
String catalogue = (i < catalogueArray.length) ? catalogueArray[i] : null;
String fileName = (i < fileNameArray.length) ? fileNameArray[i] : null;
ReviewEnterpriseArchiveFileVO fileVO = new ReviewEnterpriseArchiveFileVO();
fileVO.setId(id);
fileVO.setCatalogue(catalogue);
fileVO.setFileName(fileName);
fileList.add(fileVO);
}
return fileList;
}
@Override
public void afterPropertiesSet() throws Exception {
......
......@@ -2,10 +2,9 @@ package com.ruoyi.service.impl;
import com.ruoyi.common.DataStatisticsUtils;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.*;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveFileVO;
import com.ruoyi.mapper.*;
import com.ruoyi.service.*;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
......@@ -16,7 +15,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -180,8 +178,8 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
standard.setPassed(null);
}
if(reviewDetailsResult != null && reviewDetailsResult.getReviewEnterpriseArchiveId() != null) {
ReviewEnterpriseArchive reviewEnterpriseArchive = reviewEnterpriseArchiveMapper.selectById(reviewDetailsResult.getReviewEnterpriseArchiveId());
reviewDetailsResult.setFileName(reviewEnterpriseArchive.getFileName());
reviewDetailsResult.setFileList(setFileList(reviewDetailsResult));
}
details.setResult(reviewDetailsResult);
}
......@@ -201,6 +199,36 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
systemReviewTaskMapper.updateById(systemReviewTask);
}
// 设置文件列表
private List<ReviewEnterpriseArchiveFileVO> setFileList(ReviewDetailsResult reviewDetailsResult) {
// 拆分字段值,得到对应的数组
String[] idArray = reviewDetailsResult.getReviewEnterpriseArchiveId().split(",");
String[] catalogueArray = reviewDetailsResult.getCatalogue().split(",");
String[] fileNameArray = reviewDetailsResult.getFileName().split(",");
// 获取数组的最大长度
int maxLength = Math.max(Math.max(idArray.length, catalogueArray.length), fileNameArray.length);
// 创建列表,用于存储合成对象
List<ReviewEnterpriseArchiveFileVO> fileList = new ArrayList<>();
// 合成对象
for (int i = 0; i < maxLength; i++) {
Long id = (i < idArray.length && !idArray[i].isEmpty()) ? Long.parseLong(idArray[i]) : null;
String catalogue = (i < catalogueArray.length) ? catalogueArray[i] : null;
String fileName = (i < fileNameArray.length) ? fileNameArray[i] : null;
ReviewEnterpriseArchiveFileVO fileVO = new ReviewEnterpriseArchiveFileVO();
fileVO.setId(id);
fileVO.setCatalogue(catalogue);
fileVO.setFileName(fileName);
fileList.add(fileVO);
}
return fileList;
}
@Override
public void afterPropertiesSet() throws Exception {
......
package com.ruoyi.web.request;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveFileVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel(value = "ReviewDetailsResultSaveRequest", description = "保存审查细则的审查结果")
@Data
public class ReviewDetailsResultSaveRequest {
......@@ -26,9 +29,9 @@ public class ReviewDetailsResultSaveRequest {
@ApiModelProperty("审核是否通过(0未通过、1通过)")
private Integer passed;
@ApiModelProperty("关联到车企留档文件")
private Long reviewEnterpriseArchiveId;
@ApiModelProperty("评论")
private String comment;
@ApiModelProperty("章节条目或范围")
private String catalogue;
@ApiModelProperty("关联文件列表")
List<ReviewEnterpriseArchiveFileVO> fileList;
}
......@@ -7,7 +7,7 @@
<resultMap id="BaseResultMap" type="com.ruoyi.domain.ReviewDetailsResult">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="passed" column="passed" jdbcType="TINYINT"/>
<result property="comment" column="comment" jdbcType="VARCHAR"/>
<result property="comment" column="comment" jdbcType="LONGVARCHAR"/>
<result property="imagesUrl" column="images_url" jdbcType="VARCHAR"/>
<result property="reviewDetailsId" column="review_details_id" jdbcType="BIGINT"/>
<result property="taskId" column="task_id" jdbcType="BIGINT"/>
......@@ -15,7 +15,8 @@
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="lastModifyTime" column="last_modify_time" jdbcType="TIMESTAMP"/>
<result property="catalogue" column="catalogue" jdbcType="VARCHAR"/>
<result property="reviewEnterpriseArchiveId" column="review_enterprise_archive_id" jdbcType="BIGINT"/>
<result property="reviewEnterpriseArchiveId" column="review_enterprise_archive_id" jdbcType="VARCHAR"/>
<result property="fileName" column="file_name" jdbcType="LONGVARCHAR"/>
</resultMap>
......@@ -25,11 +26,11 @@
task_id from t_review_details_result
</sql>
<select id="findByTaskId" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time, catalogue, review_enterprise_archive_id FROM t_review_details_result WHERE task_id = #{taskId}
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time, catalogue, review_enterprise_archive_id, file_name FROM t_review_details_result WHERE task_id = #{taskId}
</select>
<select id="findByTaskIdAndDetailsId" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time, catalogue, review_enterprise_archive_id
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time, catalogue, review_enterprise_archive_id, file_name
FROM t_review_details_result
WHERE task_id = #{taskId} and review_details_id = #{reviewDetailsId}
</select>
......@@ -39,7 +40,7 @@
WHERE passed = 0 AND task_id = #{taskId}
</select>
<select id="findByDetailsList" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT tr.id, tr.passed, tr.comment, tr.images_url, tr.review_details_id, tr.task_id, tr.user_id, tr.user_name, tr.last_modify_time, tr.catalogue, tr.review_enterprise_archive_id
SELECT tr.id, tr.passed, tr.comment, tr.images_url, tr.review_details_id, tr.task_id, tr.user_id, tr.user_name, tr.last_modify_time, tr.catalogue, tr.review_enterprise_archive_id, tr.file_name
FROM t_review_details_result tr
LEFT JOIN t_system_review_task ts ON ts.id = tr.task_id
LEFT JOIN t_car_review_task tc ON tc.id = tr.task_id
......@@ -50,7 +51,7 @@
</foreach>
</select>
<select id="findByDetailsId" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time, catalogue, review_enterprise_archive_id
SELECT id, passed, comment, images_url, review_details_id, task_id, user_id, user_name, last_modify_time, catalogue, review_enterprise_archive_id, file_name
FROM t_review_details_result WHERE review_details_id = #{detailsId}
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment