fix: bug修改字段缺失
This commit is contained in:
parent
0f112c019d
commit
fc1ecf7bc9
|
|
@ -94,6 +94,54 @@ public class PortalVideoController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 写入订单:提示词、生成模式、图床 URL,以及模型/时长/分辨率/比例与完整 JSON 参数(便于对账与审计)。
|
||||||
|
*/
|
||||||
|
private void fillVideoOrderRecord(AiOrder aiOrder, PortalVideoGenRequest req, String mode, ByteBodyReq body) {
|
||||||
|
aiOrder.setText(req.getText());
|
||||||
|
aiOrder.setMode(mode);
|
||||||
|
applyOrderImages(aiOrder, req);
|
||||||
|
if (req.getDuration() != null) {
|
||||||
|
aiOrder.setDuration(req.getDuration());
|
||||||
|
} else if (body.getDuration() != null) {
|
||||||
|
aiOrder.setDuration(body.getDuration());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(body.getResolution())) {
|
||||||
|
aiOrder.setResolution(body.getResolution());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(body.getRatio())) {
|
||||||
|
aiOrder.setRatio(body.getRatio());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(body.getModel())) {
|
||||||
|
aiOrder.setModel(body.getModel());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Map<String, Object> snap = new LinkedHashMap<>();
|
||||||
|
snap.put("generationMode", mode);
|
||||||
|
snap.put("prompt", req.getText());
|
||||||
|
snap.put("functionType", StringUtils.isNotEmpty(req.getFunctionType()) ? req.getFunctionType() : "21");
|
||||||
|
snap.put("model", body.getModel());
|
||||||
|
snap.put("duration", body.getDuration());
|
||||||
|
snap.put("resolution", body.getResolution());
|
||||||
|
snap.put("ratio", body.getRatio());
|
||||||
|
if (StringUtils.isNotEmpty(req.getFirstUrl())) {
|
||||||
|
snap.put("firstUrl", req.getFirstUrl());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(req.getLastUrl())) {
|
||||||
|
snap.put("lastUrl", req.getLastUrl());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(req.getReferenceUrl())) {
|
||||||
|
snap.put("referenceUrl", req.getReferenceUrl());
|
||||||
|
}
|
||||||
|
if (req.getContent() != null && !req.getContent().isEmpty()) {
|
||||||
|
snap.put("content", req.getContent());
|
||||||
|
}
|
||||||
|
aiOrder.setVideoParams(OM.writeValueAsString(snap));
|
||||||
|
} catch (Exception e) {
|
||||||
|
aiOrder.setVideoParams("{\"error\":\"video_params_serialize_failed\"}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private AjaxResult submitOrderAndCreate(PortalVideoGenRequest req, String mode, ByteBodyReq byteBodyReq) {
|
private AjaxResult submitOrderAndCreate(PortalVideoGenRequest req, String mode, ByteBodyReq byteBodyReq) {
|
||||||
AiOrder aiOrder = aiOrderService.getAiOrder(
|
AiOrder aiOrder = aiOrderService.getAiOrder(
|
||||||
StringUtils.isNotEmpty(req.getFunctionType()) ? req.getFunctionType() : "21");
|
StringUtils.isNotEmpty(req.getFunctionType()) ? req.getFunctionType() : "21");
|
||||||
|
|
@ -101,20 +149,7 @@ public class PortalVideoController extends BaseController {
|
||||||
return AjaxResult.error(-1, "You have a low balance, please recharge");
|
return AjaxResult.error(-1, "You have a low balance, please recharge");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
aiOrder.setText(req.getText());
|
fillVideoOrderRecord(aiOrder, req, mode, byteBodyReq);
|
||||||
aiOrder.setMode(mode);
|
|
||||||
applyOrderImages(aiOrder, req);
|
|
||||||
if (req.getDuration() != null) {
|
|
||||||
aiOrder.setDuration(req.getDuration());
|
|
||||||
} else if (byteBodyReq.getDuration() != null) {
|
|
||||||
aiOrder.setDuration(byteBodyReq.getDuration());
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotEmpty(byteBodyReq.getResolution())) {
|
|
||||||
aiOrder.setResolution(byteBodyReq.getResolution());
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotEmpty(byteBodyReq.getRatio())) {
|
|
||||||
aiOrder.setRatio(byteBodyReq.getRatio());
|
|
||||||
}
|
|
||||||
aiOrderService.updateAiOrder(aiOrder);
|
aiOrderService.updateAiOrder(aiOrder);
|
||||||
|
|
||||||
String key = apiKey();
|
String key = apiKey();
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,12 @@ public class AiOrder extends BaseEntity {
|
||||||
@Excel(name = "宽高比")
|
@Excel(name = "宽高比")
|
||||||
private String ratio;
|
private String ratio;
|
||||||
|
|
||||||
|
/** 火山/方舟模型 endpoint */
|
||||||
|
private String model;
|
||||||
|
|
||||||
|
/** 视频类订单:本次提交的完整参数 JSON(提示词、模型、时长等) */
|
||||||
|
private String videoParams;
|
||||||
|
|
||||||
/** 首帧图片 */
|
/** 首帧图片 */
|
||||||
private String img1;
|
private String img1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="source" column="source" />
|
<result property="source" column="source" />
|
||||||
<result property="text" column="text" />
|
<result property="text" column="text" />
|
||||||
<result property="isTop" column="is_top" />
|
<result property="isTop" column="is_top" />
|
||||||
|
<result property="img1" column="img1" />
|
||||||
|
<result property="img2" column="img2" />
|
||||||
|
<result property="mode" column="mode" />
|
||||||
|
<result property="duration" column="duration" />
|
||||||
|
<result property="resolution" column="resolution" />
|
||||||
|
<result property="ratio" column="ratio" />
|
||||||
|
<result property="model" column="model" />
|
||||||
|
<result property="videoParams" column="video_params" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectAiOrderVo">
|
<sql id="selectAiOrderVo">
|
||||||
select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.user_id, ao.type, ao.amount, ao.result, ao.status, ao.source, ao.text, ao.is_top, au.user_id uuid from ai_order ao
|
select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.user_id, ao.type, ao.amount, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid from ai_order ao
|
||||||
left join ai_user au on au.id = ao.user_id
|
left join ai_user au on au.id = ao.user_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|
@ -118,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="amount != null">amount = #{amount},</if>
|
<if test="amount != null">amount = #{amount},</if>
|
||||||
<if test="result != null">result = #{result},</if>
|
<if test="result != null">result = #{result},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
<if test="source != null">status = #{source},</if>
|
<if test="source != null">source = #{source},</if>
|
||||||
<if test="text != null">text = #{text},</if>
|
<if test="text != null">text = #{text},</if>
|
||||||
<if test="isTop != null">is_top = #{isTop},</if>
|
<if test="isTop != null">is_top = #{isTop},</if>
|
||||||
</trim>
|
</trim>
|
||||||
|
|
|
||||||
|
|
@ -1500,6 +1500,8 @@ CREATE TABLE `ai_order` (
|
||||||
`duration` int NULL DEFAULT 5 COMMENT '视频时长(秒)',
|
`duration` int NULL DEFAULT 5 COMMENT '视频时长(秒)',
|
||||||
`resolution` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '720p' COMMENT '分辨率',
|
`resolution` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '720p' COMMENT '分辨率',
|
||||||
`ratio` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '9:16' COMMENT '宽高比',
|
`ratio` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '9:16' COMMENT '宽高比',
|
||||||
|
`model` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '火山模型 endpoint',
|
||||||
|
`video_params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '视频生成提交参数JSON',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
KEY `idx_order_num` (`order_num`) USING BTREE,
|
KEY `idx_order_num` (`order_num`) USING BTREE,
|
||||||
KEY `idx_user_id` (`user_id`) USING BTREE
|
KEY `idx_user_id` (`user_id`) USING BTREE
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue