Commit 1d1b8ff2 authored by wdy's avatar wdy

科恩根据章节查询用例列表&用户管理查看详情&编辑标准

parent 15907749
......@@ -3,6 +3,7 @@ package com.ruoyi.service;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.domain.TestUseCase;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.domain.vo.UseCaseUrlVO;
import com.ruoyi.web.request.TestUseCaseByScenarioRequest;
import com.ruoyi.web.request.TestUseCaseIdListRequest;
import com.ruoyi.web.request.TestUserCaseRequest;
......@@ -64,4 +65,12 @@ public interface TestUseCaseService extends IService<TestUseCase> {
* @throws IOException
*/
UseCaseResponse getUseCaseMsg(String request) throws IOException;
/**
* 科恩根据章节查询用例列表
* @param request
* @return
* @throws IOException
*/
List<UseCaseUrlVO> getUseCaseByChapter(String request) throws IOException;
}
......@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.response.StandardResponse;
import java.util.ArrayList;
import java.util.List;
@Service
......@@ -65,11 +66,18 @@ public class StandardServiceImpl extends ServiceImpl<StandardMapper, Standard> i
standardInspectionItemRelationMapper.deleteBatchIds(list);
}
List<StandardInspectionItemRelation> relations = request.getDictList();
List<DictDataVO> relations = request.getDictList();
List<StandardInspectionItemRelation> relationList = new ArrayList<>();
if (relations != null && relations.size() != 0) {
standardInspectionItemRelationService.saveBatch(relations);
for (DictDataVO vo : relations) {
StandardInspectionItemRelation relation = new StandardInspectionItemRelation();
relation.setStandardId(request.getId());
relation.setDictCode(vo.getDictCode());
relationList.add(relation);
}
standardInspectionItemRelationService.saveBatch(relationList);
}
standardService.updateById(standard);
}
......
......@@ -108,7 +108,7 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
MediaType mediaType = MediaType.parse("application/json");
// 创建请求体
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"query useCases($offset:OffsetConnectionInput$orderBy:OrderByInput$filter:Map$search:String){useCases(offset:$offset orderBy:$orderBy filterFields:$filter search:$search){nodes{id displayID class name description remediation requirements riskLevel method{name}scenario{name}}totalCount}}\",\"variables\":"+ request +"}");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"query useCases($offset:OffsetConnectionInput$orderBy:OrderByInput$filter:Map$search:String$searchFields:Map){useCases(offset:$offset orderBy:$orderBy filterFields:$filter search:$search searchFields:$searchFields){nodes{id displayID class name description remediation requirements riskLevel method{name}scenario{name}}totalCount}}\",\"variables\":"+ request +"}");
Request requestKE = new Request.Builder()
.url("http://10.12.48.80:8089/api/query")
......@@ -185,6 +185,45 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
return caseResponse;
}
/**
* 科恩根据章节查询用例列表
* @param request
* @return
* @throws IOException
*/
@Override
public List<UseCaseUrlVO> getUseCaseByChapter(String request) throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"query\":\"query regulationItemDetail($regulationItemID:ID!){node(id:$regulationItemID){...on RegulationItem{id serialNumber testMethod requirements useCases{id displayID name description scenario{name}method{name}}}}}\",\"variables\":"+request+"}");
Request requestKE = new Request.Builder()
.url("http://10.12.48.80:8089/api/query")
.method("POST", body)
.addHeader("Content-Type", "application/json")
// TODO 连接
// .addHeader("Host", "10.12.48.80:8089")
// .addHeader("Origin", "http://10.12.48.80:8089")
// .addHeader("Referer", "http://10.12.48.80:8089/api/graphql/playground")
// .addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36")
.build();
Response response = client.newCall(requestKE).execute();
String string = response.body().string();
JSONObject jsonObject = JSONObject.parseObject(string);
// 获取测试用例
List<UseCaseUrlVO> list = new ArrayList<>();
if (jsonObject.getJSONObject("data").getJSONObject("node") != null) {
list = jsonObject.getJSONObject("data").getJSONObject("node").getList("useCases", UseCaseUrlVO.class);
}
return list;
}
}
......
......@@ -3,6 +3,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.TestUseCase;
import com.ruoyi.domain.vo.UseCaseUrlVO;
import com.ruoyi.service.TestUseCaseService;
import com.ruoyi.web.request.TestUseCaseByScenarioRequest;
import com.ruoyi.web.request.TestUseCaseIdListRequest;
......@@ -94,4 +95,21 @@ public class TestUserCaseController extends BaseController{
}
/**
* 科恩根据章节查询用例列表
* @param request
* @return
* @throws IOException
*/
@ApiOperation("科恩根据章节查询用例列表")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getUseCaseByChapter", produces="application/json;charset=UTF-8")
public TableDataInfo<UseCaseUrlVO> getUseCaseByChapter(@Validated @RequestBody String request) throws IOException {
List<UseCaseUrlVO> list = testUseCaseService.getUseCaseByChapter(request);
return getDataTable(list);
}
}
......@@ -2,6 +2,7 @@ package com.ruoyi.web.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.domain.StandardInspectionItemRelation;
import com.ruoyi.domain.vo.DictDataVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -39,5 +40,5 @@ public class StandardEditRequest {
private Date implementationDate;
@ApiModelProperty("检验项id")
List<StandardInspectionItemRelation> dictList;
List<DictDataVO> dictList;
}
......@@ -6,6 +6,9 @@ import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.entity.SysUserSignaturePicture;
import com.ruoyi.system.mapper.SysUserSignaturePictureMapper;
import com.ruoyi.system.service.*;
import com.ruoyi.web.request.UserByRoleRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -36,10 +39,6 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
/**
* 用户信息
......@@ -63,6 +62,12 @@ public class SysUserController extends BaseController
@Autowired
private ISysPostService postService;
@Autowired
private SysUserSignaturePictureService sysUserSignaturePictureService;
@Autowired
private SysUserSignaturePictureMapper sysUserSignaturePictureMapper;
/**
* 获取用户列表
*/
......@@ -149,6 +154,8 @@ public class SysUserController extends BaseController
if (StringUtils.isNotNull(userId))
{
SysUser sysUser = userService.selectUserById(userId);
SysUserSignaturePicture picture = sysUserSignaturePictureService.getById(userId);
sysUser.setSignaturePicture(picture.getSignaturePicture());
ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
......
......@@ -169,6 +169,10 @@
<artifactId>itext-asian</artifactId>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>
......@@ -3,6 +3,7 @@ package com.ruoyi.common.core.domain.entity;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.*;
import com.baomidou.mybatisplus.annotation.TableField;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
......@@ -89,6 +90,9 @@ public class SysUser extends BaseEntity
/** 角色ID */
private Long roleId;
@TableField(exist = false)
private String signaturePicture;
public SysUser()
{
......@@ -297,6 +301,14 @@ public class SysUser extends BaseEntity
this.roleId = roleId;
}
public String getSignaturePicture() {
return signaturePicture;
}
public void setSignaturePicture(String signaturePicture) {
this.signaturePicture = signaturePicture;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......@@ -319,6 +331,7 @@ public class SysUser extends BaseEntity
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("dept", getDept())
.append("signaturePicture", getSignaturePicture())
.toString();
}
}
package com.ruoyi.common.core.domain.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("用户签字图片")
@TableName(value ="sys_user_signature_picture")
public class SysUserSignaturePicture {
/** 用户ID */
@ApiModelProperty("用户ID")
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long userId;
@ApiModelProperty("签字图片")
private String signaturePicture;
}
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.entity.SysUserSignaturePicture;
import org.springframework.stereotype.Repository;
@Repository
public interface SysUserSignaturePictureMapper extends BaseMapper<SysUserSignaturePicture> {
}
package com.ruoyi.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.entity.SysUserSignaturePicture;
public interface SysUserSignaturePictureService extends IService<SysUserSignaturePicture> {
}
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.SysUserSignaturePicture;
import com.ruoyi.system.mapper.SysUserSignaturePictureMapper;
import com.ruoyi.system.service.SysUserSignaturePictureService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class SysUserSignaturePictureServiceImpl extends ServiceImpl<SysUserSignaturePictureMapper, SysUserSignaturePicture> implements SysUserSignaturePictureService {
}
<?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.ruoyi.system.mapper.SysUserSignaturePictureMapper">
<resultMap id="BaseResultMap" type="SysUserSignaturePicture">
<id property="userId" column="user_id" jdbcType="BIGINT"/>
<result property="signaturePicture" column="signature_picture" jdbcType="VARCHAR"/>
</resultMap>
</mapper>
\ No newline at end of file
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