|
@ -4,10 +4,14 @@ import cn.hutool.core.util.NumberUtil; |
|
|
import co.yixiang.api.ApiResult; |
|
|
import co.yixiang.api.ApiResult; |
|
|
import co.yixiang.common.bean.LocalUser; |
|
|
import co.yixiang.common.bean.LocalUser; |
|
|
import co.yixiang.domain.BaseDomain; |
|
|
import co.yixiang.domain.BaseDomain; |
|
|
|
|
|
import co.yixiang.modules.logging.aop.log.Log; |
|
|
|
|
|
import co.yixiang.modules.shop.domain.YxMaterial; |
|
|
|
|
|
import co.yixiang.modules.shop.service.YxMaterialService; |
|
|
import co.yixiang.modules.subject.domain.YxStoreSubjectNode; |
|
|
import co.yixiang.modules.subject.domain.YxStoreSubjectNode; |
|
|
import co.yixiang.modules.subject.domain.YxStoreSubjectNodeViews; |
|
|
import co.yixiang.modules.subject.domain.YxStoreSubjectNodeViews; |
|
|
import co.yixiang.modules.subject.service.YxStoreSubjectNodeService; |
|
|
import co.yixiang.modules.subject.service.YxStoreSubjectNodeService; |
|
|
import co.yixiang.modules.subject.service.YxStoreSubjectNodeViewsService; |
|
|
import co.yixiang.modules.subject.service.YxStoreSubjectNodeViewsService; |
|
|
|
|
|
import co.yixiang.modules.tools.domain.dto.QiniuTaskDTO; |
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.Api; |
|
|
import io.swagger.annotations.ApiOperation; |
|
|
import io.swagger.annotations.ApiOperation; |
|
@ -30,6 +34,8 @@ public class AppSubjectNodeController { |
|
|
private final YxStoreSubjectNodeService nodeService; |
|
|
private final YxStoreSubjectNodeService nodeService; |
|
|
private final YxStoreSubjectNodeViewsService nodeViewsService; |
|
|
private final YxStoreSubjectNodeViewsService nodeViewsService; |
|
|
|
|
|
|
|
|
|
|
|
private final YxMaterialService materialService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询商品分类") |
|
|
@ApiOperation(value = "查询商品分类") |
|
|
@GetMapping("/type/list") |
|
|
@GetMapping("/type/list") |
|
@ -94,4 +100,49 @@ public class AppSubjectNodeController { |
|
|
return ApiResult.ok(list); |
|
|
return ApiResult.ok(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("任务回调") |
|
|
|
|
|
@PostMapping("/notify/qiniu") |
|
|
|
|
|
public ApiResult<?> taskNotify(@RequestBody QiniuTaskDTO dto) { |
|
|
|
|
|
if(dto.getCode() != 0) { |
|
|
|
|
|
return ApiResult.ok(); |
|
|
|
|
|
} |
|
|
|
|
|
String key = dto.getInput().getKodo_file().getKey(); |
|
|
|
|
|
List<YxStoreSubjectNode> nodeList = nodeService.lambdaQuery().like(YxStoreSubjectNode::getVideoUrl, key).list(); |
|
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(nodeList)) { |
|
|
|
|
|
YxStoreSubjectNode yxStoreSubjectNode = nodeList.get(0); |
|
|
|
|
|
String videoUrl = yxStoreSubjectNode.getVideoUrl(); |
|
|
|
|
|
yxStoreSubjectNode.setVideoUrl(rename(videoUrl, "_transcode.mp4")); |
|
|
|
|
|
yxStoreSubjectNode.setPoster(rename(videoUrl, "_poster.jpg")); |
|
|
|
|
|
|
|
|
|
|
|
nodeService.updateById(yxStoreSubjectNode); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<YxMaterial> materialList = materialService.lambdaQuery().like(YxMaterial::getUrl, key).eq(YxMaterial::getType, "video").list(); |
|
|
|
|
|
if(CollectionUtils.isNotEmpty(materialList)) { |
|
|
|
|
|
YxMaterial yxMaterial = materialList.get(0); |
|
|
|
|
|
String url = yxMaterial.getUrl(); |
|
|
|
|
|
|
|
|
|
|
|
yxMaterial.setUrl(rename(url, "_transcode.mp4")); |
|
|
|
|
|
yxMaterial.setThumb(rename(url, "_poster.jpg")); |
|
|
|
|
|
|
|
|
|
|
|
materialService.updateById(yxMaterial); |
|
|
|
|
|
} |
|
|
|
|
|
return ApiResult.ok("我知道了"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String rename(String str, String ext) { |
|
|
|
|
|
int dotIndex = str.lastIndexOf('.'); |
|
|
|
|
|
if (dotIndex != -1) { |
|
|
|
|
|
String modifiedString = str.substring(0, dotIndex) + ext; |
|
|
|
|
|
return modifiedString; |
|
|
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
String modifiedString = str + ext; |
|
|
|
|
|
return modifiedString; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|