review
This commit is contained in:
@@ -1,28 +1,28 @@
|
|||||||
package org.jeecg.modules.database.controller;
|
package org.jeecg.modules.database.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.jeecg.common.api.vo.Result;
|
|
||||||
import org.jeecg.common.system.query.QueryGenerator;
|
|
||||||
import org.jeecg.modules.database.constant.ExperimentReviewProcessType;
|
|
||||||
import org.jeecg.modules.database.entity.*;
|
|
||||||
import org.jeecg.modules.database.service.*;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
import org.jeecg.common.system.base.controller.JeecgController;
|
||||||
|
import org.jeecg.common.system.query.QueryGenerator;
|
||||||
|
import org.jeecg.modules.database.constant.ExperimentReviewProcessType;
|
||||||
|
import org.jeecg.modules.database.dto.ExperimentReviewDTO;
|
||||||
|
import org.jeecg.modules.database.entity.*;
|
||||||
|
import org.jeecg.modules.database.service.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import java.util.Arrays;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import java.util.List;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 试验评定结果
|
* @Description: 试验评定结果
|
||||||
@@ -36,14 +36,14 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class ExperimentReviewController extends JeecgController<ExperimentReview, IExperimentReviewService> {
|
public class ExperimentReviewController extends JeecgController<ExperimentReview, IExperimentReviewService> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentReviewService experimentReviewResultService;
|
private IExperimentReviewService experimentReviewService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentService experimentService;
|
private IExperimentService experimentService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentSampleInfoService experimentSampleInfoService;
|
private IExperimentSampleInfoService experimentSampleInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 试验评定列表
|
||||||
*
|
*
|
||||||
* @param experimentReviewResult
|
* @param experimentReviewResult
|
||||||
* @param pageNo
|
* @param pageNo
|
||||||
@@ -52,15 +52,19 @@ public class ExperimentReviewController extends JeecgController<ExperimentReview
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
//@AutoLog(value = "试验评定结果-分页列表查询")
|
//@AutoLog(value = "试验评定结果-分页列表查询")
|
||||||
@Operation(summary = "试验评定结果-分页列表查询")
|
@Operation(summary = "试验评定列表-分页列表查询")
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
public Result<IPage<ExperimentReview>> queryPageList(ExperimentReview experimentReviewResult,
|
public Result<IPage<Experiment>> queryPageList(Experiment experiment,
|
||||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
HttpServletRequest req) {
|
HttpServletRequest req) {
|
||||||
QueryWrapper<ExperimentReview> queryWrapper = QueryGenerator.initQueryWrapper(experimentReviewResult, req.getParameterMap());
|
QueryWrapper<Experiment> queryWrapper = QueryGenerator.initQueryWrapper(experiment, req.getParameterMap());
|
||||||
Page<ExperimentReview> page = new Page<ExperimentReview>(pageNo, pageSize);
|
Page<Experiment> page = new Page<>(pageNo, pageSize);
|
||||||
IPage<ExperimentReview> pageList = experimentReviewResultService.page(page, queryWrapper);
|
IPage<Experiment> pageList = experimentService.page(page, queryWrapper);
|
||||||
|
pageList.getRecords().forEach(ex -> {
|
||||||
|
List<ExperimentReviewDTO> experimentReviewList = experimentReviewService.getByExperimentId(ex.getId());
|
||||||
|
ex.setExperimentReviewList(experimentReviewList);
|
||||||
|
});
|
||||||
return Result.OK(pageList);
|
return Result.OK(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +80,7 @@ public class ExperimentReviewController extends JeecgController<ExperimentReview
|
|||||||
public Result<ExperimentReview> add(@RequestBody ExperimentReview experimentReviewResult) {
|
public Result<ExperimentReview> add(@RequestBody ExperimentReview experimentReviewResult) {
|
||||||
Experiment experiment = experimentService.getById(experimentReviewResult.getExperimentId());
|
Experiment experiment = experimentService.getById(experimentReviewResult.getExperimentId());
|
||||||
ExperimentSampleInfo sampleInfo = experimentSampleInfoService.getById(experimentReviewResult.getSampleId());
|
ExperimentSampleInfo sampleInfo = experimentSampleInfoService.getById(experimentReviewResult.getSampleId());
|
||||||
ExperimentReview review = experimentReviewResultService.review(experiment, sampleInfo, ExperimentReviewProcessType.GJB548C);
|
ExperimentReview review = experimentReviewService.review(experiment, sampleInfo, ExperimentReviewProcessType.GJB548C);
|
||||||
return Result.OK(review);
|
return Result.OK(review);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +95,7 @@ public class ExperimentReviewController extends JeecgController<ExperimentReview
|
|||||||
@RequiresPermissions("database:experiment_review_result:edit")
|
@RequiresPermissions("database:experiment_review_result:edit")
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
public Result<String> edit(@RequestBody ExperimentReview experimentReviewResult) {
|
public Result<String> edit(@RequestBody ExperimentReview experimentReviewResult) {
|
||||||
experimentReviewResultService.updateById(experimentReviewResult);
|
experimentReviewService.updateById(experimentReviewResult);
|
||||||
return Result.OK("编辑成功!");
|
return Result.OK("编辑成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +110,7 @@ public class ExperimentReviewController extends JeecgController<ExperimentReview
|
|||||||
@RequiresPermissions("database:experiment_review_result:delete")
|
@RequiresPermissions("database:experiment_review_result:delete")
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||||
experimentReviewResultService.removeById(id);
|
experimentReviewService.removeById(id);
|
||||||
return Result.OK("删除成功!");
|
return Result.OK("删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,7 +125,7 @@ public class ExperimentReviewController extends JeecgController<ExperimentReview
|
|||||||
@RequiresPermissions("database:experiment_review_result:deleteBatch")
|
@RequiresPermissions("database:experiment_review_result:deleteBatch")
|
||||||
@DeleteMapping(value = "/deleteBatch")
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||||
this.experimentReviewResultService.removeByIds(Arrays.asList(ids.split(",")));
|
this.experimentReviewService.removeByIds(Arrays.asList(ids.split(",")));
|
||||||
return Result.OK("批量删除成功!");
|
return Result.OK("批量删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +139,7 @@ public class ExperimentReviewController extends JeecgController<ExperimentReview
|
|||||||
@Operation(summary = "试验评定结果-通过id查询")
|
@Operation(summary = "试验评定结果-通过id查询")
|
||||||
@GetMapping(value = "/queryById")
|
@GetMapping(value = "/queryById")
|
||||||
public Result<ExperimentReview> queryById(@RequestParam(name = "id", required = true) String id) {
|
public Result<ExperimentReview> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||||
ExperimentReview experimentReviewResult = experimentReviewResultService.getById(id);
|
ExperimentReview experimentReviewResult = experimentReviewService.getById(id);
|
||||||
if (experimentReviewResult == null) {
|
if (experimentReviewResult == null) {
|
||||||
return Result.error("未找到对应数据");
|
return Result.error("未找到对应数据");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.jeecg.modules.database.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExperimentReviewDTO implements Serializable {
|
||||||
|
private String sampleName;
|
||||||
|
private String processType;
|
||||||
|
private String reviewResult;
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecg.modules.database.dto.ExperimentReviewDTO;
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
@@ -248,4 +249,9 @@ public class Experiment implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String pageName;
|
private String pageName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<ExperimentReviewDTO> ExperimentReviewList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,22 @@
|
|||||||
package org.jeecg.modules.database.service;
|
package org.jeecg.modules.database.service;
|
||||||
|
|
||||||
import org.jeecg.modules.database.entity.*;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.modules.database.dto.ExperimentReviewDTO;
|
||||||
|
import org.jeecg.modules.database.entity.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 试验评定结果
|
* @Description: 试验评定结果
|
||||||
* @Author: jeecg-boot
|
* @Author: jeecg-boot
|
||||||
* @Date: 2025-06-16
|
* @Date: 2025-06-16
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
public interface IExperimentReviewService extends IService<ExperimentReview> {
|
public interface IExperimentReviewService extends IService<ExperimentReview> {
|
||||||
|
|
||||||
ExperimentReview review(Experiment experiment, ExperimentSampleInfo sampleInfo, String processType);
|
ExperimentReview review(Experiment experiment, ExperimentSampleInfo sampleInfo, String processType);
|
||||||
|
|
||||||
|
ExperimentReview getBySampleId(String experimentId, String sampleId);
|
||||||
|
|
||||||
|
List<ExperimentReviewDTO> getByExperimentId(String experimentId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ package org.jeecg.modules.database.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.jeecg.modules.database.constant.ExperimentReviewResultEnum;
|
import org.jeecg.modules.database.constant.ExperimentReviewResultEnum;
|
||||||
|
import org.jeecg.modules.database.dto.ExperimentReviewDTO;
|
||||||
import org.jeecg.modules.database.entity.*;
|
import org.jeecg.modules.database.entity.*;
|
||||||
import org.jeecg.modules.database.mapper.ExperimentReviewResultMapper;
|
import org.jeecg.modules.database.mapper.ExperimentReviewResultMapper;
|
||||||
import org.jeecg.modules.database.service.*;
|
import org.jeecg.modules.database.service.*;
|
||||||
@@ -11,8 +14,6 @@ import org.jeecg.modules.database.service.executor.ExecutorHolder;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,6 +31,10 @@ public class ExperimentReviewServiceImpl extends ServiceImpl<ExperimentReviewRes
|
|||||||
private IExperimentReviewDetailService experimentReviewDetailService;
|
private IExperimentReviewDetailService experimentReviewDetailService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ExecutorHolder executorHolder;
|
private ExecutorHolder executorHolder;
|
||||||
|
@Autowired
|
||||||
|
private IExperimentService experimentService;
|
||||||
|
@Autowired
|
||||||
|
private IExperimentSampleInfoService experimentSampleInfoService;
|
||||||
|
|
||||||
//高估代表 0,低估代表 1,无法评定代表2,评定结果通过代表3,未通过代表 4
|
//高估代表 0,低估代表 1,无法评定代表2,评定结果通过代表3,未通过代表 4
|
||||||
@Override
|
@Override
|
||||||
@@ -64,6 +69,33 @@ public class ExperimentReviewServiceImpl extends ServiceImpl<ExperimentReviewRes
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExperimentReview getBySampleId(String experimentId, String sampleId) {
|
||||||
|
return getOne(new LambdaQueryWrapper<ExperimentReview>().eq(ExperimentReview::getExperimentId, experimentId)
|
||||||
|
.eq(ExperimentReview::getSampleId, sampleId), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExperimentReviewDTO> getByExperimentId(String experimentId) {
|
||||||
|
//Experiment experiment = experimentService.getById(experimentId);
|
||||||
|
List<ExperimentSampleInfo> sampleInfoList = experimentSampleInfoService.getByExperimentId(experimentId);
|
||||||
|
List<ExperimentReviewDTO> result = new ArrayList<>();
|
||||||
|
sampleInfoList.forEach(sampleInfo -> {
|
||||||
|
ExperimentReviewDTO dto = new ExperimentReviewDTO();
|
||||||
|
dto.setSampleName(sampleInfo.getSampleName());
|
||||||
|
ExperimentReview review = getBySampleId(experimentId, sampleInfo.getId());
|
||||||
|
if (Objects.isNull(review)) {
|
||||||
|
dto.setProcessType("");
|
||||||
|
dto.setReviewResult("未评定");
|
||||||
|
} else {
|
||||||
|
dto.setProcessType(review.getProcessType());
|
||||||
|
dto.setReviewResult(review.getResult());
|
||||||
|
}
|
||||||
|
result.add(dto);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private String adjustResult(String experimentId, String sampleId) {
|
private String adjustResult(String experimentId, String sampleId) {
|
||||||
List<ExperimentReviewDetail> detailList = experimentReviewDetailService.getBySample(experimentId, sampleId);
|
List<ExperimentReviewDetail> detailList = experimentReviewDetailService.getBySample(experimentId, sampleId);
|
||||||
ExperimentReviewDetail first = CollUtil.getFirst(detailList);
|
ExperimentReviewDetail first = CollUtil.getFirst(detailList);
|
||||||
|
|||||||
Reference in New Issue
Block a user