winter hace 1 año
padre
commit
3f896038c2
Se han modificado 5 ficheros con 35 adiciones y 1 borrados
  1. +20
    -1
      open-api/src/main/java/com/iformall/service/impl/AiVideoServiceImpl.java
  2. +4
    -0
      suimangService/src/main/java/com/iformall/mapper/ServiceInfoMapper.java
  3. +2
    -0
      suimangService/src/main/java/com/iformall/service/sm/ServiceInfoService.java
  4. +5
    -0
      suimangService/src/main/java/com/iformall/service/sm/impl/ServiceInfoServiceImpl.java
  5. +4
    -0
      suimangService/src/main/resources/mapper/ServiceInfoMapper.xml

+ 20
- 1
open-api/src/main/java/com/iformall/service/impl/AiVideoServiceImpl.java Ver fichero

@@ -19,6 +19,7 @@ import com.iformall.vo.PagePersonMouldVO;
import com.iformall.vo.PageServiceVedioRecordVO; import com.iformall.vo.PageServiceVedioRecordVO;
import com.iformall.vo.PageVO; import com.iformall.vo.PageVO;


import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;


@@ -50,13 +51,29 @@ public class AiVideoServiceImpl implements AiVideoService {
ServiceInfo serviceInfo = serviceInfoService.getServiceInfo(serviceId); ServiceInfo serviceInfo = serviceInfoService.getServiceInfo(serviceId);
// 如果是api接入,则将图片地址转为base64 // 如果是api接入,则将图片地址转为base64
if (EnumThirdPartyType.API_JOIN.getCode().equals(serviceInfo.getType())) { if (EnumThirdPartyType.API_JOIN.getCode().equals(serviceInfo.getType())) {
//判断时长是否还有
if (serviceInfo.getRemainingTimes() <= 0 ) {
AiVideoResult result = new AiVideoResult();
result.setSuccess(false);
result.setMsg("接入方无有效时长,请联系销售充时长。");
return result;
}
AiVideoParam.VideoFiles videoFiles = aiVideoParam.getVideo_files(); AiVideoParam.VideoFiles videoFiles = aiVideoParam.getVideo_files();
videoFiles.getBack_ground().setImage(Base64Util.imageUrlToBase64(videoFiles.getBack_ground().getImage())); videoFiles.getBack_ground().setImage(Base64Util.imageUrlToBase64(videoFiles.getBack_ground().getImage()));
for (AiVideoParam.Material material : videoFiles.getMaterial()) { for (AiVideoParam.Material material : videoFiles.getMaterial()) {
material.setImage(Base64Util.imageUrlToBase64(material.getImage())); material.setImage(Base64Util.imageUrlToBase64(material.getImage()));
} }
}else if(EnumThirdPartyType.PRIVATE_JOIN.getCode().equals(serviceInfo.getType())) {
//私有化部署校验时长
if (serviceInfo.getRemainingTimes() <= 0 ) {
AiVideoResult result = new AiVideoResult();
result.setSuccess(false);
result.setMsg("接入方无有效时长,请联系销售充时长。");
return result;
}
//TODO 本地部署的视频文件怎么处理
} }
//TODO 本地部署的视频文件怎么处理
AiVideoResult video = AiVideoHelper.createVideo(aiVideoParam); AiVideoResult video = AiVideoHelper.createVideo(aiVideoParam);
if (video.isSuccess()) { if (video.isSuccess()) {
// 记录时长 // 记录时长
@@ -66,6 +83,8 @@ public class AiVideoServiceImpl implements AiVideoService {
.videoUrl(video.getUrl()) .videoUrl(video.getUrl())
.build(); .build();
serviceVideoRecordService.saveServiceVideoRecord(saveServiceVideoRecordDTO); serviceVideoRecordService.saveServiceVideoRecord(saveServiceVideoRecordDTO);
//扣掉总时长
serviceInfoService.reduceTimes(serviceId, new BigDecimal(video.getDuration()).multiply(new BigDecimal(60)).longValue());
} }
return video; return video;
} }


+ 4
- 0
suimangService/src/main/java/com/iformall/mapper/ServiceInfoMapper.java Ver fichero

@@ -5,6 +5,8 @@ import com.iformall.domain.po.sm.ServiceInfo;


import java.util.List; import java.util.List;


import org.apache.ibatis.annotations.Param;

/** /**
* 合作商service * 合作商service
* *
@@ -20,4 +22,6 @@ public interface ServiceInfoMapper extends CommonMapper<ServiceInfo, Long> {
* @return {@link List}<{@link ServiceInfo}> * @return {@link List}<{@link ServiceInfo}>
*/ */
List<ServiceInfo> listServiceInfo(ServiceInfo serviceInfo); List<ServiceInfo> listServiceInfo(ServiceInfo serviceInfo);
void reduceTimes(@Param("id") Long id,@Param("seconds") Long seconds);
} }

+ 2
- 0
suimangService/src/main/java/com/iformall/service/sm/ServiceInfoService.java Ver fichero

@@ -54,4 +54,6 @@ public interface ServiceInfoService {
void associatedMoulds(Long[] mouldIds,Long id); void associatedMoulds(Long[] mouldIds,Long id);
void reduceTimes(Long serviceId,Long seconds);
} }

+ 5
- 0
suimangService/src/main/java/com/iformall/service/sm/impl/ServiceInfoServiceImpl.java Ver fichero

@@ -125,4 +125,9 @@ public class ServiceInfoServiceImpl implements ServiceInfoService {
servicePersonMouldMapper.saveBatch(spmlist); servicePersonMouldMapper.saveBatch(spmlist);
} }
} }

@Override
public void reduceTimes(Long serviceId,Long seconds) {
serviceInfoMapper.reduceTimes(serviceId,seconds);
}
} }

+ 4
- 0
suimangService/src/main/resources/mapper/ServiceInfoMapper.xml Ver fichero

@@ -39,6 +39,10 @@
FROM service_info FROM service_info
<include refid="dynamicWhereConditions"/> <include refid="dynamicWhereConditions"/>
</select> </select>
<update id = "reduceTimes" >
update service_info set remaining_times = remaining_times - #{seconds} where id = #{id}
</update>




</mapper> </mapper>

Cargando…
Cancelar
Guardar