ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaTestItemController.java
@@ -1,9 +1,28 @@ package com.ruoyi.web.controller.api; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.dto.TQaTestItemDTO; import com.ruoyi.system.model.TQaTestItem; import com.ruoyi.system.model.TQaTestItemReport; import com.ruoyi.system.query.TQaTestItemQuery; import com.ruoyi.system.service.TQaTestItemReportService; import com.ruoyi.system.service.TQaTestItemService; import com.ruoyi.system.vo.TQaTestItemReportVO; import com.ruoyi.system.vo.TQaTestItemVO; import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.ApiOperation; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; /** * <p> @@ -18,5 +37,107 @@ @RequestMapping("/t-qa-test-item") public class TQaTestItemController { private final TQaTestItemService qaTestItemService; private final TQaTestItemReportService qaTestItemReportService; @Autowired public TQaTestItemController(TQaTestItemService qaTestItemService, TQaTestItemReportService qaTestItemReportService) { this.qaTestItemService = qaTestItemService; this.qaTestItemReportService = qaTestItemReportService; } /** * 获取QA检测项管理管理列表 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:list')") @ApiOperation(value = "获取QA检测项管理分页列表") @PostMapping(value = "/api/t-qa-test-item/pageList") public R<PageInfo<TQaTestItemVO>> pageList(@RequestBody String param) { TQaTestItemQuery query = JSON.parseObject(param, TQaTestItemQuery.class); return R.ok(qaTestItemService.pageList(query)); } /** * 添加QA检测项管理管理 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:add')") @Log(title = "QA检测项管理信息-新增QA检测项管理", businessType = BusinessType.INSERT) @ApiOperation(value = "添加QA检测项管理",response = TQaTestItemDTO.class) @PostMapping(value = "/api/t-qa-test-item/add") public R<Boolean> add(@RequestBody String param) { TQaTestItemDTO dto = JSON.parseObject(param,TQaTestItemDTO.class); qaTestItemService.save(dto); return R.ok(); } /** * 修改QA检测项管理 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:edit')") @Log(title = "QA检测项管理信息-修改QA检测项管理", businessType = BusinessType.UPDATE) @ApiOperation(value = "修改QA检测项管理") @PostMapping(value = "/api/t-qa-test-item/update") public R<Boolean> update(@RequestBody String param) { TQaTestItemDTO dto = JSON.parseObject(param,TQaTestItemDTO.class); qaTestItemService.updateById(dto); return R.ok(); } /** * 查看QA检测项管理详情 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:detail')") @ApiOperation(value = "查看QA检测项管理详情") @GetMapping(value = "/open/t-qa-test-item/getDetailById") public R<TQaTestItemVO> getDetailById(@RequestParam String id) { TQaTestItem projectTeam = qaTestItemService.getById(id); TQaTestItemVO projectTeamVO = new TQaTestItemVO(); BeanUtils.copyProperties(projectTeam, projectTeamVO); // 查询QA检测项检测报告 List<TQaTestItemReportVO> qaTestItemReportVOS= qaTestItemReportService.getList(id); projectTeamVO.setQaTestItemReportList(qaTestItemReportVOS); return R.ok(projectTeamVO); } /** * 删除QA检测项管理 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:delete')") @Log(title = "QA检测项管理信息-删除QA检测项管理", businessType = BusinessType.DELETE) @ApiOperation(value = "删除QA检测项管理") @DeleteMapping(value = "/open/t-qa-test-item/deleteById") public R<Boolean> deleteById(@RequestParam String id) { // 删除QA检测项管理成员 qaTestItemReportService.remove(Wrappers.lambdaQuery(TQaTestItemReport.class).eq(TQaTestItemReport::getItemId, id)); return R.ok(qaTestItemService.removeById(id)); } /** * 批量删除QA检测项管理 */ @PreAuthorize("@ss.hasPermi('system:qaTestItem:delete')") @Log(title = "QA检测项管理信息-删除QA检测项管理", businessType = BusinessType.DELETE) @ApiOperation(value = "批量删除QA检测项管理") @DeleteMapping(value = "/open/t-qa-test-item/deleteByIds") public R<Boolean> deleteByIds(@RequestBody List<String> ids) { // 删除QA检测项检测报告 qaTestItemReportService.remove(Wrappers.lambdaQuery(TQaTestItemReport.class).in(TQaTestItemReport::getItemId, ids)); return R.ok(qaTestItemService.removeByIds(ids)); } /** * 修改QA检测项管理 */ // @PreAuthorize("@ss.hasPermi('system:qaTestItem:upAndDown')") // @Log(title = "QA检测项管理信息-提交评价QA检测项管理状态", businessType = BusinessType.UPDATE) // @ApiOperation(value = "修改QA检测项管理状态",response = UpAndDownDTO.class) // @PostMapping(value = "/api/t-qa-test-item/upAndDown") // public R<Boolean> upAndDown(@RequestBody String param) { // UpAndDownDTO dto = JSON.parseObject(param,UpAndDownDTO.class); // TQaTestItem projectTeam = qaTestItemService.getById(dto.getId()); // projectTeam.setStatus(dto.getStatus()); // qaTestItemService.updateById(projectTeam); // return R.ok(); // } } ruoyi-common/src/main/java/com/ruoyi/common/enums/QaReportFileEnum.java
New file @@ -0,0 +1,46 @@ package com.ruoyi.common.enums; import lombok.Getter; /** * @author xiaochen * @ClassName Disable * @Description * @date 2022-06-08 16:55 */ public enum QaReportFileEnum { /*报告类型 1=检测报告 2=中试生产验证 3=原辅料报告 4=产品报批报告*/ TEST_REPORT(1, "检测报告"), PILOT_PRODUCTION_VALIDATION(2, "中试生产验证"), RAW_MATERIAL_REPORT(3, "原辅料报告"), PRODUCT_APPROVAL_REPORT(4, "产品报批报告"); @Getter private String desc; @Getter private int code; QaReportFileEnum(int code, String desc) { this.code = code; this.desc = desc; } /** * 通过code获取枚举 * * @param code * @return */ public static QaReportFileEnum fromCode(Integer code) { QaReportFileEnum[] resultTypes = QaReportFileEnum.values(); for (QaReportFileEnum resultType : resultTypes) { if (code.equals(resultType.getCode())) { return resultType; } } return null; } } ruoyi-system/src/main/java/com/ruoyi/system/dto/TQaTestItemDTO.java
New file @@ -0,0 +1,13 @@ package com.ruoyi.system.dto; import com.ruoyi.system.model.TQaTestItem; import io.swagger.annotations.ApiModel; import lombok.Data; @Data @ApiModel(value = "QA检测项新增编辑") public class TQaTestItemDTO extends TQaTestItem { } ruoyi-system/src/main/java/com/ruoyi/system/mapper/TQaTestItemMapper.java
@@ -1,7 +1,13 @@ package com.ruoyi.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.TQaTestItem; import com.ruoyi.system.query.TQaTestItemQuery; import com.ruoyi.system.vo.TQaTestItemVO; import org.apache.ibatis.annotations.Param; import java.util.List; /** * <p> @@ -13,4 +19,11 @@ */ public interface TQaTestItemMapper extends BaseMapper<TQaTestItem> { /** * 分页查询QA检测项 * @param query * @param pageInfo * @return */ List<TQaTestItemVO> pageList(@Param("query") TQaTestItemQuery query, @Param("pageInfo")PageInfo<TQaTestItemVO> pageInfo); } ruoyi-system/src/main/java/com/ruoyi/system/mapper/TQaTestItemReportMapper.java
@@ -2,6 +2,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.system.model.TQaTestItemReport; import com.ruoyi.system.vo.TQaTestItemReportVO; import org.apache.ibatis.annotations.Param; import java.util.List; /** * <p> @@ -13,4 +17,10 @@ */ public interface TQaTestItemReportMapper extends BaseMapper<TQaTestItemReport> { /** * 获取列表 * @param itemId * @return */ List<TQaTestItemReportVO> getList(@Param("itemId") String itemId); } ruoyi-system/src/main/java/com/ruoyi/system/query/TQaTestItemQuery.java
New file @@ -0,0 +1,23 @@ package com.ruoyi.system.query; import com.ruoyi.common.core.domain.BasePage; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data @ApiModel(value = "检测项查询分页query") public class TQaTestItemQuery extends BasePage { @ApiModelProperty(value = "检测项名称") private String itemName; @ApiModelProperty(value = "检测项编号") private String itemCode; @ApiModelProperty(value = "状态 -1=草稿箱 1=已提交 2=待评定 3=已评定") private Integer status; @ApiModelProperty(value = "组名称") private String teamName; } ruoyi-system/src/main/java/com/ruoyi/system/service/TQaTestItemReportService.java
@@ -2,6 +2,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.system.model.TQaTestItemReport; import com.ruoyi.system.vo.TQaTestItemReportVO; import java.util.List; /** * <p> @@ -13,4 +16,10 @@ */ public interface TQaTestItemReportService extends IService<TQaTestItemReport> { /** * 获取检测项报告列表 * @param itemId * @return */ List<TQaTestItemReportVO> getList(String itemId); } ruoyi-system/src/main/java/com/ruoyi/system/service/TQaTestItemService.java
@@ -1,7 +1,10 @@ package com.ruoyi.system.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.model.TQaTestItem; import com.ruoyi.system.query.TQaTestItemQuery; import com.ruoyi.system.vo.TQaTestItemVO; /** * <p> @@ -13,4 +16,10 @@ */ public interface TQaTestItemService extends IService<TQaTestItem> { /** * 分页查询QA检测项管理 * @param query * @return */ PageInfo<TQaTestItemVO> pageList(TQaTestItemQuery query); } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TQaTestItemReportServiceImpl.java
@@ -1,10 +1,20 @@ package com.ruoyi.system.service.impl; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.enums.QaReportFileEnum; import com.ruoyi.system.mapper.TQaReportFileMapper; import com.ruoyi.system.mapper.TQaTestItemReportMapper; import com.ruoyi.system.model.TQaReportFile; import com.ruoyi.system.model.TQaTestItemReport; import com.ruoyi.system.service.TQaTestItemReportService; import com.ruoyi.system.vo.TQaTestItemReportVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.List; import java.util.stream.Collectors; /** * <p> @@ -17,4 +27,23 @@ @Service public class TQaTestItemReportServiceImpl extends ServiceImpl<TQaTestItemReportMapper, TQaTestItemReport> implements TQaTestItemReportService { @Autowired private TQaReportFileMapper qaReportFileMapper; @Override public List<TQaTestItemReportVO> getList(String itemId) { List<TQaTestItemReportVO> list = this.baseMapper.getList(itemId); if(!CollectionUtils.isEmpty(list)){ List<String> ids = list.stream().map(TQaTestItemReportVO::getId).collect(Collectors.toList()); List<TQaReportFile> qaReportFileList = qaReportFileMapper.selectList(Wrappers.lambdaQuery(TQaReportFile.class) .in(TQaReportFile::getReportId, ids)); for (TQaTestItemReportVO tQaTestItemReportVO : list) { List<TQaReportFile> qaReportFiles = qaReportFileList.stream().filter(item -> item.getReportId().equals(tQaTestItemReportVO.getId()) && item.getReportType().equals(QaReportFileEnum.TEST_REPORT.getCode())) .collect(Collectors.toList()); tQaTestItemReportVO.setQaReportFileList(qaReportFiles); } } return list; } } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TQaTestItemServiceImpl.java
@@ -1,10 +1,16 @@ package com.ruoyi.system.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.basic.PageInfo; import com.ruoyi.system.mapper.TQaTestItemMapper; import com.ruoyi.system.model.TQaTestItem; import com.ruoyi.system.query.TQaTestItemQuery; import com.ruoyi.system.service.TQaTestItemService; import com.ruoyi.system.vo.TProjectProposalVO; import com.ruoyi.system.vo.TQaTestItemVO; import org.springframework.stereotype.Service; import java.util.List; /** * <p> @@ -17,4 +23,11 @@ @Service public class TQaTestItemServiceImpl extends ServiceImpl<TQaTestItemMapper, TQaTestItem> implements TQaTestItemService { @Override public PageInfo<TQaTestItemVO> pageList(TQaTestItemQuery query) { PageInfo<TQaTestItemVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); List<TQaTestItemVO> list = this.baseMapper.pageList(query,pageInfo); pageInfo.setRecords(list); return pageInfo; } } ruoyi-system/src/main/java/com/ruoyi/system/vo/TQaTestItemReportVO.java
New file @@ -0,0 +1,18 @@ package com.ruoyi.system.vo; import com.ruoyi.system.model.TQaReportFile; import com.ruoyi.system.model.TQaTestItemReport; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data @ApiModel(value = "检测项检测报告VO") public class TQaTestItemReportVO extends TQaTestItemReport { @ApiModelProperty(value = "检测报告文件") private List<TQaReportFile> qaReportFileList; } ruoyi-system/src/main/java/com/ruoyi/system/vo/TQaTestItemVO.java
New file @@ -0,0 +1,24 @@ package com.ruoyi.system.vo; import com.ruoyi.system.model.TProjectTeam; import com.ruoyi.system.model.TQaTestItem; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data @ApiModel(value = "QA检测项") public class TQaTestItemVO extends TQaTestItem { @ApiModelProperty(value = "项目组信息") private TProjectTeam projectTeam; @ApiModelProperty(value = "组名称") private String teamName; @ApiModelProperty(value = "检测报告列表") private List<TQaTestItemReportVO> qaTestItemReportList; } ruoyi-system/src/main/resources/mapper/system/TQaTestItemMapper.xml
@@ -24,5 +24,28 @@ <sql id="Base_Column_List"> id, team_id, item_name, item_code, remark, status, evaluate_person_id, evaluate_time, evaluate_score, create_time, update_time, create_by, update_by, disabled </sql> <select id="pageList" resultType="com.ruoyi.system.vo.TQaTestItemVO"> select tqti.id, tqti.team_id, tqti.item_name, tqti.item_code, tqti.remark, tqti.status, tqti.evaluate_person_id, tqti.evaluate_time, tqti.evaluate_score, tqti.create_time, tqti.update_time, tqti.create_by, tqti.update_by, tqti.disabled, tpt.team_name as teamName from t_qa_test_item tqti left join t_project_team tpt on tpt.id = tqti.team_id <where> <if test="query.teamName != null and query.teamName != ''"> and tpt.team_name like concat('%', #{query.teamName}, '%') </if> <if test="query.itemName != null and query.itemName != ''"> and tqti.item_name like concat('%', #{query.itemName}, '%') </if> <if test="query.itemCode != null and query.itemCode != ''"> and tqti.item_code like concat('%', #{query.itemCode}) </if> <if test="query.status != null"> and tqti.status = #{query.status} </if> AND tqti.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} </where> ORDER BY tqti.create_time DESC </select> </mapper> ruoyi-system/src/main/resources/mapper/system/TQaTestItemReportMapper.xml
@@ -25,5 +25,12 @@ <sql id="Base_Column_List"> id, item_id, report_content, develop_person, develop_date, report_text, audit_person_id, audit_time, audit_remark, status, create_time, update_time, create_by, update_by, disabled </sql> <select id="getList" resultType="com.ruoyi.system.vo.TQaTestItemReportVO"> select <include refid="Base_Column_List" /> from t_qa_test_item_report where item_id = #{itemId} order by create_time desc </select> </mapper>