@@ -44,7 +44,7 @@ public class AiVideoServiceImpl implements AiVideoService { | |||
material.setImage(Base64Util.imageUrlToBase64(material.getImage())); | |||
} | |||
} | |||
//TODO 本地部署的视频文件怎么处理 | |||
AiVideoResult video = AiVideoHelper.createVideo(aiVideoParam); | |||
if (video.isSuccess()) { | |||
// 记录时长 | |||
@@ -18,6 +18,7 @@ import com.iformall.service.pay.service.pay.PayAdapterService; | |||
import com.iformall.service.pay.service.pay.entity.PayAdapterResult; | |||
import com.iformall.service.pay.service.pay.entity.PayQueryAdapterResult; | |||
import com.iformall.service.pay.service.refund.RefundPayAdapterService; | |||
import com.iformall.service.project.ProjectFactory; | |||
import com.iformall.utils.DateUtils; | |||
import com.iformall.utils.RedisLock; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -64,6 +65,9 @@ public class ProductOrderPayServiceImpl implements ProductOrderPayService { | |||
@Autowired | |||
PayServiceFactory payServiceFactory; | |||
@Autowired | |||
ProjectFactory projectFactory; | |||
@Autowired | |||
RedisLock redisLock; | |||
@@ -265,12 +269,15 @@ public class ProductOrderPayServiceImpl implements ProductOrderPayService { | |||
productOrderMapper.orderPayUpdStatus(order); | |||
Product product = productMapper.selectById(order.getProductId()); | |||
if(EnumProductType.product_1.getCode().equals(product.getType())){ | |||
userBasicPropertyService.updUserGlod(order.getUserId(),product.getProjectType(),EnumPropertyLogType.RECHARGE.getCode(), | |||
order.getId(),product.getGlod(),now); | |||
}else if(EnumProductType.product_2.getCode().equals(product.getType())){ | |||
//todo 处理套餐 | |||
//智象 | |||
if (product.getProjectType().intValue() == EnumProject.PROJECT_5.getCode().intValue()) { | |||
if(EnumProductType.product_1.getCode().equals(product.getType())){ | |||
userBasicPropertyService.updUserGlod(order.getUserId(),product.getProjectType(),EnumPropertyLogType.RECHARGE.getCode(), | |||
order.getId(),product.getGlod(),now); | |||
}else if(EnumProductType.product_2.getCode().equals(product.getType())){ | |||
} | |||
}else { | |||
projectFactory.getProjectService(product.getProjectType()).handlePaidOrder(order.getUserId(),order.getFinalTenantId(),product); | |||
} | |||
}catch(MallinkException e){ | |||
throw e; | |||
@@ -1,6 +1,7 @@ | |||
package com.iformall.service.project.service; | |||
import com.iformall.domain.po.Product; | |||
import com.iformall.domain.po.WxCUserBasicInfo; | |||
import com.iformall.service.project.entity.CreateBilling; | |||
public interface ProjectService { | |||
@@ -13,8 +14,15 @@ public interface ProjectService { | |||
public Object getPayProductExtroInfo(Product product); | |||
/** | |||
* 计算生成视频账单 | |||
* 处理充值成功 | |||
*/ | |||
public void handlePaidOrder(Long cUserId,String cUserFinalTenantId,Product product); | |||
/** | |||
* 处理生成视频账单 | |||
* @return | |||
*/ | |||
public CreateBilling calcuteVideoBilling(String videoSeconds,Long videoSize); | |||
public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoSeconds,Long videoSize); | |||
} |
@@ -3,6 +3,7 @@ package com.iformall.service.project.service.impl; | |||
import org.springframework.stereotype.Service; | |||
import com.iformall.domain.po.Product; | |||
import com.iformall.domain.po.WxCUserBasicInfo; | |||
import com.iformall.service.project.entity.CreateBilling; | |||
import com.iformall.service.project.service.ProjectService; | |||
@@ -16,9 +17,17 @@ public class CommonProjectService extends BaseProjectService implements ProjectS | |||
} | |||
@Override | |||
public CreateBilling calcuteVideoBilling(String videoSeconds, Long videoSize) { | |||
public void handlePaidOrder(Long cUserId,String cUserFinalTenantId,Product product) { | |||
// TODO Auto-generated method stub | |||
} | |||
@Override | |||
public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoSeconds, Long videoSize) { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
} |
@@ -3,6 +3,7 @@ package com.iformall.service.project.service.impl; | |||
import org.springframework.stereotype.Service; | |||
import com.iformall.domain.po.Product; | |||
import com.iformall.domain.po.WxCUserBasicInfo; | |||
import com.iformall.service.project.entity.CreateBilling; | |||
import com.iformall.service.project.service.ProjectService; | |||
@@ -16,8 +17,16 @@ public class HBProjectService extends BaseProjectService implements ProjectServi | |||
} | |||
@Override | |||
public CreateBilling calcuteVideoBilling(String videoSeconds, Long videoSize) { | |||
public void handlePaidOrder(Long cUserId,String cUserFinalTenantId,Product product) { | |||
// TODO Auto-generated method stub | |||
} | |||
@Override | |||
public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoSeconds, Long videoSize) { | |||
return null; | |||
} | |||
} |
@@ -3,6 +3,7 @@ package com.iformall.service.project.service.impl; | |||
import org.springframework.stereotype.Service; | |||
import com.iformall.domain.po.Product; | |||
import com.iformall.domain.po.WxCUserBasicInfo; | |||
import com.iformall.service.project.entity.CreateBilling; | |||
import com.iformall.service.project.service.ProjectService; | |||
@@ -16,9 +17,17 @@ public class HKProjectService extends BaseProjectService implements ProjectServi | |||
} | |||
@Override | |||
public CreateBilling calcuteVideoBilling(String videoSeconds, Long videoSize) { | |||
public void handlePaidOrder(Long cUserId,String cUserFinalTenantId,Product product) { | |||
// TODO Auto-generated method stub | |||
} | |||
@Override | |||
public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoSeconds, Long videoSize) { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
} |
@@ -1,14 +1,23 @@ | |||
package com.iformall.service.project.service.impl; | |||
import java.math.BigDecimal; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.context.annotation.Lazy; | |||
import org.springframework.stereotype.Service; | |||
import com.iformall.domain.po.Product; | |||
import com.iformall.domain.po.WxCUserBasicInfo; | |||
import com.iformall.service.WxCUserBasicInfoService; | |||
import com.iformall.service.project.entity.CreateBilling; | |||
import com.iformall.service.project.service.ProjectService; | |||
//慧影 | |||
@Service | |||
public class HYProjectService extends BaseProjectService implements ProjectService{ | |||
@Lazy | |||
@Autowired | |||
WxCUserBasicInfoService wxCUserBasicInfoService; | |||
@Override | |||
public Object getPayProductExtroInfo(Product product) { | |||
@@ -17,14 +26,24 @@ public class HYProjectService extends BaseProjectService implements ProjectServi | |||
} | |||
@Override | |||
public CreateBilling calcuteVideoBilling(String videoSeconds, Long videoSize) { | |||
public void handlePaidOrder(Long cUserId,String cUserFinalTenantId,Product product) { | |||
//更新用户的币 | |||
wxCUserBasicInfoService.reducePoints(cUserId, cUserFinalTenantId,-product.getGlod()); | |||
} | |||
@Override | |||
public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoSeconds, Long videoSize) { | |||
//慧影视频按照时长来扣币 | |||
CreateBilling cb = new CreateBilling(); | |||
//每秒扣币 | |||
float poinsPerSeconds = 0.008F; | |||
cb.setTotalCostPoins(new BigDecimal(videoSeconds).multiply(new BigDecimal(poinsPerSeconds)).intValue()); | |||
cb.setDetail("每秒扣币"+poinsPerSeconds+"个,总共时长"+videoSeconds+"秒"); | |||
//扣去当前用户的币 | |||
wxCUserBasicInfoService.reducePoints(cUserId, cUserFinalTenantId,cb.getTotalCostPoins()); | |||
return cb; | |||
} | |||
} |
@@ -3,6 +3,7 @@ package com.iformall.service.project.service.impl; | |||
import org.springframework.stereotype.Service; | |||
import com.iformall.domain.po.Product; | |||
import com.iformall.domain.po.WxCUserBasicInfo; | |||
import com.iformall.service.project.entity.CreateBilling; | |||
import com.iformall.service.project.service.ProjectService; | |||
@@ -16,9 +17,17 @@ public class HYuProjectService extends BaseProjectService implements ProjectServ | |||
} | |||
@Override | |||
public CreateBilling calcuteVideoBilling(String videoSeconds, Long videoSize) { | |||
public void handlePaidOrder(Long cUserId,String cUserFinalTenantId,Product product) { | |||
// TODO Auto-generated method stub | |||
} | |||
@Override | |||
public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoSeconds, Long videoSize) { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
} |
@@ -3,6 +3,7 @@ package com.iformall.service.project.service.impl; | |||
import org.springframework.stereotype.Service; | |||
import com.iformall.domain.po.Product; | |||
import com.iformall.domain.po.WxCUserBasicInfo; | |||
import com.iformall.service.project.entity.CreateBilling; | |||
import com.iformall.service.project.service.ProjectService; | |||
@@ -16,9 +17,17 @@ public class ZXProjectService extends BaseProjectService implements ProjectServi | |||
} | |||
@Override | |||
public CreateBilling calcuteVideoBilling(String videoSeconds, Long videoSize) { | |||
public void handlePaidOrder(Long cUserId,String cUserFinalTenantId,Product product) { | |||
// TODO Auto-generated method stub | |||
} | |||
@Override | |||
public CreateBilling handleCreateVideoBilling(Long cUserId,String cUserFinalTenantId,String videoSeconds, Long videoSize) { | |||
// TODO Auto-generated method stub | |||
return null; | |||
} | |||
} |
@@ -483,12 +483,11 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService { | |||
videoUpd.setVideoMsg("视频上传成功"); | |||
videoUpd.setUpdateDate(new Date()); | |||
//设置扣费,当前方法是慧影项目专用的 | |||
CreateBilling cb = projectFactory.getProjectService(EnumProject.PROJECT_2.getCode()).calcuteVideoBilling(videoUpd.getVideoTime(), videoUpd.getVideoSize()); | |||
CreateBilling cb = projectFactory.getProjectService(EnumProject.PROJECT_2.getCode()) | |||
.handleCreateVideoBilling(userMouldVideo.getUserId(), userMouldVideo.getFinalTenantId(), videoUpd.getVideoTime(), videoUpd.getVideoSize()); | |||
if (null != cb) { | |||
videoUpd.setCostPoints(cb.getTotalCostPoins()); | |||
videoUpd.setCostPointsDetail(cb.getDetail()); | |||
//扣去当前用户的币 | |||
wxCUserBasicInfoService.reducePoints(mouldVideo.getUserId(), mouldVideo.getFinalTenantId(),cb.getTotalCostPoins()); | |||
} | |||
this.updateById(videoUpd); | |||
break; | |||