完成专利保护实验实训上传和下载预览功能开发

main
whb 5 months ago
parent 8450dd8539
commit e7333d7b66

@ -2,15 +2,24 @@ package com.sztzjy.trade.controller.stu;
import com.sztzjy.trade.annotation.AnonymousAccess;
import com.sztzjy.trade.entity.StuAchievementInfo;
import com.sztzjy.trade.entity.StuTaskPracticeRecord;
import com.sztzjy.trade.entity.dto.StuExpermentSubmitDTO;
import com.sztzjy.trade.service.StuExpermentTrainingService;
import com.sztzjy.trade.util.ResultEntity;
import com.sztzjy.trade.util.file.IFileUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
/**
@ -27,7 +36,8 @@ public class StuExpermentTrainingController {
@Autowired
private StuExpermentTrainingService service;
@Resource
IFileUtil iFileUtil;
@AnonymousAccess
@PostMapping("/expermentSubmit")
@ApiOperation("实训任务提交")
@ -73,4 +83,33 @@ public class StuExpermentTrainingController {
}
@ApiOperation("实训统一文件下载接口")
@GetMapping("/download")
@AnonymousAccess
public void download(HttpServletResponse response, @ApiParam("下载文件名")String fileName) {
iFileUtil.download(response, File.separator+fileName);
}
@ApiOperation("实训文件上传接口")
@PostMapping("/upload")
@AnonymousAccess
public ResultEntity upload(MultipartFile file, @ApiParam("实训名称")String module,String userId,@ApiParam("例如:身份证明文件/其他主要证明文件") String name) {
if (file.isEmpty())
{
return new ResultEntity<>(HttpStatus.BAD_REQUEST,"文件不能为空");
}
//保存文件路径
String filePath = iFileUtil.upload(file);
return service.uploadFileByExperment(filePath,module,userId,name);
}
}

@ -1,6 +1,7 @@
package com.sztzjy.trade.controller.stu;
import com.sztzjy.trade.annotation.AnonymousAccess;
import com.sztzjy.trade.entity.StuAchievementInfo;
import com.sztzjy.trade.entity.StuTaskPracticeRecord;
import com.sztzjy.trade.entity.dto.StuExpermentSubmitDTO;
import com.sztzjy.trade.service.StuExpermentTrainingService;
@ -8,10 +9,9 @@ import com.sztzjy.trade.util.ResultEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
/**
* @author 17803
@ -41,11 +41,10 @@ public class StuKnowledgeTrainingController {
@PostMapping("/expermentByAutoSave")
@ApiOperation("实训任务自动保存")
public ResultEntity expermentByAutoSave(@RequestBody StuTaskPracticeRecord stuTaskPracticeRecord) {
return service.expermentByAutoSave(stuTaskPracticeRecord);
}
}
}

@ -39,7 +39,7 @@ public class StuSignInfoController {
}
// 三种方式:
// 三种方式:
//根据IP 需要request
// 根据code,需要code
// 手动签到 不用自己操作,抽到自己老师给点是否签到,没抽到自动添加签到记录表中

@ -0,0 +1,110 @@
package com.sztzjy.trade.entity;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
/**
* AI
*
* @author whb
* stu_upload_experment
*/
public class StuUploadExperment {
private Integer id;
@ApiModelProperty(notes = "用户id")
private String userId;
@ApiModelProperty(notes = "图片路径")
private String filePath;
@ApiModelProperty(notes = "创建时间")
private Date createTime;
@ApiModelProperty(notes = "文件大小")
private Double fileSize;
@ApiModelProperty(notes = "文件名")
private String fileName;
@ApiModelProperty(notes = "模块名")
private String module;
@ApiModelProperty(notes = "更新时间")
private Date updateTime;
@ApiModelProperty(notes = "文件后缀")
private String sufxx;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath == null ? null : filePath.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Double getFileSize() {
return fileSize;
}
public void setFileSize(Double fileSize) {
this.fileSize = fileSize;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName == null ? null : fileName.trim();
}
public String getModule() {
return module;
}
public void setModule(String module) {
this.module = module == null ? null : module.trim();
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getSufxx() {
return sufxx;
}
public void setSufxx(String sufxx) {
this.sufxx = sufxx == null ? null : sufxx.trim();
}
}

@ -0,0 +1,790 @@
package com.sztzjy.trade.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class StuUploadExpermentExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public StuUploadExpermentExample() {
oredCriteria = new ArrayList<>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(String value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(String value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(String value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(String value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(String value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(String value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLike(String value) {
addCriterion("user_id like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotLike(String value) {
addCriterion("user_id not like", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<String> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<String> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(String value1, String value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(String value1, String value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andFilePathIsNull() {
addCriterion("file_path is null");
return (Criteria) this;
}
public Criteria andFilePathIsNotNull() {
addCriterion("file_path is not null");
return (Criteria) this;
}
public Criteria andFilePathEqualTo(String value) {
addCriterion("file_path =", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathNotEqualTo(String value) {
addCriterion("file_path <>", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathGreaterThan(String value) {
addCriterion("file_path >", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathGreaterThanOrEqualTo(String value) {
addCriterion("file_path >=", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathLessThan(String value) {
addCriterion("file_path <", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathLessThanOrEqualTo(String value) {
addCriterion("file_path <=", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathLike(String value) {
addCriterion("file_path like", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathNotLike(String value) {
addCriterion("file_path not like", value, "filePath");
return (Criteria) this;
}
public Criteria andFilePathIn(List<String> values) {
addCriterion("file_path in", values, "filePath");
return (Criteria) this;
}
public Criteria andFilePathNotIn(List<String> values) {
addCriterion("file_path not in", values, "filePath");
return (Criteria) this;
}
public Criteria andFilePathBetween(String value1, String value2) {
addCriterion("file_path between", value1, value2, "filePath");
return (Criteria) this;
}
public Criteria andFilePathNotBetween(String value1, String value2) {
addCriterion("file_path not between", value1, value2, "filePath");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andFileSizeIsNull() {
addCriterion("file_size is null");
return (Criteria) this;
}
public Criteria andFileSizeIsNotNull() {
addCriterion("file_size is not null");
return (Criteria) this;
}
public Criteria andFileSizeEqualTo(Double value) {
addCriterion("file_size =", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeNotEqualTo(Double value) {
addCriterion("file_size <>", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeGreaterThan(Double value) {
addCriterion("file_size >", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeGreaterThanOrEqualTo(Double value) {
addCriterion("file_size >=", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeLessThan(Double value) {
addCriterion("file_size <", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeLessThanOrEqualTo(Double value) {
addCriterion("file_size <=", value, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeIn(List<Double> values) {
addCriterion("file_size in", values, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeNotIn(List<Double> values) {
addCriterion("file_size not in", values, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeBetween(Double value1, Double value2) {
addCriterion("file_size between", value1, value2, "fileSize");
return (Criteria) this;
}
public Criteria andFileSizeNotBetween(Double value1, Double value2) {
addCriterion("file_size not between", value1, value2, "fileSize");
return (Criteria) this;
}
public Criteria andFileNameIsNull() {
addCriterion("file_name is null");
return (Criteria) this;
}
public Criteria andFileNameIsNotNull() {
addCriterion("file_name is not null");
return (Criteria) this;
}
public Criteria andFileNameEqualTo(String value) {
addCriterion("file_name =", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotEqualTo(String value) {
addCriterion("file_name <>", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameGreaterThan(String value) {
addCriterion("file_name >", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameGreaterThanOrEqualTo(String value) {
addCriterion("file_name >=", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameLessThan(String value) {
addCriterion("file_name <", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameLessThanOrEqualTo(String value) {
addCriterion("file_name <=", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameLike(String value) {
addCriterion("file_name like", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotLike(String value) {
addCriterion("file_name not like", value, "fileName");
return (Criteria) this;
}
public Criteria andFileNameIn(List<String> values) {
addCriterion("file_name in", values, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotIn(List<String> values) {
addCriterion("file_name not in", values, "fileName");
return (Criteria) this;
}
public Criteria andFileNameBetween(String value1, String value2) {
addCriterion("file_name between", value1, value2, "fileName");
return (Criteria) this;
}
public Criteria andFileNameNotBetween(String value1, String value2) {
addCriterion("file_name not between", value1, value2, "fileName");
return (Criteria) this;
}
public Criteria andModuleIsNull() {
addCriterion("module is null");
return (Criteria) this;
}
public Criteria andModuleIsNotNull() {
addCriterion("module is not null");
return (Criteria) this;
}
public Criteria andModuleEqualTo(String value) {
addCriterion("module =", value, "module");
return (Criteria) this;
}
public Criteria andModuleNotEqualTo(String value) {
addCriterion("module <>", value, "module");
return (Criteria) this;
}
public Criteria andModuleGreaterThan(String value) {
addCriterion("module >", value, "module");
return (Criteria) this;
}
public Criteria andModuleGreaterThanOrEqualTo(String value) {
addCriterion("module >=", value, "module");
return (Criteria) this;
}
public Criteria andModuleLessThan(String value) {
addCriterion("module <", value, "module");
return (Criteria) this;
}
public Criteria andModuleLessThanOrEqualTo(String value) {
addCriterion("module <=", value, "module");
return (Criteria) this;
}
public Criteria andModuleLike(String value) {
addCriterion("module like", value, "module");
return (Criteria) this;
}
public Criteria andModuleNotLike(String value) {
addCriterion("module not like", value, "module");
return (Criteria) this;
}
public Criteria andModuleIn(List<String> values) {
addCriterion("module in", values, "module");
return (Criteria) this;
}
public Criteria andModuleNotIn(List<String> values) {
addCriterion("module not in", values, "module");
return (Criteria) this;
}
public Criteria andModuleBetween(String value1, String value2) {
addCriterion("module between", value1, value2, "module");
return (Criteria) this;
}
public Criteria andModuleNotBetween(String value1, String value2) {
addCriterion("module not between", value1, value2, "module");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andSufxxIsNull() {
addCriterion("sufxx is null");
return (Criteria) this;
}
public Criteria andSufxxIsNotNull() {
addCriterion("sufxx is not null");
return (Criteria) this;
}
public Criteria andSufxxEqualTo(String value) {
addCriterion("sufxx =", value, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxNotEqualTo(String value) {
addCriterion("sufxx <>", value, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxGreaterThan(String value) {
addCriterion("sufxx >", value, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxGreaterThanOrEqualTo(String value) {
addCriterion("sufxx >=", value, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxLessThan(String value) {
addCriterion("sufxx <", value, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxLessThanOrEqualTo(String value) {
addCriterion("sufxx <=", value, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxLike(String value) {
addCriterion("sufxx like", value, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxNotLike(String value) {
addCriterion("sufxx not like", value, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxIn(List<String> values) {
addCriterion("sufxx in", values, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxNotIn(List<String> values) {
addCriterion("sufxx not in", values, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxBetween(String value1, String value2) {
addCriterion("sufxx between", value1, value2, "sufxx");
return (Criteria) this;
}
public Criteria andSufxxNotBetween(String value1, String value2) {
addCriterion("sufxx not between", value1, value2, "sufxx");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

@ -0,0 +1,30 @@
package com.sztzjy.trade.mapper;
import com.sztzjy.trade.entity.StuUploadExperment;
import com.sztzjy.trade.entity.StuUploadExpermentExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface StuUploadExpermentMapper {
long countByExample(StuUploadExpermentExample example);
int deleteByExample(StuUploadExpermentExample example);
int deleteByPrimaryKey(Integer id);
int insert(StuUploadExperment record);
int insertSelective(StuUploadExperment record);
List<StuUploadExperment> selectByExample(StuUploadExpermentExample example);
StuUploadExperment selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") StuUploadExperment record, @Param("example") StuUploadExpermentExample example);
int updateByExample(@Param("record") StuUploadExperment record, @Param("example") StuUploadExpermentExample example);
int updateByPrimaryKeySelective(StuUploadExperment record);
int updateByPrimaryKey(StuUploadExperment record);
}

@ -3,6 +3,7 @@ package com.sztzjy.trade.service;
import com.sztzjy.trade.entity.StuTaskPracticeRecord;
import com.sztzjy.trade.entity.dto.StuExpermentSubmitDTO;
import com.sztzjy.trade.util.ResultEntity;
import org.springframework.web.multipart.MultipartFile;
/**
* @author 17803
@ -46,4 +47,15 @@ public interface StuExpermentTrainingService {
*/
ResultEntity trainingTaskDetails(String userId, String module,Integer page,Integer size);
/**
*
* @param filePath
* @param module
* @param userId
* @param name
* @return
*/
ResultEntity uploadFileByExperment(String filePath, String module, String userId, String name);
}

@ -8,6 +8,7 @@ import com.sztzjy.trade.entity.dto.StuExpermentSubmitDTO;
import com.sztzjy.trade.entity.dto.StuTaskDetailDTO;
import com.sztzjy.trade.mapper.StuExpermentTrainingScoreMapper;
import com.sztzjy.trade.mapper.StuTaskPracticeRecordMapper;
import com.sztzjy.trade.mapper.StuUploadExpermentMapper;
import com.sztzjy.trade.mapper.StuWrongQuestionRankingMapper;
import com.sztzjy.trade.service.StuExpermentTrainingService;
import com.sztzjy.trade.util.ResultEntity;
@ -17,11 +18,14 @@ import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
@ -41,6 +45,9 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
@Autowired
private StuTaskPracticeRecordMapper stuTaskPracticeRecordMapper;
@Resource
private StuUploadExpermentMapper stuUploadExpermentMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public ResultEntity expermentSubmit(StuExpermentSubmitDTO stuExpermentSubmitDTO) {
@ -249,6 +256,49 @@ public class StuExpermentTrainingServiceImpl implements StuExpermentTrainingServ
}
/**
*
* @param filePath
* @param module
* @param userId
* @param name
* @return
*/
@Override
public ResultEntity uploadFileByExperment(String filePath, String module, String userId, String name) {
StuUploadExpermentExample uploadExpermentExample = new StuUploadExpermentExample();
uploadExpermentExample.createCriteria()
.andUserIdEqualTo(userId)
.andModuleEqualTo(module)
.andFileNameEqualTo(name);
List<StuUploadExperment> stuUploadExpermentList = stuUploadExpermentMapper.selectByExample(uploadExpermentExample);
if (stuUploadExpermentList.isEmpty())
{
StuUploadExperment uploadExperment = new StuUploadExperment();
int id = UUID.randomUUID().hashCode() > 0 ? UUID.randomUUID().hashCode() : -UUID.randomUUID().hashCode();
uploadExperment.setId(id);
uploadExperment.setFileName(name);
uploadExperment.setFilePath(filePath);
uploadExperment.setCreateTime(new Date());
uploadExperment.setModule(module);
uploadExperment.setUserId(userId);
stuUploadExpermentMapper.insertSelective(uploadExperment);
return new ResultEntity<>(HttpStatus.OK,"上传成功!");
}else {
StuUploadExperment uploadExperment = stuUploadExpermentList.get(0);
uploadExperment.setUpdateTime(new Date());
uploadExperment.setFilePath(filePath);
stuUploadExpermentMapper.updateByPrimaryKeySelective(uploadExperment);
return new ResultEntity<>(HttpStatus.OK,"上传成功!");
}
}
private synchronized void subQuestionRanking(String schoolId, String module, String classId, List<StuTaskDetailDTO> taskList, int state) {

@ -113,6 +113,7 @@ public class TeacherOpenCourseStudentSigninServiceImpl implements TeacherOpenCou
if (openCourseStudentSigninSetting == null) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "不存在的ID");
}
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingStartStatus(String.valueOf(StartStatusEnum.END));
openCourseStudentSigninSetting.setTeacherOpenCourseStudentSigninSettingEndTime(new Date());

@ -0,0 +1,275 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sztzjy.trade.mapper.StuUploadExpermentMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.trade.entity.StuUploadExperment">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="file_path" jdbcType="VARCHAR" property="filePath" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="file_size" jdbcType="DOUBLE" property="fileSize" />
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
<result column="module" jdbcType="VARCHAR" property="module" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="sufxx" jdbcType="VARCHAR" property="sufxx" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, user_id, file_path, create_time, file_size, file_name, module, update_time, sufxx
</sql>
<select id="selectByExample" parameterType="com.sztzjy.trade.entity.StuUploadExpermentExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from stu_upload_experment
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from stu_upload_experment
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from stu_upload_experment
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.trade.entity.StuUploadExpermentExample">
delete from stu_upload_experment
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.trade.entity.StuUploadExperment">
insert into stu_upload_experment (id, user_id, file_path,
create_time, file_size, file_name,
module, update_time, sufxx
)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{filePath,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{fileSize,jdbcType=DOUBLE}, #{fileName,jdbcType=VARCHAR},
#{module,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{sufxx,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.trade.entity.StuUploadExperment">
insert into stu_upload_experment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="filePath != null">
file_path,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="fileSize != null">
file_size,
</if>
<if test="fileName != null">
file_name,
</if>
<if test="module != null">
module,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="sufxx != null">
sufxx,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="filePath != null">
#{filePath,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="fileSize != null">
#{fileSize,jdbcType=DOUBLE},
</if>
<if test="fileName != null">
#{fileName,jdbcType=VARCHAR},
</if>
<if test="module != null">
#{module,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="sufxx != null">
#{sufxx,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.trade.entity.StuUploadExpermentExample" resultType="java.lang.Long">
select count(*) from stu_upload_experment
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update stu_upload_experment
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=VARCHAR},
</if>
<if test="record.filePath != null">
file_path = #{record.filePath,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.fileSize != null">
file_size = #{record.fileSize,jdbcType=DOUBLE},
</if>
<if test="record.fileName != null">
file_name = #{record.fileName,jdbcType=VARCHAR},
</if>
<if test="record.module != null">
module = #{record.module,jdbcType=VARCHAR},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.sufxx != null">
sufxx = #{record.sufxx,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update stu_upload_experment
set id = #{record.id,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=VARCHAR},
file_path = #{record.filePath,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
file_size = #{record.fileSize,jdbcType=DOUBLE},
file_name = #{record.fileName,jdbcType=VARCHAR},
module = #{record.module,jdbcType=VARCHAR},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
sufxx = #{record.sufxx,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.trade.entity.StuUploadExperment">
update stu_upload_experment
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="filePath != null">
file_path = #{filePath,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="fileSize != null">
file_size = #{fileSize,jdbcType=DOUBLE},
</if>
<if test="fileName != null">
file_name = #{fileName,jdbcType=VARCHAR},
</if>
<if test="module != null">
module = #{module,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="sufxx != null">
sufxx = #{sufxx,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.trade.entity.StuUploadExperment">
update stu_upload_experment
set user_id = #{userId,jdbcType=VARCHAR},
file_path = #{filePath,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
file_size = #{fileSize,jdbcType=DOUBLE},
file_name = #{fileName,jdbcType=VARCHAR},
module = #{module,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
sufxx = #{sufxx,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
Loading…
Cancel
Save