Commit 1208e99e authored by 高滢's avatar 高滢

检测方案记录

parent f7b9c4e9
......@@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
......@@ -16,10 +16,11 @@ import lombok.Data;
*/
@TableName(value ="t_test_plan_record")
@Data
public class TTestPlanRecord implements Serializable {
public class TTestPlanRecord extends BaseEntity {
/**
* 主键
*/
@ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
......@@ -27,86 +28,72 @@ public class TTestPlanRecord implements Serializable {
/**
* 被检车企ID
*/
@TableField(value = "inspect_car_company_id")
private Long inspect_car_company_id;
@ApiModelProperty("被检车企ID")
private Long inspectCarCompanyId;
/**
* 车辆型号
* 被检车企名称
*/
@TableField(value = "car_model")
private String car_model;
@ApiModelProperty("被检车企名称")
private String inspectCarCompanyName;
/**
* 检测方案生成时间
* 车辆型号
*/
@TableField(value = "generation_time")
private Date generation_time;
@ApiModelProperty("车辆型号")
private String carModel;
/**
* 文件路径
*/
@TableField(value = "file_url")
private String file_url;
@ApiModelProperty("车辆型号")
private String fileUrl;
/**
* 测试结果
*/
@TableField(value = "test_result")
private String test_result;
@ApiModelProperty("测试结果")
private String testResult;
/**
* 创建人
*/
@TableField(value = "create_by")
private String create_by;
/**
* 创建时间
* 检测机构id
*/
@TableField(value = "create_time")
private Date create_time;
@ApiModelProperty("检测机构id")
private Long testOrganizationId;
/**
* 修改人
* 检测机构名称
*/
@TableField(value = "update_by")
private String update_by;
@ApiModelProperty("检测机构名称")
private String testOrganizationName;
/**
* 修改时间
* 关联的检验项目逗号分隔id
*/
@TableField(value = "update_time")
private Date update_time;
@ApiModelProperty("关联的检验项目逗号分隔id")
private String inspectionItem;
/**
* 备注
* 关联的用例编号逗号分隔id
*/
@TableField(value = "remark")
private String remark;
@ApiModelProperty("关联的用例编号")
private String useCaseNo;
/**
* 检测机构id
* 标准id
*/
@TableField(value = "test_organization_id")
private Long test_organization_id;
@ApiModelProperty("标准id")
private Long inspectionStandardId;
/**
* 关联的检验项目逗号分隔id
* 标准名称
*/
@TableField(value = "inspection_item")
private String inspection_item;
@ApiModelProperty("标准名称")
private String inspectionStandardName;
/**
* 关联的用例编号逗号分隔id
*/
@TableField(value = "use_case_no")
private Integer use_case_no;
/**
* 标准id
*/
@TableField(value = "inspection_standard_id")
private Long inspection_standard_id;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
......
package com.ruoyi.domain;
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 com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@ApiModel
@TableName(value ="t_test_plan_record")
@Data
public class TestPlanRecord extends BaseEntity {
@ApiModelProperty("主键")
@TableId(type = IdType.ASSIGN_ID)
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
@ApiModelProperty("被检车企")
private String inspectCarCompany;
@ApiModelProperty("被检车企id")
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long inspectCarCompanyId;
@ApiModelProperty("车辆型号")
private String carModel;
@ApiModelProperty("检测方案生成时间")
private Date generationTime;
@ApiModelProperty("检测机构")
private String testOrganization;
@ApiModelProperty("文件路径")
private String fileUrl;
@ApiModelProperty("测试结果")
private String testResult;
}
......@@ -2,6 +2,8 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.TTestPlanRecord;
import com.ruoyi.web.request.TestPlanRecordGetInfoRequest;
import org.springframework.stereotype.Repository;
/**
* @author W_YI
......@@ -9,8 +11,13 @@ import com.ruoyi.domain.TTestPlanRecord;
* @createDate 2024-08-30 10:19:06
* @Entity com.ruoyi.domain.TTestPlanRecord
*/
@Repository
public interface TTestPlanRecordMapper extends BaseMapper<TTestPlanRecord> {
public int insertTestPlanRecord(TTestPlanRecord tTestPlanRecord);
public TTestPlanRecord selectTestPlanRecordDetails(Long id);
}
......
......@@ -2,6 +2,7 @@ package com.ruoyi.service;
import com.ruoyi.domain.TTestPlanRecord;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.web.request.TestPlanRecordGetInfoRequest;
/**
* @author W_YI
......@@ -10,4 +11,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface TTestPlanRecordService extends IService<TTestPlanRecord> {
public int insertTestPlanRecord(TTestPlanRecord tTestPlanRecord);
public TTestPlanRecord selectTestPlanRecordDetails(Long id);
}
package com.ruoyi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.TTestPlanRecord;
import com.ruoyi.service.TTestPlanRecordService;
import com.ruoyi.mapper.TTestPlanRecordMapper;
import com.ruoyi.web.request.TestPlanRecordGetInfoRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* @author W_YI
* @description 针对表【t_test_plan_record】的数据库操作Service实现
......@@ -15,6 +20,21 @@ import org.springframework.stereotype.Service;
public class TTestPlanRecordServiceImpl extends ServiceImpl<TTestPlanRecordMapper, TTestPlanRecord>
implements TTestPlanRecordService{
@Autowired
private TTestPlanRecordMapper tTestPlanRecordMapper;
@Override
public int insertTestPlanRecord(TTestPlanRecord tTestPlanRecord){
tTestPlanRecord.setInspectCarCompanyId(SecurityUtils.getDeptId());
tTestPlanRecord.setCreateTime(new Date());
return tTestPlanRecordMapper.insertTestPlanRecord(tTestPlanRecord);
}
@Override
public TTestPlanRecord selectTestPlanRecordDetails(Long id){
return tTestPlanRecordMapper.selectTestPlanRecordDetails(id);
}
}
......
......@@ -33,14 +33,17 @@ public class TestObjectDataController {
List<TestObjectData> objectList = testObjectDataService.selectTestObjectDataList();
Map<String, List<TestObjectData>> groupedObject = objectList.stream() .sorted(Comparator.comparingInt(TestObjectData::getSort)).collect(Collectors.groupingBy(TestObjectData::getDescribe));
List list= new ArrayList<>();
final int[] sum = {0};
groupedObject.forEach((key,value)->{
Map map=new HashMap();
map.put("describe",value.get(0).getDescribe());
map.put("type",value.get(0).getType());
map.put("key", String.valueOf(sum[0]));
Map mapObj =new HashMap();
mapObj.put("options",value);
map.put("componentProps",mapObj);
list.add(map);
sum[0] = sum[0] +1;
});
return R.ok(list);
......
package com.ruoyi.web;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.ReviewStandard;
import com.ruoyi.domain.TTestPlanRecord;
import com.ruoyi.service.TTestPlanRecordService;
import com.ruoyi.service.impl.ReviewStandardServiceImpl;
import com.ruoyi.web.request.PlanDetailStandardRequest;
import com.ruoyi.web.request.TestPlanRecordGetInfoRequest;
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;
import java.util.List;
@Api(tags = "检测方案记录")
@RestController
@RequestMapping("/Plan/Record")
public class TestPlanRecordController {
@Autowired
private TTestPlanRecordService tTestPlanRecordService;
@Autowired
private ReviewStandardServiceImpl reviewStandardService;
@ApiOperation("新增检测方案")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@Log(title = "新增检测方案", businessType = BusinessType.INSERT)
@RequestMapping(method = RequestMethod.POST, value = "/add")
public R<Long> insertTestPlanRecord(@Validated @RequestBody TTestPlanRecord tTestPlanRecord){
tTestPlanRecordService.insertTestPlanRecord(tTestPlanRecord);
return R.ok(tTestPlanRecord.getId());
}
@ApiOperation("检测方案详情")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/details")
public R<TTestPlanRecord> selectTestPlanRecordDetails(@Validated @RequestBody TestPlanRecordGetInfoRequest testPlanRecordGetInfoRequest){
return R.ok(tTestPlanRecordService.selectTestPlanRecordDetails(testPlanRecordGetInfoRequest.getId()));
}
@ApiOperation("查询标准详情")
@Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/standard")
public R<List<ReviewStandard>> selectStandarDetails(@Validated @RequestBody PlanDetailStandardRequest planDetailStandardRequest){
List<ReviewStandard> tree = reviewStandardService.findTree(planDetailStandardRequest.getInspectionStandardId(), planDetailStandardRequest.getType());
return R.ok(tree);
}
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Gaoying
*/
@Data
@ApiModel
public class PlanDetailStandardRequest {
@ApiModelProperty("标准id")
private Long inspectionStandardId;
@ApiModelProperty("实验类型")
private String type;
}
package com.ruoyi.web.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel
public class TestPlanRecordGetInfoRequest {
@ApiModelProperty("ID")
private Long id;
}
......@@ -6,27 +6,58 @@
<resultMap id="BaseResultMap" type="com.ruoyi.domain.TTestPlanRecord">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="inspect_car_company_id" column="inspect_car_company_id" jdbcType="BIGINT"/>
<result property="car_model" column="car_model" jdbcType="VARCHAR"/>
<result property="generation_time" column="generation_time" jdbcType="TIMESTAMP"/>
<result property="file_url" column="file_url" jdbcType="VARCHAR"/>
<result property="test_result" column="test_result" jdbcType="VARCHAR"/>
<result property="create_by" column="create_by" jdbcType="VARCHAR"/>
<result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
<result property="update_by" column="update_by" jdbcType="VARCHAR"/>
<result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="test_organization_id" column="test_organization_id" jdbcType="BIGINT"/>
<result property="inspection_item" column="inspection_item" jdbcType="VARCHAR"/>
<result property="use_case_no" column="use_case_no" jdbcType="INTEGER"/>
<result property="inspection_standard_id" column="inspection_standard_id" jdbcType="BIGINT"/>
<result property="inspectCarCompanyId" column="inspect_car_company_id" jdbcType="BIGINT"/>
<result property="inspectCarCompanyName" column="enterprise_name" jdbcType="VARCHAR"/>
<result property="carModel" column="car_model" jdbcType="VARCHAR"/>
<result property="fileUrl" column="file_url" jdbcType="VARCHAR"/>
<result property="testResult" column="test_result" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="testOrganizationId" column="test_organization_id" jdbcType="BIGINT"/>
<result property="testOrganizationName" column="dept_name" jdbcType="VARCHAR"/>
<result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/>
<result property="useCaseNo" column="use_case_no" jdbcType="INTEGER"/>
<result property="inspectionStandardId" column="inspection_standard_id" jdbcType="BIGINT"/>
<result property="inspectionStandardId" column="name" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,inspect_car_company_id,car_model,
generation_time,file_url,test_result,
create_by,create_time,update_by,
update_time,remark,test_organization_id,
inspection_item,use_case_no,inspection_standard_id
<sql id="selectTestPlanRecordVo">
select pr.*,
ts.name,
tae.enterprise_name,
pr.dept_name
from t_test_plan_record pr
left join t_standard ts on ts.id = pr.inspection_standard_id
left join t_automobile_enterprise tae on tae.id = pr.inspect_car_company_id
left join sys_dept sd on sd.dept_id = pr.test_organization_id
</sql>
<insert id="insertTestPlanRecord" parameterType="com.ruoyi.domain.TTestPlanRecord" useGeneratedKeys="true" keyProperty="id">
insert into t_test_plan_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="carModel != null">car_model,</if>
<if test="fileUrl != null">fileUrl,</if>
<if test="testResult != null">test_result,</if>
<if test="createTime != null">create_time,</if>
<if test="testOrganizationId != null">test_organization_id,</if>
<if test="inspectionItem != null">inspection_item,</if>
<if test="useCaseNo != null">use_case_no,</if>
<if test="inspectionStandardId!= null">inspection_standard_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="carModel != null">#{carModel},</if>
<if test="fileUrl != null">#{fileUrl},</if>
<if test="testResult != null">#{testResult},</if>
<if test="createTime != null">#{createTime},</if>
<if test="testOrganizationId != null">#{testOrganizationId},</if>
<if test="inspectionItem != null">#{inspectionItem},</if>
<if test="useCaseNo != null">#{useCaseNo},</if>
<if test="inspectionStandardId!= null">#{inspectionStandardId},</if>
</trim>
</insert>
<select id="selectTestPlanRecordDetails" parameterType="Long" resultMap="BaseResultMap">
<include refid="selectTestPlanRecordVo"/>
where sm.id = #{id}
</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