@@ -3,12 +3,15 @@ package com.iformall.controller.ai; | |||||
import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
import com.iformall.controller.BaseController; | import com.iformall.controller.BaseController; | ||||
import com.iformall.dto.GenerateVideoDTO; | import com.iformall.dto.GenerateVideoDTO; | ||||
import com.iformall.dto.PagePersonMouldDTO; | |||||
import com.iformall.dto.PageServiceVideoRecordDTO; | |||||
import com.iformall.dto.PreviewVideoDTO; | import com.iformall.dto.PreviewVideoDTO; | ||||
import com.iformall.service.AiVideoService; | import com.iformall.service.AiVideoService; | ||||
import com.iformall.sm.AiVideoParam; | import com.iformall.sm.AiVideoParam; | ||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.PostMapping; | import org.springframework.web.bind.annotation.PostMapping; | ||||
import org.springframework.web.bind.annotation.RequestBody; | import org.springframework.web.bind.annotation.RequestBody; | ||||
import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
@@ -33,4 +36,11 @@ public class AiVideoController extends BaseController { | |||||
public ResultData generateVideo(@RequestBody AiVideoParam aiVideoParam) { | public ResultData generateVideo(@RequestBody AiVideoParam aiVideoParam) { | ||||
return new ResultData(aiVideoService.generateVideo(aiVideoParam, getServiceId())); | return new ResultData(aiVideoService.generateVideo(aiVideoParam, getServiceId())); | ||||
} | } | ||||
@ApiOperation("分页查询生成记录列表") | |||||
@GetMapping("serviceVedioRecordPage") | |||||
public ResultData pagePersonMould(PageServiceVideoRecordDTO dto) { | |||||
dto.setServiceId(this.getServiceId()); | |||||
return new ResultData(aiVideoService.serviceVideoRecords(dto)); | |||||
} | |||||
} | } |
@@ -0,0 +1,18 @@ | |||||
package com.iformall.dto; | |||||
import com.iformall.domain.po.sm.ServiceVideoRecord; | |||||
import io.swagger.annotations.ApiModel; | |||||
import lombok.Data; | |||||
@ApiModel(value = "分页查询数字人模板请求参数") | |||||
@Data | |||||
public class PageServiceVideoRecordDTO extends PageDTO { | |||||
private Long serviceId; | |||||
public static ServiceVideoRecord mappingPO(PageServiceVideoRecordDTO dto) { | |||||
ServiceVideoRecord svr = new ServiceVideoRecord(); | |||||
svr.setServiceId(dto.getServiceId()); | |||||
return svr; | |||||
} | |||||
} |
@@ -1,11 +1,12 @@ | |||||
package com.iformall.service; | package com.iformall.service; | ||||
import com.iformall.dto.GenerateVideoDTO; | |||||
import com.iformall.dto.PreviewVideoDTO; | |||||
import com.iformall.dto.PageServiceVideoRecordDTO; | |||||
import com.iformall.sm.AiPreviewParam; | import com.iformall.sm.AiPreviewParam; | ||||
import com.iformall.sm.AiPreviewResult; | import com.iformall.sm.AiPreviewResult; | ||||
import com.iformall.sm.AiVideoParam; | import com.iformall.sm.AiVideoParam; | ||||
import com.iformall.sm.AiVideoResult; | import com.iformall.sm.AiVideoResult; | ||||
import com.iformall.vo.PageServiceVedioRecordVO; | |||||
import com.iformall.vo.PageVO; | |||||
/** | /** | ||||
* ai视频服务 | * ai视频服务 | ||||
@@ -24,4 +25,11 @@ public interface AiVideoService { | |||||
* @return {@link AiVideoResult} | * @return {@link AiVideoResult} | ||||
*/ | */ | ||||
AiVideoResult generateVideo(AiVideoParam aiVideoParam, Long serviceId); | AiVideoResult generateVideo(AiVideoParam aiVideoParam, Long serviceId); | ||||
/** | |||||
* 生成视频记录分页 | |||||
* @param dto | |||||
* @return | |||||
*/ | |||||
PageVO<PageServiceVedioRecordVO> serviceVideoRecords(PageServiceVideoRecordDTO dto); | |||||
} | } |
@@ -1,15 +1,27 @@ | |||||
package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
import com.github.pagehelper.PageInfo; | |||||
import com.iformall.common.CommonConstants; | import com.iformall.common.CommonConstants; | ||||
import com.iformall.domain.dto.sm.SaveServiceVideoRecordDTO; | import com.iformall.domain.dto.sm.SaveServiceVideoRecordDTO; | ||||
import com.iformall.domain.po.sm.PersonMould; | |||||
import com.iformall.domain.po.sm.ServiceInfo; | import com.iformall.domain.po.sm.ServiceInfo; | ||||
import com.iformall.domain.po.sm.ServiceVideoRecord; | |||||
import com.iformall.dto.GenerateVideoDTO; | import com.iformall.dto.GenerateVideoDTO; | ||||
import com.iformall.dto.PagePersonMouldDTO; | |||||
import com.iformall.dto.PageServiceVideoRecordDTO; | |||||
import com.iformall.enums.sm.EnumThirdPartyType; | import com.iformall.enums.sm.EnumThirdPartyType; | ||||
import com.iformall.service.AiVideoService; | import com.iformall.service.AiVideoService; | ||||
import com.iformall.service.sm.ServiceInfoService; | import com.iformall.service.sm.ServiceInfoService; | ||||
import com.iformall.service.sm.ServiceVideoRecordService; | import com.iformall.service.sm.ServiceVideoRecordService; | ||||
import com.iformall.sm.*; | import com.iformall.sm.*; | ||||
import com.iformall.utils.Base64Util; | import com.iformall.utils.Base64Util; | ||||
import com.iformall.vo.PagePersonMouldVO; | |||||
import com.iformall.vo.PageServiceVedioRecordVO; | |||||
import com.iformall.vo.PageVO; | |||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
@@ -56,4 +68,11 @@ public class AiVideoServiceImpl implements AiVideoService { | |||||
} | } | ||||
return video; | return video; | ||||
} | } | ||||
@Override | |||||
public PageVO<PageServiceVedioRecordVO> serviceVideoRecords(PageServiceVideoRecordDTO dto) { | |||||
PageInfo<ServiceVideoRecord> personMouldPage = serviceVideoRecordService.listAsPage(PageServiceVideoRecordDTO.mappingPO(dto), dto.getPageNum(), dto.getPageSize()); | |||||
List<PageServiceVedioRecordVO> result = personMouldPage.getList().stream().map(PageServiceVedioRecordVO::mapping).collect(Collectors.toList()); | |||||
return PageVO.build(personMouldPage.getTotal(), result); | |||||
} | |||||
} | } |
@@ -0,0 +1,28 @@ | |||||
package com.iformall.vo; | |||||
import java.util.Date; | |||||
import com.iformall.domain.po.sm.ServiceVideoRecord; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
@ApiModel(value = "分页查询数字人模板返回数据") | |||||
@Data | |||||
public class PageServiceVedioRecordVO { | |||||
@ApiModelProperty("接入商标识") | |||||
private Long serviceId; | |||||
@ApiModelProperty("视频时长") | |||||
private String videoTime; | |||||
@ApiModelProperty("创建时间") | |||||
private Date createDate; | |||||
public static PageServiceVedioRecordVO mapping(ServiceVideoRecord serviceVideoRecord) { | |||||
PageServiceVedioRecordVO vo = new PageServiceVedioRecordVO(); | |||||
vo.setServiceId(serviceVideoRecord.getServiceId()); | |||||
vo.setVideoTime(serviceVideoRecord.getVideoTime()); | |||||
vo.setCreateDate(serviceVideoRecord.getCreateTime()); | |||||
return vo; | |||||
} | |||||
} |
@@ -5,4 +5,5 @@ import com.iformall.domain.po.sm.ServiceInfo; | |||||
import com.iformall.domain.po.sm.ServiceVideoRecord; | import com.iformall.domain.po.sm.ServiceVideoRecord; | ||||
public interface ServiceVideoRecordMapper extends CommonMapper<ServiceVideoRecord, Long> { | public interface ServiceVideoRecordMapper extends CommonMapper<ServiceVideoRecord, Long> { | ||||
} | } |
@@ -1,6 +1,8 @@ | |||||
package com.iformall.service.sm; | package com.iformall.service.sm; | ||||
import com.github.pagehelper.PageInfo; | |||||
import com.iformall.domain.dto.sm.SaveServiceVideoRecordDTO; | import com.iformall.domain.dto.sm.SaveServiceVideoRecordDTO; | ||||
import com.iformall.domain.po.sm.ServiceVideoRecord; | |||||
/** | /** | ||||
* @author xmzhao71 | * @author xmzhao71 | ||||
@@ -12,4 +14,8 @@ public interface ServiceVideoRecordService { | |||||
* @param dto | * @param dto | ||||
*/ | */ | ||||
void saveServiceVideoRecord(SaveServiceVideoRecordDTO dto); | void saveServiceVideoRecord(SaveServiceVideoRecordDTO dto); | ||||
PageInfo<ServiceVideoRecord> listAsPage(ServiceVideoRecord record, Integer pageIndex, Integer pageSize); | |||||
} | } |
@@ -1,6 +1,10 @@ | |||||
package com.iformall.service.sm.impl; | package com.iformall.service.sm.impl; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.github.pagehelper.PageHelper; | |||||
import com.github.pagehelper.PageInfo; | |||||
import com.iformall.domain.dto.sm.SaveServiceVideoRecordDTO; | import com.iformall.domain.dto.sm.SaveServiceVideoRecordDTO; | ||||
import com.iformall.domain.po.sm.ServiceVideoRecord; | |||||
import com.iformall.mapper.ServiceVideoRecordMapper; | import com.iformall.mapper.ServiceVideoRecordMapper; | ||||
import com.iformall.service.sm.ServiceVideoRecordService; | import com.iformall.service.sm.ServiceVideoRecordService; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
@@ -16,4 +20,10 @@ public class ServiceVideoRecordServiceImpl implements ServiceVideoRecordService | |||||
public void saveServiceVideoRecord(SaveServiceVideoRecordDTO dto) { | public void saveServiceVideoRecord(SaveServiceVideoRecordDTO dto) { | ||||
serviceVideoRecordMapper.insert(SaveServiceVideoRecordDTO.mapping(dto)); | serviceVideoRecordMapper.insert(SaveServiceVideoRecordDTO.mapping(dto)); | ||||
} | } | ||||
@Override | |||||
public PageInfo<ServiceVideoRecord> listAsPage(ServiceVideoRecord record, Integer pageIndex, Integer pageSize) { | |||||
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> serviceVideoRecordMapper | |||||
.selectList(new LambdaQueryWrapper<ServiceVideoRecord>().eq(ServiceVideoRecord::getServiceId, record.getServiceId()).orderByDesc(ServiceVideoRecord::getCreateTime))); | |||||
} | |||||
} | } |