update
This commit is contained in:
@@ -1,41 +1,30 @@
|
|||||||
package org.jeecg.modules.database.controller;
|
package org.jeecg.modules.database.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
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.common.util.oConvertUtils;
|
|
||||||
import org.jeecg.modules.database.entity.ExperimentReport;
|
|
||||||
import org.jeecg.modules.database.service.IExperimentReportService;
|
|
||||||
|
|
||||||
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 lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
||||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
||||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
||||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
||||||
import org.jeecg.common.system.base.controller.JeecgController;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
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.query.QueryGenerator;
|
||||||
|
import org.jeecg.common.system.util.JwtUtil;
|
||||||
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.database.entity.ExperimentReport;
|
||||||
|
import org.jeecg.modules.database.service.IExperimentReportService;
|
||||||
|
import org.jeecg.modules.system.entity.SysUser;
|
||||||
|
import org.jeecg.modules.system.service.ISysUserService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 试验报告
|
* @Description: 试验报告
|
||||||
@@ -51,6 +40,9 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IExperimentReportService experimentReportService;
|
private IExperimentReportService experimentReportService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
*
|
*
|
||||||
@@ -63,10 +55,7 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
|
|||||||
//@AutoLog(value = "试验报告-分页列表查询")
|
//@AutoLog(value = "试验报告-分页列表查询")
|
||||||
@Operation(summary = "试验报告-分页列表查询")
|
@Operation(summary = "试验报告-分页列表查询")
|
||||||
@GetMapping(value = "/list")
|
@GetMapping(value = "/list")
|
||||||
public Result<IPage<ExperimentReport>> queryPageList(ExperimentReport experimentReport,
|
public Result<IPage<ExperimentReport>> queryPageList(ExperimentReport experimentReport, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
||||||
HttpServletRequest req) {
|
|
||||||
QueryWrapper<ExperimentReport> queryWrapper = QueryGenerator.initQueryWrapper(experimentReport, req.getParameterMap());
|
QueryWrapper<ExperimentReport> queryWrapper = QueryGenerator.initQueryWrapper(experimentReport, req.getParameterMap());
|
||||||
Page<ExperimentReport> page = new Page<ExperimentReport>(pageNo, pageSize);
|
Page<ExperimentReport> page = new Page<ExperimentReport>(pageNo, pageSize);
|
||||||
IPage<ExperimentReport> pageList = experimentReportService.page(page, queryWrapper);
|
IPage<ExperimentReport> pageList = experimentReportService.page(page, queryWrapper);
|
||||||
@@ -175,4 +164,62 @@ public class ExperimentReportController extends JeecgController<ExperimentReport
|
|||||||
return super.importExcel(request, response, ExperimentReport.class);
|
return super.importExcel(request, response, ExperimentReport.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核
|
||||||
|
*
|
||||||
|
* @param experimentReport
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@AutoLog(value = "试验报告-审核")
|
||||||
|
@Operation(summary = "试验报告-审核")
|
||||||
|
@RequiresPermissions("database:experiment_report:audit")
|
||||||
|
@RequestMapping(value = "/audit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
|
public Result<String> audit(@RequestBody ExperimentReport experimentReport, HttpServletRequest request) {
|
||||||
|
String username = JwtUtil.getUserNameByToken(request);
|
||||||
|
if (oConvertUtils.isEmpty(username)) {
|
||||||
|
return Result.error("用户未登录!");
|
||||||
|
}
|
||||||
|
// 根据用户名查询用户信息
|
||||||
|
SysUser sysUser = sysUserService.getUserByName(username);
|
||||||
|
ExperimentReport report = experimentReportService.getById(experimentReport.getId());
|
||||||
|
//校对员
|
||||||
|
String requestStatus = experimentReport.getStatus();
|
||||||
|
if (StringUtils.equals(report.getProofreader(), sysUser.getId())) {
|
||||||
|
if (!StringUtils.equals(report.getStatus(), "INIT")) {
|
||||||
|
return Result.error("实验报告状态不匹配!");
|
||||||
|
}
|
||||||
|
if (!StringUtils.equals(requestStatus, "PROOFREAD_PASS")) {
|
||||||
|
report.setStatus("REJECT");
|
||||||
|
}
|
||||||
|
report.setStatus(requestStatus);
|
||||||
|
}
|
||||||
|
//审核员
|
||||||
|
if (StringUtils.equals(report.getAuditor(), sysUser.getId())) {
|
||||||
|
if (!StringUtils.equals(report.getStatus(), "PROOFREAD_PASS")) {
|
||||||
|
return Result.error("实验报告状态不匹配!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.equals(requestStatus, "AUDIT_PASS")) {
|
||||||
|
report.setStatus("REJECT");
|
||||||
|
}
|
||||||
|
report.setStatus(requestStatus);
|
||||||
|
}
|
||||||
|
//批准员
|
||||||
|
if (StringUtils.equals(report.getConfirmer(), sysUser.getId())) {
|
||||||
|
if (!StringUtils.equals(report.getStatus(), "AUDIT_PASS")) {
|
||||||
|
return Result.error("实验报告状态不匹配!");
|
||||||
|
}
|
||||||
|
if (!StringUtils.equals(requestStatus, "PASSED")) {
|
||||||
|
report.setStatus("REJECT");
|
||||||
|
}
|
||||||
|
report.setStatus(requestStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
experimentReportService.updateById(report);
|
||||||
|
|
||||||
|
return Result.OK("审核成功!");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
package org.jeecg.modules.database.entity;
|
package org.jeecg.modules.database.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
|
||||||
import lombok.Data;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
|
||||||
import org.jeecg.common.aspect.annotation.Dict;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 试验报告
|
* @Description: 试验报告
|
||||||
@@ -31,55 +28,87 @@ import lombok.experimental.Accessors;
|
|||||||
public class ExperimentReport implements Serializable {
|
public class ExperimentReport implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**主键*/
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
@TableId(type = IdType.ASSIGN_ID)
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
@Schema(description = "主键")
|
@Schema(description = "主键")
|
||||||
private String id;
|
private String id;
|
||||||
/**创建人*/
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
private String createBy;
|
private String createBy;
|
||||||
/**创建日期*/
|
/**
|
||||||
|
* 创建日期
|
||||||
|
*/
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Schema(description = "创建日期")
|
@Schema(description = "创建日期")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
/**更新人*/
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
@Schema(description = "更新人")
|
@Schema(description = "更新人")
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
/**更新日期*/
|
/**
|
||||||
|
* 更新日期
|
||||||
|
*/
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Schema(description = "更新日期")
|
@Schema(description = "更新日期")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
/**所属部门*/
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
@Schema(description = "所属部门")
|
@Schema(description = "所属部门")
|
||||||
private String sysOrgCode;
|
private String sysOrgCode;
|
||||||
/**试验ID*/
|
/**
|
||||||
|
* 试验ID
|
||||||
|
*/
|
||||||
@Excel(name = "试验ID", width = 15)
|
@Excel(name = "试验ID", width = 15)
|
||||||
@Schema(description = "试验ID")
|
@Schema(description = "试验ID")
|
||||||
private String experimentId;
|
private String experimentId;
|
||||||
/**样品信息*/
|
/**
|
||||||
|
* 样品信息
|
||||||
|
*/
|
||||||
@Excel(name = "样品信息", width = 15)
|
@Excel(name = "样品信息", width = 15)
|
||||||
@Schema(description = "样品信息")
|
@Schema(description = "样品信息")
|
||||||
private String sampleInfo;
|
private String sampleInfo;
|
||||||
/**偏置原理图*/
|
/**
|
||||||
|
* 偏置原理图
|
||||||
|
*/
|
||||||
@Excel(name = "偏置原理图", width = 15)
|
@Excel(name = "偏置原理图", width = 15)
|
||||||
@Schema(description = "偏置原理图")
|
@Schema(description = "偏置原理图")
|
||||||
private String imgUrls;
|
private String imgUrls;
|
||||||
/**偏置原理说明*/
|
/**
|
||||||
|
* 偏置原理说明
|
||||||
|
*/
|
||||||
@Excel(name = "偏置原理说明", width = 15)
|
@Excel(name = "偏置原理说明", width = 15)
|
||||||
@Schema(description = "偏置原理说明")
|
@Schema(description = "偏置原理说明")
|
||||||
private String description;
|
private String description;
|
||||||
/**审核员*/
|
/**
|
||||||
|
* 审核员
|
||||||
|
*/
|
||||||
@Excel(name = "审核员", width = 15)
|
@Excel(name = "审核员", width = 15)
|
||||||
@Schema(description = "审核员")
|
@Schema(description = "审核员")
|
||||||
private String auditor;
|
private String auditor;
|
||||||
/**校对员*/
|
/**
|
||||||
|
* 校对员
|
||||||
|
*/
|
||||||
@Excel(name = "校对员", width = 15)
|
@Excel(name = "校对员", width = 15)
|
||||||
@Schema(description = "校对员")
|
@Schema(description = "校对员")
|
||||||
private String proofreader;
|
private String proofreader;
|
||||||
/**确认员*/
|
/**
|
||||||
|
* 确认员
|
||||||
|
*/
|
||||||
@Excel(name = "确认员", width = 15)
|
@Excel(name = "确认员", width = 15)
|
||||||
@Schema(description = "确认员")
|
@Schema(description = "确认员")
|
||||||
private String confirmer;
|
private String confirmer;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "状态", width = 15)
|
||||||
|
@Schema(description = "状态(申请中(待校对):INIT,不合格RE:REJECT ,校对通过(待审核):PROOFREAD_PASS,审核通过(待批准):AUDIT_PASS,批准通过:PASSED)")
|
||||||
|
private String status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user