|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.ctop.controller;
|
|
|
|
|
|
+import cn.com.ctop.common.utils.Check;
|
|
|
import cn.com.ctop.manage.modules.actor.entity.Actor;
|
|
|
import cn.com.ctop.manage.modules.actor.entity.ActorComment;
|
|
|
import cn.com.ctop.manage.modules.actor.entity.ActorPhoto;
|
|
@@ -11,6 +12,7 @@ import cn.com.ctop.manage.modules.actor.service.IActorVideoService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import constant.KuaishouInterfaceConstant;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
@@ -18,9 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
|
@Slf4j
|
|
@@ -180,6 +179,12 @@ public class ActorController {
|
|
|
public Result<ActorVideo> addVideo(ActorVideo actorVideo) {
|
|
|
Result<ActorVideo> result = new Result<ActorVideo>();
|
|
|
try {
|
|
|
+ String videoUrl = actorVideo.getVideoUrl();
|
|
|
+ if (!Check.isNull(videoUrl)) {
|
|
|
+ if (!videoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ actorVideo.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + videoUrl);
|
|
|
+ }
|
|
|
+ }
|
|
|
actorVideoService.save(actorVideo);
|
|
|
result.success("添加成功!");
|
|
|
} catch (Exception e) {
|
|
@@ -193,6 +198,13 @@ public class ActorController {
|
|
|
public Result<ActorPhoto> addPhoto(ActorPhoto actorPhoto) {
|
|
|
Result<ActorPhoto> result = new Result<ActorPhoto>();
|
|
|
try {
|
|
|
+ String photoUrl = actorPhoto.getPhotoUrl();
|
|
|
+ if (!Check.isNull(photoUrl)) {
|
|
|
+ if (!photoUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ actorPhoto.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + photoUrl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
actorPhotoService.save(actorPhoto);
|
|
|
result.success("添加成功!");
|
|
|
} catch (Exception e) {
|
|
@@ -208,7 +220,6 @@ public class ActorController {
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
HttpServletRequest req) {
|
|
|
Result<IPage<ActorVideo>> result = new Result<IPage<ActorVideo>>();
|
|
|
-
|
|
|
QueryWrapper<ActorVideo> queryWrapper = QueryGenerator.initQueryWrapper(actorVideo, req.getParameterMap());
|
|
|
Page<ActorVideo> page = new Page<ActorVideo>(pageNo, pageSize);
|
|
|
IPage<ActorVideo> pageList = actorVideoService.page(page, queryWrapper);
|
|
@@ -228,23 +239,38 @@ public class ActorController {
|
|
|
public Result<Actor> add(@RequestBody Actor actor) {
|
|
|
Result<Actor> result = new Result<Actor>();
|
|
|
try {
|
|
|
+ String coverUrl = actor.getCoverUrl();
|
|
|
+ if (!Check.isNull(coverUrl)) {
|
|
|
+ if (!coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
|
|
|
+ }
|
|
|
+ }
|
|
|
actorService.save(actor);
|
|
|
-// if (actor.getImageUrl() != null && actor.getImageUrl().size() > 0) {
|
|
|
-// for (String url : actor.getImageUrl()) {
|
|
|
-// ActorPhoto photo = new ActorPhoto();
|
|
|
-// photo.setActorId(actor.getId());
|
|
|
-// photo.setPhotoUrl("http:" + url);
|
|
|
-// actorPhotoService.save(photo);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (actor.getVideoUrl() != null && actor.getVideoUrl().size() > 0) {
|
|
|
-// for (String url : actor.getVideoUrl()) {
|
|
|
-// ActorVideo video = new ActorVideo();
|
|
|
-// video.setActorId(actor.getId());
|
|
|
-// video.setVideoUrl("http:" + url);
|
|
|
-// actorVideoService.save(video);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if (actor.getImageUrl() != null && actor.getImageUrl().size() > 0) {
|
|
|
+ for (String url : actor.getImageUrl()) {
|
|
|
+ ActorPhoto photo = new ActorPhoto();
|
|
|
+ photo.setActorId(actor.getId());
|
|
|
+ if (!Check.isNull(url)) {
|
|
|
+ if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ photo.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ actorPhotoService.save(photo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (actor.getVideoUrl() != null && actor.getVideoUrl().size() > 0) {
|
|
|
+ for (String url : actor.getVideoUrl()) {
|
|
|
+ ActorVideo video = new ActorVideo();
|
|
|
+ video.setActorId(actor.getId());
|
|
|
+ if (!Check.isNull(url)) {
|
|
|
+ if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ video.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ actorVideoService.save(video);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
result.success("添加成功!");
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|
|
@@ -267,6 +293,14 @@ public class ActorController {
|
|
|
if (actorEntity == null) {
|
|
|
result.error500("未找到对应实体");
|
|
|
} else {
|
|
|
+
|
|
|
+ String coverUrl = actor.getCoverUrl();
|
|
|
+ if (!Check.isNull(coverUrl)) {
|
|
|
+ if (!coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
|
|
|
+ actor.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
boolean ok = actorService.updateById(actor);
|
|
|
// ActorPhoto actorPhoto = new ActorPhoto();
|
|
|
// actorPhoto.setActorId(actor.getId());
|