| @@ -3,14 +3,18 @@ package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.AuthIgnore; | import com.iformall.annotation.AuthIgnore; | ||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.ProductOrder; | |||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.sm.PersonMould; | import com.iformall.domain.po.sm.PersonMould; | ||||
| import com.iformall.domain.po.sm.UserMouldVideo; | import com.iformall.domain.po.sm.UserMouldVideo; | ||||
| import com.iformall.domain.po.sm.VoiceLanguage; | import com.iformall.domain.po.sm.VoiceLanguage; | ||||
| import com.iformall.domain.po.sm.VoiceMould; | import com.iformall.domain.po.sm.VoiceMould; | ||||
| import com.iformall.domain.vo.sm.PreviewVoiceVO; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.language.LanguageDetect; | import com.iformall.language.LanguageDetect; | ||||
| import com.iformall.service.ProductOrderService; | |||||
| import com.iformall.service.WxCVoiceService; | import com.iformall.service.WxCVoiceService; | ||||
| import com.iformall.service.sm.*; | import com.iformall.service.sm.*; | ||||
| import com.iformall.sm.AiPreviewParam; | import com.iformall.sm.AiPreviewParam; | ||||
| @@ -54,6 +58,9 @@ public class VoiceMouldController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCVoiceService wxCVoiceService; | private WxCVoiceService wxCVoiceService; | ||||
| @Autowired | |||||
| private ProductOrderService productOrderService; | |||||
| @AuthIgnore | @AuthIgnore | ||||
| @ApiOperation("获取语种") | @ApiOperation("获取语种") | ||||
| @GetMapping("getLanguages") | @GetMapping("getLanguages") | ||||
| @@ -174,6 +181,20 @@ public class VoiceMouldController extends BaseController { | |||||
| @ApiImplicitParams({}) | @ApiImplicitParams({}) | ||||
| public ResultData voicePreview(@RequestBody AiPreviewParam aiPreviewParam) { | public ResultData voicePreview(@RequestBody AiPreviewParam aiPreviewParam) { | ||||
| logger.debug("[" + getIpAddr() + "] MouldPatchController::voicePreview"); | logger.debug("[" + getIpAddr() + "] MouldPatchController::voicePreview"); | ||||
| return new ResultData(voiceInfoService.previewVoice(aiPreviewParam)); | |||||
| PreviewVoiceVO pv = voiceInfoService.previewVoice(aiPreviewParam); | |||||
| Double time = pv.getTime();//秒 | |||||
| if (time > 5*60 ) { | |||||
| return new ResultData(Result.ERROR,"视频最大时长为300秒,当前时长为"+time+"秒"); | |||||
| } | |||||
| //如果用户未支付,则只能1分钟以内,如果已支付,则可以5分钟以内 | |||||
| ProductOrder po = new ProductOrder(); | |||||
| po.setUserId(getMemberId()); | |||||
| Integer paidCount = productOrderService.findPaidCount(po); | |||||
| if (null == paidCount || paidCount <= 0 ) { | |||||
| if (time > 60) { | |||||
| return new ResultData(Result.ERROR,"视频最大时长为60秒,当前时长为"+time+"秒"); | |||||
| } | |||||
| } | |||||
| return new ResultData(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -15,6 +15,7 @@ import com.iformall.domain.po.sm.InviteCodeInfo; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import com.iformall.service.cuser.CUserServiceFactory; | import com.iformall.service.cuser.CUserServiceFactory; | ||||
| import com.iformall.service.project.ProjectFactory; | |||||
| 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.UserConsumptionPackageService; | ||||
| @@ -113,6 +114,9 @@ public class WxUserGrantController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCUserAuthorityService wxCUserAuthorityService; | private WxCUserAuthorityService wxCUserAuthorityService; | ||||
| @Autowired | |||||
| private ProjectFactory projectFactory; | |||||
| @AuthIgnore | @AuthIgnore | ||||
| @ApiOperation("验证码") | @ApiOperation("验证码") | ||||
| @GetMapping("/captcha.jpg") | @GetMapping("/captcha.jpg") | ||||
| @@ -439,6 +443,9 @@ public class WxUserGrantController extends BaseController { | |||||
| if (!aBoolean) { | if (!aBoolean) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "初始化创建视频时间表失败"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "初始化创建视频时间表失败"); | ||||
| } | } | ||||
| //慧影注册送金币 | |||||
| projectFactory.getProjectService(EnumProject.PROJECT_2.getCode()).handleAfterRegeister(basicInfo); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| // } else { | // } else { | ||||
| // return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); | // return new ResultData(ErrorCode.MSG_VERIFY_CODE_NOT_FOUND); | ||||
| @@ -800,4 +807,12 @@ public class WxUserGrantController extends BaseController { | |||||
| return new ResultData(userBasicInfo.getPoins()); | return new ResultData(userBasicInfo.getPoins()); | ||||
| } | } | ||||
| @ApiOperation("扣减获取用户币值") | |||||
| @GetMapping("/reduceUserPoins") | |||||
| public ResultData reduceUserPoins() { | |||||
| WxCUserBasicInfo user = this.getCUser(); | |||||
| wxCUserBasicInfoService.reducePoints(user.getId(), user.getFinalTenantId(), 1); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||
| @@ -10,4 +10,6 @@ public interface ProductOrderMapper extends CommonMapper<ProductOrder, Long> { | |||||
| List<ProductOrder> findList(ProductOrder record); | List<ProductOrder> findList(ProductOrder record); | ||||
| int orderPayUpdStatus(ProductOrder productOrder); | int orderPayUpdStatus(ProductOrder productOrder); | ||||
| int findCount(ProductOrder record); | |||||
| } | } | ||||
| @@ -29,5 +29,7 @@ public interface ProductOrderService { | |||||
| void handldSharing(ProductOrder order); | void handldSharing(ProductOrder order); | ||||
| void handldTimeOut(Long id); | void handldTimeOut(Long id); | ||||
| Integer findPaidCount(ProductOrder record); | |||||
| } | } | ||||
| @@ -180,4 +180,10 @@ public class ProductOrderServiceImpl implements ProductOrderService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public Integer findPaidCount(ProductOrder record) { | |||||
| record.setOrderStatus(EnumProductOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||||
| return productOrderMapper.findCount(record); | |||||
| } | |||||
| } | } | ||||
| @@ -24,5 +24,10 @@ public interface ProjectService { | |||||
| */ | */ | ||||
| public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoTimes,Long videoSize); | public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoTimes,Long videoSize); | ||||
| /** | |||||
| * 处理用户注册后事项 | |||||
| */ | |||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser); | |||||
| } | } | ||||
| @@ -28,6 +28,12 @@ public class CommonProjectService extends BaseProjectService implements ProjectS | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| } | } | ||||
| @@ -27,6 +27,12 @@ public class HBProjectService extends BaseProjectService implements ProjectServi | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| } | } | ||||
| @@ -28,6 +28,12 @@ public class HKProjectService extends BaseProjectService implements ProjectServi | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| } | } | ||||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
| import com.iformall.service.project.entity.CreateBilling; | import com.iformall.service.project.entity.CreateBilling; | ||||
| import com.iformall.service.project.service.ProjectService; | import com.iformall.service.project.service.ProjectService; | ||||
| import com.iformall.utils.Constant; | |||||
| //慧影 | //慧影 | ||||
| @Service | @Service | ||||
| @@ -37,11 +38,16 @@ public class HYProjectService extends BaseProjectService implements ProjectServi | |||||
| CreateBilling cb = new CreateBilling(); | CreateBilling cb = new CreateBilling(); | ||||
| //每分钟扣币,不足一分钟按一分钟算 | //每分钟扣币,不足一分钟按一分钟算 | ||||
| Integer minitues = new BigDecimal(videoTimes).divide(new BigDecimal(60)).setScale(0,BigDecimal.ROUND_UP).intValue(); | Integer minitues = new BigDecimal(videoTimes).divide(new BigDecimal(60)).setScale(0,BigDecimal.ROUND_UP).intValue(); | ||||
| Integer poinsPerMinites = 1; | |||||
| Integer poinsPerMinites = Constant.hyCostPoinsPerMinites; | |||||
| cb.setTotalCostPoins(new BigDecimal(minitues).multiply(new BigDecimal(poinsPerMinites)).intValue()); | cb.setTotalCostPoins(new BigDecimal(minitues).multiply(new BigDecimal(poinsPerMinites)).intValue()); | ||||
| cb.setDetail("每分钟扣币"+poinsPerMinites+"个,总共时长"+videoTimes+"(秒),按"+minitues+"分钟总计费。"); | cb.setDetail("每分钟扣币"+poinsPerMinites+"个,总共时长"+videoTimes+"(秒),按"+minitues+"分钟总计费。"); | ||||
| //扣去当前用户的币 | //扣去当前用户的币 | ||||
| wxCUserBasicInfoService.reducePoints(cUserId, cUserFinalTenantId,cb.getTotalCostPoins()); | wxCUserBasicInfoService.reducePoints(cUserId, cUserFinalTenantId,cb.getTotalCostPoins()); | ||||
| return cb; | return cb; | ||||
| } | } | ||||
| @Override | |||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | |||||
| wxCUserBasicInfoService.addPoints(cUser.getId(), cUser.getFinalTenantId(),Constant.hyRegeisterPoins); | |||||
| } | |||||
| } | } | ||||
| @@ -28,6 +28,12 @@ public class HYuProjectService extends BaseProjectService implements ProjectServ | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| } | } | ||||
| @@ -28,6 +28,12 @@ public class ZXProjectService extends BaseProjectService implements ProjectServi | |||||
| return null; | return null; | ||||
| } | } | ||||
| @Override | |||||
| public void handleAfterRegeister(WxCUserBasicInfo cUser) { | |||||
| // TODO Auto-generated method stub | |||||
| } | |||||
| } | } | ||||
| @@ -8,10 +8,12 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.ProductOrder; | |||||
| 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.EnumThirdPartyType; | import com.iformall.enums.sm.EnumThirdPartyType; | ||||
| import com.iformall.mapper.UserMouldVideoMapper; | import com.iformall.mapper.UserMouldVideoMapper; | ||||
| import com.iformall.service.ProductOrderService; | |||||
| import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
| import com.iformall.service.project.ProjectFactory; | import com.iformall.service.project.ProjectFactory; | ||||
| import com.iformall.service.project.entity.CreateBilling; | import com.iformall.service.project.entity.CreateBilling; | ||||
| @@ -75,6 +77,9 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||||
| @Autowired | @Autowired | ||||
| WxCUserBasicInfoService wxCUserBasicInfoService; | WxCUserBasicInfoService wxCUserBasicInfoService; | ||||
| @Autowired | |||||
| ProductOrderService productOrderService; | |||||
| @Override | @Override | ||||
| public PageInfo<UserMouldVideo> listAsPage(UserMouldVideo record, Integer pageIndex, Integer pageSize) { | public PageInfo<UserMouldVideo> listAsPage(UserMouldVideo record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -368,6 +373,17 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||||
| videoParam.setSubtitle(subtitleMap); | videoParam.setSubtitle(subtitleMap); | ||||
| videoParam.setVoice_id(voiceMouldSmId); | videoParam.setVoice_id(voiceMouldSmId); | ||||
| videoParam.setVoice_style(voiceType); | videoParam.setVoice_style(voiceType); | ||||
| videoParam.setTenancy_logo(Base64Util.imageUrlToBase64(Constant.hyLogo)); | |||||
| //查询用户是否有付费订单 | |||||
| ProductOrder po = new ProductOrder(); | |||||
| po.setUserId(mouldVideo.getUserId()); | |||||
| Integer paidCount = productOrderService.findPaidCount(po); | |||||
| if (null != paidCount && paidCount > 0 ) { | |||||
| videoParam.setUser_level(1); | |||||
| }else { | |||||
| videoParam.setUser_level(0); | |||||
| } | |||||
| AiVideoParam.VideoFiles videoFiles = new AiVideoParam.VideoFiles(); | AiVideoParam.VideoFiles videoFiles = new AiVideoParam.VideoFiles(); | ||||
| AiVideoParam.BackGround backGround = new AiVideoParam.BackGround(); | AiVideoParam.BackGround backGround = new AiVideoParam.BackGround(); | ||||
| backGround.setType(EnumVideoType.getEnum(mouldVideo.getVideoType()).getType()); | backGround.setType(EnumVideoType.getEnum(mouldVideo.getVideoType()).getType()); | ||||
| @@ -2,6 +2,8 @@ package com.iformall.sm; | |||||
| import com.alibaba.fastjson.JSON; | import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||||
| import lombok.Data; | import lombok.Data; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -42,6 +44,8 @@ public class AiVideoParam { | |||||
| private String url = "None";//预留音频url | private String url = "None";//预留音频url | ||||
| private VideoFiles video_files; | private VideoFiles video_files; | ||||
| private String token; | private String token; | ||||
| private String tenancy_logo; | |||||
| private Integer user_level; | |||||
| private Map<String,Object> subtitle; | private Map<String,Object> subtitle; | ||||
| @@ -52,6 +56,12 @@ public class AiVideoParam { | |||||
| str.append("\"video_template_id\":").append("\"").append(video_template_id).append("\","); | str.append("\"video_template_id\":").append("\"").append(video_template_id).append("\","); | ||||
| str.append("\"voice_id\":").append("\"").append(voice_id).append("\","); | str.append("\"voice_id\":").append("\"").append(voice_id).append("\","); | ||||
| str.append("\"voice_style\":").append("\"").append(voice_style).append("\","); | str.append("\"voice_style\":").append("\"").append(voice_style).append("\","); | ||||
| if (StringUtils.isNotBlank(tenancy_logo)) { | |||||
| str.append("\"tenancy_logo\":").append("\"").append(tenancy_logo).append("\","); | |||||
| } | |||||
| if ( null != user_level) { | |||||
| str.append("\"user_level\":").append("").append(user_level).append(","); | |||||
| } | |||||
| if(video_files != null){ | if(video_files != null){ | ||||
| str.append("\"video_files\":").append("{"); | str.append("\"video_files\":").append("{"); | ||||
| if(video_files.getBack_ground() != null){ | if(video_files.getBack_ground() != null){ | ||||
| @@ -120,5 +120,13 @@ public class Constant { | |||||
| public static final Integer wiwideNewPlat = 1;//新平台 | public static final Integer wiwideNewPlat = 1;//新平台 | ||||
| public static final String text_pause = "\uD83D\uDD57"; | public static final String text_pause = "\uD83D\uDD57"; | ||||
| //慧影每分钟消耗金币数 | |||||
| public static final Integer hyCostPoinsPerMinites = 1; | |||||
| //慧影注册送金币数 | |||||
| public static final Integer hyRegeisterPoins = 5; | |||||
| //慧影项目生成视频logo | |||||
| public static final String hyLogo=""; | |||||
| } | } | ||||
| @@ -119,6 +119,12 @@ | |||||
| from product_order | from product_order | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findCount" parameterType="com.iformall.domain.po.ProductOrder" resultType="Integer"> | |||||
| select count(1) | |||||
| from product_order | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| <update id="orderPayUpdStatus" parameterType="com.iformall.domain.po.ProductOrder"> | <update id="orderPayUpdStatus" parameterType="com.iformall.domain.po.ProductOrder"> | ||||