diff --git a/suimangService/src/main/java/com/iformall/domain/po/sm/UserMouldVideo.java b/suimangService/src/main/java/com/iformall/domain/po/sm/UserMouldVideo.java
index 75e064e..23aa38c 100644
--- a/suimangService/src/main/java/com/iformall/domain/po/sm/UserMouldVideo.java
+++ b/suimangService/src/main/java/com/iformall/domain/po/sm/UserMouldVideo.java
@@ -54,13 +54,26 @@ public class UserMouldVideo extends TenantEntity {
* "videoType":,
* "title":,
* "mouldSmId":,
- * "material":,
- * "backgroundId:,
- * "backgroundMaterial":
+ * "material":
* }
*/
@io.swagger.annotations.ApiModelProperty(value="人物模板",name="personMouldSm")
private String personMouldSm;
+
+ /**
+ * {
+ * "id":,
+ * "type":,
+ * "material":,
+ * "x":,
+ * "y":,
+ * "z":,
+ * "w":,
+ * "h":
+ * }
+ */
+ @io.swagger.annotations.ApiModelProperty(value="人物模板",name="personJson")
+ private String personJson;
@TableField(exist = false)
private PersonMould personMould;
diff --git a/suimangService/src/main/java/com/iformall/service/sm/impl/UserMouldVideoServiceImpl.java b/suimangService/src/main/java/com/iformall/service/sm/impl/UserMouldVideoServiceImpl.java
index 7ce7858..a4ef8d5 100644
--- a/suimangService/src/main/java/com/iformall/service/sm/impl/UserMouldVideoServiceImpl.java
+++ b/suimangService/src/main/java/com/iformall/service/sm/impl/UserMouldVideoServiceImpl.java
@@ -13,6 +13,7 @@ import com.iformall.domain.po.sm.UserMouldVideo;
import com.iformall.domain.po.sm.VoiceMould;
import com.iformall.enums.EnumMouldPatchType;
import com.iformall.enums.EnumVideoStatus;
+import com.iformall.enums.EnumVideoType;
import com.iformall.enums.EnumVoiceType;
import com.iformall.mapper.UserMouldVideoMapper;
import com.iformall.service.sm.MaterialMouldService;
@@ -95,9 +96,44 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService {
personMouldObject.put("title",personMould.getTitle());
personMouldObject.put("mouldSmId",personMould.getMouldSmId());
personMouldObject.put("material",personMould.getMaterial());
- personMouldObject.put("backgroundId",personMould.getBackgroundId());
- personMouldObject.put("backgroundMaterial",personMould.getBackgroundMaterial());
record.setPersonMouldSm(personMouldObject.toJSONString());
+
+ if(StringUtils.isBlank(record.getPersonJson())){
+ record.setPersonJson("{}");
+ }
+ boolean isPerson = false;
+ try{
+ JSONObject personObject = JSONObject.parseObject(record.getPersonJson());
+ if(personObject != null && !personObject.isEmpty()){
+ isPerson = true;
+ }
+ }catch(Exception e){}
+ //给数字人默认属性
+ if(!isPerson){
+ JSONObject personObject = new JSONObject();
+ personObject.put("id",personMould.getId());
+ personObject.put("type",EnumMouldPatchType.person_mould.getCode());
+ personObject.put("material",personMould.getMaterial());
+ //竖屏 数字人尺寸按竖屏尺寸处理 1080*1920
+ if(EnumVideoType.VERTICAL_PLATE.getCode().equals(record.getVideoType())){
+ personObject.put("x",0);
+ personObject.put("y",0);
+ }else{
+
+ int x = (1920-1080)/2;
+ personObject.put("x",x);
+ int y = (1080-1920);
+ personObject.put("y",y);
+ }
+ personObject.put("z",0);
+ personObject.put("w","1");//比例系数(2位小数)
+ personObject.put("h","1");//比例系数(2位小数)
+ record.setPersonJson(personObject.toJSONString());
+ }
+ //默认背景
+ if(record.getBackgroundId() == null){
+ record.setBackgroundId(personMould.getBackgroundId());
+ }
}
if(record.getVoiceMouldIds() != null && !record.getVoiceMouldIds().isEmpty()){
if(record.getVoiceMouldIds().size() > 1){
@@ -160,9 +196,9 @@ public class UserMouldVideoServiceImpl implements UserMouldVideoService {
materialIds.add(id);
}
String material = jsonObject.getString("material");
- String x = jsonObject.getString("x");
- String y = jsonObject.getString("y");
- String z = jsonObject.getString("z");
+ Integer x = jsonObject.getInteger("x");
+ Integer y = jsonObject.getInteger("y");
+ Integer z = jsonObject.getInteger("z");
String w = jsonObject.getString("w");
String h = jsonObject.getString("h");
}
diff --git a/suimangService/src/main/resources/mapper/UserMouldVideoMapper.xml b/suimangService/src/main/resources/mapper/UserMouldVideoMapper.xml
index 82173de..2010831 100644
--- a/suimangService/src/main/resources/mapper/UserMouldVideoMapper.xml
+++ b/suimangService/src/main/resources/mapper/UserMouldVideoMapper.xml
@@ -9,6 +9,7 @@
+