1111
This commit is contained in:
parent
209e52ff4c
commit
cb10052615
@ -6,6 +6,7 @@ import jakarta.validation.constraints.NotEmpty;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -22,7 +23,7 @@ public class addClinicalVideoApp {
|
|||||||
|
|
||||||
// 是否外部链接(0:否 1:是)
|
// 是否外部链接(0:否 1:是)
|
||||||
@JsonProperty("isLink")
|
@JsonProperty("isLink")
|
||||||
private String isLink = "0";
|
private Integer isLink = 0;
|
||||||
|
|
||||||
// 外部链接地址
|
// 外部链接地址
|
||||||
@JsonProperty("isLinkUrl")
|
@JsonProperty("isLinkUrl")
|
||||||
@ -33,6 +34,10 @@ public class addClinicalVideoApp {
|
|||||||
@NotEmpty(message = "标题不能为空")
|
@NotEmpty(message = "标题不能为空")
|
||||||
private String videoTitle;
|
private String videoTitle;
|
||||||
|
|
||||||
|
// 发布时间
|
||||||
|
@JsonProperty("pushDate")
|
||||||
|
private LocalDateTime pushDate;
|
||||||
|
|
||||||
// 作者
|
// 作者
|
||||||
@JsonProperty("author")
|
@JsonProperty("author")
|
||||||
private List<Author> author;
|
private List<Author> author;
|
||||||
|
|||||||
@ -525,20 +525,60 @@ public class CaseClinicalVideoService {
|
|||||||
try {
|
try {
|
||||||
// 1. 手动读取请求体并转为 addClinicalVideoApp 对象
|
// 1. 手动读取请求体并转为 addClinicalVideoApp 对象
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
addClinicalVideoApp dto = objectMapper.readValue(request.getInputStream(), addClinicalVideoApp.class);
|
addClinicalVideoApp r = objectMapper.readValue(request.getInputStream(), addClinicalVideoApp.class);
|
||||||
|
|
||||||
// 2. 自动校验(@Validated)
|
// 2. 自动校验(@Validated)
|
||||||
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
|
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
|
||||||
Set<ConstraintViolation<addClinicalVideoApp>> violations = validator.validate(dto);
|
Set<ConstraintViolation<addClinicalVideoApp>> violations = validator.validate(r);
|
||||||
if (!violations.isEmpty()) {
|
if (!violations.isEmpty()) {
|
||||||
String errorMessage = violations.iterator().next().getMessage();
|
String errorMessage = violations.iterator().next().getMessage();
|
||||||
throw new BusinessException("-1", errorMessage);
|
throw new BusinessException("-1", errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测签名
|
// 检测签名
|
||||||
Video.checkSign(request,"26e8675f44565b1ed4eaaa0fcf3531d7",dto,objectMapper);
|
Video.checkSign(request,"26e8675f44565b1ed4eaaa0fcf3531d7",r,objectMapper);
|
||||||
|
|
||||||
|
// // 处理业务逻辑
|
||||||
|
// // 获取视频数据
|
||||||
|
// LambdaQueryWrapper<CaseClinicalVideoModel> videoQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
// videoQueryWrapper.eq(CaseClinicalVideoModel::getVideoNo, r.getVideoNo());
|
||||||
|
// CaseClinicalVideoModel caseClinicalVideo = caseClinicalVideoDao.selectOne(videoQueryWrapper);
|
||||||
|
//
|
||||||
|
// // 新增
|
||||||
|
// if (Objects.equals(r.getAction(), "add")){
|
||||||
|
// if (caseClinicalVideo != null){
|
||||||
|
// // 已存在该视频
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 新增视频
|
||||||
|
// caseClinicalVideo = new CaseClinicalVideoModel();
|
||||||
|
// caseClinicalVideo.setVideoTitle(r.getVideoTitle());
|
||||||
|
// caseClinicalVideo.setVideoNo(r.getVideoNo());
|
||||||
|
// caseClinicalVideo.setPushDate(r.getPushDate());
|
||||||
|
// caseClinicalVideo.setIsLink(r.getIsLink());
|
||||||
|
// caseClinicalVideo.setIsLinkUrl(r.getIsLinkUrl());
|
||||||
|
// int res = caseClinicalVideoDao.insert(caseClinicalVideo);
|
||||||
|
// if (res <= 0){
|
||||||
|
// throw new BusinessException("-1", "内部错误,添加视频失败");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 新增标签
|
||||||
|
// CaseClinicalVideoLabelModel caseClinicalVideoLabel = new CaseClinicalVideoLabelModel();
|
||||||
|
// caseClinicalVideoLabel.setVideoId(caseClinicalVideo.getVideoId());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 修改
|
||||||
|
// if (Objects.equals(r.getAction(), "update")){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 删除
|
||||||
|
// if (Objects.equals(r.getAction(), "delete")){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
// 处理业务逻辑
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException("-1", e.getMessage());
|
throw new BusinessException("-1", e.getMessage());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user