Commit e5088777 authored by 盖献康's avatar 盖献康

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents 71c9df54 1e722089
......@@ -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;
}
\ No newline at end of file
/**
* 审核人id
*/
@ApiModelProperty("审核人id")
private Long userId;
/**
* 审核人姓名
*/
@ApiModelProperty("审核人姓名")
private String userName;
/**
* 最后修改时间
*/
@ApiModelProperty("最后修改时间")
private Date lastModifyTime;
}
......@@ -17,6 +17,10 @@ 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);
Long findNotPass(@Param("taskId") Long taskId);
}
......
......@@ -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);
}
......@@ -4,6 +4,7 @@ import com.ruoyi.domain.SystemReviewTask;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.request.SystemReviewTaskStartRequest;
import com.ruoyi.web.request.SystemReviewTaskSubmitRequest;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import java.util.List;
......@@ -46,4 +47,10 @@ public interface SystemReviewTaskService extends IService<SystemReviewTask> {
*/
List<SystemReviewTask> findListInProcess();
/**
* 提交审查问卷
* @param request
*/
void submit(SystemReviewTaskSubmitRequest 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);
}
}
}
......
......@@ -11,6 +11,7 @@ import com.ruoyi.service.*;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.web.request.SystemReviewTaskCreateRequest;
import com.ruoyi.web.request.SystemReviewTaskStartRequest;
import com.ruoyi.web.request.SystemReviewTaskSubmitRequest;
import com.ruoyi.web.response.SystemReviewTaskViewResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -111,6 +112,11 @@ public class SystemReviewTaskServiceImpl extends ServiceImpl<SystemReviewTaskMap
return systemReviewTaskMapper.findListInProcess();
}
@Override
public void submit(SystemReviewTaskSubmitRequest request) {
}
}
......
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;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "SystemReviewTaskSubmitRequest", description = "提交体系审查问卷")
@Data
public class SystemReviewTaskSubmitRequest {
@ApiModelProperty("任务id")
private Long taskId;
@ApiModelProperty("图片地址")
private String imagesUrl;
}
......@@ -21,4 +21,20 @@
<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>
<select id="findNotPass" resultType="long">
SELECT COUNT(*) sum FROM t_review_details_result
WHERE passed = 0 AND task_id = #{taskId}
</select>
<select id="findNoResult" resultType="long">
SELECT COUNT(*) sum FROM t_review_details_result
WHERE passed is null AND task_id = #{taskId}
</select>
</mapper>
package com.ruoyi;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.utils.SnowflakeUtil;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.service.ReviewStandardService;
import org.junit.jupiter.api.Test;
......@@ -26,10 +27,21 @@ public class ReviewStandardTest {
}
@Test
public void findTreeTest() {
public void findTreeTestSystem() {
List<ReviewStandard> tree = reviewStandardService.findTree(1L, ReviewStandard.TYPE_SYSTEM);
System.out.println(JSONUtil.toJsonPrettyStr(tree));
}
@Test
public void findTreeTestCar() {
List<ReviewStandard> tree = reviewStandardService.findTree(1L, ReviewStandard.TYPE_CAR);
System.out.println(JSONUtil.toJsonPrettyStr(tree));
}
@Test
public void generateId() {
for(int i=0; i<38; i++)
System.out.println(SnowflakeUtil.generate());
}
}
......@@ -26,6 +26,8 @@ public final class ServiceException extends RuntimeException
*/
private String detailMessage;
private Object data;
/**
* 空构造方法,避免反序列化问题
*/
......@@ -44,6 +46,13 @@ public final class ServiceException extends RuntimeException
this.code = code;
}
public ServiceException(String message, Integer code, Object data)
{
this.message = message;
this.code = code;
this.data = data;
}
public String getDetailMessage()
{
return detailMessage;
......@@ -71,4 +80,16 @@ public final class ServiceException extends RuntimeException
this.detailMessage = detailMessage;
return this;
}
public void setCode(Integer code) {
this.code = code;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
\ No newline at end of file
......@@ -58,7 +58,9 @@ public class GlobalExceptionHandler
{
log.error(e.getMessage(), e);
Integer code = e.getCode();
return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage());
Object data = e.getData();
return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage(), data == null ? null : data);
}
/**
......
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