Commit bcc1a652 authored by W_Y's avatar W_Y

填写检查问卷的保存更新

parent 3a0e7ec7
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -54,4 +55,22 @@ public class ReviewDetailsResult implements Serializable {
@ApiModelProperty("关联的任务id")
private Long taskId;
/**
* 审核人id
*/
@ApiModelProperty("审核人id")
private Long userId;
/**
* 审核人姓名
*/
@ApiModelProperty("审核人姓名")
private String userName;
/**
* 最后修改时间
*/
@ApiModelProperty("最后修改时间")
private Date lastModifyTime;
}
......@@ -17,6 +17,8 @@ import java.util.List;
public interface ReviewDetailsResultMapper extends BaseMapper<ReviewDetailsResult> {
List<ReviewDetailsResult> findByTaskId(@Param("taskId") Long taskId);
ReviewDetailsResult findByTaskIdAndDetailsId(@Param("taskId") Long taskId,@Param("reviewDetailsId") Long reviewDetailsId);
}
......
......@@ -2,6 +2,7 @@ package com.ruoyi.service;
import com.ruoyi.domain.ReviewDetailsResult;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.web.request.ReviewDetailsResultSaveRequest;
import java.util.List;
......@@ -14,4 +15,8 @@ public interface ReviewDetailsResultService extends IService<ReviewDetailsResult
List<ReviewDetailsResult> findByTaskId(Long taskId);
ReviewDetailsResult findByTaskIdAndDetailsId(Long taskId, Long reviewDetailsId);
void save(ReviewDetailsResultSaveRequest request);
}
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.domain.ReviewDetailsResult;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.mapper.ReviewDetailsResultMapper;
import com.ruoyi.web.request.ReviewDetailsResultSaveRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
......@@ -26,6 +30,39 @@ public class ReviewDetailsResultServiceImpl extends ServiceImpl<ReviewDetailsRes
public List<ReviewDetailsResult> findByTaskId(Long taskId) {
return reviewDetailsResultMapper.findByTaskId(taskId);
}
@Override
public ReviewDetailsResult findByTaskIdAndDetailsId(Long taskId, Long reviewDetailsId) {
return reviewDetailsResultMapper.findByTaskIdAndDetailsId(taskId, reviewDetailsId);
}
@Override
public void save(ReviewDetailsResultSaveRequest request) {
ReviewDetailsResult result = reviewDetailsResultMapper.findByTaskIdAndDetailsId(request.getTaskId(), request.getReviewDetailsId());
// 获取当前登陆人
SysUser loginUser = SecurityUtils.getLoginUser().getUser();
if (result != null) {
// 更新
result.setPassed(request.getPassed());
result.setUserId(loginUser.getUserId());
result.setUserName(loginUser.getNickName());
result.setLastModifyTime(new Date());
this.baseMapper.updateById(result);
} else {
// 新增
ReviewDetailsResult reviewDetailsResult = new ReviewDetailsResult();
reviewDetailsResult.setTaskId(request.getTaskId());
reviewDetailsResult.setReviewDetailsId(request.getReviewDetailsId());
reviewDetailsResult.setPassed(request.getPassed());
reviewDetailsResult.setUserId(loginUser.getUserId());
reviewDetailsResult.setUserName(loginUser.getNickName());
reviewDetailsResult.setLastModifyTime(new Date());
this.baseMapper.insert(reviewDetailsResult);
}
}
}
......
package com.ruoyi.web;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.service.ReviewDetailsResultService;
import com.ruoyi.web.request.ReviewDetailsResultSaveRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Api("审查细则的审查结果")
@RestController
@RequestMapping("/review/details/result")
public class ReviewDetailsResultController extends BaseController {
@Autowired
private ReviewDetailsResultService reviewDetailsResultService;
@ApiOperation("保存审查结果")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "保存审查结果", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/save")
public R<String> save(@Validated @RequestBody ReviewDetailsResultSaveRequest request) {
reviewDetailsResultService.save(request);
return R.ok();
}
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "ReviewDetailsResultSaveRequest", description = "保存审查细则的审查结果")
@Data
public class ReviewDetailsResultSaveRequest {
/**
* 关联到的细则id
*/
@ApiModelProperty("关联到的细则id")
private Long reviewDetailsId;
/**
* 关联的任务id
*/
@ApiModelProperty("关联的任务id")
private Long taskId;
/**
* 审核是否通过(0未通过、1通过)
*/
@ApiModelProperty("审核是否通过(0未通过、1通过)")
private Integer passed;
}
......@@ -21,4 +21,10 @@
<select id="findByTaskId" resultType="com.ruoyi.domain.ReviewDetailsResult">
SELECT id, passed, comment, images_url, review_details_id, task_id 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
FROM t_review_details_result
WHERE task_id = #{taskId} and review_details_id = #{reviewDetailsId}
</select>
</mapper>
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