@@ -0,0 +1,2 @@ | |||||
ALTER TABLE `mallink_suimang_test`.`voice_material` | |||||
ADD COLUMN `type` int NULL COMMENT '1-上传、2-录音' AFTER `type`; |
@@ -0,0 +1,2 @@ | |||||
ALTER TABLE `mallink_suimang_test`.`photo_speak_video` | |||||
ADD COLUMN `save_dir` varchar(255) NULL COMMENT '超分的视频路径' AFTER `music_id`; |
@@ -0,0 +1,8 @@ | |||||
ALTER TABLE `mallink_suimang_test`.`photo_speak_video` | |||||
ADD COLUMN `video_hy_status` smallint DEFAULT 0 NULL COMMENT '视频超分状态' AFTER `video_status`; | |||||
ALTER TABLE `mallink_suimang_test`.`voice_info` | |||||
ADD COLUMN `age_type` smallint NULL COMMENT '年纪类型 EnumAgeType' AFTER `sex`; | |||||
ALTER TABLE `mallink_suimang_test`.`photo_speak_video` | |||||
ADD COLUMN `is_hy` smallint NULL DEFAULT 0 COMMENT '是否超分(1、是,2、否)' AFTER `video_hy_status`, |
@@ -6,11 +6,10 @@ import com.iformall.annotation.AuthIgnore; | |||||
import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
import com.iformall.domain.po.sm.MusicInfo; | |||||
import com.iformall.domain.po.sm.PhotoSpeakVideo; | |||||
import com.iformall.domain.po.sm.UserMouldVideo; | |||||
import com.iformall.domain.po.sm.VoiceInfo; | |||||
import com.iformall.domain.po.sm.*; | |||||
import com.iformall.enums.EnumMouldSendType; | |||||
import com.iformall.enums.EnumVideoStatus; | import com.iformall.enums.EnumVideoStatus; | ||||
import com.iformall.enums.EnumaMouldPatchStatus; | |||||
import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
import com.iformall.service.sm.*; | import com.iformall.service.sm.*; | ||||
import com.iformall.video.VideoFactory; | import com.iformall.video.VideoFactory; | ||||
@@ -64,6 +63,9 @@ public class PhotoSpeakVideoController extends BaseController { | |||||
@Autowired | @Autowired | ||||
private MusicInfoService musicInfoService; | private MusicInfoService musicInfoService; | ||||
@Autowired | |||||
private VoiceMaterialService voiceMaterialService; | |||||
@ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
@GetMapping("list") | @GetMapping("list") | ||||
@ApiImplicitParams({ | @ApiImplicitParams({ | ||||
@@ -94,6 +96,10 @@ public class PhotoSpeakVideoController extends BaseController { | |||||
VoiceInfo voiceInfo = voiceInfoService.getById(photoSpeakVideo.getVoiceMouldId()); | VoiceInfo voiceInfo = voiceInfoService.getById(photoSpeakVideo.getVoiceMouldId()); | ||||
photoSpeakVideo.setVoiceInfo(voiceInfo); | photoSpeakVideo.setVoiceInfo(voiceInfo); | ||||
} | } | ||||
if(photoSpeakVideo.getVoiceMaterialId() != null){ | |||||
VoiceMaterial voiceMaterial = voiceMaterialService.getById(photoSpeakVideo.getVoiceMaterialId()); | |||||
photoSpeakVideo.setVoiceMaterial(voiceMaterial); | |||||
} | |||||
return new ResultData(photoSpeakVideo); | return new ResultData(photoSpeakVideo); | ||||
} | } | ||||
@@ -301,10 +307,103 @@ public class PhotoSpeakVideoController extends BaseController { | |||||
@AuthIgnore | @AuthIgnore | ||||
@GetMapping(value = "/music") | @GetMapping(value = "/music") | ||||
@ApiImplicitParams({ | |||||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
@ApiOperation("获取默认音乐") | @ApiOperation("获取默认音乐") | ||||
public ResultData music() { | |||||
List<MusicInfo> music = musicInfoService.music(); | |||||
public ResultData music(@ModelAttribute MusicInfo record, Integer pageNum, Integer pageSize) { | |||||
logger.debug("[" + getIpAddr() + "] UserMouldVideoController::userList"); | |||||
if (record == null) record = new MusicInfo(); | |||||
PageInfo<MusicInfo> music = musicInfoService.music(pageNum, pageSize, record); | |||||
return new ResultData(music); | |||||
} | |||||
@GetMapping(value = "/userMusic") | |||||
@ApiImplicitParams({ | |||||
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
@ApiOperation("获取用户音乐") | |||||
public ResultData userMusic(@ModelAttribute MusicInfo record, Integer pageNum, Integer pageSize) { | |||||
logger.debug("[" + getIpAddr() + "] UserMouldVideoController::userMusic"); | |||||
if (record == null) record = new MusicInfo(); | |||||
record.setUserId(getMemberId()); | |||||
PageInfo<MusicInfo> music = musicInfoService.userMusic(pageNum, pageSize, record); | |||||
return new ResultData(music); | return new ResultData(music); | ||||
} | } | ||||
@ApiOperation("新增接口") | |||||
@PostMapping("/save") | |||||
public ResultData save(@RequestBody MusicInfo record) { | |||||
logger.debug("[" + getIpAddr() + "] UserMouldVideoController::save"); | |||||
if (record == null) record = new MusicInfo(); | |||||
record.setType(EnumMouldSendType.build.getCode()); | |||||
record.setUserId(getMemberId()); | |||||
if (record.getTitle() == null) { | |||||
record.setTitle("用户自建"); | |||||
} | |||||
return musicInfoService.saveOrUpdate(record); | |||||
} | |||||
@ApiOperation("根据id删除接口") | |||||
@GetMapping("/delete") | |||||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
public ResultData delete(Long id) { | |||||
logger.debug("[" + getIpAddr() + "] PersonPhotoController::delete"); | |||||
if(id == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"参数为空"); | |||||
} | |||||
MusicInfo musicInfo = musicInfoService.getById(id); | |||||
if(musicInfo == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到数据"); | |||||
} | |||||
if(!musicInfo.getUserId().equals(getMemberId())){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到用户数据"); | |||||
} | |||||
musicInfoService.deleteById(id); | |||||
return new ResultData(); | |||||
} | |||||
@ApiOperation("视频超分") | |||||
@GetMapping("/videoHy") | |||||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
public ResultData videoHy(Long id) { | |||||
logger.debug("[" + getIpAddr() + "] PersonPhotoController::videoHy"); | |||||
if(id == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"参数为空"); | |||||
} | |||||
PhotoSpeakVideo speakVideo = photoSpeakVideoService.getById(id); | |||||
if(speakVideo == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到数据"); | |||||
} | |||||
if (StringUtils.isEmpty(speakVideo.getSaveDir())){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"save_dir为空"); | |||||
} | |||||
if(!speakVideo.getUserId().equals(getMemberId())){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到用户数据"); | |||||
} | |||||
if(!EnumVideoStatus.upload_success.getCode().equals(speakVideo.getVideoStatus())){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"原始视频生成未完成"); | |||||
} | |||||
if(EnumVideoStatus.ing.getCode().equals(speakVideo.getVideoHyStatus()) | |||||
|| EnumVideoStatus.success.getCode().equals(speakVideo.getVideoHyStatus()) | |||||
|| EnumVideoStatus.upload_ing.getCode().equals(speakVideo.getVideoHyStatus()) | |||||
|| EnumVideoStatus.upload_fail.getCode().equals(speakVideo.getVideoHyStatus())){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"高清晰度视频生成中"); | |||||
} | |||||
if(EnumVideoStatus.upload_success.getCode().equals(speakVideo.getVideoHyStatus())){ | |||||
//上传阿里云状态 生成成功 | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"高清晰度视频已生成完成"); | |||||
} | |||||
speakVideo.setVideoStatus(EnumVideoStatus.ing.getCode()); | |||||
speakVideo.setVideoMsg(""); | |||||
speakVideo.setUpdateDate(new Date()); | |||||
photoSpeakVideoService.updateById(speakVideo); | |||||
photoSpeakVideoService.videoHy(speakVideo,true); | |||||
return new ResultData(); | |||||
} | |||||
} | } |
@@ -0,0 +1,107 @@ | |||||
package com.iformall.controller; | |||||
import com.alibaba.fastjson.JSONObject; | |||||
import com.iformall.common.ErrorCode; | |||||
import com.iformall.common.ResultData; | |||||
import com.iformall.domain.po.sm.PhotoSpeakVideo; | |||||
import com.iformall.domain.po.sm.PreviewParam; | |||||
import com.iformall.enums.EnumVideoStatus; | |||||
import com.iformall.service.sm.PhotoSpeakVideoService; | |||||
import com.iformall.service.sm.PersonPhotoService; | |||||
import com.iformall.service.sm.VoiceInfoService; | |||||
import com.iformall.sm.AiPreviewParam; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiImplicitParam; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
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 java.util.Date; | |||||
/** | |||||
* 对外开放的 API 接口 | |||||
*/ | |||||
@RestController | |||||
@RequestMapping("/api/open") | |||||
@Api(description = "对外开放的 API 接口") | |||||
public class SDKController extends BaseController { | |||||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
@Autowired | |||||
private PersonPhotoService personPhotoService; | |||||
@Autowired | |||||
private VoiceInfoService voiceInfoService; | |||||
@Autowired | |||||
private PhotoSpeakVideoService photoSpeakVideoService; | |||||
@ApiOperation("图片质量审核接口") | |||||
@PostMapping("checkPhoto") | |||||
@ApiImplicitParam(name = "material", value = "material", dataType = "String", paramType = "query", required = true) | |||||
public ResultData checkPhoto(String material) { | |||||
logger.debug("[" + getIpAddr() + "] SDKController::checkPhoto"); | |||||
if (StringUtils.isBlank(material)) { | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "素材为空"); | |||||
} | |||||
ResultData data = personPhotoService.checkPhoto(material); | |||||
if (data.code == 2000) { | |||||
return new ResultData(); | |||||
} | |||||
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), data.message); | |||||
} | |||||
@ApiOperation("TTS音色预览") | |||||
@PostMapping("/preview") | |||||
public ResultData voicePreview(@RequestBody PreviewParam previewParam) { | |||||
logger.debug("[" + getIpAddr() + "] SDKController::voicePreview"); | |||||
if (previewParam.getVoiceId() == null) { | |||||
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "音色ID不能为空"); | |||||
} | |||||
if (StringUtils.isBlank(previewParam.getGenTxt())) { | |||||
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "需要生成的文字不能为空"); | |||||
} | |||||
AiPreviewParam param = new AiPreviewParam(); | |||||
param.setVoice_id(previewParam.getVoiceId()); | |||||
param.setVoice_style(previewParam.getVoiceStyle()); | |||||
param.setGen_txt(previewParam.getGenTxt()); | |||||
param.setGender(previewParam.getGender()); | |||||
return new ResultData(voiceInfoService.voicePreview(param)); | |||||
} | |||||
@ApiOperation("生成视频") | |||||
@PostMapping("/createVideo") | |||||
public ResultData create(@RequestBody PhotoSpeakVideo record) { | |||||
logger.debug("[" + getIpAddr() + "] MouldPatchController::saveOrUpdate"); | |||||
if (record.getId() == null) { | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
} | |||||
PhotoSpeakVideo mouldVideo = photoSpeakVideoService.getById(record.getId()); | |||||
logger.info("TEST--" + JSONObject.toJSONString(mouldVideo)); | |||||
if (mouldVideo == null || !mouldVideo.getUserId().equals(getMemberId())) { | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "未找到用户数据"); | |||||
} | |||||
if (EnumVideoStatus.ing.getCode().equals(mouldVideo.getVideoStatus()) | |||||
|| EnumVideoStatus.success.getCode().equals(mouldVideo.getVideoStatus()) | |||||
|| EnumVideoStatus.upload_ing.getCode().equals(mouldVideo.getVideoStatus()) | |||||
|| EnumVideoStatus.upload_fail.getCode().equals(mouldVideo.getVideoStatus())) { | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "视频生成中"); | |||||
} | |||||
if (EnumVideoStatus.upload_success.getCode().equals(mouldVideo.getVideoStatus())) { | |||||
//上传阿里云状态 生成成功 | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "视频已生成完成"); | |||||
} | |||||
PhotoSpeakVideo mouldVideoUpd = new PhotoSpeakVideo(); | |||||
mouldVideoUpd.setId(record.getId()); | |||||
mouldVideoUpd.setVideoStatus(EnumVideoStatus.ing.getCode()); | |||||
mouldVideoUpd.setVideoMsg(""); | |||||
mouldVideoUpd.setCreateVideoDate(new Date()); | |||||
photoSpeakVideoService.saveOrUpdate(mouldVideoUpd); | |||||
photoSpeakVideoService.createVideo(mouldVideo, true); | |||||
return new ResultData(); | |||||
} | |||||
} |
@@ -69,7 +69,7 @@ public class VoiceMaterialController extends BaseController { | |||||
public ResultData save(@RequestBody VoiceMaterial record) { | public ResultData save(@RequestBody VoiceMaterial record) { | ||||
logger.debug("[" + getIpAddr() + "] VoiceMaterialController::save"); | logger.debug("[" + getIpAddr() + "] VoiceMaterialController::save"); | ||||
if(record == null)record = new VoiceMaterial(); | if(record == null)record = new VoiceMaterial(); | ||||
record.setSendType(EnumMouldSendType.build.getCode()); | |||||
// record.setSendType(EnumMouldSendType.build.getCode()); | |||||
record.setUserId(getMemberId()); | record.setUserId(getMemberId()); | ||||
if(StringUtils.isBlank(record.getVideoId())){ | if(StringUtils.isBlank(record.getVideoId())){ | ||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"音频为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"音频为空"); | ||||
@@ -77,6 +77,9 @@ public class VoiceMaterialController extends BaseController { | |||||
if(record.getTitle() == null){ | if(record.getTitle() == null){ | ||||
record.setTitle("用户自建"); | record.setTitle("用户自建"); | ||||
} | } | ||||
if(record.getSendType() == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"上传音频类型不能为空"); | |||||
} | |||||
record.setPrice(0); | record.setPrice(0); | ||||
record.setSalePrice(0); | record.setSalePrice(0); | ||||
record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | record.setStatus(EnumaMouldPatchStatus.put_on.getCode()); | ||||
@@ -12,6 +12,7 @@ import com.iformall.service.*; | |||||
import com.iformall.service.cuser.CUserServiceFactory; | import com.iformall.service.cuser.CUserServiceFactory; | ||||
import com.iformall.service.sm.InviteCodeInfoService; | import com.iformall.service.sm.InviteCodeInfoService; | ||||
import com.iformall.service.sm.InviteCodeService; | import com.iformall.service.sm.InviteCodeService; | ||||
import com.iformall.service.sm.UserConsumptionPackageService; | |||||
import com.iformall.service.sm.UserCreateVideoNumService; | import com.iformall.service.sm.UserCreateVideoNumService; | ||||
import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
import com.iformall.utils.PasswordHelper; | import com.iformall.utils.PasswordHelper; | ||||
@@ -95,6 +96,9 @@ public class WxUserGrantController extends BaseController { | |||||
@Autowired | @Autowired | ||||
private InviteCodeInfoService inviteCodeInfoService; | private InviteCodeInfoService inviteCodeInfoService; | ||||
@Autowired | |||||
private UserConsumptionPackageService userConsumptionPackageService; | |||||
@AuthIgnore | @AuthIgnore | ||||
@ApiOperation("验证码") | @ApiOperation("验证码") | ||||
@GetMapping("/captcha.jpg") | @GetMapping("/captcha.jpg") | ||||
@@ -361,6 +365,7 @@ public class WxUserGrantController extends BaseController { | |||||
// } | // } | ||||
// if(isValidCode) { | // if(isValidCode) { | ||||
basicInfo = wxCUserBasicInfoService.register(getTenantInfo(),phone,password); | basicInfo = wxCUserBasicInfoService.register(getTenantInfo(),phone,password); | ||||
Boolean aBoolean = userCreateVideoNumService.initializationUserCreateVideoNum(basicInfo.getId()); | Boolean aBoolean = userCreateVideoNumService.initializationUserCreateVideoNum(basicInfo.getId()); | ||||
if (!aBoolean){ | if (!aBoolean){ | ||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "初始化创建视频时间表失败"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "初始化创建视频时间表失败"); | ||||
@@ -409,6 +414,7 @@ public class WxUserGrantController extends BaseController { | |||||
// } | // } | ||||
// if(isValidCode) { | // if(isValidCode) { | ||||
basicInfo = wxCUserBasicInfoService.registerEmail(getTenantInfo(),email,password); | basicInfo = wxCUserBasicInfoService.registerEmail(getTenantInfo(),email,password); | ||||
Boolean aBoolean = userCreateVideoNumService.initializationUserCreateVideoNum(basicInfo.getId()); | Boolean aBoolean = userCreateVideoNumService.initializationUserCreateVideoNum(basicInfo.getId()); | ||||
if (!aBoolean){ | if (!aBoolean){ | ||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "初始化创建视频时间表失败"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "初始化创建视频时间表失败"); | ||||
@@ -709,4 +715,12 @@ public class WxUserGrantController extends BaseController { | |||||
return new ResultData(userBasicInfo); | return new ResultData(userBasicInfo); | ||||
} | } | ||||
@AuthIgnore | |||||
@ApiOperation("套餐档次查询") | |||||
@GetMapping("/getPackageInfo") | |||||
public ResultData getPackageInfo() { | |||||
logger.debug("[" + getIpAddr() + "] WxUserGrantController::getPackageInfo"); | |||||
return new ResultData(userConsumptionPackageService.getPackageInfo()); | |||||
} | |||||
} | } |
@@ -112,26 +112,49 @@ public class PhotoSpeakSchedule { | |||||
/** | /** | ||||
* 统计用户创建视频成功的时长 | |||||
* 获取超分时长和大小 | |||||
*/ | */ | ||||
@Scheduled(cron = "0 */30 * * * *?") // 每半小时检查一次 | |||||
public void userCreateVideoTimeSchedule() { | |||||
List<PhotoSpeakVideo> videos = photoSpeakVideoService.getUploadSuccessList(); | |||||
@Scheduled(cron = "0 1/5 * * * *?") // 每五分钟检查一次 | |||||
public void userVideoHyDetailSchedule() { | |||||
List<PhotoSpeakVideo> videos = photoSpeakVideoService.getUpLoadHyIngList(); | |||||
if (videos != null && videos.size() > 0) { | if (videos != null && videos.size() > 0) { | ||||
HashMap<Long, Long> map = new HashMap<>(); | |||||
for (PhotoSpeakVideo video : videos) { | for (PhotoSpeakVideo video : videos) { | ||||
try { | try { | ||||
if (map.get(video.getUserId()) == null) { | |||||
map.put(video.getUserId(), Long.parseLong(video.getVideoTime())); | |||||
} else { | |||||
Long time = map.get(video.getUserId()); | |||||
map.put(video.getUserId(), Long.parseLong(video.getVideoTime()) + time); | |||||
VideUploadResult videoDetail = videoFactory.getExcutor(videoType).getVideoDetailWithCache(video.getVideoId()); | |||||
if (videoDetail.isSuccess() | |||||
&& StringUtils.isNotBlank(videoDetail.getDuration()) | |||||
&& !"0.0".equals(videoDetail.getDuration())) { | |||||
video.setCoverImg(videoDetail.getCoverURL()); | |||||
video.setVideoPlayUrl(videoDetail.getVideoUrl()); | |||||
video.setVideoTime(videoDetail.getDuration()); | |||||
video.setVideoSize(videoDetail.getSize()); | |||||
video.setVideoHyStatus(EnumVideoStatus.upload_success.getCode()); | |||||
photoSpeakVideoService.updateById(video); | |||||
} | } | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
logger.error("TtCouponVideoSchedule error.couponVideoSchedule:" + video.getId(), e); | |||||
logger.error("TtCouponVideoSchedule error.couponVideoSchedule:"+video.getId(),e); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
/** | |||||
* 超分生成视频 | |||||
*/ | |||||
@Scheduled(cron = "0 20/30 * * * *?") // 每半小时检查一次 | |||||
public void photoSpeakCreateHySchedule() { | |||||
PhotoSpeakVideo videoUpd = new PhotoSpeakVideo(); | |||||
videoUpd.setVideoStartDate(DateUtils.getHourDateBefore(2,new Date())); | |||||
videoUpd.setVideoHyStatus(EnumVideoStatus.fail.getCode()); | |||||
List<PhotoSpeakVideo> list = photoSpeakVideoService.findList(videoUpd); | |||||
if (list != null && list.size() > 0) { | |||||
for (PhotoSpeakVideo video : list) { | |||||
try { | |||||
photoSpeakVideoService.videoHy(video,false); | |||||
} catch (Exception e) { | |||||
logger.error("TtCouponVideoSchedule error.couponVideoSchedule:"+video.getId(),e); | |||||
} | } | ||||
} | } | ||||
userCreateVideoNumService.uploadUserCreateVideoNum(map); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -215,6 +215,10 @@ public class WxCUserBasicInfo extends TenantEntityWithoutFinalTenantId { | |||||
@io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | @io.swagger.annotations.ApiModelProperty(value="操作人ID",name="operatorId") | ||||
private Long operatorId; | private Long operatorId; | ||||
@TableField(exist = false) | |||||
@io.swagger.annotations.ApiModelProperty(value="套餐类型(1、基础版,2、专业版,3、加强版)",name="packageType") | |||||
private Integer packageType; | |||||
public void protectInfos() { | public void protectInfos() { | ||||
if(StringUtils.isNotBlank(this.password)) { | if(StringUtils.isNotBlank(this.password)) { | ||||
setPassword("保密"); | setPassword("保密"); | ||||
@@ -1,34 +1,36 @@ | |||||
package com.iformall.domain.po.sm; | package com.iformall.domain.po.sm; | ||||
import com.baomidou.mybatisplus.annotation.TableField; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | import com.baomidou.mybatisplus.annotation.TableId; | ||||
import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.io.Serializable; | import java.io.Serializable; | ||||
import com.iformall.domain.po.base.TenantEntity; | |||||
import lombok.Data; | import lombok.Data; | ||||
/** | |||||
* @Description | |||||
* @Author LRH | |||||
* @Date 2023-06-13 | |||||
*/ | |||||
@Data | @Data | ||||
@TableName("music_info" ) | @TableName("music_info" ) | ||||
public class MusicInfo implements Serializable { | |||||
private static final long serialVersionUID = 6934358084213154592L; | |||||
public class MusicInfo extends TenantEntity { | |||||
/** | /** | ||||
* 主键ID | * 主键ID | ||||
*/ | */ | ||||
@TableId | |||||
private Integer id; | |||||
private Long id; | |||||
/** | /** | ||||
* 音乐名称 | * 音乐名称 | ||||
*/ | */ | ||||
private String name; | private String name; | ||||
private Long userId; | |||||
/** | |||||
* 类型(1、系统音乐,2、用户上传) | |||||
*/ | |||||
private Integer type; | |||||
/** | /** | ||||
* 音乐链接 | * 音乐链接 | ||||
*/ | */ | ||||
@@ -37,12 +39,12 @@ public class MusicInfo implements Serializable { | |||||
/** | /** | ||||
* 音乐大小 | * 音乐大小 | ||||
*/ | */ | ||||
private Integer size; | |||||
private Long size; | |||||
/** | /** | ||||
* 音乐时长(s) | * 音乐时长(s) | ||||
*/ | */ | ||||
private Integer time; | |||||
private Double time; | |||||
/** | /** | ||||
* 创建时间 | * 创建时间 | ||||
@@ -59,4 +61,9 @@ public class MusicInfo implements Serializable { | |||||
*/ | */ | ||||
private Integer isDel; | private Integer isDel; | ||||
private String title; | |||||
@TableField(exist = false) | |||||
private String voiceId; | |||||
} | } |
@@ -152,5 +152,11 @@ public class PhotoSpeakVideo extends TenantEntity { | |||||
private List<Integer> videoStatuss; | private List<Integer> videoStatuss; | ||||
private Long musicId; | private Long musicId; | ||||
private String saveDir; | |||||
private Integer videoHyStatus; | |||||
private Integer isHy;//是否超分(1、是,0、否) | |||||
} | } |
@@ -0,0 +1,11 @@ | |||||
package com.iformall.domain.po.sm; | |||||
import lombok.Data; | |||||
@Data | |||||
public class PreviewParam { | |||||
private String genTxt; | |||||
private String voiceId; | |||||
private String voiceStyle; | |||||
private String gender; | |||||
} |
@@ -0,0 +1,122 @@ | |||||
package com.iformall.domain.po.sm; | |||||
import com.baomidou.mybatisplus.annotation.TableField; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.util.Date; | |||||
import java.io.Serializable; | |||||
import lombok.Data; | |||||
import java.math.BigDecimal; | |||||
import java.util.List; | |||||
/** | |||||
* @Description | |||||
* @Author LRH | |||||
* @Date 2023-06-15 | |||||
*/ | |||||
@Data | |||||
@TableName("user_consumption_package" ) | |||||
public class UserConsumptionPackage implements Serializable { | |||||
private static final long serialVersionUID = 7987400196899039170L; | |||||
/** | |||||
* 主键ID | |||||
*/ | |||||
@TableId | |||||
private Integer id; | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private String tenantId; | |||||
/** | |||||
* 父租户ID | |||||
*/ | |||||
private String parentTenantId; | |||||
/** | |||||
* 套餐类型(1、基础版,2、专业版,3、加强版) | |||||
*/ | |||||
private Integer type; | |||||
@TableField(exist = false) | |||||
private String typeDesc; | |||||
/** | |||||
* 英文名字 | |||||
*/ | |||||
private String englishName; | |||||
/** | |||||
* 美元 | |||||
*/ | |||||
private BigDecimal dollar; | |||||
/** | |||||
* 人民币 | |||||
*/ | |||||
private BigDecimal rmb; | |||||
/** | |||||
* 积分 | |||||
*/ | |||||
private Integer credit; | |||||
/** | |||||
* 有效期时长(天) | |||||
*/ | |||||
private Integer validityDuration; | |||||
/** | |||||
* 邀请用户送的积分 | |||||
*/ | |||||
private Integer inviteUserCredit; | |||||
/** | |||||
* 照片说话单价(积分) | |||||
*/ | |||||
private Integer videoPrice; | |||||
/** | |||||
* ai生成照片单价(积分) | |||||
*/ | |||||
private Integer photoPrice; | |||||
/** | |||||
* 口播的单价(积分) | |||||
*/ | |||||
private Integer talkPrice; | |||||
/** | |||||
* 照片说话单价、口播的单价收费时长 | |||||
*/ | |||||
private Integer chargeTime; | |||||
/** | |||||
* 创建时间 | |||||
*/ | |||||
private Date createDate; | |||||
/** | |||||
* 更新时间 | |||||
*/ | |||||
private Date updateDate; | |||||
/** | |||||
* 是否删除1是0否 | |||||
*/ | |||||
private Integer isDel; | |||||
/** | |||||
* 套餐颜色 | |||||
*/ | |||||
private String color; | |||||
/** | |||||
* 详细配置信息 | |||||
*/ | |||||
@TableField(exist = false) | |||||
List<UserPackageDetail> userPackageDetails; | |||||
} |
@@ -1,77 +1,126 @@ | |||||
package com.iformall.domain.po.sm; | package com.iformall.domain.po.sm; | ||||
import com.baomidou.mybatisplus.annotation.TableId; | import com.baomidou.mybatisplus.annotation.TableId; | ||||
import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
import java.util.Date; | |||||
import java.io.Serializable; | |||||
import lombok.Data; | import lombok.Data; | ||||
import java.io.Serializable; | |||||
import java.util.Date; | |||||
/** | /** | ||||
* @author LRH | |||||
* @date Wed Jun 07 17:06:17 CST 2023 | |||||
* @describe 用户创建视频时间表 | |||||
* @Description | |||||
* @Author LRH | |||||
* @Date 2023-06-15 | |||||
*/ | */ | ||||
@Data | @Data | ||||
@TableName("user_create_video_num") | |||||
@TableName("user_create_video_num" ) | |||||
public class UserCreateVideoNum implements Serializable { | public class UserCreateVideoNum implements Serializable { | ||||
private static final long serialVersionUID = 6845742086152117203L; | |||||
/** | |||||
* 主键ID | |||||
*/ | |||||
private static final long serialVersionUID = 4995993777308528646L; | |||||
/** | |||||
* 主键ID | |||||
*/ | |||||
@TableId | @TableId | ||||
private Long id; | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private String tenantId; | |||||
/** | |||||
* 父租户ID | |||||
*/ | |||||
private String parentTenantId; | |||||
/** | |||||
* 用户id(wx_c_user_basic_info.id) | |||||
*/ | |||||
private Long userId; | |||||
/** | |||||
* 剩余条数 | |||||
*/ | |||||
private Integer residueNum; | |||||
/** | |||||
* 总条数 | |||||
*/ | |||||
private Integer residueTotal; | |||||
/** | |||||
* 用户生成视频的个数 | |||||
*/ | |||||
private Integer createNum; | |||||
/** | |||||
* 用户生成视频的总时长(s) | |||||
*/ | |||||
private Long createAllTime; | |||||
/** | |||||
* 总时长(单位:s) | |||||
*/ | |||||
private Long totalTime; | |||||
/** | |||||
* 剩余时长(单位:s) | |||||
*/ | |||||
private Long residueTime; | |||||
/** | |||||
* 有效期 | |||||
*/ | |||||
private Date effectiveDate; | |||||
/** | |||||
* 创建时间 | |||||
*/ | |||||
private Date createDate; | |||||
/** | |||||
* 更新时间 | |||||
*/ | |||||
private Date updateDate; | |||||
/** | |||||
* 是否删除1是0否 | |||||
*/ | |||||
private long isDel; | |||||
private Long id; | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private String tenantId; | |||||
/** | |||||
* 父租户ID | |||||
*/ | |||||
private String parentTenantId; | |||||
/** | |||||
* 用户id(wx_c_user_basic_info.id) | |||||
*/ | |||||
private Long userId; | |||||
/** | |||||
* 套餐id(user_consumption_package.id) | |||||
*/ | |||||
private Integer packageId; | |||||
/** | |||||
* 剩余条数 | |||||
*/ | |||||
private Integer residueNum; | |||||
/** | |||||
* 总条数 | |||||
*/ | |||||
private Integer residueTotal; | |||||
/** | |||||
* 用户生成视频的个数 | |||||
*/ | |||||
private Integer createNum; | |||||
/** | |||||
* 用户生成视频的总时长(s) | |||||
*/ | |||||
private float createAllTime; | |||||
/** | |||||
* 用户拥有总时长(单位:s) | |||||
*/ | |||||
private Long totalTime; | |||||
/** | |||||
* 用户剩余时长(单位:s) | |||||
*/ | |||||
private Long residueTime; | |||||
/** | |||||
* 有效期 | |||||
*/ | |||||
private Date effectiveDate; | |||||
/** | |||||
* 用户总积分 | |||||
*/ | |||||
private Integer userCredits; | |||||
/** | |||||
* 用户剩余积分 | |||||
*/ | |||||
private Integer residueCredits; | |||||
/** | |||||
* 邀请人送的基础积分(暂时默认每个档次都是10积分) | |||||
*/ | |||||
private Integer inviteBaseCredits; | |||||
/** | |||||
* 照片说话的单价/min | |||||
*/ | |||||
private Integer videoPrice; | |||||
/** | |||||
* ai生成照片的单价/min | |||||
*/ | |||||
private Integer photoPrice; | |||||
/** | |||||
* 生成口播的单价/min | |||||
*/ | |||||
private Integer talkPrice; | |||||
/** | |||||
* 创建时间 | |||||
*/ | |||||
private Date createDate; | |||||
/** | |||||
* 更新时间 | |||||
*/ | |||||
private Date updateDate; | |||||
/** | |||||
* 是否删除1是0否 | |||||
*/ | |||||
private Integer isDel; | |||||
} | } |
@@ -0,0 +1,84 @@ | |||||
package com.iformall.domain.po.sm; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.util.Date; | |||||
import java.io.Serializable; | |||||
import io.swagger.models.auth.In; | |||||
import lombok.Data; | |||||
/** | |||||
* @Description | |||||
* @Author LRH | |||||
* @Date 2023-06-15 | |||||
*/ | |||||
@Data | |||||
@TableName("user_credit_log" ) | |||||
public class UserCreditLog implements Serializable { | |||||
private static final long serialVersionUID = 8595480777599856051L; | |||||
/** | |||||
* 主键ID | |||||
*/ | |||||
@TableId | |||||
private Long id; | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private String tenantId; | |||||
/** | |||||
* 父租户ID | |||||
*/ | |||||
private String parentTenantId; | |||||
/** | |||||
* 用户id(wx_c_user_basic_info.id) | |||||
*/ | |||||
private Long userId; | |||||
/** | |||||
* 视频id 或者 图片id 或者 口播id | |||||
*/ | |||||
private Long videoOrPhotoOrTalkId; | |||||
/** | |||||
* 订单id | |||||
*/ | |||||
private Integer orderId; | |||||
/** | |||||
* 类型(1、注册,2、邀请新用户,3、套餐增加,4、照片说话,5、AI生成照片,6、口播) | |||||
*/ | |||||
private Integer type; | |||||
/** | |||||
* 积分加减情况 | |||||
*/ | |||||
private float credits; | |||||
/** | |||||
* 备注 | |||||
*/ | |||||
private String remark; | |||||
/** | |||||
* 创建时间 | |||||
*/ | |||||
private Date createDate; | |||||
/** | |||||
* 更新时间 | |||||
*/ | |||||
private Date updateDate; | |||||
/** | |||||
* 是否删除1是0否 | |||||
*/ | |||||
private Integer isDel; | |||||
} |
@@ -0,0 +1,124 @@ | |||||
package com.iformall.domain.po.sm; | |||||
import com.baomidou.mybatisplus.annotation.TableField; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.util.Date; | |||||
import java.io.Serializable; | |||||
import lombok.Data; | |||||
/** | |||||
* @Description | |||||
* @Author LRH | |||||
* @Date 2023-06-16 | |||||
*/ | |||||
@Data | |||||
@TableName("user_package_detail" ) | |||||
public class UserPackageDetail implements Serializable { | |||||
private static final long serialVersionUID = 8868339443558940187L; | |||||
/** | |||||
* 主键ID | |||||
*/ | |||||
@TableId | |||||
private Integer id; | |||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private String tenantId; | |||||
/** | |||||
* 父租户ID | |||||
*/ | |||||
private String parentTenantId; | |||||
/** | |||||
* 套餐类型(1、图片说话,2、口播) | |||||
*/ | |||||
private Integer detailType; | |||||
@TableField(exist = false) | |||||
private String detailTypeDesc; | |||||
/** | |||||
* 套餐id(user_consumption_package.id) | |||||
*/ | |||||
private Integer packageId; | |||||
/** | |||||
* 是否有水印(1-是,2-否) | |||||
*/ | |||||
private Integer watermark; | |||||
@TableField(exist = false) | |||||
private String watermarkDesc; | |||||
/** | |||||
* 语言(1:50+语言) | |||||
*/ | |||||
private Integer language; | |||||
@TableField(exist = false) | |||||
private String languageDesc; | |||||
/** | |||||
* 声音(1:400+声音) | |||||
*/ | |||||
private Integer sound; | |||||
@TableField(exist = false) | |||||
private String soundDesc; | |||||
/** | |||||
* 单个视频时长(s) | |||||
*/ | |||||
private Integer videoTime; | |||||
/** | |||||
* AI生成人像(1-是、2-否) | |||||
*/ | |||||
private Integer aiPortrait; | |||||
@TableField(exist = false) | |||||
private String aiPortraitDesc; | |||||
/** | |||||
* 照片唱歌(1-是、2-否) | |||||
*/ | |||||
private Integer photoSing; | |||||
@TableField(exist = false) | |||||
private String photoSingDesc; | |||||
/** | |||||
* AI生成脚本次数 | |||||
*/ | |||||
private Integer aiCreateTime; | |||||
/** | |||||
* 视频分辨率(1:720p、2:1080p) | |||||
*/ | |||||
private Integer resolutionRatio; | |||||
@TableField(exist = false) | |||||
private String resolutionRatioDesc; | |||||
/** | |||||
* 数字人模板(1-免费,2-VIP) | |||||
*/ | |||||
private Integer humanTemplate; | |||||
@TableField(exist = false) | |||||
private String humanTemplateDesc; | |||||
/** | |||||
* 创建时间 | |||||
*/ | |||||
private Date createDate; | |||||
/** | |||||
* 更新时间 | |||||
*/ | |||||
private Date updateDate; | |||||
/** | |||||
* 是否删除1是0否 | |||||
*/ | |||||
private Integer isDel; | |||||
} |
@@ -0,0 +1,46 @@ | |||||
package com.iformall.domain.po.sm; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import java.util.Date; | |||||
import java.io.Serializable; | |||||
import io.swagger.models.auth.In; | |||||
import lombok.Data; | |||||
/** | |||||
* @Description | |||||
* @Author LRH | |||||
* @Date 2023-06-13 | |||||
*/ | |||||
@Data | |||||
@TableName("user_time_config" ) | |||||
public class UserTimeConfig implements Serializable { | |||||
private static final long serialVersionUID = 2953038588956565523L; | |||||
@TableId | |||||
private Integer id; | |||||
/** | |||||
* 用户类型(0-注册用户,1-邀请用户) | |||||
*/ | |||||
private Integer userType; | |||||
/** | |||||
* 默认时长(s) | |||||
*/ | |||||
private Long time; | |||||
private String tenantId; | |||||
private String parentTenantId; | |||||
private Date createDate; | |||||
private Date updateDate; | |||||
private Integer isDel; | |||||
} |
@@ -2,7 +2,11 @@ package com.iformall.domain.po.sm; | |||||
import com.baomidou.mybatisplus.annotation.TableField; | import com.baomidou.mybatisplus.annotation.TableField; | ||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.iformall.domain.po.base.TenantEntity; | |||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.EqualsAndHashCode; | |||||
import lombok.ToString; | |||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.List; | import java.util.List; | ||||
@@ -10,8 +14,11 @@ import java.util.List; | |||||
/** | /** | ||||
* 声音表 | * 声音表 | ||||
*/ | */ | ||||
@TableName(value = "voice_info") | |||||
@Data | @Data | ||||
public class VoiceInfo { | |||||
@ToString(callSuper = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
public class VoiceInfo extends TenantEntity { | |||||
/** | /** | ||||
* 主键ID | * 主键ID | ||||
*/ | */ | ||||
@@ -21,14 +28,6 @@ public class VoiceInfo { | |||||
*/ | */ | ||||
private Long languageId; | private Long languageId; | ||||
/** | /** | ||||
* 租户ID | |||||
*/ | |||||
private String tenantId; | |||||
/** | |||||
* 父租户ID | |||||
*/ | |||||
private String parentTenantId; | |||||
/** | |||||
* 性别 | * 性别 | ||||
*/ | */ | ||||
private Integer sex; | private Integer sex; | ||||
@@ -74,4 +73,8 @@ public class VoiceInfo { | |||||
* 是否删除1是0否 | * 是否删除1是0否 | ||||
*/ | */ | ||||
private Integer isDel; | private Integer isDel; | ||||
/** | |||||
* 年纪类型 EnumAgeType | |||||
*/ | |||||
private Integer ageType; | |||||
} | } |
@@ -1,7 +1,11 @@ | |||||
package com.iformall.domain.po.sm; | package com.iformall.domain.po.sm; | ||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.iformall.domain.po.base.TenantEntity; | |||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.EqualsAndHashCode; | |||||
import lombok.ToString; | |||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.Objects; | import java.util.Objects; | ||||
@@ -9,21 +13,16 @@ import java.util.Objects; | |||||
/** | /** | ||||
* 语种表 | * 语种表 | ||||
*/ | */ | ||||
@TableName(value = "voice_language") | |||||
@Data | @Data | ||||
public class VoiceLanguage implements Comparable { | |||||
@ToString(callSuper = true) | |||||
@EqualsAndHashCode(callSuper = true) | |||||
public class VoiceLanguage extends TenantEntity { | |||||
/** | /** | ||||
* 主键ID | * 主键ID | ||||
*/ | */ | ||||
private Long id; | private Long id; | ||||
/** | |||||
* 租户ID | |||||
*/ | |||||
private String tenantId; | |||||
/** | |||||
* 父租户ID | |||||
*/ | |||||
private String parentTenantId; | |||||
/** | /** | ||||
* 国家code | * 国家code | ||||
*/ | */ | ||||
@@ -40,6 +39,10 @@ public class VoiceLanguage implements Comparable { | |||||
* | * | ||||
*/ | */ | ||||
private String name; | private String name; | ||||
/** | |||||
* | |||||
*/ | |||||
private String chineseName; | |||||
/** | /** | ||||
* 图片 | * 图片 | ||||
*/ | */ | ||||
@@ -57,19 +60,4 @@ public class VoiceLanguage implements Comparable { | |||||
*/ | */ | ||||
private Integer isDel; | private Integer isDel; | ||||
@Override | |||||
public int compareTo(Object obj) { | |||||
// 判断是否是学生类型 | |||||
if (obj instanceof VoiceLanguage) { | |||||
VoiceLanguage s = (VoiceLanguage) obj; | |||||
// 如果是学生类型,如果学号相等,则不加入Set | |||||
if (Objects.equals(s.getLanguage(), this.getLanguage()) && Objects.equals(s.getCountry(), this.getCountry())) { | |||||
return 0; | |||||
} else { | |||||
return 1; | |||||
} | |||||
} else { | |||||
return 0; | |||||
} | |||||
} | |||||
} | } |
@@ -118,5 +118,7 @@ public class VoiceMaterial extends TenantEntity { | |||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private List<Integer> sendTypes; | private List<Integer> sendTypes; | ||||
private Integer type; | |||||
} | } |
@@ -0,0 +1,34 @@ | |||||
package com.iformall.enums.sm; | |||||
/** | |||||
* 数字人模板 | |||||
*/ | |||||
public enum EnumHumanTemplateType { | |||||
FREE(1, "免费"), | |||||
VIP(2, "VIP"); | |||||
public static EnumHumanTemplateType getEnum(Integer code) { | |||||
for (EnumHumanTemplateType value : values()) { | |||||
if (value.getCode().equals(code)) { | |||||
return value; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
private Integer code; | |||||
private String message; | |||||
EnumHumanTemplateType(Integer code, String message) { | |||||
this.code = code; | |||||
this.message = message; | |||||
} | |||||
public Integer getCode() { | |||||
return code; | |||||
} | |||||
public String getMessage() { | |||||
return message; | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
package com.iformall.enums.sm; | |||||
/** | |||||
* 语言 | |||||
*/ | |||||
public enum EnumLanguageType { | |||||
LANGUAGE(1, "50+"); | |||||
public static EnumLanguageType getEnum(Integer code) { | |||||
for (EnumLanguageType value : values()) { | |||||
if (value.getCode().equals(code)) { | |||||
return value; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
private Integer code; | |||||
private String message; | |||||
EnumLanguageType(Integer code, String message) { | |||||
this.code = code; | |||||
this.message = message; | |||||
} | |||||
public Integer getCode() { | |||||
return code; | |||||
} | |||||
public String getMessage() { | |||||
return message; | |||||
} | |||||
} |
@@ -0,0 +1,38 @@ | |||||
package com.iformall.enums.sm; | |||||
/** | |||||
* 日志类型 | |||||
*/ | |||||
public enum EnumLogType { | |||||
REGISTER_USER(1, "注册"), | |||||
INVITE_USER(2, "邀请新用户"), | |||||
BUY_PACKAGE(3, "套餐增加"), | |||||
PHOTO_SPEAK(4, "照片说话"), | |||||
AI_PHOTO(5, "AI生成照片"), | |||||
TALK(6, "口播"); | |||||
public static EnumLogType getEnum(Integer code) { | |||||
for (EnumLogType value : values()) { | |||||
if (value.getCode().equals(code)) { | |||||
return value; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
private Integer code; | |||||
private String message; | |||||
EnumLogType(Integer code, String message) { | |||||
this.code = code; | |||||
this.message = message; | |||||
} | |||||
public Integer getCode() { | |||||
return code; | |||||
} | |||||
public String getMessage() { | |||||
return message; | |||||
} | |||||
} |
@@ -0,0 +1,34 @@ | |||||
package com.iformall.enums.sm; | |||||
/** | |||||
* 套餐详细类型 | |||||
*/ | |||||
public enum EnumPackageDetailType { | |||||
PHOTO_SPEAK(1, "照片说话"), | |||||
TALK(2, "口播"); | |||||
public static EnumPackageDetailType getEnum(Integer code) { | |||||
for (EnumPackageDetailType value : values()) { | |||||
if (value.getCode().equals(code)) { | |||||
return value; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
private Integer code; | |||||
private String message; | |||||
EnumPackageDetailType(Integer code, String message) { | |||||
this.code = code; | |||||
this.message = message; | |||||
} | |||||
public Integer getCode() { | |||||
return code; | |||||
} | |||||
public String getMessage() { | |||||
return message; | |||||
} | |||||
} |
@@ -0,0 +1,36 @@ | |||||
package com.iformall.enums.sm; | |||||
/** | |||||
* 套餐类型 | |||||
*/ | |||||
public enum EnumPackageType { | |||||
BASIC(1, "基础版"), | |||||
MAJOR(2, "专业版"), | |||||
ENHANCE(3, "加强版") | |||||
; | |||||
public static EnumPackageType getEnum(Integer code) { | |||||
for (EnumPackageType value : values()) { | |||||
if (value.getCode().equals(code)) { | |||||
return value; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
private Integer code; | |||||
private String message; | |||||
EnumPackageType(Integer code, String message) { | |||||
this.code = code; | |||||
this.message = message; | |||||
} | |||||
public Integer getCode() { | |||||
return code; | |||||
} | |||||
public String getMessage() { | |||||
return message; | |||||
} | |||||
} |
@@ -0,0 +1,34 @@ | |||||
package com.iformall.enums.sm; | |||||
/** | |||||
* 分辨率 | |||||
*/ | |||||
public enum EnumResolutionRatioType { | |||||
RESOLUTION_RATIO_720P(1, "720p"), | |||||
RESOLUTION_RATIO_1080P(2, "1080p"); | |||||
public static EnumResolutionRatioType getEnum(Integer code) { | |||||
for (EnumResolutionRatioType value : values()) { | |||||
if (value.getCode().equals(code)) { | |||||
return value; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
private Integer code; | |||||
private String message; | |||||
EnumResolutionRatioType(Integer code, String message) { | |||||
this.code = code; | |||||
this.message = message; | |||||
} | |||||
public Integer getCode() { | |||||
return code; | |||||
} | |||||
public String getMessage() { | |||||
return message; | |||||
} | |||||
} |
@@ -0,0 +1,33 @@ | |||||
package com.iformall.enums.sm; | |||||
/** | |||||
* 声音 | |||||
*/ | |||||
public enum EnumSoundType { | |||||
SOUND(1, "400+"); | |||||
public static EnumSoundType getEnum(Integer code) { | |||||
for (EnumSoundType value : values()) { | |||||
if (value.getCode().equals(code)) { | |||||
return value; | |||||
} | |||||
} | |||||
return null; | |||||
} | |||||
private Integer code; | |||||
private String message; | |||||
EnumSoundType(Integer code, String message) { | |||||
this.code = code; | |||||
this.message = message; | |||||
} | |||||
public Integer getCode() { | |||||
return code; | |||||
} | |||||
public String getMessage() { | |||||
return message; | |||||
} | |||||
} |
@@ -4,11 +4,13 @@ import com.iformall.common.CommonMapper; | |||||
import com.iformall.domain.po.AliBusinessCircleOrder; | import com.iformall.domain.po.AliBusinessCircleOrder; | ||||
import com.iformall.domain.po.sm.InviteCode; | import com.iformall.domain.po.sm.InviteCode; | ||||
import com.iformall.service.sm.InviteCodeService; | import com.iformall.service.sm.InviteCodeService; | ||||
import org.apache.ibatis.annotations.Param; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
public interface InviteCodeMapper extends CommonMapper<InviteCode, String> { | |||||
public interface InviteCodeMapper extends CommonMapper<InviteCode, Long> { | |||||
void addUseTotal(@Param("id") Long id, @Param("total") Integer total); | |||||
} | } |
@@ -3,6 +3,15 @@ package com.iformall.mapper; | |||||
import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
import com.iformall.domain.po.MallPermission; | import com.iformall.domain.po.MallPermission; | ||||
import com.iformall.domain.po.sm.MusicInfo; | import com.iformall.domain.po.sm.MusicInfo; | ||||
import com.iformall.domain.po.sm.PersonPhoto; | |||||
import org.apache.ibatis.annotations.Param; | |||||
import java.util.List; | |||||
public interface MusicInfoServiceMapper extends CommonMapper<MusicInfo, String> { | public interface MusicInfoServiceMapper extends CommonMapper<MusicInfo, String> { | ||||
List<MusicInfo> findList(MusicInfo record); | |||||
void deleteById(@Param("id")Long id); | |||||
List<MusicInfo> userMusic(MusicInfo record); | |||||
} | } |
@@ -0,0 +1,10 @@ | |||||
package com.iformall.mapper; | |||||
import com.iformall.common.CommonMapper; | |||||
import com.iformall.domain.po.sm.UserConsumptionPackage; | |||||
public interface UserConsumptionPackageMapper extends CommonMapper<UserConsumptionPackage, Long> { | |||||
} |
@@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Param; | |||||
public interface UserCreateVideoNumMapper extends CommonMapper<UserCreateVideoNum, String> { | public interface UserCreateVideoNumMapper extends CommonMapper<UserCreateVideoNum, String> { | ||||
Boolean addOrSubtractNumberOfTimes(@Param("type") Integer type,@Param("createVideoNum") UserCreateVideoNum createVideoNum); | |||||
Boolean addOrSubtractNumberOfTimes(@Param("type") Integer type, @Param("createVideoNum") UserCreateVideoNum createVideoNum, @Param("useCredit") Double useCredit, @Param("time") Double videoTime); | |||||
} | } |
@@ -0,0 +1,11 @@ | |||||
package com.iformall.mapper; | |||||
import com.iformall.common.CommonMapper; | |||||
import com.iformall.domain.po.sm.UserConsumptionPackage; | |||||
import com.iformall.domain.po.sm.UserCreditLog; | |||||
public interface UserCreditLogMapper extends CommonMapper<UserCreditLog, Long> { | |||||
} |
@@ -0,0 +1,11 @@ | |||||
package com.iformall.mapper; | |||||
import com.iformall.common.CommonMapper; | |||||
import com.iformall.domain.po.sm.UserCreditLog; | |||||
import com.iformall.domain.po.sm.UserPackageDetail; | |||||
public interface UserPackageDetailMapper extends CommonMapper<UserPackageDetail, Long> { | |||||
} |
@@ -0,0 +1,7 @@ | |||||
package com.iformall.mapper; | |||||
import com.iformall.common.CommonMapper; | |||||
import com.iformall.domain.po.sm.UserTimeConfig; | |||||
public interface UserTimeConfigServiceMapper extends CommonMapper<UserTimeConfig, Long> { | |||||
} |
@@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Param; | |||||
import java.util.HashSet; | import java.util.HashSet; | ||||
public interface VoiceLanguageMapper extends CommonMapper<VoiceLanguage, String> { | |||||
public interface VoiceLanguageMapper extends CommonMapper<VoiceLanguage, Long> { | |||||
void saveBatch(@Param("set") HashSet<VoiceLanguage> set); | void saveBatch(@Param("set") HashSet<VoiceLanguage> set); | ||||
} | } | ||||
@@ -1,13 +1,19 @@ | |||||
package com.iformall.service.sm; | package com.iformall.service.sm; | ||||
import com.github.pagehelper.PageInfo; | |||||
import com.iformall.common.ResultData; | |||||
import com.iformall.domain.po.sm.MusicInfo; | import com.iformall.domain.po.sm.MusicInfo; | ||||
import com.iformall.domain.po.sm.VoiceMaterial; | |||||
import java.util.List; | import java.util.List; | ||||
public interface MusicInfoService { | public interface MusicInfoService { | ||||
List<MusicInfo> music(); | |||||
MusicInfo getById(Long voiceMaterialId); | MusicInfo getById(Long voiceMaterialId); | ||||
PageInfo<MusicInfo> music(Integer pageNum, Integer pageSize, MusicInfo record); | |||||
ResultData saveOrUpdate(MusicInfo record); | |||||
void deleteById(Long id); | |||||
PageInfo<MusicInfo> userMusic(Integer pageNum, Integer pageSize, MusicInfo record); | |||||
} | } |
@@ -59,4 +59,10 @@ public interface PhotoSpeakVideoService { | |||||
int updateById(PhotoSpeakVideo video); | int updateById(PhotoSpeakVideo video); | ||||
void videoHy(PhotoSpeakVideo speakVideo,Boolean flag); | |||||
void uploadHyVideo(PhotoSpeakVideo mouldVideo); | |||||
List<PhotoSpeakVideo> getUpLoadHyIngList(); | |||||
} | } |
@@ -0,0 +1,15 @@ | |||||
package com.iformall.service.sm; | |||||
import com.iformall.domain.po.sm.UserConsumptionPackage; | |||||
import java.util.List; | |||||
public interface UserConsumptionPackageService { | |||||
UserConsumptionPackage getPackageInfoByType(Integer enumPackageType); | |||||
List<UserConsumptionPackage> getPackageInfo(); | |||||
UserConsumptionPackage getPackageInfoById(Integer id); | |||||
} |
@@ -11,9 +11,11 @@ public interface UserCreateVideoNumService { | |||||
Boolean initializationUserCreateVideoNum(Long id); | Boolean initializationUserCreateVideoNum(Long id); | ||||
Boolean addOrSubtractNumberOfTimes(Integer type, UserCreateVideoNum createVideoNum); | |||||
Boolean addOrSubtractNumberOfTimes(Integer type, UserCreateVideoNum createVideoNum,Double useCredit,Double videoTime); | |||||
UserCreateVideoNum queryInfoByUserId(Long userId); | UserCreateVideoNum queryInfoByUserId(Long userId); | ||||
void uploadUserCreateVideoNum(Map<Long, Long> collect); | void uploadUserCreateVideoNum(Map<Long, Long> collect); | ||||
void inviteUserAddCreatTime(Long id); | |||||
} | } |
@@ -0,0 +1,8 @@ | |||||
package com.iformall.service.sm; | |||||
import com.iformall.domain.po.sm.UserCreditLog; | |||||
public interface UserCreditLogService { | |||||
void insertLog(UserCreditLog log); | |||||
} |
@@ -0,0 +1,11 @@ | |||||
package com.iformall.service.sm; | |||||
import com.iformall.domain.po.sm.UserPackageDetail; | |||||
import java.util.List; | |||||
public interface UserPackageDetailService { | |||||
List<UserPackageDetail> getDetailInfo(); | |||||
} |
@@ -8,10 +8,17 @@ import com.iformall.common.ResultData; | |||||
import com.iformall.domain.po.WxCUserBasicInfo; | import com.iformall.domain.po.WxCUserBasicInfo; | ||||
import com.iformall.domain.po.sm.InviteCode; | import com.iformall.domain.po.sm.InviteCode; | ||||
import com.iformall.domain.po.sm.InviteCodeInfo; | import com.iformall.domain.po.sm.InviteCodeInfo; | ||||
import com.iformall.domain.po.sm.UserCreateVideoNum; | |||||
import com.iformall.domain.po.sm.UserCreditLog; | |||||
import com.iformall.enums.sm.EnumLogType; | |||||
import com.iformall.mapper.InviteCodeInfoMapper; | import com.iformall.mapper.InviteCodeInfoMapper; | ||||
import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
import com.iformall.service.sm.InviteCodeInfoService; | import com.iformall.service.sm.InviteCodeInfoService; | ||||
import com.iformall.service.sm.InviteCodeService; | import com.iformall.service.sm.InviteCodeService; | ||||
import com.iformall.service.sm.UserCreateVideoNumService; | |||||
import com.iformall.service.sm.UserCreditLogService; | |||||
import lombok.Data; | |||||
import org.checkerframework.checker.units.qual.A; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.util.CollectionUtils; | import org.springframework.util.CollectionUtils; | ||||
@@ -32,6 +39,12 @@ public class InviteCodeInfoServiceImpl implements InviteCodeInfoService { | |||||
@Autowired | @Autowired | ||||
private WxCUserBasicInfoService wxCUserBasicInfoService; | private WxCUserBasicInfoService wxCUserBasicInfoService; | ||||
@Autowired | |||||
private UserCreateVideoNumService userCreateVideoNumService; | |||||
@Autowired | |||||
private UserCreditLogService userCreditLogService; | |||||
/** | /** | ||||
* 使用邀请码 | * 使用邀请码 | ||||
* | * | ||||
@@ -64,7 +77,22 @@ public class InviteCodeInfoServiceImpl implements InviteCodeInfoService { | |||||
codeInfo.setPhone(codeInfo.getPhone()); | codeInfo.setPhone(codeInfo.getPhone()); | ||||
inviteCodeInfoMapper.insert(codeInfo); | inviteCodeInfoMapper.insert(codeInfo); | ||||
inviteCodeService.addUseTotal(info.getId(), info.getTotal()); | |||||
//邀请码最多使用10次 | |||||
if (info.getTotal() < 10){ | |||||
inviteCodeService.addUseTotal(info.getId(), info.getTotal()); | |||||
userCreateVideoNumService.inviteUserAddCreatTime(info.getId()); | |||||
//根据用户id获取邀请的时候送多少积分 | |||||
UserCreateVideoNum videoNum = userCreateVideoNumService.queryInfoByUserId(cUser.getId()); | |||||
//插入日志信息 | |||||
UserCreditLog log = new UserCreditLog(); | |||||
log.setId(IdWorker.get().nextId()); | |||||
log.setUserId(cUser.getId()); | |||||
log.setCredits(videoNum.getInviteBaseCredits()); | |||||
log.setType(EnumLogType.INVITE_USER.getCode()); | |||||
log.setRemark(EnumLogType.INVITE_USER.getMessage()); | |||||
userCreditLogService.insertLog(log); | |||||
} | |||||
return new ResultData(); | return new ResultData(); | ||||
} else { | } else { | ||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR, "邀请码不存在"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR, "邀请码不存在"); | ||||
@@ -53,9 +53,6 @@ public class InviteCodeServiceImpl implements InviteCodeService { | |||||
@Override | @Override | ||||
public void addUseTotal(Long id, Integer total) { | public void addUseTotal(Long id, Integer total) { | ||||
InviteCode code = new InviteCode(); | |||||
code.setId(id); | |||||
code.setTotal(total + 1); | |||||
inviteCodeMapper.updateById(code); | |||||
inviteCodeMapper.addUseTotal(id, total); | |||||
} | } | ||||
} | } |
@@ -1,15 +1,24 @@ | |||||
package com.iformall.service.sm.impl; | package com.iformall.service.sm.impl; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.github.pagehelper.PageHelper; | |||||
import com.github.pagehelper.PageInfo; | |||||
import com.iformall.common.ErrorCode; | |||||
import com.iformall.common.IdWorker; | |||||
import com.iformall.common.ResultData; | |||||
import com.iformall.domain.po.sm.MusicInfo; | import com.iformall.domain.po.sm.MusicInfo; | ||||
import com.iformall.domain.po.sm.VoiceMaterial; | |||||
import com.iformall.enums.EnumaMouldPatchStatus; | |||||
import com.iformall.mapper.MusicInfoServiceMapper; | import com.iformall.mapper.MusicInfoServiceMapper; | ||||
import com.iformall.service.sm.MusicInfoService; | import com.iformall.service.sm.MusicInfoService; | ||||
import com.iformall.video.VideoFactory; | |||||
import com.iformall.video.entity.VideUploadResult; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.Date; | |||||
import java.util.List; | import java.util.List; | ||||
@Service | @Service | ||||
@@ -19,13 +28,60 @@ public class MusicInfoServiceImpl implements MusicInfoService { | |||||
@Autowired | @Autowired | ||||
private MusicInfoServiceMapper musicInfoServiceMapper; | private MusicInfoServiceMapper musicInfoServiceMapper; | ||||
@Override | |||||
public List<MusicInfo> music() { | |||||
return musicInfoServiceMapper.selectList(new LambdaQueryWrapper<MusicInfo>().eq(MusicInfo::getIsDel, 0)); | |||||
} | |||||
@Autowired | |||||
VideoFactory videoFactory; | |||||
@Autowired | |||||
String videoType; | |||||
@Override | @Override | ||||
public MusicInfo getById(Long voiceMaterialId) { | public MusicInfo getById(Long voiceMaterialId) { | ||||
return musicInfoServiceMapper.selectById(voiceMaterialId); | return musicInfoServiceMapper.selectById(voiceMaterialId); | ||||
} | } | ||||
@Override | |||||
public PageInfo<MusicInfo> music(Integer pageNum, Integer pageSize, MusicInfo record) { | |||||
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> musicInfoServiceMapper.findList(record)); | |||||
} | |||||
@Override | |||||
public ResultData saveOrUpdate(MusicInfo record) { | |||||
VideUploadResult videoDetail = videoFactory.getExcutor(videoType).getVideoDetailWithCache(record.getVoiceId()); | |||||
if (videoDetail.isSuccess() | |||||
&& StringUtils.isNotBlank(videoDetail.getDuration()) | |||||
&& !"0.0".equals(videoDetail.getDuration()) | |||||
&& StringUtils.isNotBlank(videoDetail.getTitle()) | |||||
&& StringUtils.isNotBlank(videoDetail.getVideoUrl())) { | |||||
record.setTime(Double.valueOf(videoDetail.getDuration())); | |||||
record.setSize(videoDetail.getSize()); | |||||
record.setUrl(videoDetail.getVideoUrl()); | |||||
record.setName(videoDetail.getTitle().split("\\.")[0]); | |||||
} | |||||
if (StringUtils.isBlank(record.getUrl())) { | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "素材为空"); | |||||
} | |||||
Date now = new Date(); | |||||
if (record.getId() == null) { | |||||
record.setId(IdWorker.get().nextId()); | |||||
record.setCreateDate(now); | |||||
record.setUpdateDate(now); | |||||
musicInfoServiceMapper.insert(record); | |||||
} else { | |||||
record.setUpdateDate(now); | |||||
musicInfoServiceMapper.updateById(record); | |||||
} | |||||
return new ResultData(record); | |||||
} | |||||
@Override | |||||
public void deleteById(Long id) { | |||||
musicInfoServiceMapper.deleteById(id); | |||||
} | |||||
@Override | |||||
public PageInfo<MusicInfo> userMusic(Integer pageNum, Integer pageSize, MusicInfo record) { | |||||
return PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> musicInfoServiceMapper.userMusic(record)); | |||||
} | |||||
} | } |
@@ -9,10 +9,13 @@ import com.iformall.common.IdWorker; | |||||
import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
import com.iformall.domain.po.sm.*; | import com.iformall.domain.po.sm.*; | ||||
import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
import com.iformall.enums.sm.EnumLogType; | |||||
import com.iformall.enums.sm.EnumPackageType; | |||||
import com.iformall.mapper.PhotoSpeakVideoMapper; | import com.iformall.mapper.PhotoSpeakVideoMapper; | ||||
import com.iformall.service.sm.*; | import com.iformall.service.sm.*; | ||||
import com.iformall.sm.*; | import com.iformall.sm.*; | ||||
import com.iformall.utils.Base64Util; | import com.iformall.utils.Base64Util; | ||||
import com.iformall.utils.DateUtils; | |||||
import com.iformall.video.VideoFactory; | import com.iformall.video.VideoFactory; | ||||
import com.iformall.video.entity.VideUploadResult; | import com.iformall.video.entity.VideUploadResult; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
@@ -66,6 +69,13 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
@Autowired | @Autowired | ||||
private MusicInfoService musicInfoService; | private MusicInfoService musicInfoService; | ||||
@Autowired | |||||
private UserConsumptionPackageService userConsumptionPackageService; | |||||
@Autowired | |||||
private UserCreditLogService userCreditLogService; | |||||
private final static String str = "\uD83D\uDD57"; | |||||
@Override | @Override | ||||
public PageInfo<PhotoSpeakVideo> listAsPage(PhotoSpeakVideo record, Integer pageIndex, Integer pageSize) { | public PageInfo<PhotoSpeakVideo> listAsPage(PhotoSpeakVideo record, Integer pageIndex, Integer pageSize) { | ||||
@@ -115,8 +125,9 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
voiceMouldObject.put("personTypeStr","default"); | voiceMouldObject.put("personTypeStr","default"); | ||||
voiceMouldObject.put("speakType",0); | voiceMouldObject.put("speakType",0); | ||||
voiceMouldObject.put("speakTypeStr","default"); | voiceMouldObject.put("speakTypeStr","default"); | ||||
EnumSpeakType speakType = null; | |||||
if(StringUtils.isNotBlank(record.getSpeakTypeStr())){ | if(StringUtils.isNotBlank(record.getSpeakTypeStr())){ | ||||
EnumSpeakType speakType = EnumSpeakType.getEnumByMsg(record.getSpeakTypeStr()); | |||||
speakType = EnumSpeakType.getEnumByMsg(record.getSpeakTypeStr()); | |||||
if(speakType == null){ | if(speakType == null){ | ||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"声音类型信息错误"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"声音类型信息错误"); | ||||
} | } | ||||
@@ -205,6 +216,24 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
Integer voiceFrom = photoSpeakVideo.getVoiceFrom(); | Integer voiceFrom = photoSpeakVideo.getVoiceFrom(); | ||||
String voiceMouldSmId = null; | String voiceMouldSmId = null; | ||||
String voiceType = "default";//默认 | String voiceType = "default";//默认 | ||||
Integer sex = 1; | |||||
Double videoTime = null;//用户创建视频的时长 | |||||
//TODO 关闭用户相关流程 | |||||
UserCreateVideoNum videoNum = userCreateVideoNumService.queryInfoByUserId(photoSpeakVideo.getUserId()); | |||||
// if (videoNum == null) { | |||||
// videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||||
// videoUpd.setVideoMsg("用户没有创建视频时长"); | |||||
// this.saveOrUpdate(videoUpd); | |||||
// return new AsyncResult<>(0); | |||||
// } else { | |||||
// if (DateUtils.isDateAfter(String.valueOf(videoNum.getEffectiveDate()))) { | |||||
// videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||||
// videoUpd.setVideoMsg("有效期已到期"); | |||||
// this.saveOrUpdate(videoUpd); | |||||
// return new AsyncResult<>(0); | |||||
// } | |||||
// } | |||||
String voiceMaterialUrl = null; | String voiceMaterialUrl = null; | ||||
if(EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)){ | if(EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)){ | ||||
@@ -213,6 +242,7 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
voiceMouldSmId = personMouldObject.getString("mouldSmId"); | voiceMouldSmId = personMouldObject.getString("mouldSmId"); | ||||
Integer speakType = personMouldObject.getInteger("speakType"); | Integer speakType = personMouldObject.getInteger("speakType"); | ||||
Integer personType = personMouldObject.getInteger("personType"); | Integer personType = personMouldObject.getInteger("personType"); | ||||
sex = personMouldObject.getInteger("sex"); | |||||
if(speakType != null && speakType > 0){ | if(speakType != null && speakType > 0){ | ||||
voiceType = EnumSpeakType.getEnum(speakType).getMessage(); | voiceType = EnumSpeakType.getEnum(speakType).getMessage(); | ||||
}else if(personType != null && personType > 0){ | }else if(personType != null && personType > 0){ | ||||
@@ -223,10 +253,24 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
if(StringUtils.isBlank(voiceMouldSmId)){ | if(StringUtils.isBlank(voiceMouldSmId)){ | ||||
msg = "参数错误,未找到声音模板数据"; | msg = "参数错误,未找到声音模板数据"; | ||||
} | } | ||||
//获取视频时长 | |||||
AiPreviewParam param = new AiPreviewParam(); | |||||
if (StringUtils.isBlank(photoSpeakVideo.getPaperwork())){ | |||||
msg = "未填写视频文案数据"; | |||||
} | |||||
param.setGen_txt(photoSpeakVideo.getPaperwork().replaceAll(str, "[*]")); | |||||
param.setGender(sex == 1 ? "male" : "female"); | |||||
param.setVoice_id(voiceMouldSmId); | |||||
param.setVoice_style(voiceType); | |||||
AiPreviewResult result = AiVideoHelper.voicePreview(param); | |||||
if (result.isSuccess()) { | |||||
videoTime = result.getTime(); | |||||
} | |||||
}else if(EnumVoiceFrom.FROM_UPD.getCode().equals(voiceFrom)){ | }else if(EnumVoiceFrom.FROM_UPD.getCode().equals(voiceFrom)){ | ||||
voiceMaterialUrl = photoSpeakVideo.getVoiceMaterialUrl(); | voiceMaterialUrl = photoSpeakVideo.getVoiceMaterialUrl(); | ||||
VoiceMaterial voiceMaterial = voiceMaterialService.getById(photoSpeakVideo.getVoiceMaterialId()); | |||||
if(StringUtils.isBlank(voiceMaterialUrl)){ | if(StringUtils.isBlank(voiceMaterialUrl)){ | ||||
VoiceMaterial voiceMaterial = voiceMaterialService.getById(photoSpeakVideo.getVoiceMaterialId()); | |||||
voiceMaterialService.handVideoUrl(voiceMaterial); | voiceMaterialService.handVideoUrl(voiceMaterial); | ||||
voiceMaterialUrl = voiceMaterial.getMaterial(); | voiceMaterialUrl = voiceMaterial.getMaterial(); | ||||
videoUpd.setVoiceMaterialUrl(voiceMaterialUrl); | videoUpd.setVoiceMaterialUrl(voiceMaterialUrl); | ||||
@@ -234,20 +278,54 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
if(StringUtils.isBlank(voiceMaterialUrl)){ | if(StringUtils.isBlank(voiceMaterialUrl)){ | ||||
msg = "未找到上传声音文件"; | msg = "未找到上传声音文件"; | ||||
} | } | ||||
//判断用户时长是否够创建该视频 | |||||
VideUploadResult videoDetail = videoFactory.getExcutor(videoType).getVideoDetailWithCache(voiceMaterial.getVideoId()); | |||||
if (videoDetail.isSuccess() && StringUtils.isNotBlank(videoDetail.getDuration()) && !"0.0".equals(videoDetail.getDuration())) { | |||||
String duration = videoDetail.getDuration(); | |||||
videoTime = Double.valueOf(duration); | |||||
} | |||||
} else if (EnumVoiceFrom.MUSIC.getCode().equals(voiceFrom)) { | } else if (EnumVoiceFrom.MUSIC.getCode().equals(voiceFrom)) { | ||||
Long musicId = photoSpeakVideo.getMusicId(); | Long musicId = photoSpeakVideo.getMusicId(); | ||||
MusicInfo musicInfo = musicInfoService.getById(musicId); | MusicInfo musicInfo = musicInfoService.getById(musicId); | ||||
if (ObjectUtils.isEmpty(musicInfo)){ | |||||
if (ObjectUtils.isEmpty(musicInfo)) { | |||||
msg = "未找到音乐文件"; | msg = "未找到音乐文件"; | ||||
} | } | ||||
voiceMaterialUrl = musicInfo.getUrl(); | voiceMaterialUrl = musicInfo.getUrl(); | ||||
if (StringUtils.isBlank(voiceMaterialUrl)) { | if (StringUtils.isBlank(voiceMaterialUrl)) { | ||||
msg = "音乐文件错误"; | msg = "音乐文件错误"; | ||||
} | } | ||||
videoTime = Double.valueOf(musicInfo.getTime()); | |||||
} else { | } else { | ||||
msg = "声音数据异常"; | msg = "声音数据异常"; | ||||
} | } | ||||
//判断获取创建的视频时长 | |||||
if (videoTime == null){ | |||||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||||
videoUpd.setVideoMsg("获取创建的视频时长失败"); | |||||
this.saveOrUpdate(videoUpd); | |||||
return new AsyncResult<>(0); | |||||
} | |||||
//TODO 关闭用户相关流程 | |||||
//获取套餐信息 | |||||
// UserConsumptionPackage infoById = userConsumptionPackageService.getPackageInfoById(videoNum.getPackageId()); | |||||
// if (infoById == null){ | |||||
// videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||||
// videoUpd.setVideoMsg("套餐信息不存在"); | |||||
// this.saveOrUpdate(videoUpd); | |||||
// return new AsyncResult<>(0); | |||||
// } | |||||
// //生成视频时长不能超过对应套餐的时长 | |||||
// if (infoById.getChargeTime() < videoTime) { | |||||
// videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||||
// videoUpd.setVideoMsg("视频时长不能超过" + infoById.getChargeTime() + "s"); | |||||
// this.saveOrUpdate(videoUpd); | |||||
// return new AsyncResult<>(0); | |||||
// } | |||||
videoUpd.setVideoTime(String.valueOf(videoTime)); | |||||
if(StringUtils.isBlank(voiceMouldSmId) && StringUtils.isBlank(voiceMaterialUrl)){ | if(StringUtils.isBlank(voiceMouldSmId) && StringUtils.isBlank(voiceMaterialUrl)){ | ||||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | ||||
videoUpd.setVideoMsg(msg); | videoUpd.setVideoMsg(msg); | ||||
@@ -263,87 +341,79 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
return new AsyncResult<>(0); | return new AsyncResult<>(0); | ||||
} | } | ||||
UserCreateVideoNum createVideoNum = new UserCreateVideoNum(); | |||||
double useCredit = 0; | |||||
//修改用户创建视频时间表 | |||||
if (flag) { | if (flag) { | ||||
//修改用户生成视频次数 | |||||
createVideoNum = userCreateVideoNumService.queryInfoByUserId(photoSpeakVideo.getUserId()); | |||||
if (ObjectUtils.isEmpty(createVideoNum)) { | |||||
return new AsyncResult<>("用户没有生成视频次数"); | |||||
} else { | |||||
//剩余条数 | |||||
Integer residueNum = createVideoNum.getResidueNum(); | |||||
if (residueNum.intValue() <= 0) { | |||||
return new AsyncResult<>("剩余生成视频次数不足"); | |||||
} else { | |||||
//减去生成视频次数 | |||||
Boolean times = userCreateVideoNumService.addOrSubtractNumberOfTimes(1, createVideoNum); | |||||
if (!times) { | |||||
return new AsyncResult<>("剩余生成视频次数不足"); | |||||
} | |||||
} | |||||
} | |||||
// //每秒消耗的积分 | |||||
// double i = (double)( videoNum.getVideoPrice() / 60); | |||||
// i = i < 1 ? 1.0 : i; //如果小于1 就直接取1 | |||||
// //用户创建视频需要时积分 | |||||
// useCredit = (videoTime * i); | |||||
// //判断用户积分是否足够 | |||||
// if (videoNum.getResidueCredits() < useCredit) { | |||||
// videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||||
// videoUpd.setVideoMsg("创建视频时长不足,请充值"); | |||||
// this.saveOrUpdate(videoUpd); | |||||
// return new AsyncResult<>(0); | |||||
// } | |||||
// useCredit = Math.round(useCredit); | |||||
//如果时间够,就去减去相对应的数据 | |||||
userCreateVideoNumService.addOrSubtractNumberOfTimes(1, videoNum, useCredit, videoTime); | |||||
} | } | ||||
try { | try { | ||||
AiPreviewParam previewParam = new AiPreviewParam(); | |||||
previewParam.setVoice_id(voiceMouldSmId); | |||||
AiPhotoSpeakParam param = new AiPhotoSpeakParam(); | AiPhotoSpeakParam param = new AiPhotoSpeakParam(); | ||||
param.setImg(Base64Util.imageUrlToBase64(photoSpeakVideo.getPersonPhotoUrl())); | param.setImg(Base64Util.imageUrlToBase64(photoSpeakVideo.getPersonPhotoUrl())); | ||||
param.setVoice_id(voiceMouldSmId); | |||||
param.setVoice_id(voiceMouldSmId == null ? "default" : voiceMouldSmId); | |||||
String voiceMouldSm = photoSpeakVideo.getVoiceMouldSm(); | String voiceMouldSm = photoSpeakVideo.getVoiceMouldSm(); | ||||
JSONObject jsonObject = JSON.parseObject(voiceMouldSm); | |||||
Integer speakTypeStr = jsonObject.getInteger("speakType"); | |||||
param.setVoice_style(StringUtils.isBlank(voiceType) ? "default" : EnumSpeakType.getEnum(speakTypeStr).getType()); | |||||
previewParam.setVoice_style(StringUtils.isBlank(voiceType) ? "default" : EnumSpeakType.getEnum(speakTypeStr).getType()); | |||||
Integer speakType = 0; | |||||
if (!StringUtils.isBlank(voiceMouldSm)) { | |||||
JSONObject jsonObject = JSON.parseObject(voiceMouldSm); | |||||
speakType = jsonObject.getInteger("speakType"); | |||||
} | |||||
param.setVoice_style(EnumSpeakType.getEnum(speakType).getType()); | |||||
Integer sex = jsonObject.getInteger("sex"); | |||||
if (EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)) { | if (EnumVoiceFrom.FROM_MOULD.getCode().equals(voiceFrom)) { | ||||
param.setGen_txt(paperwork); | |||||
previewParam.setGen_txt(paperwork); | |||||
param.setGen_txt(paperwork.replaceAll(str, "[*]")); | |||||
if (sex == 1){ | if (sex == 1){ | ||||
param.setGender("male"); | param.setGender("male"); | ||||
previewParam.setGender("male"); | |||||
}else if (sex == 2){ | }else if (sex == 2){ | ||||
param.setGender("female"); | param.setGender("female"); | ||||
previewParam.setGender("female"); | |||||
}else { | }else { | ||||
param.setGender("unknown"); | param.setGender("unknown"); | ||||
previewParam.setGender("unknown"); | |||||
} | } | ||||
param.setUrl("None"); | param.setUrl("None"); | ||||
} else if (EnumVoiceFrom.FROM_UPD.getCode().equals(voiceFrom)) { | } else if (EnumVoiceFrom.FROM_UPD.getCode().equals(voiceFrom)) { | ||||
param.setGen_txt("None"); | param.setGen_txt("None"); | ||||
param.setGender("None"); | param.setGender("None"); | ||||
param.setUrl(voiceMaterialUrl); | param.setUrl(voiceMaterialUrl); | ||||
} | |||||
//TTS音色预览 | |||||
AiPreviewResult result = AiVideoHelper.voicePreview(previewParam); | |||||
if (!result.isSuccess()) { | |||||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | |||||
videoUpd.setVideoMsg(result.getMsgInfo(result.getCode(), result.getMsg())); | |||||
videoUpd.setCreateVideoDate(new Date()); | |||||
this.saveOrUpdate(videoUpd); | |||||
if (flag) { | |||||
//如果生成视频失败了,就把创建视频的次数加回去 | |||||
userCreateVideoNumService.addOrSubtractNumberOfTimes(2, createVideoNum); | |||||
} | |||||
return new AsyncResult<>(0); | |||||
}else if (EnumVoiceFrom.MUSIC.getCode().equals(voiceFrom)){ | |||||
param.setGen_txt("None"); | |||||
param.setGender("None"); | |||||
param.setUrl(voiceMaterialUrl); | |||||
} | } | ||||
AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | ||||
if (video.isSuccess()) { | if (video.isSuccess()) { | ||||
videoUpd.setVideoPath(video.getUrl()); | videoUpd.setVideoPath(video.getUrl()); | ||||
videoUpd.setSaveDir(video.getSaveDir()); | |||||
videoUpd.setVideoStatus(EnumVideoStatus.success.getCode()); | videoUpd.setVideoStatus(EnumVideoStatus.success.getCode()); | ||||
videoUpd.setVideoMsg("success"); | videoUpd.setVideoMsg("success"); | ||||
videoUpd.setCreateVideoDate(new Date()); | videoUpd.setCreateVideoDate(new Date()); | ||||
this.saveOrUpdate(videoUpd); | this.saveOrUpdate(videoUpd); | ||||
videoUpd.setTitle(photoSpeakVideo.getTitle()); | videoUpd.setTitle(photoSpeakVideo.getTitle()); | ||||
// UserCreditLog log = new UserCreditLog(); | |||||
// log.setId(IdWorker.get().nextId()); | |||||
// log.setUserId(photoSpeakVideo.getUserId()); | |||||
// log.setCredits(-(float)useCredit); | |||||
// log.setType(EnumLogType.PHOTO_SPEAK.getCode()); | |||||
// log.setRemark(EnumLogType.PHOTO_SPEAK.getMessage()); | |||||
// log.setVideoOrPhotoOrTalkId(videoUpd.getId()); | |||||
// userCreditLogService.insertLog(log); | |||||
this.uploadVideo(videoUpd); | this.uploadVideo(videoUpd); | ||||
return new AsyncResult<>(1); | return new AsyncResult<>(1); | ||||
@@ -353,17 +423,17 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
this.saveOrUpdate(videoUpd); | this.saveOrUpdate(videoUpd); | ||||
if (flag) { | if (flag) { | ||||
//如果生成视频失败了,就把创建视频的次数加回去 | |||||
userCreateVideoNumService.addOrSubtractNumberOfTimes(2, createVideoNum); | |||||
//如果生成视频失败了,就把创建视频积分加回去 | |||||
userCreateVideoNumService.addOrSubtractNumberOfTimes(2, videoNum, useCredit, videoTime); | |||||
} | } | ||||
return new AsyncResult<>(0); | return new AsyncResult<>(0); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
e.printStackTrace(); | |||||
if (flag) { | if (flag) { | ||||
//如果生成视频失败了,就把创建视频的次数加回去 | |||||
userCreateVideoNumService.addOrSubtractNumberOfTimes(2, createVideoNum); | |||||
//如果生成视频失败了,就把创建视频积分加回去 | |||||
userCreateVideoNumService.addOrSubtractNumberOfTimes(2, videoNum, useCredit, videoTime); | |||||
} | } | ||||
e.printStackTrace(); | |||||
videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | videoUpd.setVideoStatus(EnumVideoStatus.fail.getCode()); | ||||
videoUpd.setVideoMsg("请求异常"); | videoUpd.setVideoMsg("请求异常"); | ||||
this.saveOrUpdate(videoUpd); | this.saveOrUpdate(videoUpd); | ||||
@@ -421,4 +491,45 @@ public class PhotoSpeakVideoServiceImpl implements PhotoSpeakVideoService { | |||||
return photoSpeakVideoMapper.updateById(video); | return photoSpeakVideoMapper.updateById(video); | ||||
} | } | ||||
@Override | |||||
public void videoHy(PhotoSpeakVideo speakVideo,Boolean flag) { | |||||
AiVideoHqParam param = new AiVideoHqParam(); | |||||
param.setSave_dir(speakVideo.getSaveDir()); | |||||
AiVideoHqResult result = AiVideoHelper.videoHq(param); | |||||
if(result.isSuccess()){ | |||||
speakVideo.setVideoHyStatus(EnumVideoStatus.success.getCode()); | |||||
speakVideo.setVideoMsg("超分视频生成成功"); | |||||
speakVideo.setIsHy(EnumYesOrNo.YES.getCode()); | |||||
this.updateById(speakVideo); | |||||
this.uploadHyVideo(speakVideo); | |||||
} | |||||
speakVideo.setVideoHyStatus(EnumVideoStatus.fail.getCode()); | |||||
speakVideo.setVideoMsg("超分视频失败"); | |||||
this.updateById(speakVideo); | |||||
} | |||||
@Override | |||||
public void uploadHyVideo(PhotoSpeakVideo mouldVideo){ | |||||
if(EnumVideoStatus.success.getCode().equals(mouldVideo.getVideoHyStatus()) | |||||
|| EnumVideoStatus.upload_fail.getCode().equals(mouldVideo.getVideoHyStatus())){ | |||||
String url = mouldVideo.getPhotoSpeakPathUri() + mouldVideo.getVideoPath(); | |||||
VideUploadResult result = videoFactory.getExcutor(videoType).uploadVideoPath(mouldVideo.getTitle(), url); | |||||
if(result.isSuccess()){ | |||||
PhotoSpeakVideo videoUpd = new PhotoSpeakVideo(); | |||||
videoUpd.setId(mouldVideo.getId()); | |||||
videoUpd.setVideoId(result.getVideoId()); | |||||
videoUpd.setVideoHyStatus(EnumVideoStatus.upload_ing.getCode()); | |||||
this.saveOrUpdate(videoUpd); | |||||
} | |||||
} | |||||
} | |||||
@Override | |||||
public List<PhotoSpeakVideo> getUpLoadHyIngList() { | |||||
PhotoSpeakVideo umVideoQ = new PhotoSpeakVideo(); | |||||
umVideoQ.setVideoHyStatus(EnumVideoStatus.upload_ing.getCode()); | |||||
return photoSpeakVideoMapper.getSortList(umVideoQ); | |||||
} | |||||
} | } |
@@ -0,0 +1,78 @@ | |||||
package com.iformall.service.sm.impl; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.iformall.domain.po.sm.UserConsumptionPackage; | |||||
import com.iformall.domain.po.sm.UserPackageDetail; | |||||
import com.iformall.enums.EnumLanguages; | |||||
import com.iformall.enums.EnumYesOrNo; | |||||
import com.iformall.enums.sm.*; | |||||
import com.iformall.mapper.UserConsumptionPackageMapper; | |||||
import com.iformall.service.sm.UserConsumptionPackageService; | |||||
import com.iformall.service.sm.UserPackageDetailService; | |||||
import org.apache.commons.collections.CollectionUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
@Service | |||||
public class UserConsumptionPackageImpl implements UserConsumptionPackageService { | |||||
@Autowired | |||||
private UserConsumptionPackageMapper userConsumptionPackageMapper; | |||||
@Autowired | |||||
private UserPackageDetailService userPackageDetailService; | |||||
@Override | |||||
public UserConsumptionPackage getPackageInfoByType(Integer packageType) { | |||||
return userConsumptionPackageMapper | |||||
.selectOne(new LambdaQueryWrapper<UserConsumptionPackage>() | |||||
.eq(UserConsumptionPackage::getIsDel, 0) | |||||
.eq(UserConsumptionPackage::getType, packageType)); | |||||
} | |||||
@Override | |||||
public UserConsumptionPackage getPackageInfoById(Integer id) { | |||||
return userConsumptionPackageMapper | |||||
.selectOne(new LambdaQueryWrapper<UserConsumptionPackage>() | |||||
.eq(UserConsumptionPackage::getIsDel, 0) | |||||
.eq(UserConsumptionPackage::getId, id)); | |||||
} | |||||
@Override | |||||
public List<UserConsumptionPackage> getPackageInfo() { | |||||
List<UserConsumptionPackage> consumptionPackages = userConsumptionPackageMapper.selectList(new LambdaQueryWrapper<UserConsumptionPackage>().eq(UserConsumptionPackage::getIsDel, 0)); | |||||
List<UserPackageDetail> detailInfo = userPackageDetailService.getDetailInfo(); | |||||
if (CollectionUtils.isEmpty(consumptionPackages) || CollectionUtils.isEmpty(detailInfo)) { | |||||
return consumptionPackages; | |||||
} | |||||
for (UserConsumptionPackage consumptionPackage : consumptionPackages) { | |||||
consumptionPackage.setTypeDesc(EnumPackageType.getEnum(consumptionPackage.getType()).getMessage()); | |||||
List<UserPackageDetail> list = new ArrayList<>(); | |||||
for (UserPackageDetail detail : detailInfo) { | |||||
if (consumptionPackage.getId().equals(detail.getPackageId())) { | |||||
detail.setDetailTypeDesc(EnumPackageDetailType.getEnum(detail.getDetailType()).getMessage()); | |||||
detail.setWatermarkDesc(EnumYesOrNo.getEnum(detail.getWatermark()).getMessage()); | |||||
detail.setLanguageDesc(EnumLanguageType.getEnum(detail.getLanguage()).getMessage()); | |||||
detail.setSoundDesc(EnumSoundType.getEnum(detail.getSound()).getMessage()); | |||||
detail.setResolutionRatioDesc(EnumResolutionRatioType.getEnum(detail.getResolutionRatio()).getMessage()); | |||||
if (detail.getDetailType().equals(EnumPackageDetailType.PHOTO_SPEAK.getCode())) { | |||||
detail.setAiPortraitDesc(EnumYesOrNo.getEnum(detail.getAiPortrait()).getMessage()); | |||||
detail.setPhotoSingDesc(EnumYesOrNo.getEnum(detail.getPhotoSing()).getMessage()); | |||||
} | |||||
if (detail.getDetailType().equals(EnumPackageDetailType.TALK.getCode())) { | |||||
detail.setHumanTemplateDesc(EnumHumanTemplateType.getEnum(detail.getHumanTemplate()).getMessage()); | |||||
} | |||||
list.add(detail); | |||||
} | |||||
} | |||||
consumptionPackage.setUserPackageDetails(list); | |||||
} | |||||
return consumptionPackages; | |||||
} | |||||
} |
@@ -2,17 +2,23 @@ | |||||
package com.iformall.service.sm.impl; | package com.iformall.service.sm.impl; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
import com.iformall.domain.po.sm.UserConsumptionPackage; | |||||
import com.iformall.domain.po.sm.UserCreateVideoNum; | import com.iformall.domain.po.sm.UserCreateVideoNum; | ||||
import com.iformall.domain.po.sm.UserCreditLog; | |||||
import com.iformall.enums.sm.EnumLogType; | |||||
import com.iformall.enums.sm.EnumPackageType; | |||||
import com.iformall.mapper.UserCreateVideoNumMapper; | import com.iformall.mapper.UserCreateVideoNumMapper; | ||||
import com.iformall.service.sm.UserConsumptionPackageService; | |||||
import com.iformall.service.sm.UserCreateVideoNumService; | import com.iformall.service.sm.UserCreateVideoNumService; | ||||
import io.swagger.models.auth.In; | |||||
import com.iformall.service.sm.UserCreditLogService; | |||||
import com.iformall.utils.DateUtils; | |||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.util.ObjectUtils; | |||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.Map; | import java.util.Map; | ||||
@@ -24,11 +30,15 @@ public class UserCreateVideoNumServiceImpl implements UserCreateVideoNumService | |||||
@Autowired | @Autowired | ||||
private UserCreateVideoNumMapper userCreateVideoNumMapper; | private UserCreateVideoNumMapper userCreateVideoNumMapper; | ||||
//总条数初始值 | |||||
private static final Integer RESIDUE_TOTAL = 10; | |||||
@Autowired | |||||
private UserConsumptionPackageService userConsumptionPackageService; | |||||
@Autowired | |||||
private UserCreditLogService userCreditLogService; | |||||
/** | /** | ||||
* 初始化注册用户创建视频的次数 | |||||
* 初始化注册用户创建视频的时长 | |||||
* | * | ||||
* @param id 用户id | * @param id 用户id | ||||
* @Author LWH | * @Author LWH | ||||
@@ -36,26 +46,55 @@ public class UserCreateVideoNumServiceImpl implements UserCreateVideoNumService | |||||
* @date: 2023/6/8 10:23 | * @date: 2023/6/8 10:23 | ||||
*/ | */ | ||||
public Boolean initializationUserCreateVideoNum(Long id) { | public Boolean initializationUserCreateVideoNum(Long id) { | ||||
//注册即送最基础版的积分 | |||||
UserConsumptionPackage packageInfo = userConsumptionPackageService.getPackageInfoByType(EnumPackageType.BASIC.getCode()); | |||||
UserCreateVideoNum createVideoNum = new UserCreateVideoNum(); | UserCreateVideoNum createVideoNum = new UserCreateVideoNum(); | ||||
createVideoNum.setId(IdWorker.get().nextId()); | |||||
createVideoNum.setUserId(id); | |||||
createVideoNum.setResidueNum(RESIDUE_TOTAL); | |||||
createVideoNum.setResidueTotal(RESIDUE_TOTAL); | |||||
Date date = new Date(); | |||||
createVideoNum.setCreateDate(date); | |||||
createVideoNum.setUpdateDate(date); | |||||
createVideoNum.setIsDel(0); | |||||
return userCreateVideoNumMapper.insert(createVideoNum) > 0; | |||||
if (!ObjectUtils.isEmpty(packageInfo)) { | |||||
createVideoNum.setId(IdWorker.get().nextId()); | |||||
createVideoNum.setUserId(id); | |||||
//有效期 | |||||
createVideoNum.setEffectiveDate(DateUtils.getTimeAfterDays(packageInfo.getValidityDuration(), new Date())); | |||||
//积分 | |||||
createVideoNum.setUserCredits(packageInfo.getCredit()); | |||||
createVideoNum.setResidueCredits(packageInfo.getCredit()); | |||||
createVideoNum.setInviteBaseCredits(packageInfo.getInviteUserCredit()); | |||||
createVideoNum.setVideoPrice(packageInfo.getVideoPrice()); | |||||
createVideoNum.setPhotoPrice(packageInfo.getPhotoPrice()); | |||||
createVideoNum.setTalkPrice(packageInfo.getTalkPrice()); | |||||
//插入类型 | |||||
createVideoNum.setPackageId(packageInfo.getId()); | |||||
Date date = new Date(); | |||||
createVideoNum.setCreateDate(date); | |||||
createVideoNum.setUpdateDate(date); | |||||
createVideoNum.setIsDel(0); | |||||
//插入日志信息 | |||||
UserCreditLog log = new UserCreditLog(); | |||||
log.setId(IdWorker.get().nextId()); | |||||
log.setUserId(id); | |||||
log.setCredits(packageInfo.getCredit()); | |||||
log.setType(EnumLogType.REGISTER_USER.getCode()); | |||||
log.setRemark(EnumLogType.REGISTER_USER.getMessage()); | |||||
userCreditLogService.insertLog(log); | |||||
return userCreateVideoNumMapper.insert(createVideoNum) > 0; | |||||
} | |||||
return false; | |||||
} | } | ||||
@Override | @Override | ||||
public Boolean addOrSubtractNumberOfTimes(Integer type, UserCreateVideoNum createVideoNum) { | |||||
return userCreateVideoNumMapper.addOrSubtractNumberOfTimes(type,createVideoNum); | |||||
public Boolean addOrSubtractNumberOfTimes(Integer type, UserCreateVideoNum createVideoNum, Double useCredit, Double videoTime) { | |||||
return userCreateVideoNumMapper.addOrSubtractNumberOfTimes(type, createVideoNum, useCredit, videoTime); | |||||
} | } | ||||
@Override | @Override | ||||
public UserCreateVideoNum queryInfoByUserId(Long userId) { | public UserCreateVideoNum queryInfoByUserId(Long userId) { | ||||
return userCreateVideoNumMapper.selectOne(new LambdaQueryWrapper<UserCreateVideoNum>().eq(UserCreateVideoNum::getUserId, userId)); | |||||
return userCreateVideoNumMapper | |||||
.selectOne(new LambdaQueryWrapper<UserCreateVideoNum>() | |||||
.eq(UserCreateVideoNum::getIsDel, 0) | |||||
.eq(UserCreateVideoNum::getUserId, userId)); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -66,8 +105,20 @@ public class UserCreateVideoNumServiceImpl implements UserCreateVideoNumService | |||||
videoNum.setCreateAllTime(entry.getValue()); | videoNum.setCreateAllTime(entry.getValue()); | ||||
userCreateVideoNumMapper.update(videoNum, | userCreateVideoNumMapper.update(videoNum, | ||||
new LambdaUpdateWrapper<UserCreateVideoNum>() | new LambdaUpdateWrapper<UserCreateVideoNum>() | ||||
.eq(UserCreateVideoNum::getIsDel, 0) | |||||
.eq(UserCreateVideoNum::getUserId, entry.getKey())); | |||||
.eq(UserCreateVideoNum::getIsDel, 0) | |||||
.eq(UserCreateVideoNum::getUserId, entry.getKey())); | |||||
} | |||||
} | |||||
/** | |||||
* 使用邀请码用户增加时长 | |||||
*/ | |||||
@Override | |||||
public void inviteUserAddCreatTime(Long id) { | |||||
UserCreateVideoNum videoNum = queryInfoByUserId(id); | |||||
if (!ObjectUtils.isEmpty(videoNum)) { | |||||
videoNum.setUserCredits(videoNum.getUserCredits() + videoNum.getInviteBaseCredits()); | |||||
userCreateVideoNumMapper.updateById(videoNum); | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -0,0 +1,19 @@ | |||||
package com.iformall.service.sm.impl; | |||||
import com.iformall.domain.po.sm.UserCreditLog; | |||||
import com.iformall.mapper.UserCreditLogMapper; | |||||
import com.iformall.service.sm.UserCreditLogService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
@Service | |||||
public class UserCreditLogServiceImpl implements UserCreditLogService { | |||||
@Autowired | |||||
private UserCreditLogMapper userCreditLogMapper; | |||||
@Override | |||||
public void insertLog(UserCreditLog log) { | |||||
userCreditLogMapper.insert(log); | |||||
} | |||||
} |
@@ -0,0 +1,23 @@ | |||||
package com.iformall.service.sm.impl; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.iformall.domain.po.sm.UserPackageDetail; | |||||
import com.iformall.mapper.UserPackageDetailMapper; | |||||
import com.iformall.service.sm.UserPackageDetailService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.List; | |||||
@Service | |||||
public class UserPackageDetailServiceImpl implements UserPackageDetailService { | |||||
@Autowired | |||||
private UserPackageDetailMapper userPackageDetailMapper; | |||||
@Override | |||||
public List<UserPackageDetail> getDetailInfo() { | |||||
return userPackageDetailMapper.selectList(new LambdaQueryWrapper<UserPackageDetail>().eq(UserPackageDetail::getIsDel, 0)); | |||||
} | |||||
} |
@@ -27,9 +27,11 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { | |||||
@Autowired | @Autowired | ||||
private VoiceMapper voiceMapper; | private VoiceMapper voiceMapper; | ||||
private final static String str = "\uD83D\uDD57"; | |||||
@Override | @Override | ||||
public List<VoiceInfo> chooseType(Long id) { | public List<VoiceInfo> chooseType(Long id) { | ||||
List<VoiceInfo> voiceInfos = voiceMapper.selectList(new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getLanguageId, id).orderByAsc(VoiceInfo::getDisplayName).select(VoiceInfo::getId, VoiceInfo::getDisplayName, VoiceInfo::getStyleList)); | |||||
List<VoiceInfo> voiceInfos = voiceMapper.selectList(new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getLanguageId, id).orderByAsc(VoiceInfo::getDisplayName).select(VoiceInfo::getId, VoiceInfo::getDisplayName, VoiceInfo::getStyleList,VoiceInfo::getSex,VoiceInfo::getAgeType)); | |||||
voiceInfos.forEach(x -> { | voiceInfos.forEach(x -> { | ||||
if (StringUtils.isNotEmpty(x.getStyleList())) { | if (StringUtils.isNotEmpty(x.getStyleList())) { | ||||
List<String> strings = JSON.parseArray(x.getStyleList(), String.class); | List<String> strings = JSON.parseArray(x.getStyleList(), String.class); | ||||
@@ -40,6 +42,7 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { | |||||
x.setStyle(list); | x.setStyle(list); | ||||
} else { | } else { | ||||
x.setStyle(Lists.newArrayList()); | x.setStyle(Lists.newArrayList()); | ||||
} | } | ||||
}); | }); | ||||
return voiceInfos; | return voiceInfos; | ||||
@@ -52,15 +55,14 @@ public class VoiceInfoServiceImpl implements VoiceInfoService { | |||||
@Override | @Override | ||||
public ResultData voicePreview(AiPreviewParam aiPreviewParam) { | public ResultData voicePreview(AiPreviewParam aiPreviewParam) { | ||||
if (aiPreviewParam.getVoice_id() == null || StringUtils.isBlank(aiPreviewParam.getGen_txt())) { | |||||
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "参数不能为空"); | |||||
} | |||||
VoiceInfo voiceInfo = voiceMapper.selectOne(new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getIsDel, 0).eq(VoiceInfo::getId, aiPreviewParam.getVoice_id())); | VoiceInfo voiceInfo = voiceMapper.selectOne(new LambdaQueryWrapper<VoiceInfo>().eq(VoiceInfo::getIsDel, 0).eq(VoiceInfo::getId, aiPreviewParam.getVoice_id())); | ||||
if (ObjectUtils.isEmpty(voiceInfo)){ | |||||
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(), "声音信息不存在"); | |||||
} | |||||
AiPreviewParam param = new AiPreviewParam(); | AiPreviewParam param = new AiPreviewParam(); | ||||
param.setGen_txt(aiPreviewParam.getGen_txt()); | |||||
param.setGen_txt(aiPreviewParam.getGen_txt().replaceAll(str,"[*]")); | |||||
param.setVoice_id(voiceInfo.getMouldSmId()); | param.setVoice_id(voiceInfo.getMouldSmId()); | ||||
param.setVoice_style(StringUtils.isBlank(aiPreviewParam.getVoice_style()) ? "default" : aiPreviewParam.getVoice_style()); | |||||
param.setVoice_style(StringUtils.isBlank(aiPreviewParam.getVoice_style()) ? EnumSpeakType.default_0.getMessage() : aiPreviewParam.getVoice_style()); | |||||
param.setGender(voiceInfo.getSex() == 1 ? "male" : "female"); | param.setGender(voiceInfo.getSex() == 1 ? "male" : "female"); | ||||
AiPreviewResult result = AiVideoHelper.voicePreview(param); | AiPreviewResult result = AiVideoHelper.voicePreview(param); | ||||
if (result.isSuccess()){ | if (result.isSuccess()){ | ||||
@@ -20,7 +20,7 @@ public class VoiceLanguageServiceImpl implements VoiceLanguageService { | |||||
@Override | @Override | ||||
public List<VoiceLanguage> voiceTotal() { | public List<VoiceLanguage> voiceTotal() { | ||||
List<VoiceLanguage> languages = voiceLanguageMapper.selectList(new LambdaQueryWrapper<VoiceLanguage>().eq(VoiceLanguage::getIsDel, 0).orderByAsc(VoiceLanguage::getName).select(VoiceLanguage::getId, VoiceLanguage::getName, VoiceLanguage::getImg)); | |||||
List<VoiceLanguage> languages = voiceLanguageMapper.selectList(new LambdaQueryWrapper<VoiceLanguage>().eq(VoiceLanguage::getIsDel, 0).orderByAsc(VoiceLanguage::getLocal)); | |||||
return CollectionUtils.isEmpty(languages) ? Lists.newArrayList() : languages; | return CollectionUtils.isEmpty(languages) ? Lists.newArrayList() : languages; | ||||
} | } | ||||
} | } |
@@ -8,6 +8,7 @@ public class AiPhotoSpeakResult { | |||||
private boolean success; | private boolean success; | ||||
private String msg; | private String msg; | ||||
private String url; | private String url; | ||||
private String saveDir; | |||||
public String getMsgInfo(Integer code, String msg) { | public String getMsgInfo(Integer code, String msg) { | ||||
if (code == 4000 && msg.equals("success")) { | if (code == 4000 && msg.equals("success")) { | ||||
@@ -10,6 +10,7 @@ public class AiPreviewResult { | |||||
private Integer code; | private Integer code; | ||||
private String msg; | private String msg; | ||||
private String url; | private String url; | ||||
private Double time; | |||||
public String getMsgInfo(Integer code, String msg) { | public String getMsgInfo(Integer code, String msg) { | ||||
if (code == 3000 && msg.equals("success")) { | if (code == 3000 && msg.equals("success")) { | ||||
@@ -35,6 +35,7 @@ public class AiVideoHelper { | |||||
public static String photo_speak_suffix = "/img_talking"; | public static String photo_speak_suffix = "/img_talking"; | ||||
public static String image_quality_suffix = "/image_qualit"; | public static String image_quality_suffix = "/image_qualit"; | ||||
public static String voice_preview = "/tts_wav"; | public static String voice_preview = "/tts_wav"; | ||||
public static String video_hq = "/video_hq"; | |||||
public static String doPost(String url, String params) { | public static String doPost(String url, String params) { | ||||
return HttpUtil.doAiVideoPost(url,params); | return HttpUtil.doAiVideoPost(url,params); | ||||
@@ -123,8 +124,10 @@ public class AiVideoHelper { | |||||
if (code.intValue() == 4000) { | if (code.intValue() == 4000) { | ||||
JSONObject data = jsonObject.getJSONObject("data"); | JSONObject data = jsonObject.getJSONObject("data"); | ||||
String videoUrl = data.getString("url"); | String videoUrl = data.getString("url"); | ||||
String saveDir = data.getString("save_dir"); | |||||
result.setSuccess(true); | result.setSuccess(true); | ||||
result.setUrl(videoUrl); | result.setUrl(videoUrl); | ||||
result.setSaveDir(saveDir); | |||||
String resultMsg = result.getMsgInfo(code, msg); | String resultMsg = result.getMsgInfo(code, msg); | ||||
result.setMsg(resultMsg); | result.setMsg(resultMsg); | ||||
} else { | } else { | ||||
@@ -181,6 +184,13 @@ public class AiVideoHelper { | |||||
JSONObject jsonObject = JSON.parseObject(response); | JSONObject jsonObject = JSON.parseObject(response); | ||||
JSONObject status = jsonObject.getJSONObject("status"); | JSONObject status = jsonObject.getJSONObject("status"); | ||||
JSONObject data = jsonObject.getJSONObject("data"); | JSONObject data = jsonObject.getJSONObject("data"); | ||||
String strURL = null; | |||||
String time = null; | |||||
if (data != null){ | |||||
strURL = data.getString("url"); | |||||
time = data.getString("time"); | |||||
} | |||||
Integer code = status.getInteger("code"); | Integer code = status.getInteger("code"); | ||||
String msg = status.getString("msg"); | String msg = status.getString("msg"); | ||||
if (code == null) { | if (code == null) { | ||||
@@ -191,7 +201,48 @@ public class AiVideoHelper { | |||||
if (code.intValue() == 3000) { | if (code.intValue() == 3000) { | ||||
result.setCode(200); | result.setCode(200); | ||||
result.setSuccess(true); | result.setSuccess(true); | ||||
result.setUrl(url + data.getString("url")); | |||||
result.setUrl(url + strURL); | |||||
result.setTime(Double.valueOf(time)); | |||||
String resultMsg = result.getMsgInfo(code, msg); | |||||
result.setMsg(resultMsg); | |||||
} else { | |||||
result.setCode(code); | |||||
result.setSuccess(false); | |||||
String resultMsg = result.getMsgInfo(code, msg); | |||||
result.setMsg(resultMsg); | |||||
} | |||||
return result; | |||||
} | |||||
public static AiVideoHqResult videoHq(AiVideoHqParam param) { | |||||
String response = doPost(url + video_hq, JSONObject.toJSONString(param)); | |||||
log.info("视频超分 end response:" + response); | |||||
AiVideoHqResult result = new AiVideoHqResult(); | |||||
if (StringUtils.isBlank(response)) { | |||||
result.setSuccess(false); | |||||
result.setMsg("视频超分失败,请稍后重试"); | |||||
return result; | |||||
} | |||||
JSONObject jsonObject = JSON.parseObject(response); | |||||
JSONObject status = jsonObject.getJSONObject("status"); | |||||
JSONObject data = jsonObject.getJSONObject("data"); | |||||
String strURL = null; | |||||
if (data != null){ | |||||
strURL = data.getString("url"); | |||||
} | |||||
Integer code = status.getInteger("code"); | |||||
String msg = status.getString("msg"); | |||||
if (code == null) { | |||||
result.setSuccess(false); | |||||
result.setMsg("视频超分异常,请稍后重试"); | |||||
return result; | |||||
} | |||||
if (code.intValue() == 3000) { | |||||
result.setCode(200); | |||||
result.setSuccess(true); | |||||
result.setUrl(url + strURL); | |||||
String resultMsg = result.getMsgInfo(code, msg); | String resultMsg = result.getMsgInfo(code, msg); | ||||
result.setMsg(resultMsg); | result.setMsg(resultMsg); | ||||
} else { | } else { | ||||
@@ -229,11 +280,11 @@ public class AiVideoHelper { | |||||
param.setGen_txt("人多泰达股份冲冠怒发代发"); | param.setGen_txt("人多泰达股份冲冠怒发代发"); | ||||
param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/digitalperson/16760216806604820_cSHoijDX_matting.png")); | param.setImg(Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/digitalperson/16760216806604820_cSHoijDX_matting.png")); | ||||
param.setGender("male"); | param.setGender("male"); | ||||
param.setVoice_id("zh-CN-YunxiNeural"); | |||||
param.setVoice_style("sad"); | |||||
param.setVoice_id("zh-CN-YunyangNeural"); | |||||
param.setVoice_style("default"); | |||||
param.setUrl("None"); | param.setUrl("None"); | ||||
AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | AiPhotoSpeakResult video = AiVideoHelper.createPhotoSpeakVideo(param); | ||||
// | |||||
// AiCheckPhotoParam param = new AiCheckPhotoParam(); | // AiCheckPhotoParam param = new AiCheckPhotoParam(); | ||||
// String img = Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personmould/16760216806604820_cSHoijDX_grace_1080.jpg"); | // String img = Base64Util.imageUrlToBase64("https://suimang.oss-accelerate.aliyuncs.com/builtin/personmould/16760216806604820_cSHoijDX_grace_1080.jpg"); | ||||
// param.setImg(img); | // param.setImg(img); | ||||
@@ -242,11 +293,16 @@ public class AiVideoHelper { | |||||
// | // | ||||
// AiPreviewParam param = new AiPreviewParam(); | // AiPreviewParam param = new AiPreviewParam(); | ||||
// param.setGen_txt("今天是个好日子"); | // param.setGen_txt("今天是个好日子"); | ||||
// param.setVoice_id("zh-CN-YunyangNeural"); | |||||
// param.setVoice_id("ar-DZ-AminaNeural"); | |||||
// param.setVoice_style("default"); | // param.setVoice_style("default"); | ||||
// param.setGender("male"); | |||||
// param.setGender("female"); | |||||
// AiPreviewResult result = AiVideoHelper.voicePreview(param); | // AiPreviewResult result = AiVideoHelper.voicePreview(param); | ||||
// System.out.println(result); | |||||
// AiVideoHqParam param = new AiVideoHqParam(); | |||||
// param.setSave_dir(); | |||||
// AiVideoHqResult result = AiVideoHelper.videoHq(param); | |||||
// System.out.println(result); | |||||
} | } | ||||
@@ -0,0 +1,9 @@ | |||||
package com.iformall.sm; | |||||
import lombok.Data; | |||||
@Data | |||||
public class AiVideoHqParam { | |||||
private String save_dir; | |||||
} |
@@ -0,0 +1,19 @@ | |||||
package com.iformall.sm; | |||||
import lombok.Data; | |||||
@Data | |||||
public class AiVideoHqResult { | |||||
private boolean success; | |||||
private Integer code; | |||||
private String msg; | |||||
private String url; | |||||
public String getMsgInfo(Integer code, String msg) { | |||||
if (code == 5000 && msg.equals("success")) { | |||||
return "成功"; | |||||
} | |||||
return msg; | |||||
} | |||||
} |
@@ -0,0 +1,10 @@ | |||||
<?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.iformall.mapper.InviteCodeMapper"> | |||||
<update id="addUseTotal"> | |||||
UPDATE invite_code | |||||
SET total = #{total} + 1 | |||||
WHERE id = #{id} | |||||
</update> | |||||
</mapper> |
@@ -0,0 +1,22 @@ | |||||
<?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.iformall.mapper.MusicInfoServiceMapper"> | |||||
<select id="findList" resultType="com.iformall.domain.po.sm.MusicInfo"> | |||||
SELECT id, update_date, size, name, time, is_del, url, create_date, user_id, type | |||||
FROM music_info | |||||
WHERE is_del = 0 and type = #{type} and user_id = 0 | |||||
ORDER BY create_date DESC | |||||
</select> | |||||
<select id="userMusic" resultType="com.iformall.domain.po.sm.MusicInfo"> | |||||
SELECT id, update_date, size, name, time, is_del, url, create_date, user_id, type | |||||
FROM music_info | |||||
WHERE is_del = 0 and type = #{type} and user_id = #{userId} | |||||
ORDER BY create_date DESC | |||||
</select> | |||||
<update id="deleteById"> | |||||
update music_info set is_del = 1,update_date = now() where id = #{id} | |||||
</update> | |||||
</mapper> |
@@ -27,6 +27,11 @@ | |||||
<result column="video_status" jdbcType="INTEGER" property="videoStatus"/> | <result column="video_status" jdbcType="INTEGER" property="videoStatus"/> | ||||
<result column="video_msg" jdbcType="VARCHAR" property="videoMsg"/> | <result column="video_msg" jdbcType="VARCHAR" property="videoMsg"/> | ||||
<result column="is_hy" jdbcType="INTEGER" property="isHy"/> | |||||
<result column="video_hy_status" jdbcType="INTEGER" property="videoHyStatus"/> | |||||
<result column="music_id" jdbcType="VARCHAR" property="musicId"/> | |||||
<result column="save_dir" jdbcType="VARCHAR" property="saveDir"/> | |||||
<result column="create_video_date" jdbcType="TIMESTAMP" property="createVideoDate"/> | <result column="create_video_date" jdbcType="TIMESTAMP" property="createVideoDate"/> | ||||
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | ||||
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||||
@@ -35,7 +40,8 @@ | |||||
<sql id="allColumns"> | <sql id="allColumns"> | ||||
`id`, `tenant_id`, `parent_tenant_id`, `user_id`, | `id`, `tenant_id`, `parent_tenant_id`, `user_id`, | ||||
`person_photo_id`, `person_photo_url`, `voice_from`, `voice_mould_id`, `voice_mould_sm`, `paperwork`, `voice_material_id`, `voice_material_url`, | `person_photo_id`, `person_photo_url`, `voice_from`, `voice_mould_id`, `voice_mould_sm`, `paperwork`, `voice_material_id`, `voice_material_url`, | ||||
`title`, `cover_img`, `remark`, `video_id`, `video_path`, `video_play_url`, `video_time`, `video_size`, `video_status`, `video_msg`, `create_video_date`, `create_date`, `update_date` | |||||
`title`, `cover_img`, `remark`, `video_id`, `video_path`, `video_play_url`, `video_time`, `video_size`, `video_status`, `video_msg`, `create_video_date`, `create_date`, `update_date`, | |||||
`is_hy`,`video_hy_status`,`music_id`,`save_dir` | |||||
</sql> | </sql> | ||||
<sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
@@ -59,6 +65,15 @@ | |||||
<if test=" null != voiceFrom "> | <if test=" null != voiceFrom "> | ||||
and `voice_from` = #{voiceFrom} | and `voice_from` = #{voiceFrom} | ||||
</if> | </if> | ||||
<if test=" null != isHy "> | |||||
and `is_hy` = #{isHy} | |||||
</if> | |||||
<if test=" null != musicId "> | |||||
and `music_id` = #{musicId} | |||||
</if> | |||||
<if test=" null != saveDir "> | |||||
and `save_dir` = #{saveDir} | |||||
</if> | |||||
<if test=" null != voiceMouldId "> | <if test=" null != voiceMouldId "> | ||||
and `voice_mould_id` = #{voiceMouldId} | and `voice_mould_id` = #{voiceMouldId} | ||||
@@ -71,6 +86,9 @@ | |||||
<if test=" null != videoStatus "> | <if test=" null != videoStatus "> | ||||
and `video_status` = #{videoStatus} | and `video_status` = #{videoStatus} | ||||
</if> | </if> | ||||
<if test=" null != videoHyStatus "> | |||||
and `video_hy_status` = #{videoHyStatus} | |||||
</if> | |||||
<if test=" null != startDate "> | <if test=" null != startDate "> | ||||
and create_date >= #{startDate} | and create_date >= #{startDate} | ||||
@@ -119,7 +137,7 @@ | |||||
`id`, | `id`, | ||||
`paperwork`, | `paperwork`, | ||||
`title`, `cover_img`, `remark`, `video_id`, `video_path`, `video_play_url`, `video_time`, `video_size`, `video_status`,`video_msg`, | `title`, `cover_img`, `remark`, `video_id`, `video_path`, `video_play_url`, `video_time`, `video_size`, `video_status`,`video_msg`, | ||||
`create_video_date`, `create_date`, `update_date` | |||||
`create_video_date`, `create_date`, `update_date`,`is_hy` | |||||
from photo_speak_video | from photo_speak_video | ||||
<include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
</select> | </select> | ||||
@@ -7,10 +7,14 @@ | |||||
UPDATE user_create_video_num | UPDATE user_create_video_num | ||||
<set> | <set> | ||||
<if test="type == 1"> | <if test="type == 1"> | ||||
residue_num = #{createVideoNum.residueNum} - 1,create_num = #{createVideoNum.createNum} + 1 | |||||
<!-- residue_credits = residue_credits - #{useCredit},--> | |||||
create_num = create_num + 1, | |||||
create_all_time = create_all_time + #{time} | |||||
</if> | </if> | ||||
<if test="type == 2"> | <if test="type == 2"> | ||||
residue_num = #{createVideoNum.residueNum} + 1,create_num = #{createVideoNum.createNum} - 1 | |||||
<!-- residue_credits = residue_credits + #{useCredit},--> | |||||
create_num =create_num - 1, | |||||
create_all_time = create_all_time - #{time} | |||||
</if> | </if> | ||||
</set> | </set> | ||||
WHERE user_id = #{createVideoNum.userId} | WHERE user_id = #{createVideoNum.userId} | ||||