update
This commit is contained in:
@@ -16,6 +16,7 @@ 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.modules.database.dto.ExperimentRatingDTO;
|
||||
import org.jeecg.modules.database.dto.ExperimentRatingUserDTO;
|
||||
import org.jeecg.modules.database.entity.Experiment;
|
||||
import org.jeecg.modules.database.entity.ExperimentRating;
|
||||
import org.jeecg.modules.database.service.IExperimentRatingService;
|
||||
@@ -95,10 +96,55 @@ public class ExperimentRatingController extends JeecgController<ExperimentRating
|
||||
if (StringUtils.isBlank(experimentId)) {
|
||||
return Result.error("试验数据不存在!");
|
||||
}
|
||||
Experiment experiment = experimentService.getById(experimentId);
|
||||
if (Objects.isNull(experiment)) {
|
||||
return Result.error("试验数据不存在!");
|
||||
}
|
||||
if (StringUtils.isBlank(experimentRating.getRateUserId())) {
|
||||
return Result.error("评分人员不能为空!");
|
||||
}
|
||||
experimentRatingService.save(experimentRating);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param experimentRating
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "试验评分-批量添加")
|
||||
@Operation(summary = "试验评分-批量添加")
|
||||
@RequiresPermissions("database:experiment_rating:add")
|
||||
@PostMapping(value = "/addAll")
|
||||
public Result<String> batchAdd(@RequestBody ExperimentRatingDTO experimentRating) {
|
||||
String experimentId = experimentRating.getExperimentId();
|
||||
if (StringUtils.isBlank(experimentId)) {
|
||||
return Result.error("试验数据不存在!");
|
||||
}
|
||||
Experiment experiment = experimentService.getById(experimentId);
|
||||
if (Objects.isNull(experiment)) {
|
||||
return Result.error("试验数据不存在!");
|
||||
}
|
||||
List<ExperimentRatingUserDTO> rateUserList = experimentRating.getRateUserList();
|
||||
if (rateUserList.isEmpty()) {
|
||||
return Result.error("评分人员不能为空!");
|
||||
}
|
||||
rateUserList.forEach(v -> {
|
||||
ExperimentRating er = new ExperimentRating();
|
||||
er.setExperimentId(experimentId);
|
||||
er.setRateUserId(v.getRateUserId());
|
||||
er.setBaseScore(v.getBaseScore());
|
||||
er.setCompletionScore(v.getCompletionScore());
|
||||
er.setTotalScore(v.getTotalScore());
|
||||
er.setManagementScore(v.getManagementScore());
|
||||
er.setDifficultyScore(v.getDifficultyScore());
|
||||
experimentRatingService.save(er);
|
||||
});
|
||||
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
*/
|
||||
package org.jeecg.modules.database.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lise
|
||||
@@ -21,36 +21,64 @@ import java.util.Date;
|
||||
@Setter
|
||||
public class ExperimentRatingDTO {
|
||||
|
||||
/**主键*/
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
/**创建人*/
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
/**
|
||||
* 更新日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**所属部门*/
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
private String sysOrgCode;
|
||||
/**实验ID*/
|
||||
/**
|
||||
* 实验ID
|
||||
*/
|
||||
private String experimentId;
|
||||
/**评分人*/
|
||||
/**
|
||||
* 评分人
|
||||
*/
|
||||
private String rateUserId;
|
||||
/**总分数*/
|
||||
/**
|
||||
* 总分数
|
||||
*/
|
||||
private Integer totalScore;
|
||||
/**基础分*/
|
||||
/**
|
||||
* 基础分
|
||||
*/
|
||||
private Integer baseScore;
|
||||
/**完成分*/
|
||||
/**
|
||||
* 完成分
|
||||
*/
|
||||
private Integer completionScore;
|
||||
/**难度分*/
|
||||
/**
|
||||
* 难度分
|
||||
*/
|
||||
private Integer difficultyScore;
|
||||
/**管理支撑分*/
|
||||
/**
|
||||
* 管理支撑分
|
||||
*/
|
||||
private Integer managementScore;
|
||||
private String experimentName;
|
||||
private String experimentNo;
|
||||
@Schema(description = "评分人列表")
|
||||
private List<ExperimentRatingUserDTO> rateUserList;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Ant Group
|
||||
* Copyright (c) 2004-2024 All Rights Reserved.
|
||||
*/
|
||||
package org.jeecg.modules.database.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author lise
|
||||
* @version ExperimentRatingDTO.java, v 0.1 2024年11月16日 13:46 lise
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description="试验评分")
|
||||
public class ExperimentRatingUserDTO {
|
||||
|
||||
/**
|
||||
* 评分人
|
||||
*/
|
||||
@Schema(description = "评分人")
|
||||
private String rateUserId;
|
||||
/**
|
||||
* 总分数
|
||||
*/
|
||||
@Schema(description = "总分数")
|
||||
private Integer totalScore;
|
||||
/**
|
||||
* 基础分
|
||||
*/
|
||||
@Schema(description = "基础分")
|
||||
private Integer baseScore;
|
||||
/**
|
||||
* 完成分
|
||||
*/
|
||||
@Schema(description = "完成分")
|
||||
private Integer completionScore;
|
||||
/**
|
||||
* 难度分
|
||||
*/
|
||||
@Schema(description = "难度分")
|
||||
private Integer difficultyScore;
|
||||
/**
|
||||
* 管理支撑分
|
||||
*/
|
||||
@Schema(description = "管理支撑分")
|
||||
private Integer managementScore;
|
||||
}
|
||||
Reference in New Issue
Block a user